Sometimes when I add the required @NonNullByDefault
annotation I get lot of build errors like: “Illegal redefinition of parameter xxx, inherited method from xxx does not constrain this parameter”.
I don’t know how to fix this. If I remove the annotation build is not happy either.
Example:
@NonNullByDefault
public class EnergyUnitConverter implements SingleValueConverter {
/**
* Marshals an Object into a single value representation.
*
* @param obj the Object to be converted
* @return a String with the single value of the Object or <code>null</code>
*/
@Override
public String toString(Object obj) {
return obj.toString();
}
/* ... */
}
And the build error is: Illegal redefinition of parameter obj, inherited method from com.thoughtworks.xstream.converters.SingleValueConverter does not constrain this parameter
I checked triple times and the class contain that parameter!
public interface SingleValueConverter extends ConverterMatcher {
/**
* Marshals an Object into a single value representation.
* @param obj the Object to be converted
* @return a String with the single value of the Object or <code>null</code>
*/
public String toString(Object obj);
/* ... */
}
Can we disable this “stupid” rule? Use Kotlin to avoid NPE or someting. I’m weeery frustrated.