view dyncast.txt @ 93:1a5dbddf9ea9

rebase to current hsx/hotspot-comp
author jrose
date Mon, 03 Dec 2012 18:58:36 -0800
line wrap: on
line source
0000000: writing libraries in Java for non-Java languages requires permissive Dynamic type
Summary: javac allows additional conversions (relaxed but safe) to and from Dynamic

javac needs to support library development for non-Java langauges[TBD]0

- conversions to java.dyn.Dynamic always succeed, without a "checkcast" operation
- this is safe, because the JVM verifier does not verify interface types (really!)
- casts from java.dyn.Dynamic always succeed
- conversions from primitives to Dynamic use autoboxing
- conversions to primitives from Dynamic use autoboxing, according to the target type
- the non-static method java.dyn.Dynamic.<T>zzz(AAA)T always exists for Dynamic references
- the syntax x.<T>zzz(aaa) is in all ways equivalent to Dynamic.<T>zzz(aaa)
- if the return type parameter <T> is omitted, it defaults to Dynamic, allowing chained calls
- null values of type Dynamic can appear in receiver position; no null check is performed

- promote the type Dynamic as a "flex" type for concisely forming invokedynamic calls

- John Rose (Sun)