1494 else return this; |
1494 else return this; |
1495 } |
1495 } |
1496 |
1496 |
1497 /** get all bounds of a given kind */ |
1497 /** get all bounds of a given kind */ |
1498 public List<Type> getBounds(InferenceBound... ibs) { |
1498 public List<Type> getBounds(InferenceBound... ibs) { |
1499 ListBuffer<Type> buf = ListBuffer.lb(); |
1499 ListBuffer<Type> buf = new ListBuffer<>(); |
1500 for (InferenceBound ib : ibs) { |
1500 for (InferenceBound ib : ibs) { |
1501 buf.appendList(bounds.get(ib)); |
1501 buf.appendList(bounds.get(ib)); |
1502 } |
1502 } |
1503 return buf.toList(); |
1503 return buf.toList(); |
1504 } |
1504 } |
1505 |
1505 |
1506 /** get the list of declared (upper) bounds */ |
1506 /** get the list of declared (upper) bounds */ |
1507 public List<Type> getDeclaredBounds() { |
1507 public List<Type> getDeclaredBounds() { |
1508 ListBuffer<Type> buf = ListBuffer.lb(); |
1508 ListBuffer<Type> buf = new ListBuffer<>(); |
1509 int count = 0; |
1509 int count = 0; |
1510 for (Type b : getBounds(InferenceBound.UPPER)) { |
1510 for (Type b : getBounds(InferenceBound.UPPER)) { |
1511 if (count++ == declaredCount) break; |
1511 if (count++ == declaredCount) break; |
1512 buf.append(b); |
1512 buf.append(b); |
1513 } |
1513 } |
1563 } |
1563 } |
1564 }; |
1564 }; |
1565 for (Map.Entry<InferenceBound, List<Type>> _entry : bounds.entrySet()) { |
1565 for (Map.Entry<InferenceBound, List<Type>> _entry : bounds.entrySet()) { |
1566 InferenceBound ib = _entry.getKey(); |
1566 InferenceBound ib = _entry.getKey(); |
1567 List<Type> prevBounds = _entry.getValue(); |
1567 List<Type> prevBounds = _entry.getValue(); |
1568 ListBuffer<Type> newBounds = ListBuffer.lb(); |
1568 ListBuffer<Type> newBounds = new ListBuffer<>(); |
1569 ListBuffer<Type> deps = ListBuffer.lb(); |
1569 ListBuffer<Type> deps = new ListBuffer<>(); |
1570 //step 1 - re-add bounds that are not dependent on ivars |
1570 //step 1 - re-add bounds that are not dependent on ivars |
1571 for (Type t : prevBounds) { |
1571 for (Type t : prevBounds) { |
1572 if (!t.containsAny(instVars)) { |
1572 if (!t.containsAny(instVars)) { |
1573 newBounds.append(t); |
1573 newBounds.append(t); |
1574 } else { |
1574 } else { |