-
Bug
-
Resolution: Done
-
Major
-
4.0.0-BETA4
-
None
The 4.0.0 release branch for jdk9 includes changes to the rule compiler handle inaccessible classes generically as Objects. This avoids a longstanding problem with references to inaccessible types from generated bytecode. Operations which produce or operate on instances of such classes need to employ method handles. This occasionally requires use of a checkcast when an expression producing an instance of a non-accessible type is consumed as an instance of an accessible type.
For example, consider the expression $0.myList = $1.privateListImplementation where privateListImplementation is an instance of a private class specialising class List and field myList is type to the public type List. The rhs of the assignment will be compiled to a getter method handle call generating an object. This value must be cast to type List before ti can be assigned to the accessible field myList.
This requirement for checkcast handling is not being met correctly in the special case where a rule variable binding is declared using an accessible type but using an initializer exprression whose type is inaccessible – for example, he binding
loader : ClassLoader = jdk.internal.loader.ClassLoaders.PLATFORM_LOADER;
The initializer is compiled to byecode that stacks a generic Obejct. However, the code which stores the binding (in a local var of the helper adapter class) expects to consume an instance of ClassLoader