1796 Type st2 = types.memberType(t2, s2);
1797 if (types.overrideEquivalent(st1, st2))
1798 log.error(pos, "concrete.inheritance.conflict",
1799 s1, t1, s2, t2, sup);
1800 }
1801 }
1802 }
1803 }
1804 }
1805
1806 /** Check that classes (or interfaces) do not each define an abstract
1807 * method with same name and arguments but incompatible return types.
1808 * @param pos Position to be used for error reporting.
1809 * @param t1 The first argument type.
1810 * @param t2 The second argument type.
1811 */
1812 public boolean checkCompatibleAbstracts(DiagnosticPosition pos,
1813 Type t1,
1814 Type t2) {
1815 return checkCompatibleAbstracts(pos, t1, t2,
1816 types.makeCompoundType(t1, t2));
1817 }
1818
1819 public boolean checkCompatibleAbstracts(DiagnosticPosition pos,
1820 Type t1,
1821 Type t2,
1822 Type site) {
1823 if ((site.tsym.flags() & COMPOUND) != 0) {
1824 // special case for intersections: need to eliminate wildcards in supertypes
1825 t1 = types.capture(t1);
1826 t2 = types.capture(t2);
1827 }
1828 return firstIncompatibility(pos, t1, t2, site) == null;
1829 }
1830
1831 /** Return the first method which is defined with same args
1832 * but different return types in two given interfaces, or null if none
1833 * exists.
1834 * @param t1 The first type.
1835 * @param t2 The second type.
1836 * @param site The most derived type.
|
1796 Type st2 = types.memberType(t2, s2);
1797 if (types.overrideEquivalent(st1, st2))
1798 log.error(pos, "concrete.inheritance.conflict",
1799 s1, t1, s2, t2, sup);
1800 }
1801 }
1802 }
1803 }
1804 }
1805
1806 /** Check that classes (or interfaces) do not each define an abstract
1807 * method with same name and arguments but incompatible return types.
1808 * @param pos Position to be used for error reporting.
1809 * @param t1 The first argument type.
1810 * @param t2 The second argument type.
1811 */
1812 public boolean checkCompatibleAbstracts(DiagnosticPosition pos,
1813 Type t1,
1814 Type t2) {
1815 return checkCompatibleAbstracts(pos, t1, t2,
1816 types.makeIntersectionType(t1, t2));
1817 }
1818
1819 public boolean checkCompatibleAbstracts(DiagnosticPosition pos,
1820 Type t1,
1821 Type t2,
1822 Type site) {
1823 if ((site.tsym.flags() & COMPOUND) != 0) {
1824 // special case for intersections: need to eliminate wildcards in supertypes
1825 t1 = types.capture(t1);
1826 t2 = types.capture(t2);
1827 }
1828 return firstIncompatibility(pos, t1, t2, site) == null;
1829 }
1830
1831 /** Return the first method which is defined with same args
1832 * but different return types in two given interfaces, or null if none
1833 * exists.
1834 * @param t1 The first type.
1835 * @param t2 The second type.
1836 * @param site The most derived type.
|