[279259] - Clean up of IClassFile and IType
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTModelBridgeTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTModelBridgeTests.java
index f70ff24..1f87345 100644
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTModelBridgeTests.java
+++ b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTModelBridgeTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others.
+ * Copyright (c) 2004, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -676,21 +676,6 @@
/*
* Ensures that the correct IBindings are created for a given set of IJavaScriptElement
- * (type parameter)
- */
- public void testCreateBindings14() throws JavaScriptModelException {
- IBinding[] bindings = createBindings(
- "public class X<T> {\n" +
- "}",
- this.workingCopy.getType("X").getTypeParameter("T")
- );
- assertBindingsEqual(
- "LX;:TT;",
- bindings);
- }
-
- /*
- * Ensures that the correct IBindings are created for a given set of IJavaScriptElement
* (binary type)
*/
public void testCreateBindings15() throws CoreException {
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ClassFileTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ClassFileTests.java
index 0f2239d..9a1866d 100644
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ClassFileTests.java
+++ b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ClassFileTests.java
@@ -468,77 +468,6 @@
}
}
-/**
- * Ensure that the type parameter signatures of a binary type are correct.
- */
-public void testParameterTypeSignatures1() throws JavaScriptModelException {
- IType type = this.jarRoot.getPackageFragment("generic").getClassFile("X.class").getType();
- assertStringsEqual(
- "Unexpected type parameters",
- "T:Ljava.lang.Object;\n",
- type.getTypeParameterSignatures());
-}
-
-/**
- * Ensure that the type parameter signatures of a binary type are correct.
- */
-public void testParameterTypeSignatures2() throws JavaScriptModelException {
- IType type = this.jarRoot.getPackageFragment("nongeneric").getClassFile("A.class").getType();
- assertStringsEqual(
- "Unexpected type parameters",
- "",
- type.getTypeParameterSignatures());
-}
-
-/**
- * Ensure that the type parameter signatures of a binary type are correct.
- */
-public void testParameterTypeSignatures3() throws JavaScriptModelException {
- IType type = this.jarRoot.getPackageFragment("generic").getClassFile("Y.class").getType();
- assertStringsEqual(
- "Unexpected type parameters",
- "K:Ljava.lang.Object;\n" +
- "L:Ljava.lang.Object;\n",
- type.getTypeParameterSignatures());
-}
-
-/**
- * Ensure that the type parameter signatures of a binary type are correct.
- */
-public void testParameterTypeSignatures4() throws JavaScriptModelException {
- IType type = this.jarRoot.getPackageFragment("generic").getClassFile("Z.class").getType();
- assertStringsEqual(
- "Unexpected type parameters",
- "T:Ljava.lang.Object;:Lgeneric.I<-TT;>;\n",
- type.getTypeParameterSignatures());
-}
-
-/**
- * Ensure that the type parameter signatures of a binary type are correct.
- */
-public void testParameterTypeSignatures5() throws JavaScriptModelException {
- IType type = this.jarRoot.getPackageFragment("generic").getClassFile("W.class").getType();
- assertStringsEqual(
- "Unexpected type parameters",
- "T:Lgeneric.X<TT;>;\n" +
- "U:TT;\n",
- type.getTypeParameterSignatures());
-}
-//
-///**
-// * Ensure that the type parameter signatures of a binary method are correct.
-// * @deprecated
-// */
-//public void testParameterTypeSignatures6() throws JavaScriptModelException {
-// IType type = this.jarRoot.getPackageFragment("generic").getClassFile("X.class").getType();
-// IFunction method = type.getFunction("foo", new String[] {"TK;", "TV;"});
-// assertStringsEqual(
-// "Unexpected type parameters",
-// "K:Ljava.lang.Object;\n" +
-// "V:Ljava.lang.Object;\n",
-// method.getTypeParameterSignatures());
-//}
-
/*
* Ensures that the raw parameter names of a binary method with source attached are correct.
*/
@@ -632,21 +561,6 @@
}
/*
- * Ensure that opening a binary type parameter when its parent has not been open yet
- * doesn't throw a JavaScriptModelException
- * (regression test for bug 101228 JME on code assist)
- */
-public void testTypeParameter() throws CoreException {
- IClassFile clazz = this.jarRoot.getPackageFragment("generic").getClassFile("X.class");
- ITypeParameter typeParameter = clazz.getType().getTypeParameter("T");
- clazz.close();
- assertStringsEqual(
- "Unexpected bounds",
- "java.lang.Object\n",
- typeParameter.getBounds());
-}
-
-/*
* Ensure that a method with varargs has the AccVarargs flag set.
*/
public void testVarargs() throws JavaScriptModelException {
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ExistenceTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ExistenceTests.java
index dde28f1..1d68e98 100644
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ExistenceTests.java
+++ b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ExistenceTests.java
@@ -64,8 +64,8 @@
}
public void testBinaryMethodAfterNonExistingMember() throws CoreException {
try {
- IJavaScriptProject project = createJavaProject("P", new String[] {}, new String[] {"JCL_LIB"});
- IClassFile classFile = project.getPackageFragmentRoot(getSystemJsPathString()).getPackageFragment("java.lang").getClassFile("Object.class");
+ IJavaScriptProject project = createJavaProject("P", new String[] {}, new String[] {});
+ IClassFile classFile = project.getPackageFragmentRoot(getSystemJsPathString()).getPackageFragment("").getClassFile("system.js");
classFile.open(null);
IType type = classFile.getType();
type.getFunction("foo", new String[0]).exists();
@@ -78,7 +78,7 @@
try {
this.createJavaProject("P", new String[] {"src"});
this.createFile("P/bin/X.class", "");
- IClassFile classFile = this.getClassFile("P/bin/X.class");
+ IJavaScriptElement classFile = this.getClassFile("P/bin/X.class");
assertTrue(!classFile.exists());
} finally {
this.deleteProject("P");
@@ -88,7 +88,7 @@
try {
this.createJavaProject("P", new String[] {}, new String[] {"lib"});
this.createFile("P/lib/X.class", "");
- IClassFile classFile = this.getClassFile("P/lib/X.class");
+ IJavaScriptElement classFile = this.getClassFile("P/lib/X.class");
assertTrue(classFile.exists());
} finally {
this.deleteProject("P");
@@ -101,7 +101,7 @@
String path = "P2/lib/X.class";
IFile file = this.createFile(path, "");
IJavaScriptProject p1 = createJavaProject("P1", new String[] {}, new String[] {"/P2/lib"});
- IClassFile nonExistingFile = getClassFile(path);
+ IJavaScriptElement nonExistingFile = getClassFile(path);
assertFalse("File '"+path+"' should not exist in P2!", nonExistingFile.exists());
IJavaScriptElement element = JavaScriptCore.create(getFolder("/P2/lib"));
assertTrue("folder '/P2/lib' should be found in P1!", element.exists());
@@ -140,7 +140,7 @@
try {
this.createJavaProject("P", new String[] {"src"});
this.createFile("P/src/X.class", "");
- IClassFile classFile = this.getClassFile("P/src/X.class");
+ IJavaScriptElement classFile = this.getClassFile("P/src/X.class");
assertTrue("Class file should not exist", !classFile.exists());
} finally {
this.deleteProject("P");
@@ -345,63 +345,12 @@
}
}
/*
- * Ensure that an ITypeParameter exists if it exists in source.
- */
-public void testTypeParameter1() throws CoreException {
- try {
- createJavaProject("P");
- createFile(
- "P/X.js",
- "public class X<T> {}"
- );
- ITypeParameter typeParameter = getCompilationUnit("P/X.js").getType("X").getTypeParameter("T");
- assertTrue("Type parameter should exist", typeParameter.exists());
- } finally {
- deleteProject("P");
- }
-}
-/*
- * Ensure that an ITypeParameter doesn't exist if it doesn't exist in source.
- */
-public void testTypeParameter3() throws CoreException {
- try {
- createJavaProject("P");
- createFile(
- "P/X.js",
- "public class X<T> {}"
- );
- ITypeParameter typeParameter = getCompilationUnit("P/X.js").getType("X").getTypeParameter("U");
- assertTrue("Type parameter should not exist", !typeParameter.exists());
- } finally {
- deleteProject("P");
- }
-}
-/*
- * Ensure that an ITypeParameter doesn't exist even if a member class with the same name exists in source.
- * (regression test for bug 73255 [1.5][reconciling] ClassCastException in SourceTypeElementInfo#getTypeParameterBounds)
- */
-public void testTypeParameter5() throws CoreException {
- try {
- createJavaProject("P");
- createFile(
- "P/X.js",
- "public class X {\n" +
- " class T {}\n" +
- "}"
- );
- ITypeParameter typeParameter = getCompilationUnit("P/X.js").getType("X").getTypeParameter("T");
- assertTrue("Type parameter should not exist", !typeParameter.exists());
- } finally {
- deleteProject("P");
- }
-}
-/*
* Ensures that one cannot get the corresponding resource of a non-existing class file.
*/
public void testCorrespondingResourceNonExistingClassFile() throws CoreException {
try {
createJavaProject("P", new String[] {"src"}, new String[] {"lib"});
- IClassFile classFile = getClassFile("/P/lib/X.class");
+ IJavaScriptElement classFile = getClassFile("/P/lib/X.class");
assertCorrespondingResourceFails(classFile);
} finally {
deleteProject("P");
@@ -487,7 +436,7 @@
public void testUnderlyingResourceNonExistingClassFile() throws CoreException {
try {
createJavaProject("P", new String[] {"src"}, new String[] {"lib"});
- IClassFile classFile = getClassFile("/P/lib/X.class");
+ IJavaScriptElement classFile = getClassFile("/P/lib/X.js");
assertUnderlyingResourceFails(classFile);
} finally {
deleteProject("P");
@@ -506,18 +455,6 @@
}
}
/*
- * Ensures that one cannot get the underlying resource of a non-existing jar package fragment root.
- */
-public void testUnderlyingResourceNonExistingJarPkgFragmentRoot() throws CoreException {
- try {
- IJavaScriptProject project = createJavaProject("P", new String[] {"src"});
- IPackageFragmentRoot root = project.getPackageFragmentRoot("/nonExisting.jar");
- assertUnderlyingResourceFails(root);
- } finally {
- deleteProject("P");
- }
-}
-/*
* Ensures that one cannot get the underlying resource of a non-existing package fragment.
*/
public void testUnderlyingResourceNonExistingPkgFragment() throws CoreException {
@@ -558,7 +495,7 @@
createJavaProject("P", new String[] {"src"});
createFile(
"/P/src/X.js",
- "public class X{\n" +
+ "function X(){\n" +
"}"
);
IType type = getCompilationUnit("/P/src/X.js").getType("NonExisting");
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/GetSourceTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/GetSourceTests.java
index ef77562..f43e06f 100644
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/GetSourceTests.java
+++ b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/GetSourceTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -205,40 +205,6 @@
}
}
- /*
- * Ensures the name range for a type parameter is correct.
- */
- public void testNameRangeTypeParameter1() throws CoreException {
- try {
- String cuSource = "package p;\n"
- + "public class Y<T extends String> {\n" + "}";
- createFile("/P/p/Y.js", cuSource);
- ITypeParameter typeParameter = getCompilationUnit("/P/p/Y.js")
- .getType("Y").getTypeParameter("T");
- assertSourceEquals("Unexpected source'", "T", getNameSource(
- cuSource, typeParameter));
- } finally {
- deleteFile("/P/p/Y.js");
- }
- }
-
- /*
- * Ensures the source for a type parameter is correct.
- */
- public void testTypeParameter1() throws CoreException {
- try {
- String cuSource = "package p;\n"
- + "public class Y<T extends String> {\n" + "}";
- createFile("/P/p/Y.js", cuSource);
- ITypeParameter typeParameter = getCompilationUnit("/P/p/Y.js")
- .getType("Y").getTypeParameter("T");
- assertSourceEquals("Unexpected source'", "T extends String",
- typeParameter.getSource());
- } finally {
- deleteFile("/P/p/Y.js");
- }
- }
-
/**
* Ensure the source for a field contains the modifiers, field type, name,
* and terminator, and unicode characters.
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavaSearchBugsTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavaSearchBugsTests.java
index 33e7db8..deca71d 100644
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavaSearchBugsTests.java
+++ b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavaSearchBugsTests.java
@@ -2547,22 +2547,6 @@
}
/**
- * Bug 87627: [search] correct results are missing in java search
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=87627"
- */
-public void testBug87627() throws CoreException {
- IType type = getClassFile("JavaSearchBugs", "lib/b87627.jar", "b87627", "List.class").getType();
- ITypeParameter[] parameters = type.getTypeParameters();
- assertNotNull(type.getFullyQualifiedName()+" should have parameters", parameters);
- assertEquals("Wrong number of parameters", 1, parameters.length);
- search(parameters[0], REFERENCES);
- assertSearchResults(
- "lib/b87627.jar b87627.List EXACT_MATCH\n" +
- "lib/b87627.jar boolean b87627.List.addAll(b87627.Collection<? extends E>) EXACT_MATCH"
- );
-}
-
-/**
* Bug 88300: [search] Reference search result is changed by placement of private method
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=88300"
*/
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/MementoTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/MementoTests.java
index c675ff6..8ae6dde 100644
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/MementoTests.java
+++ b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/MementoTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -689,13 +689,4 @@
"=P/src<p{X.java[X",
type);
}
-/*
- * Tests that a type parameter can be persisted and restored using its memento.
- */
-public void testTypeParameter1() {
- ITypeParameter typeParameter = getCompilationUnit("/P/src/p/X.js").getType("X").getTypeParameter("T");
- assertMemento(
- "=P/src<p{X.java[X]T",
- typeParameter);
-}
}