In a java class, I have an overloaded method like this:
method1(List<Details1HO> input){};
and method1(List<Details2HO> input){};
Both Details2HO and Details1HO extend the same class DetailsHO.
RAD builds the class fine, but ant gives error:
name clash: method1(java.util.List<Details1HO>) and method2(java.util.List<Details1HO>) have the same erasure
The Java version is 1.5 both in ant and in RAD
EDIT: The methods have different return types
EDIT #2: Real error:
name clash: mapToDO(java.util.List<com.bmo.ctp.alerts.businessobjects.user.hibernate.DeliveryDomainRestrictionHO>) and mapToDO(java.util.List<com.bmo.ctp.alerts.businessobjects.subscription.hibernate.SubscriptionDetailsHO>) have the same erasure
Real declaration:
public static DeliveryDomainRestrictionDO[] mapToDO(List<DeliveryDomainRestrictionHO> deliveryDomainRestrictions){}
public static List<SubscriptionSummaryDO> mapToDO(List<SubscriptionDetailsHO> input) {}
I’m surprised that RAD will build this; it shouldn’t. It’s not legal to have a class that looks like:
because, due to type erasure, they both have the exact same signature at runtime:
When you have this sort of problem, it typically means you’re trying to do something more complicated than you actually need to 🙂 In any case, you will need to disambiguate these somehow.