IndexerTest fail fix
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/nd/indexer/IndexerTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/nd/indexer/IndexerTest.java
index a5a181d..0f8398b 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/nd/indexer/IndexerTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/nd/indexer/IndexerTest.java
@@ -26,6 +26,7 @@
import org.eclipse.jdt.core.IClassFile;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IOrdinaryClassFile;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.IParent;
import org.eclipse.jdt.core.tests.model.AbstractJavaModelTests;
@@ -199,8 +200,9 @@
collectAllClassFiles(result, next);
iterationMon.setWorkRemaining(result.size());
for (IClassFile nextClass : result) {
+ if (!(nextClass instanceof IOrdinaryClassFile)) continue;
SubMonitor classMon = iterationMon.split(1);
- BinaryTypeDescriptor descriptor = BinaryTypeFactory.createDescriptor(nextClass);
+ BinaryTypeDescriptor descriptor = BinaryTypeFactory.createDescriptor((IOrdinaryClassFile) nextClass);
IndexBinaryType indexedBinaryType = (IndexBinaryType)BinaryTypeFactory.readFromIndex(localIndex, descriptor, classMon);
ClassFileReader originalBinaryType = BinaryTypeFactory.rawReadType(descriptor, true);
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java
index 8271dbc..2760a2c 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java
@@ -22,6 +22,7 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.jdt.core.IBuffer;
+import org.eclipse.jdt.core.IClassFile;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.IOpenable;
@@ -1524,26 +1525,29 @@
typeDeclaration = new ASTNodeFinder(parsedUnit).findType(context);
}
} else { // binary type
- ClassFile classFile = (ClassFile) context.getClassFile();
- BinaryTypeDescriptor descriptor = BinaryTypeFactory.createDescriptor(classFile);
- ClassFileReader reader = null;
- try {
- reader = BinaryTypeFactory.rawReadType(descriptor, false/*don't fully initialize so as to keep constant pool (used below)*/);
- } catch (ClassFormatException e) {
- if (JavaCore.getPlugin().isDebugging()) {
- e.printStackTrace(System.err);
+ IClassFile iClassFile = context.getClassFile();
+ if (iClassFile instanceof ClassFile) {
+ ClassFile classFile = (ClassFile) iClassFile;
+ BinaryTypeDescriptor descriptor = BinaryTypeFactory.createDescriptor(classFile);
+ ClassFileReader reader = null;
+ try {
+ reader = BinaryTypeFactory.rawReadType(descriptor, false/*don't fully initialize so as to keep constant pool (used below)*/);
+ } catch (ClassFormatException e) {
+ if (JavaCore.getPlugin().isDebugging()) {
+ e.printStackTrace(System.err);
+ }
}
+ if (reader == null) {
+ throw classFile.newNotPresentException();
+ }
+ CompilationResult result = new CompilationResult(reader.getFileName(), 1, 1, this.compilerOptions.maxProblemsPerUnit);
+ parsedUnit = new CompilationUnitDeclaration(this.parser.problemReporter(), result, 0);
+ HashSetOfCharArrayArray typeNames = new HashSetOfCharArrayArray();
+
+ BinaryTypeConverter converter = new BinaryTypeConverter(this.parser.problemReporter(), result, typeNames);
+ typeDeclaration = converter.buildTypeDeclaration(context, parsedUnit);
+ parsedUnit.imports = converter.buildImports(reader);
}
- if (reader == null) {
- throw classFile.newNotPresentException();
- }
- CompilationResult result = new CompilationResult(reader.getFileName(), 1, 1, this.compilerOptions.maxProblemsPerUnit);
- parsedUnit = new CompilationUnitDeclaration(this.parser.problemReporter(), result, 0);
- HashSetOfCharArrayArray typeNames = new HashSetOfCharArrayArray();
-
- BinaryTypeConverter converter = new BinaryTypeConverter(this.parser.problemReporter(), result, typeNames);
- typeDeclaration = converter.buildTypeDeclaration(context, parsedUnit);
- parsedUnit.imports = converter.buildImports(reader);
}
if (typeDeclaration != null) {
diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/indexer/Indexer.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/indexer/Indexer.java
index 80918fb..953f14d 100644
--- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/indexer/Indexer.java
+++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/indexer/Indexer.java
@@ -51,11 +51,11 @@
import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
import org.eclipse.core.runtime.preferences.InstanceScope;
-import org.eclipse.jdt.core.IClassFile;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaElementDelta;
import org.eclipse.jdt.core.IJavaModelStatusConstants;
import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IOrdinaryClassFile;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
@@ -810,8 +810,8 @@
Package.logInfo("The path " + element.getPath() + " contained no class files"); //$NON-NLS-1$ //$NON-NLS-2$
}
return classesIndexed;
- } else if (element instanceof IClassFile) {
- IClassFile classFile = (IClassFile)element;
+ } else if (element instanceof IOrdinaryClassFile) {
+ IOrdinaryClassFile classFile = (IOrdinaryClassFile) element;
SubMonitor iterationMonitor = subMonitor.split(1);
BinaryTypeDescriptor descriptor = BinaryTypeFactory.createDescriptor(classFile);