Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
21cccc7f
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看板
提交
21cccc7f
编写于
6月 25, 2013
作者:
V
vromero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8017104: javac should have a class for primitive types that inherits from Type
Reviewed-by: jjg
上级
2ef1fff2
变更
14
展开全部
隐藏空白更改
内联
并排
Showing
14 changed file
with
517 addition
and
292 deletion
+517
-292
src/share/classes/com/sun/tools/javac/api/JavacTrees.java
src/share/classes/com/sun/tools/javac/api/JavacTrees.java
+4
-4
src/share/classes/com/sun/tools/javac/code/Attribute.java
src/share/classes/com/sun/tools/javac/code/Attribute.java
+2
-2
src/share/classes/com/sun/tools/javac/code/Kinds.java
src/share/classes/com/sun/tools/javac/code/Kinds.java
+3
-3
src/share/classes/com/sun/tools/javac/code/Printer.java
src/share/classes/com/sun/tools/javac/code/Printer.java
+2
-2
src/share/classes/com/sun/tools/javac/code/Symbol.java
src/share/classes/com/sun/tools/javac/code/Symbol.java
+4
-4
src/share/classes/com/sun/tools/javac/code/Symtab.java
src/share/classes/com/sun/tools/javac/code/Symtab.java
+13
-19
src/share/classes/com/sun/tools/javac/code/Type.java
src/share/classes/com/sun/tools/javac/code/Type.java
+340
-100
src/share/classes/com/sun/tools/javac/code/TypeTag.java
src/share/classes/com/sun/tools/javac/code/TypeTag.java
+34
-58
src/share/classes/com/sun/tools/javac/code/Types.java
src/share/classes/com/sun/tools/javac/code/Types.java
+105
-95
src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java
src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java
+6
-1
src/share/classes/com/sun/tools/javac/comp/Infer.java
src/share/classes/com/sun/tools/javac/comp/Infer.java
+1
-1
src/share/classes/com/sun/tools/javac/comp/Resolve.java
src/share/classes/com/sun/tools/javac/comp/Resolve.java
+1
-1
src/share/classes/com/sun/tools/javac/jvm/Code.java
src/share/classes/com/sun/tools/javac/jvm/Code.java
+1
-1
src/share/classes/com/sun/tools/javac/model/JavacTypes.java
src/share/classes/com/sun/tools/javac/model/JavacTypes.java
+1
-1
未找到文件。
src/share/classes/com/sun/tools/javac/api/JavacTrees.java
浏览文件 @
21cccc7f
...
@@ -69,6 +69,7 @@ import com.sun.tools.javac.code.Type.ClassType;
...
@@ -69,6 +69,7 @@ import com.sun.tools.javac.code.Type.ClassType;
import
com.sun.tools.javac.code.Type.ErrorType
;
import
com.sun.tools.javac.code.Type.ErrorType
;
import
com.sun.tools.javac.code.Type.UnionClassType
;
import
com.sun.tools.javac.code.Type.UnionClassType
;
import
com.sun.tools.javac.code.Types
;
import
com.sun.tools.javac.code.Types
;
import
com.sun.tools.javac.code.TypeTag
;
import
com.sun.tools.javac.code.Types.TypeRelation
;
import
com.sun.tools.javac.code.Types.TypeRelation
;
import
com.sun.tools.javac.comp.Attr
;
import
com.sun.tools.javac.comp.Attr
;
import
com.sun.tools.javac.comp.AttrContext
;
import
com.sun.tools.javac.comp.AttrContext
;
...
@@ -653,8 +654,7 @@ public class JavacTrees extends DocTrees {
...
@@ -653,8 +654,7 @@ public class JavacTrees extends DocTrees {
switch
(
t
.
getTag
())
{
switch
(
t
.
getTag
())
{
case
BYTE:
case
CHAR:
case
SHORT:
case
INT:
case
LONG:
case
FLOAT:
case
BYTE:
case
CHAR:
case
SHORT:
case
INT:
case
LONG:
case
FLOAT:
case
DOUBLE:
case
BOOLEAN:
case
VOID:
case
BOT:
case
NONE:
case
DOUBLE:
case
BOOLEAN:
case
VOID:
case
BOT:
case
NONE:
return
t
.
getTag
()
==
s
.
getTag
();
return
t
.
hasTag
(
s
.
getTag
());
default
:
default
:
throw
new
AssertionError
(
"fuzzyMatcher "
+
t
.
getTag
());
throw
new
AssertionError
(
"fuzzyMatcher "
+
t
.
getTag
());
}
}
...
@@ -668,7 +668,7 @@ public class JavacTrees extends DocTrees {
...
@@ -668,7 +668,7 @@ public class JavacTrees extends DocTrees {
if
(
s
.
isPartial
())
if
(
s
.
isPartial
())
return
visit
(
s
,
t
);
return
visit
(
s
,
t
);
return
s
.
getTag
()
==
ARRAY
return
s
.
hasTag
(
ARRAY
)
&&
visit
(
t
.
elemtype
,
types
.
elemtype
(
s
));
&&
visit
(
t
.
elemtype
,
types
.
elemtype
(
s
));
}
}
...
@@ -685,7 +685,7 @@ public class JavacTrees extends DocTrees {
...
@@ -685,7 +685,7 @@ public class JavacTrees extends DocTrees {
@Override
@Override
public
Boolean
visitErrorType
(
ErrorType
t
,
Type
s
)
{
public
Boolean
visitErrorType
(
ErrorType
t
,
Type
s
)
{
return
s
.
getTag
()
==
CLASS
return
s
.
hasTag
(
CLASS
)
&&
t
.
tsym
.
name
==
((
ClassType
)
s
).
tsym
.
name
;
&&
t
.
tsym
.
name
==
((
ClassType
)
s
).
tsym
.
name
;
}
}
};
};
...
...
src/share/classes/com/sun/tools/javac/code/Attribute.java
浏览文件 @
21cccc7f
...
@@ -83,7 +83,7 @@ public abstract class Attribute implements AnnotationValue {
...
@@ -83,7 +83,7 @@ public abstract class Attribute implements AnnotationValue {
return
v
.
visitString
((
String
)
value
,
p
);
return
v
.
visitString
((
String
)
value
,
p
);
if
(
value
instanceof
Integer
)
{
if
(
value
instanceof
Integer
)
{
int
i
=
(
Integer
)
value
;
int
i
=
(
Integer
)
value
;
switch
(
type
.
tag
)
{
switch
(
type
.
getTag
()
)
{
case
BOOLEAN:
return
v
.
visitBoolean
(
i
!=
0
,
p
);
case
BOOLEAN:
return
v
.
visitBoolean
(
i
!=
0
,
p
);
case
CHAR:
return
v
.
visitChar
((
char
)
i
,
p
);
case
CHAR:
return
v
.
visitChar
((
char
)
i
,
p
);
case
BYTE:
return
v
.
visitByte
((
byte
)
i
,
p
);
case
BYTE:
return
v
.
visitByte
((
byte
)
i
,
p
);
...
@@ -91,7 +91,7 @@ public abstract class Attribute implements AnnotationValue {
...
@@ -91,7 +91,7 @@ public abstract class Attribute implements AnnotationValue {
case
INT:
return
v
.
visitInt
(
i
,
p
);
case
INT:
return
v
.
visitInt
(
i
,
p
);
}
}
}
}
switch
(
type
.
tag
)
{
switch
(
type
.
getTag
()
)
{
case
LONG:
return
v
.
visitLong
((
Long
)
value
,
p
);
case
LONG:
return
v
.
visitLong
((
Long
)
value
,
p
);
case
FLOAT:
return
v
.
visitFloat
((
Float
)
value
,
p
);
case
FLOAT:
return
v
.
visitFloat
((
Float
)
value
,
p
);
case
DOUBLE:
return
v
.
visitDouble
((
Double
)
value
,
p
);
case
DOUBLE:
return
v
.
visitDouble
((
Double
)
value
,
p
);
...
...
src/share/classes/com/sun/tools/javac/code/Kinds.java
浏览文件 @
21cccc7f
...
@@ -218,10 +218,10 @@ public class Kinds {
...
@@ -218,10 +218,10 @@ public class Kinds {
/** A KindName representing the kind of a given class/interface type.
/** A KindName representing the kind of a given class/interface type.
*/
*/
public
static
KindName
typeKindName
(
Type
t
)
{
public
static
KindName
typeKindName
(
Type
t
)
{
if
(
t
.
tag
==
TYPEVAR
||
if
(
t
.
hasTag
(
TYPEVAR
)
||
t
.
tag
==
CLASS
&&
(
t
.
tsym
.
flags
()
&
COMPOUND
)
!=
0
)
t
.
hasTag
(
CLASS
)
&&
(
t
.
tsym
.
flags
()
&
COMPOUND
)
!=
0
)
return
KindName
.
BOUND
;
return
KindName
.
BOUND
;
else
if
(
t
.
tag
==
PACKAGE
)
else
if
(
t
.
hasTag
(
PACKAGE
)
)
return
KindName
.
PACKAGE
;
return
KindName
.
PACKAGE
;
else
if
((
t
.
tsym
.
flags_field
&
ANNOTATION
)
!=
0
)
else
if
((
t
.
tsym
.
flags_field
&
ANNOTATION
)
!=
0
)
return
KindName
.
ANNOTATION
;
return
KindName
.
ANNOTATION
;
...
...
src/share/classes/com/sun/tools/javac/code/Printer.java
浏览文件 @
21cccc7f
...
@@ -215,7 +215,7 @@ public abstract class Printer implements Type.Visitor<String, Locale>, Symbol.Vi
...
@@ -215,7 +215,7 @@ public abstract class Printer implements Type.Visitor<String, Locale>, Symbol.Vi
@Override
@Override
public
String
visitClassType
(
ClassType
t
,
Locale
locale
)
{
public
String
visitClassType
(
ClassType
t
,
Locale
locale
)
{
StringBuilder
buf
=
new
StringBuilder
();
StringBuilder
buf
=
new
StringBuilder
();
if
(
t
.
getEnclosingType
().
tag
==
CLASS
&&
t
.
tsym
.
owner
.
kind
==
Kinds
.
TYP
)
{
if
(
t
.
getEnclosingType
().
hasTag
(
CLASS
)
&&
t
.
tsym
.
owner
.
kind
==
Kinds
.
TYP
)
{
buf
.
append
(
visit
(
t
.
getEnclosingType
(),
locale
));
buf
.
append
(
visit
(
t
.
getEnclosingType
(),
locale
));
buf
.
append
(
'.'
);
buf
.
append
(
'.'
);
buf
.
append
(
className
(
t
,
false
,
locale
));
buf
.
append
(
className
(
t
,
false
,
locale
));
...
@@ -379,7 +379,7 @@ public abstract class Printer implements Type.Visitor<String, Locale>, Symbol.Vi
...
@@ -379,7 +379,7 @@ public abstract class Printer implements Type.Visitor<String, Locale>, Symbol.Vi
?
s
.
owner
.
name
.
toString
()
?
s
.
owner
.
name
.
toString
()
:
s
.
name
.
toString
();
:
s
.
name
.
toString
();
if
(
s
.
type
!=
null
)
{
if
(
s
.
type
!=
null
)
{
if
(
s
.
type
.
tag
==
FORALL
)
{
if
(
s
.
type
.
hasTag
(
FORALL
)
)
{
ms
=
"<"
+
visitTypes
(
s
.
type
.
getTypeArguments
(),
locale
)
+
">"
+
ms
;
ms
=
"<"
+
visitTypes
(
s
.
type
.
getTypeArguments
(),
locale
)
+
">"
+
ms
;
}
}
ms
+=
"("
+
printMethodArgs
(
ms
+=
"("
+
printMethodArgs
(
...
...
src/share/classes/com/sun/tools/javac/code/Symbol.java
浏览文件 @
21cccc7f
...
@@ -699,17 +699,17 @@ public abstract class Symbol implements Element {
...
@@ -699,17 +699,17 @@ public abstract class Symbol implements Element {
public
final
boolean
precedes
(
TypeSymbol
that
,
Types
types
)
{
public
final
boolean
precedes
(
TypeSymbol
that
,
Types
types
)
{
if
(
this
==
that
)
if
(
this
==
that
)
return
false
;
return
false
;
if
(
t
his
.
type
.
tag
==
that
.
type
.
tag
)
{
if
(
t
ype
.
hasTag
(
that
.
type
.
getTag
())
)
{
if
(
t
his
.
t
ype
.
hasTag
(
CLASS
))
{
if
(
type
.
hasTag
(
CLASS
))
{
return
return
types
.
rank
(
that
.
type
)
<
types
.
rank
(
this
.
type
)
||
types
.
rank
(
that
.
type
)
<
types
.
rank
(
this
.
type
)
||
types
.
rank
(
that
.
type
)
==
types
.
rank
(
this
.
type
)
&&
types
.
rank
(
that
.
type
)
==
types
.
rank
(
this
.
type
)
&&
that
.
getQualifiedName
().
compareTo
(
this
.
getQualifiedName
())
<
0
;
that
.
getQualifiedName
().
compareTo
(
this
.
getQualifiedName
())
<
0
;
}
else
if
(
t
his
.
t
ype
.
hasTag
(
TYPEVAR
))
{
}
else
if
(
type
.
hasTag
(
TYPEVAR
))
{
return
types
.
isSubtype
(
this
.
type
,
that
.
type
);
return
types
.
isSubtype
(
this
.
type
,
that
.
type
);
}
}
}
}
return
t
his
.
t
ype
.
hasTag
(
TYPEVAR
);
return
type
.
hasTag
(
TYPEVAR
);
}
}
@Override
@Override
...
...
src/share/classes/com/sun/tools/javac/code/Symtab.java
浏览文件 @
21cccc7f
...
@@ -28,7 +28,6 @@ package com.sun.tools.javac.code;
...
@@ -28,7 +28,6 @@ package com.sun.tools.javac.code;
import
java.util.*
;
import
java.util.*
;
import
javax.lang.model.element.ElementVisitor
;
import
javax.lang.model.element.ElementVisitor
;
import
javax.lang.model.type.TypeVisitor
;
import
com.sun.tools.javac.code.Symbol.*
;
import
com.sun.tools.javac.code.Symbol.*
;
import
com.sun.tools.javac.code.Type.*
;
import
com.sun.tools.javac.code.Type.*
;
...
@@ -65,16 +64,16 @@ public class Symtab {
...
@@ -65,16 +64,16 @@ public class Symtab {
/** Builtin types.
/** Builtin types.
*/
*/
public
final
Type
byteType
=
new
Type
(
BYTE
,
null
);
public
final
JCPrimitiveType
byteType
=
new
JCPrimitive
Type
(
BYTE
,
null
);
public
final
Type
charType
=
new
Type
(
CHAR
,
null
);
public
final
JCPrimitiveType
charType
=
new
JCPrimitive
Type
(
CHAR
,
null
);
public
final
Type
shortType
=
new
Type
(
SHORT
,
null
);
public
final
JCPrimitiveType
shortType
=
new
JCPrimitive
Type
(
SHORT
,
null
);
public
final
Type
intType
=
new
Type
(
INT
,
null
);
public
final
JCPrimitiveType
intType
=
new
JCPrimitive
Type
(
INT
,
null
);
public
final
Type
longType
=
new
Type
(
LONG
,
null
);
public
final
JCPrimitiveType
longType
=
new
JCPrimitive
Type
(
LONG
,
null
);
public
final
Type
floatType
=
new
Type
(
FLOAT
,
null
);
public
final
JCPrimitiveType
floatType
=
new
JCPrimitive
Type
(
FLOAT
,
null
);
public
final
Type
doubleType
=
new
Type
(
DOUBLE
,
null
);
public
final
JCPrimitiveType
doubleType
=
new
JCPrimitive
Type
(
DOUBLE
,
null
);
public
final
Type
booleanType
=
new
Type
(
BOOLEAN
,
null
);
public
final
JCPrimitiveType
booleanType
=
new
JCPrimitive
Type
(
BOOLEAN
,
null
);
public
final
Type
botType
=
new
BottomType
();
public
final
Type
botType
=
new
BottomType
();
public
final
JC
NoType
voidType
=
new
JCNoType
(
VOID
);
public
final
JC
VoidType
voidType
=
new
JCVoidType
(
);
private
final
Names
names
;
private
final
Names
names
;
private
final
ClassReader
reader
;
private
final
ClassReader
reader
;
...
@@ -208,7 +207,7 @@ public class Symtab {
...
@@ -208,7 +207,7 @@ public class Symtab {
public
void
initType
(
Type
type
,
ClassSymbol
c
)
{
public
void
initType
(
Type
type
,
ClassSymbol
c
)
{
type
.
tsym
=
c
;
type
.
tsym
=
c
;
typeOfTag
[
type
.
tag
.
ordinal
()]
=
type
;
typeOfTag
[
type
.
getTag
()
.
ordinal
()]
=
type
;
}
}
public
void
initType
(
Type
type
,
String
name
)
{
public
void
initType
(
Type
type
,
String
name
)
{
...
@@ -220,7 +219,7 @@ public class Symtab {
...
@@ -220,7 +219,7 @@ public class Symtab {
public
void
initType
(
Type
type
,
String
name
,
String
bname
)
{
public
void
initType
(
Type
type
,
String
name
,
String
bname
)
{
initType
(
type
,
name
);
initType
(
type
,
name
);
boxedName
[
type
.
tag
.
ordinal
()]
=
names
.
fromString
(
"java.lang."
+
bname
);
boxedName
[
type
.
getTag
()
.
ordinal
()]
=
names
.
fromString
(
"java.lang."
+
bname
);
}
}
/** The class symbol that owns all predefined symbols.
/** The class symbol that owns all predefined symbols.
...
@@ -330,7 +329,7 @@ public class Symtab {
...
@@ -330,7 +329,7 @@ public class Symtab {
}
}
public
void
synthesizeBoxTypeIfMissing
(
final
Type
type
)
{
public
void
synthesizeBoxTypeIfMissing
(
final
Type
type
)
{
ClassSymbol
sym
=
reader
.
enterClass
(
boxedName
[
type
.
tag
.
ordinal
()]);
ClassSymbol
sym
=
reader
.
enterClass
(
boxedName
[
type
.
getTag
()
.
ordinal
()]);
final
Completer
completer
=
sym
.
completer
;
final
Completer
completer
=
sym
.
completer
;
if
(
completer
!=
null
)
{
if
(
completer
!=
null
)
{
sym
.
completer
=
new
Completer
()
{
sym
.
completer
=
new
Completer
()
{
...
@@ -388,12 +387,7 @@ public class Symtab {
...
@@ -388,12 +387,7 @@ public class Symtab {
target
=
Target
.
instance
(
context
);
target
=
Target
.
instance
(
context
);
// Create the unknown type
// Create the unknown type
unknownType
=
new
Type
(
UNKNOWN
,
null
)
{
unknownType
=
new
UnknownType
();
@Override
public
<
R
,
P
>
R
accept
(
TypeVisitor
<
R
,
P
>
v
,
P
p
)
{
return
v
.
visitUnknown
(
this
,
p
);
}
};
// create the basic builtin symbols
// create the basic builtin symbols
rootPackage
=
new
PackageSymbol
(
names
.
empty
,
null
);
rootPackage
=
new
PackageSymbol
(
names
.
empty
,
null
);
...
...
src/share/classes/com/sun/tools/javac/code/Type.java
浏览文件 @
21cccc7f
此差异已折叠。
点击以展开。
src/share/classes/com/sun/tools/javac/code/TypeTag.java
浏览文件 @
21cccc7f
...
@@ -42,132 +42,107 @@ import static com.sun.tools.javac.code.TypeTag.NumericClasses.*;
...
@@ -42,132 +42,107 @@ import static com.sun.tools.javac.code.TypeTag.NumericClasses.*;
public
enum
TypeTag
{
public
enum
TypeTag
{
/** The tag of the basic type `byte'.
/** The tag of the basic type `byte'.
*/
*/
BYTE
(
BYTE_CLASS
,
BYTE_SUPERCLASSES
,
BYTE
(
BYTE_CLASS
,
BYTE_SUPERCLASSES
,
true
),
TypeTagKind
.
PRIMITIVE
|
TypeTagKind
.
NUMERIC
),
/** The tag of the basic type `char'.
/** The tag of the basic type `char'.
*/
*/
CHAR
(
CHAR_CLASS
,
CHAR_SUPERCLASSES
,
CHAR
(
CHAR_CLASS
,
CHAR_SUPERCLASSES
,
true
),
TypeTagKind
.
PRIMITIVE
|
TypeTagKind
.
NUMERIC
),
/** The tag of the basic type `short'.
/** The tag of the basic type `short'.
*/
*/
SHORT
(
SHORT_CLASS
,
SHORT_SUPERCLASSES
,
SHORT
(
SHORT_CLASS
,
SHORT_SUPERCLASSES
,
true
),
TypeTagKind
.
PRIMITIVE
|
TypeTagKind
.
NUMERIC
),
/** The tag of the basic type `int'.
*/
INT
(
INT_CLASS
,
INT_SUPERCLASSES
,
TypeTagKind
.
PRIMITIVE
|
TypeTagKind
.
NUMERIC
),
/** The tag of the basic type `long'.
/** The tag of the basic type `long'.
*/
*/
LONG
(
LONG_CLASS
,
LONG_SUPERCLASSES
,
TypeTagKind
.
PRIMITIVE
|
TypeTagKind
.
NUMERIC
),
LONG
(
LONG_CLASS
,
LONG_SUPERCLASSES
,
true
),
/** The tag of the basic type `float'.
/** The tag of the basic type `float'.
*/
*/
FLOAT
(
FLOAT_CLASS
,
FLOAT_SUPERCLASSES
,
TypeTagKind
.
PRIMITIVE
|
TypeTagKind
.
NUMERIC
),
FLOAT
(
FLOAT_CLASS
,
FLOAT_SUPERCLASSES
,
true
),
/** The tag of the basic type `int'.
*/
INT
(
INT_CLASS
,
INT_SUPERCLASSES
,
true
),
/** The tag of the basic type `double'.
/** The tag of the basic type `double'.
*/
*/
DOUBLE
(
DOUBLE_CLASS
,
DOUBLE_CLASS
,
TypeTagKind
.
PRIMITIVE
|
TypeTagKind
.
NUMERIC
),
DOUBLE
(
DOUBLE_CLASS
,
DOUBLE_CLASS
,
true
),
/** The tag of the basic type `boolean'.
/** The tag of the basic type `boolean'.
*/
*/
BOOLEAN
(
TypeTagKind
.
PRIMITIVE
),
BOOLEAN
(
0
,
0
,
true
),
/** The tag of the type `void'.
/** The tag of the type `void'.
*/
*/
VOID
(
TypeTagKind
.
VOID
)
,
VOID
,
/** The tag of all class and interface types.
/** The tag of all class and interface types.
*/
*/
CLASS
(
TypeTagKind
.
REFERENCE
)
,
CLASS
,
/** The tag of all array types.
/** The tag of all array types.
*/
*/
ARRAY
(
TypeTagKind
.
REFERENCE
)
,
ARRAY
,
/** The tag of all (monomorphic) method types.
/** The tag of all (monomorphic) method types.
*/
*/
METHOD
(
TypeTagKind
.
OTHER
)
,
METHOD
,
/** The tag of all package "types".
/** The tag of all package "types".
*/
*/
PACKAGE
(
TypeTagKind
.
OTHER
)
,
PACKAGE
,
/** The tag of all (source-level) type variables.
/** The tag of all (source-level) type variables.
*/
*/
TYPEVAR
(
TypeTagKind
.
REFERENCE
)
,
TYPEVAR
,
/** The tag of all type arguments.
/** The tag of all type arguments.
*/
*/
WILDCARD
(
TypeTagKind
.
REFERENCE
)
,
WILDCARD
,
/** The tag of all polymorphic (method-) types.
/** The tag of all polymorphic (method-) types.
*/
*/
FORALL
(
TypeTagKind
.
OTHER
)
,
FORALL
,
/** The tag of deferred expression types in method context
/** The tag of deferred expression types in method context
*/
*/
DEFERRED
(
TypeTagKind
.
OTHER
)
,
DEFERRED
,
/** The tag of the bottom type {@code <null>}.
/** The tag of the bottom type {@code <null>}.
*/
*/
BOT
(
TypeTagKind
.
OTHER
)
,
BOT
,
/** The tag of a missing type.
/** The tag of a missing type.
*/
*/
NONE
(
TypeTagKind
.
OTHER
)
,
NONE
,
/** The tag of the error type.
/** The tag of the error type.
*/
*/
ERROR
(
TypeTagKind
.
REFERENCE
|
TypeTagKind
.
PARTIAL
)
,
ERROR
,
/** The tag of an unknown type
/** The tag of an unknown type
*/
*/
UNKNOWN
(
TypeTagKind
.
PARTIAL
)
,
UNKNOWN
,
/** The tag of all instantiatable type variables.
/** The tag of all instantiatable type variables.
*/
*/
UNDETVAR
(
TypeTagKind
.
PARTIAL
)
,
UNDETVAR
,
/** Pseudo-types, these are special tags
/** Pseudo-types, these are special tags
*/
*/
UNINITIALIZED_THIS
(
TypeTagKind
.
OTHER
)
,
UNINITIALIZED_THIS
,
UNINITIALIZED_OBJECT
(
TypeTagKind
.
OTHER
)
;
UNINITIALIZED_OBJECT
;
final
boolean
isPrimitive
;
final
boolean
isNumeric
;
final
boolean
isPartial
;
final
boolean
isReference
;
final
boolean
isPrimitiveOrVoid
;
final
int
superClasses
;
final
int
superClasses
;
final
int
numericClass
;
final
int
numericClass
;
final
boolean
isPrimitive
;
private
TypeTag
(
int
kind
)
{
private
TypeTag
()
{
this
(
0
,
0
,
kind
);
this
(
0
,
0
,
false
);
}
}
private
TypeTag
(
int
numericClass
,
int
superClasses
,
int
kind
)
{
private
TypeTag
(
int
numericClass
,
int
superClasses
,
boolean
isPrimitive
)
{
isPrimitive
=
(
kind
&
TypeTagKind
.
PRIMITIVE
)
!=
0
;
this
.
superClasses
=
superClasses
;
isNumeric
=
(
kind
&
TypeTagKind
.
NUMERIC
)
!=
0
;
this
.
numericClass
=
numericClass
;
isPartial
=
(
kind
&
TypeTagKind
.
PARTIAL
)
!=
0
;
this
.
isPrimitive
=
isPrimitive
;
isReference
=
(
kind
&
TypeTagKind
.
REFERENCE
)
!=
0
;
isPrimitiveOrVoid
=
((
kind
&
TypeTagKind
.
PRIMITIVE
)
!=
0
)
||
((
kind
&
TypeTagKind
.
VOID
)
!=
0
);
this
.
superClasses
=
superClasses
;
this
.
numericClass
=
numericClass
;
}
static
class
TypeTagKind
{
static
final
int
PRIMITIVE
=
1
;
static
final
int
NUMERIC
=
2
;
static
final
int
REFERENCE
=
4
;
static
final
int
PARTIAL
=
8
;
static
final
int
OTHER
=
16
;
static
final
int
VOID
=
32
;
}
}
public
static
class
NumericClasses
{
public
static
class
NumericClasses
{
...
@@ -261,4 +236,5 @@ public enum TypeTag {
...
@@ -261,4 +236,5 @@ public enum TypeTag {
throw
new
AssertionError
(
"unknown primitive type "
+
this
);
throw
new
AssertionError
(
"unknown primitive type "
+
this
);
}
}
}
}
}
}
src/share/classes/com/sun/tools/javac/code/Types.java
浏览文件 @
21cccc7f
此差异已折叠。
点击以展开。
src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java
浏览文件 @
21cccc7f
...
@@ -115,12 +115,17 @@ public class DeferredAttr extends JCTree.Visitor {
...
@@ -115,12 +115,17 @@ public class DeferredAttr extends JCTree.Visitor {
SpeculativeCache
speculativeCache
;
SpeculativeCache
speculativeCache
;
DeferredType
(
JCExpression
tree
,
Env
<
AttrContext
>
env
)
{
DeferredType
(
JCExpression
tree
,
Env
<
AttrContext
>
env
)
{
super
(
DEFERRED
,
null
);
super
(
null
);
this
.
tree
=
tree
;
this
.
tree
=
tree
;
this
.
env
=
env
.
dup
(
tree
,
env
.
info
.
dup
());
this
.
env
=
env
.
dup
(
tree
,
env
.
info
.
dup
());
this
.
speculativeCache
=
new
SpeculativeCache
();
this
.
speculativeCache
=
new
SpeculativeCache
();
}
}
@Override
public
TypeTag
getTag
()
{
return
DEFERRED
;
}
/**
/**
* A speculative cache is used to keep track of all overload resolution rounds
* A speculative cache is used to keep track of all overload resolution rounds
* that triggered speculative attribution on a given deferred type. Each entry
* that triggered speculative attribution on a given deferred type. Each entry
...
...
src/share/classes/com/sun/tools/javac/comp/Infer.java
浏览文件 @
21cccc7f
...
@@ -96,7 +96,7 @@ public class Infer {
...
@@ -96,7 +96,7 @@ public class Infer {
}
}
/** A value for prototypes that admit any type, including polymorphic ones. */
/** A value for prototypes that admit any type, including polymorphic ones. */
public
static
final
Type
anyPoly
=
new
Type
(
NONE
,
null
);
public
static
final
Type
anyPoly
=
new
JCNoType
(
);
/**
/**
* This exception class is design to store a list of diagnostics corresponding
* This exception class is design to store a list of diagnostics corresponding
...
...
src/share/classes/com/sun/tools/javac/comp/Resolve.java
浏览文件 @
21cccc7f
...
@@ -2843,7 +2843,7 @@ public class Resolve {
...
@@ -2843,7 +2843,7 @@ public class Resolve {
protected
Symbol
lookup
(
Env
<
AttrContext
>
env
,
MethodResolutionPhase
phase
)
{
protected
Symbol
lookup
(
Env
<
AttrContext
>
env
,
MethodResolutionPhase
phase
)
{
Scope
sc
=
new
Scope
(
syms
.
arrayClass
);
Scope
sc
=
new
Scope
(
syms
.
arrayClass
);
MethodSymbol
arrayConstr
=
new
MethodSymbol
(
PUBLIC
,
name
,
null
,
site
.
tsym
);
MethodSymbol
arrayConstr
=
new
MethodSymbol
(
PUBLIC
,
name
,
null
,
site
.
tsym
);
arrayConstr
.
type
=
new
MethodType
(
List
.
of
(
syms
.
intType
),
site
,
List
.<
Type
>
nil
(),
syms
.
methodClass
);
arrayConstr
.
type
=
new
MethodType
(
List
.
<
Type
>
of
(
syms
.
intType
),
site
,
List
.<
Type
>
nil
(),
syms
.
methodClass
);
sc
.
enter
(
arrayConstr
);
sc
.
enter
(
arrayConstr
);
return
findMethodInScope
(
env
,
site
,
name
,
argtypes
,
typeargtypes
,
sc
,
methodNotFound
,
phase
.
isBoxingRequired
(),
phase
.
isVarargsRequired
(),
false
,
false
);
return
findMethodInScope
(
env
,
site
,
name
,
argtypes
,
typeargtypes
,
sc
,
methodNotFound
,
phase
.
isBoxingRequired
(),
phase
.
isVarargsRequired
(),
false
,
false
);
}
}
...
...
src/share/classes/com/sun/tools/javac/jvm/Code.java
浏览文件 @
21cccc7f
...
@@ -1859,7 +1859,7 @@ public class Code {
...
@@ -1859,7 +1859,7 @@ public class Code {
}
}
}
}
static
final
Type
jsrReturnValue
=
new
Type
(
INT
,
null
);
static
final
Type
jsrReturnValue
=
new
JCPrimitive
Type
(
INT
,
null
);
/* **************************************************************************
/* **************************************************************************
...
...
src/share/classes/com/sun/tools/javac/model/JavacTypes.java
浏览文件 @
21cccc7f
...
@@ -139,7 +139,7 @@ public class JavacTypes implements javax.lang.model.util.Types {
...
@@ -139,7 +139,7 @@ public class JavacTypes implements javax.lang.model.util.Types {
Type
unboxed
=
types
.
unboxedType
((
Type
)
t
);
Type
unboxed
=
types
.
unboxedType
((
Type
)
t
);
if
(!
unboxed
.
isPrimitive
())
// only true primitives, not void
if
(!
unboxed
.
isPrimitive
())
// only true primitives, not void
throw
new
IllegalArgumentException
(
t
.
toString
());
throw
new
IllegalArgumentException
(
t
.
toString
());
return
unboxed
;
return
(
PrimitiveType
)
unboxed
;
}
}
public
TypeMirror
capture
(
TypeMirror
t
)
{
public
TypeMirror
capture
(
TypeMirror
t
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录