Index: src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceTypeHierarchyTests.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core.tests.performance/src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceTypeHierarchyTests.java,v retrieving revision 1.4 diff -u -r1.4 FullSourceWorkspaceTypeHierarchyTests.java --- src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceTypeHierarchyTests.java 14 Apr 2005 18:24:48 -0000 1.4 +++ src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceTypeHierarchyTests.java 6 Sep 2005 11:12:33 -0000 @@ -29,8 +29,6 @@ // Log files private static PrintStream[] LOG_STREAMS = new PrintStream[LOG_TYPES.length]; - static int[] COUNTERS = new int[1]; - /** * @param name */ @@ -38,9 +36,9 @@ super(name); } -// static { -// TESTS_NAMES = new String[] { "testPerfAllTypes" }; -// } + static { +// TESTS_NAMES = new String[] { "testPerfClassWithPotentialSubinterfaces" }; + } public static Test suite() { Test suite = buildSuite(testClass()); TESTS_COUNT = suite.countTestCases(); @@ -72,16 +70,6 @@ logPerfResult(LOG_STREAMS, TESTS_COUNT); } - // Print statistics - if (TESTS_COUNT == 0) { - // Print statistics - System.out.println("-------------------------------------"); - System.out.println("Type Hierarchy test statistics:"); - NumberFormat intFormat = NumberFormat.getIntegerInstance(); - System.out.println(" - "+intFormat.format(COUNTERS[0])+" all types found."); - System.out.println("-------------------------------------\n"); - } - // Call super at the end as it close print streams super.tearDown(); } @@ -121,7 +109,47 @@ commitMeasurements(); assertPerformance(); - // Store counter - COUNTERS[0] = length; + // Print statistics + if (TESTS_COUNT == 0) { + // Print statistics + System.out.println("-------------------------------------"); + System.out.println("Type Hierarchy test statistics:"); + NumberFormat intFormat = NumberFormat.getIntegerInstance(); + System.out.println(" - "+intFormat.format(length)+" all types found."); + System.out.println("-------------------------------------\n"); + } + + } + + /* + * A direct subclass of org.eclipse.jface.text.templates.TemplateVariableResolver is called Collection. + * Collection is also an interface that is the root of a deep hierarchy in java.util. + * This test proves that the interface and all its potential subtypes are not injected while computing + * the hierarchy. + * (test for bug 108820 Index based type hierarchy should not consider interfaces in index when focus is a class) + */ + public void testPerfClassWithPotentialSubinterfaces() throws CoreException { + ICompilationUnit unit = getCompilationUnit("org.eclipse.text", "org.eclipse.jface.text.templates", "TemplateVariableResolver.java"); + assertNotNull("TemplateVariableResolver not found!", unit); + + // Warm up + IType type = unit.getType("TemplateVariableResolver"); + type.newTypeHierarchy(null); + + // Clean memory + runGc(); + + // Measures + for (int i=0; i