編譯報錯:java
have the same erasure, yet neither overrides the otherapp
java version "1.7.0_25" Java(TM) SE Runtime Environment (build 1.7.0_25-b17) Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)
首先,這個問題貌似出如今JDK1.7 中,1.6時應該能夠的。ide
public class PortfolioDataValidator implements IRecordValidator{ public int validate(List<BusinessObjectViolation> violations, Object obj, int index, Object validateHelper) { if (obj == null) { return 0; } else { return doValidate(violations, obj, index, validateHelper); } } }
提示在這個類的這個方法上出錯。
ui
public interface IRecordValidator<T> { int validate(List<BusinessObjectViolation> violations, T obj, int index, Object validateHelper); }
這是接口。code
一個簡單的實現,應該沒什麼問題的。接口
Sun那邊有個ticket
get
http://bugs.java.com/bugdatabase/view_bug.do?bug_id=7078419 it
The interim support for "jsr14" class files was never a documented supported option. And, since generic signature attributes are not defined for v48 (JDK 1.4) and earlier class files, it is inappropriate for javac to behave otherwise.io
最後這麼解決的:編譯
public class PortfolioDataValidator implements IRecordValidator<Object> { public int validate(List<BusinessObjectViolation> violations, Object obj, int index, Object validateHelper) { if (obj == null) { return 0; } else { return doValidate(violations, obj, index, validateHelper); } } }
添加了一個
IRecordValidator<Object>