-
Bug
-
Resolution: Not an Issue
-
P2
-
None
-
None
-
generic
-
generic
The following specification parts in Byte Code section (ie.
aastore,checkcast,instanceof) define rules to the case
where a referenced object is an interface type.
However, at runtime an referenced object can not be an interface type but a class
type because an object can not be created from an interface (see the definition
of 'new' byte code) but an object can be created from a class.
So, the following specification parts saying about the case of "interface type"
may be not appropriate for runtime behavior.
Any guidance to our licensees about how to implement the speficiation part
would be appreciated.
=== instanceof ===========================================
instanceof
<snip>
Format
instanceof
indexbyte1
indexbyte2
Forms
instanceof = 193 (0xc1)
Operand Stack
..., objectref ..., result
Description
<snip>
The following rules are used to determine whether an objectref
that is not null is an instance of the resolved type: If S is the class of
the object referred to by objectref and T is the resolved class, array,
or interface type, instanceof determines whether objectref is an instance
of T as follows:
<snip>
----------> The following parts are not appropriate.
* If S is an interface type, then:
o If T is a class type, then T must be Object (¿2.4.7).
o If T is an interface type, then T must be the same interface as S,
or a superinterface of S (¿2.13.2).
=== checkcast ============================================
checkcast
<snip>
Format
checkcast
indexbyte1
indexbyte2
Forms
checkcast = 192 (0xc0)
Operand Stack
..., objectref ..., objectref
Description
<snip>
The following rules are used to determine whether an objectref
that is not null can be cast to the resolved type: if S is
the class of the object referred to by objectref and T is
the resolved class, array, or interface type, checkcast determines
whether objectref can be cast to type T as follows:
<snip>
----------> The following parts are not appropriate.
* If S is an interface type, then:
o If T is a class type, then T must be Object (¿2.4.7).
o If T is an interface type, then T must be the same interface as S
or a superinterface of S (¿2.13.2).
=== aastore =============================================
aastore
<snip>
Format
aastore
Forms
aastore = 83 (0x53)
Operand Stack
..., arrayref, index, value ...
Description
<snip>
The type of value must be assignment compatible (¿2.6.7) with
the type of the components of the array referenced by arrayref.
Assignment of a value of reference type S (source) to a variable
of reference type T (target) is allowed only when the type S supports
all the operations defined on type T. The detailed rules follow:
<snip>
----------> The following parts are not appropriate.
* If S is an interface type, then:
o If T is a class type, then T must be Object (¿2.4.7).
o If T is an interface type, then T must be the same interface
as S or a superinterface of S (¿2.13.2).
=======================================================
aastore,checkcast,instanceof) define rules to the case
where a referenced object is an interface type.
However, at runtime an referenced object can not be an interface type but a class
type because an object can not be created from an interface (see the definition
of 'new' byte code) but an object can be created from a class.
So, the following specification parts saying about the case of "interface type"
may be not appropriate for runtime behavior.
Any guidance to our licensees about how to implement the speficiation part
would be appreciated.
=== instanceof ===========================================
instanceof
<snip>
Format
instanceof
indexbyte1
indexbyte2
Forms
instanceof = 193 (0xc1)
Operand Stack
..., objectref ..., result
Description
<snip>
The following rules are used to determine whether an objectref
that is not null is an instance of the resolved type: If S is the class of
the object referred to by objectref and T is the resolved class, array,
or interface type, instanceof determines whether objectref is an instance
of T as follows:
<snip>
----------> The following parts are not appropriate.
* If S is an interface type, then:
o If T is a class type, then T must be Object (¿2.4.7).
o If T is an interface type, then T must be the same interface as S,
or a superinterface of S (¿2.13.2).
=== checkcast ============================================
checkcast
<snip>
Format
checkcast
indexbyte1
indexbyte2
Forms
checkcast = 192 (0xc0)
Operand Stack
..., objectref ..., objectref
Description
<snip>
The following rules are used to determine whether an objectref
that is not null can be cast to the resolved type: if S is
the class of the object referred to by objectref and T is
the resolved class, array, or interface type, checkcast determines
whether objectref can be cast to type T as follows:
<snip>
----------> The following parts are not appropriate.
* If S is an interface type, then:
o If T is a class type, then T must be Object (¿2.4.7).
o If T is an interface type, then T must be the same interface as S
or a superinterface of S (¿2.13.2).
=== aastore =============================================
aastore
<snip>
Format
aastore
Forms
aastore = 83 (0x53)
Operand Stack
..., arrayref, index, value ...
Description
<snip>
The type of value must be assignment compatible (¿2.6.7) with
the type of the components of the array referenced by arrayref.
Assignment of a value of reference type S (source) to a variable
of reference type T (target) is allowed only when the type S supports
all the operations defined on type T. The detailed rules follow:
<snip>
----------> The following parts are not appropriate.
* If S is an interface type, then:
o If T is a class type, then T must be Object (¿2.4.7).
o If T is an interface type, then T must be the same interface
as S or a superinterface of S (¿2.13.2).
=======================================================