Lines 16-21
Link Here
|
16 |
import org.eclipse.core.runtime.CoreException; |
16 |
import org.eclipse.core.runtime.CoreException; |
17 |
import org.eclipse.core.runtime.IProgressMonitor; |
17 |
import org.eclipse.core.runtime.IProgressMonitor; |
18 |
import org.eclipse.core.runtime.NullProgressMonitor; |
18 |
import org.eclipse.core.runtime.NullProgressMonitor; |
|
|
19 |
import org.eclipse.core.runtime.Platform; |
20 |
import org.eclipse.core.runtime.content.IContentType; |
19 |
import org.eclipse.jdt.core.IClasspathEntry; |
21 |
import org.eclipse.jdt.core.IClasspathEntry; |
20 |
import org.eclipse.jdt.core.ICompilationUnit; |
22 |
import org.eclipse.jdt.core.ICompilationUnit; |
21 |
import org.eclipse.jdt.core.IJavaProject; |
23 |
import org.eclipse.jdt.core.IJavaProject; |
Lines 1244-1247
Link Here
|
1244 |
deleteProject("P"); |
1246 |
deleteProject("P"); |
1245 |
} |
1247 |
} |
1246 |
} |
1248 |
} |
|
|
1249 |
|
1250 |
/** |
1251 |
* @bug 302455: java.lang.ClassCastException in secondary types removal |
1252 |
* @test Ensure that no invalid entries are put in the secondary types caches |
1253 |
* when a file extension spec is removed from the workspace as the CCE |
1254 |
* does no longer occur... |
1255 |
* Also verify that secondary types from the removed file extension are not |
1256 |
* kept in the projects caches as the secondary type is no longer in the |
1257 |
* cache at the end of the test... |
1258 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=302455" |
1259 |
*/ |
1260 |
public void testBug302455() throws CoreException, InterruptedException { |
1261 |
IContentType javaContentType = Platform.getContentTypeManager().getContentType(JavaCore.JAVA_SOURCE_CONTENT_TYPE); |
1262 |
try { |
1263 |
// Create project and file |
1264 |
assertNotNull("We should have got a Java Source content type!", javaContentType); |
1265 |
javaContentType.addFileSpec("b302455", IContentType.FILE_EXTENSION_SPEC); |
1266 |
IJavaProject javaProject = createJavaProject("P"); |
1267 |
createFolder("/P/p"); |
1268 |
String filePath = "/P/p/Bug.b302455"; |
1269 |
createFile( |
1270 |
filePath, |
1271 |
"package p;\n" + |
1272 |
"public class Bug {}\n" + |
1273 |
"class Secondary {}\n" + |
1274 |
"" |
1275 |
); |
1276 |
waitUntilIndexesReady(); |
1277 |
|
1278 |
// Get the secondary type |
1279 |
IType type = javaProject.findType("p.Secondary", new NullProgressMonitor()); |
1280 |
assertNotNull("We should have found the secondary type!", type); |
1281 |
|
1282 |
// Remove file extension |
1283 |
org.eclipse.jdt.internal.core.JavaModelManager.VERBOSE = true; |
1284 |
javaContentType.removeFileSpec("b302455", IContentType.FILE_EXTENSION_SPEC); |
1285 |
|
1286 |
// As there's no specific event fo |
1287 |
type = javaProject.findType("p.Secondary", new NullProgressMonitor()); |
1288 |
assertNull("We should have not found the secondary type!", type); |
1289 |
} finally { |
1290 |
deleteProject("P"); |
1291 |
} |
1292 |
} |
1247 |
} |
1293 |
} |