In the following code: public class Price extends CostCalculator { /* Written by PEC! */ static { final MethodHandles.Lookup l = MethodHandles.lookup(); MethodHandle mh; mh = l.findSpecial( Price.class, "cost", MethodType.methodType( double.class, Price.class, Book.class ), Price.class ); System.out.println(" Price cost type = "+mh.type()); CostCalculatorDispatcher.register( mh ); mh = l.findSpecial( Price.class, "cost", MethodType.methodType( double.class, Price.class, CD.class ), Price.class ); System.out.println(" Price cost type = "+mh.type()); CostCalculatorDispatcher.register( mh ); }
@MultipleDispatch public double cost( final Price notUsed, final Book b ) { return b.getPrice(); } @MultipleDispatch public double cost( final Price notUsed, final CD c ) { return c.getPrice(); } } The findSpecial methods find methods, the printlns give: Price cost type = (invokedynamicmultipledispatch.Price,invokedynamicmultipledispatch.Price,invokedynamicmultipledispatch.Book)double Price cost type = (invokedynamicmultipledispatch.Price,invokedynamicmultipledispatch.Price,invokedynamicmultipledispatch.CD)double Note the double Price argument. I think the findSpecials should throw NoAccessException. Is this a bug? -- -- Howard. _______________________________________________ mlvm-dev mailing list mlvm-dev@openjdk.java.net http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev