Bug in findSpecial?
Howard Lovatt
howard.lovatt at gmail.com
Fri Jun 18 00:52:09 PDT 2010
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.
More information about the mlvm-dev
mailing list