L
Leonardo Teixeira Passos
Hi all. I am currently writing a Java code that looks like the following:
public abstract class Parser {
....
abstract public AST parse
(Scanner scanner,
Map<String, LinkedList<String> > parameters)
throws Exception, ParseException, ScanException ;
....
}
When writing a subclass of Parser, for instance, CupParser, I have:
public class CupParser extends Parser {
....
public AST parse
(Scanner scanner,
Map<String, LinkedList<Object,String>> parameters)
throws Exception, ParseException, ScanException {
...
}
....
}
When using the open-jdk version of javac, it reports the
following:
CupParser is not abstract and does not override abstract method
parse(dcf.frontend.Scanner, java.util.Map).
Of course, changing the signature of the parse method to the one stated by
the compiler works fine, but the question is: why does the compiler complain
about the presented code in the subclass, since it is just restating the
inherited method signature?
public abstract class Parser {
....
abstract public AST parse
(Scanner scanner,
Map<String, LinkedList<String> > parameters)
throws Exception, ParseException, ScanException ;
....
}
When writing a subclass of Parser, for instance, CupParser, I have:
public class CupParser extends Parser {
....
public AST parse
(Scanner scanner,
Map<String, LinkedList<Object,String>> parameters)
throws Exception, ParseException, ScanException {
...
}
....
}
When using the open-jdk version of javac, it reports the
following:
CupParser is not abstract and does not override abstract method
parse(dcf.frontend.Scanner, java.util.Map).
Of course, changing the signature of the parse method to the one stated by
the compiler works fine, but the question is: why does the compiler complain
about the presented code in the subclass, since it is just restating the
inherited method signature?