Update: this seems to be related to Eclipse, not Hudson, so I updated this question accordingly.
I get some compiler errors when launching Maven on the command line, but all the developers in our group have code that works fine in Eclipse (some common subtleties, see below for details). How can this differ and what to do about it?
Invalid code is as follows:
299 private <T extends ProductClassDTO> List<T> convertProductClass(List<? extends ProductClassDTO> fromList) { 300 List<T> toList = new ArrayList<T>(); 301 for (ProductClassDTO from : fromList) { 302 T to = convert(from); 303 toList.add(to); 304 } 305 return toList; 306 }
This is an error on the build server:
[ERROR] ...java:[302,26] type parameters of <T>T cannot be determined; no unique maximal instance exists for type variable T with upper bounds T,com.volvo.protom.util.dto.ProductClassDTO
(I know there are other questions + answers to this in SO, but they don't seem to apply to this particular question, since switching to T to = <T>convert(from) does not work, maybe I should do that something else?) I "Assuming that the error refers to the fact that there are several convert methods in this class, and more than one are suitable?
Thanks!
Update 2: - this is the signature of the conversion:
private void convert(TestObjectDTO from, TestObjectDTO to); private <T extends TestObjectDTO> T convert(TestObjectDTO from); private void convert(ProductClassDTO from, ProductClassDTO to); private <T extends ProductClassDTO> T convert(ProductClassDTO from); private void convert(TestObjectTypeDTO from, TestObjectTypeDTO to); private <T extends TestObjectTypeDTO> T convert(TestObjectTypeDTO from);
source share