singhbaljit opened a new pull request #810:
URL: https://github.com/apache/commons-lang/pull/810


   See https://issues.apache.org/jira/browse/LANG-1674.
   
   The constructors for `org.apache.commons.lang3.Range` don't play nicely with 
abstract/derived classes. Example:
   
   ```java
       abstract class AbstractComparable implements 
Comparable<AbstractComparable> {
           @Override public int compareTo(AbstractComparable o) {}
       }
   
       class DerivedA extends AbstractComparable {}
   
       class DerivedB extends AbstractComparable {}
   
       // compiles, and reasonable since AbstractComparable is the common parent
       static final Range<AbstractComparable> RANGE_MIXED = Range.between(new 
DerivedA(), new DerivedB());
   
       // compiles, but unreasonable to force usage of parent class
       static final Range<AbstractComparable> RANGE_SAME_CLASS = 
Range.between(new DerivedA(), new DerivedA());
   
       // compiler error
       static final Range<DerivedA> RANGE_A = Range.between(new DerivedA(), new 
DerivedA());
   
       // compiler error
       static final Range<DerivedB> RANGE_B = Range.is(new DerivedB());
   ```
   
   This PR will fix the compiler errors.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to