Hello, in my DMSServiceLocator.class, I have a method called getParser() with a return type called Parser. I'm trying to return a service called AutoMateParser with an Impl that extends Parser, however I'm' getting a compiling error saying Parser is required, found AutoMateParser. When I return new AutoMateServiceImpl() rather than my service interface, I receive no compiling errors. It doesn't appear my getParser() method realizes autoMateParser is of the same type. I tried casting AutoMateParser with Parser, "return (Parser) autoMateParser;" which resolved compiling errors, but received a cast exception. I'm wondering if anybody knows how to do this. Thanks in advance.
below is a sample of my code. AppModule public static void bind(ServiceBinder binder) { binder.bind(AutoMateParser.class, AutoMateParserImpl.class); } public class DMSServiceLocator { @Inject private AutoMateParser autoMateParser; public Parser getParser() { if(automate) { return autoMateParser(); } else { //Different data scrubber, but also extends Parser return homenetParser(); } } } public class AutoMateParserImpl extends Parser implements AutoMateParser { protected Vehicle parseCar(String vehicleData) { //some data scrubbing code } } public class Parser { //some csv line reader code protected abstract Vehicle parseCar(String carData); } -- View this message in context: http://tapestry.1045711.n5.nabble.com/Compiling-error-returning-service-interface-in-service-locator-method-tp5715645.html Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org