This is probably my mistake, but I thought it worth checking anyway! I am playing around with multiple dispatch in the MLVM, in particular.
public class Cost { /* Written by PEC! */ static { final MethodHandle bootstrap = MethodHandles.lookup().findStatic( CostCalculatorDispatcher.class, "cost", Dispatchers.bootstrapType ); Linkage.registerBootstrapMethod( Cost.class, bootstrap ); } public static void main( final String[] notUsed ) { final List<Item> shoppingCart = new ArrayList<Item>(); shoppingCart.add( new Book( 20, 0.5 ) ); shoppingCart.add( new CD( 25 ) ); System.out.println( "cost = " + cost( shoppingCart ) ); } public static double cost( final List<Item> shoppingCart ) { final CostCalculator price = new Price(); final CostCalculator postage = new Postage(); double cost = 0; for ( final Item item : shoppingCart ) { try { /* Written by PEC! */ cost += InvokeDynamic.<double>cost( price, item ); } catch ( Throwable e ) { throw new MultipleDispatchException( e ); } try { /* Written by PEC! */ cost += InvokeDynamic.<double>cost( postage, item ); } catch ( Throwable e ) { throw new MultipleDispatchException( e ); } } return cost; } } The bootstrap method gets called, but its type argument is: (invokedynamicmultipledispatch.CostCalculator,invokedynamicmultipledispatch.Item)double IE the static types, I was expecting the dynamic types: (invokedynamicmultipledispatch.Price,invokedynamicmultipledispatch.Book)double etc. What am I doing wrong? -- Howard.
_______________________________________________ mlvm-dev mailing list mlvm-dev@openjdk.java.net http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev