Lines 30-37
Link Here
|
30 |
public LookupTest(String name) { |
30 |
public LookupTest(String name) { |
31 |
super(name); |
31 |
super(name); |
32 |
} |
32 |
} |
|
|
33 |
//static { |
34 |
// TESTS_NUMBERS = new int[] { 50 }; |
35 |
// TESTS_RANGE = new int[] { 50, -1 }; |
36 |
//} |
33 |
public static Test suite() { |
37 |
public static Test suite() { |
34 |
return setupSuite(testClass()); |
38 |
return buildTestSuite(testClass()); |
|
|
39 |
} |
40 |
public static Class testClass() { |
41 |
return LookupTest.class; |
35 |
} |
42 |
} |
36 |
/** |
43 |
/** |
37 |
* Non-static member class |
44 |
* Non-static member class |
Lines 1683-1689
Link Here
|
1683 |
"Cannot make a static reference to the non-static method format(Date) from the type DateFormat\n" + |
1690 |
"Cannot make a static reference to the non-static method format(Date) from the type DateFormat\n" + |
1684 |
"----------\n"); |
1691 |
"----------\n"); |
1685 |
} |
1692 |
} |
1686 |
public static Class testClass() { |
1693 |
// 79163 - [compiler] Dependency on indirectly referenced types not correctly computed |
1687 |
return LookupTest.class; |
1694 |
public void test050() { |
|
|
1695 |
this.runNegativeTest( |
1696 |
new String[] { |
1697 |
"p/Client.java", |
1698 |
"package p;\n" + |
1699 |
"import q.FooFactory;\n" + |
1700 |
"public class Client {\n" + |
1701 |
" void foo() {\n" + |
1702 |
" FooFactory.createFoo().bar();\n" + |
1703 |
" }\n" + |
1704 |
"}\n", |
1705 |
"q/Foo.java", |
1706 |
"package q;\n" + |
1707 |
"class Foo {\n" + // Foo not public to get visibility problems |
1708 |
" public void bar() {}\n" + |
1709 |
"}\n", |
1710 |
"q/FooFactory.java", |
1711 |
"package q;\n" + |
1712 |
"public class FooFactory {\n" + |
1713 |
" public static Foo createFoo() {\n" + |
1714 |
" return new Foo();\n" + |
1715 |
" }\n" + |
1716 |
"}\n" |
1717 |
}, |
1718 |
"----------\n" + |
1719 |
"1. ERROR in p\\Client.java (at line 5)\n" + |
1720 |
" FooFactory.createFoo().bar();\n" + |
1721 |
" ^^^^^^^^^^^^^^^^^^^^^^\n" + |
1722 |
"The type Foo is not visible\n" + |
1723 |
"----------\n", |
1724 |
Util.concatWithClassLibs(OUTPUT_DIR, true/*output in front*/), |
1725 |
false, // do not flush output |
1726 |
null, // options |
1727 |
false, // do not generate output |
1728 |
new ICompilerRequestor() { |
1729 |
public void acceptResult(CompilationResult result) { |
1730 |
assertNotNull("missing reference information",result.simpleNameReferences); |
1731 |
boolean found = false; |
1732 |
char[] foo = "Foo".toCharArray(); |
1733 |
for (int i = 0, length = result.simpleNameReferences.length; i < length; i++) { |
1734 |
char[] name = result.simpleNameReferences[i]; |
1735 |
if (CharOperation.equals(foo, name)) |
1736 |
found = true; |
1737 |
} |
1738 |
assertTrue(new String(result.compilationUnit.getMainTypeName())+" should contain reference to Foo", found); |
1739 |
} |
1740 |
}); |
1741 |
} |
1742 |
public void test051() { |
1743 |
this.runNegativeTest( |
1744 |
new String[] { |
1745 |
"p/Client.java", |
1746 |
"package p;\n" + |
1747 |
"import q.FooFactory;\n" + |
1748 |
"public class Client {\n" + |
1749 |
" void foo() { \n" + |
1750 |
" FooFactory.createFoos().clone();\n" + |
1751 |
" }\n" + |
1752 |
"}\n", |
1753 |
"q/Foo.java", |
1754 |
"package q;\n" + |
1755 |
"class Foo {\n" + // Foo not public to get visibility problems |
1756 |
" public Foo[] bar() { return null; }\n" + |
1757 |
"}\n", |
1758 |
"q/FooFactory.java", |
1759 |
"package q;\n" + |
1760 |
"public class FooFactory {\n" + |
1761 |
" public static Foo[] createFoos() {\n" + |
1762 |
" return new Foo[] { new Foo() };\n" + |
1763 |
" }\n" + |
1764 |
"}\n" |
1765 |
}, |
1766 |
"----------\n" + |
1767 |
"1. ERROR in p\\Client.java (at line 5)\n" + |
1768 |
" FooFactory.createFoos().clone();\n" + |
1769 |
" ^^^^^^^^^^^^^^^^^^^^^^^\n" + |
1770 |
"The type Foo is not visible\n" + |
1771 |
"----------\n", |
1772 |
Util.concatWithClassLibs(OUTPUT_DIR, true/*output in front*/), |
1773 |
false, // do not flush output |
1774 |
null, // options |
1775 |
false, // do not generate output |
1776 |
new ICompilerRequestor() { |
1777 |
public void acceptResult(CompilationResult result) { |
1778 |
assertNotNull("missing reference information",result.simpleNameReferences); |
1779 |
boolean found = false; |
1780 |
char[] foo = "Foo".toCharArray(); |
1781 |
for (int i = 0, length = result.simpleNameReferences.length; i < length; i++) { |
1782 |
char[] name = result.simpleNameReferences[i]; |
1783 |
if (CharOperation.equals(foo, name)) |
1784 |
found = true; |
1785 |
} |
1786 |
assertTrue(new String(result.compilationUnit.getMainTypeName())+" should contain reference to Foo", found); |
1787 |
} |
1788 |
}); |
1789 |
} |
1790 |
public void test052() { |
1791 |
this.runNegativeTest( |
1792 |
new String[] { |
1793 |
"p/Client.java", |
1794 |
"package p;\n" + |
1795 |
"import q.FooFactory;\n" + |
1796 |
"public class Client {\n" + |
1797 |
" int foo() { \n" + |
1798 |
" return FooFactory.createFoos().length;\n" + |
1799 |
" }\n" + |
1800 |
"}\n", |
1801 |
"q/Foo.java", |
1802 |
"package q;\n" + |
1803 |
"class Foo {\n" + // Foo not public to get visibility problems |
1804 |
" public Foo[][] foos;\n" + |
1805 |
"}\n", |
1806 |
"q/FooFactory.java", |
1807 |
"package q;\n" + |
1808 |
"public class FooFactory {\n" + |
1809 |
" public static Foo[] createFoos() {\n" + |
1810 |
" return new Foo[] { new Foo() };\n" + |
1811 |
" }\n" + |
1812 |
"}\n" |
1813 |
}, |
1814 |
"----------\n" + |
1815 |
"1. ERROR in p\\Client.java (at line 5)\n" + |
1816 |
" return FooFactory.createFoos().length;\n" + |
1817 |
" ^^^^^^^^^^^^^^^^^^^^^^^\n" + |
1818 |
"The type Foo is not visible\n" + |
1819 |
"----------\n", |
1820 |
Util.concatWithClassLibs(OUTPUT_DIR, true/*output in front*/), |
1821 |
false, // do not flush output |
1822 |
null, // options |
1823 |
false, // do not generate output |
1824 |
new ICompilerRequestor() { |
1825 |
public void acceptResult(CompilationResult result) { |
1826 |
assertNotNull("missing reference information",result.simpleNameReferences); |
1827 |
boolean found = false; |
1828 |
char[] foo = "Foo".toCharArray(); |
1829 |
for (int i = 0, length = result.simpleNameReferences.length; i < length; i++) { |
1830 |
char[] name = result.simpleNameReferences[i]; |
1831 |
if (CharOperation.equals(foo, name)) |
1832 |
found = true; |
1833 |
} |
1834 |
assertTrue(new String(result.compilationUnit.getMainTypeName())+" should contain reference to Foo", found); |
1835 |
} |
1836 |
}); |
1688 |
} |
1837 |
} |
1689 |
} |
1838 |
} |