I get an error when starting maven compilation in this class, but it seems to work fine when executed. I looked at several other posts on the same topic, but could not get this to work for myself.
EDIT - removed source code fragments and replaced
EDIT - Providing MCVE - very stripped down
By the way, this runs in Java 6
public class MainTester {
@SuppressWarnings("rawtypes")
public static void main(String[] args) {
ProtocolHandler<MappingRule> mappingProtocolHandler = new MappingProtocolHandler();
Map<String, List<MappingRule>> protocols = mappingProtocolHandler.getProtocols();
System.out.println(protocols);
}
}
ProtocolHandler and Child class:
public abstract class ProtocolHandler<E extends Rule<?, ?>> {
public Map<String, List<E>> getProtocols() {
return getProtocolsForRequest();
}
protected abstract Map<String, List<E>> getProtocolsForRequest();
}
@SuppressWarnings("rawtypes")
public class MappingProtocolHandler extends ProtocolHandler<MappingRule>{
@Override
protected Map<String, List<MappingRule>> getProtocolsForRequest() {
return new HashMap<String, List<MappingRule>>();
}
}
Rule classes:
public interface Rule<F, T> {
public void execute(F object, T object2);
}
public abstract class BaseRule<F, T> implements Rule<F, T>, Comparable<BaseRule<F, T>> {
}
public abstract class MappingRule<F,T> extends BaseRule<F, T> implements CustomAttributes{
}
public abstract class InputRule extends MappingRule<Object, Map<String,Object>> {
}
public abstract class OutputRule extends MappingRule<Map<String, Object>, Object> {
}
public interface CustomAttributes {
}
Handler classes:
public abstract class ProtocolHandler<E extends Rule<?, ?>> {
public Map<String, List<E>> getProtocols() {
return getProtocolsForRequest();
}
protected abstract Map<String, List<E>> getProtocolsForRequest();
}
@SuppressWarnings("rawtypes")
public class MappingProtocolHandler extends ProtocolHandler<MappingRule>{
@Override
protected Map<String, List<MappingRule>> getProtocolsForRequest() {
return new HashMap<String, List<MappingRule>>();
}
}
[ERROR] org.apache.maven.plugins: Maven--: 2.5.1: ( ) . : : : [ERROR]...\SRC\\Java\Common\\MainTester.java: [14,18] type common.mapping.rule.MappingRule [ERROR]...\SRC\\Java\Common\\MappingProtocolHandler.java: [10,60] type common.mapping.rule.MappingRule