-
Type:
Bug
-
Resolution: Fixed
-
Priority:
P4
-
Affects Version/s: 8, 24
-
Component/s: specification
rewrittenUninitializedType(uninitializedThis, Environment,
MethodClass, MethodClass) :-
MethodClass = class(MethodClassName, CurrentLoader),
thisClass(Environment, class(thisClassName, thisLoader)),
superclassChain(thisClassName, thisLoader, [MethodClass | Rest]).
This says that, for an invokespecial of a superclass <init> method, the type 'unintializedThis' should be replaced with 'MethodClass', the type of the *superclass*. But that's incorrect: the new type should be the type of the *current class*.
This bug appears to have been introduced by JDK-7160765, which recognized the need to constrain the invocation to the current class or the superclass. But it inadvertently changed the result type at the same time.
Ever since JDK-8138821, which spun off the 'uninitializedThis' case separately, there hasn't really been a need for a 'rewrittenUninitializedType' predicate that works on all uninitialized types. It may make sense to strip this check down to a simpler 'validInvokespecialTarget' or something like that, and leave it to the 'instructionIsTypeSafe' rule to always map 'uninitializedThis' to 'CurrentClass'.
MethodClass, MethodClass) :-
MethodClass = class(MethodClassName, CurrentLoader),
thisClass(Environment, class(thisClassName, thisLoader)),
superclassChain(thisClassName, thisLoader, [MethodClass | Rest]).
This says that, for an invokespecial of a superclass <init> method, the type 'unintializedThis' should be replaced with 'MethodClass', the type of the *superclass*. But that's incorrect: the new type should be the type of the *current class*.
This bug appears to have been introduced by JDK-7160765, which recognized the need to constrain the invocation to the current class or the superclass. But it inadvertently changed the result type at the same time.
Ever since JDK-8138821, which spun off the 'uninitializedThis' case separately, there hasn't really been a need for a 'rewrittenUninitializedType' predicate that works on all uninitialized types. It may make sense to strip this check down to a simpler 'validInvokespecialTarget' or something like that, and leave it to the 'instructionIsTypeSafe' rule to always map 'uninitializedThis' to 'CurrentClass'.
- relates to
-
JDK-8122946 4.10.1.9: invoke{special,static} can invoke an interface method
-
- Resolved
-
-
JDK-8323557 4.10.1: clarify distinction between types and classes
-
- Resolved
-