Skip to content
This repository was archived by the owner on Apr 21, 2023. It is now read-only.

Commit

Permalink
get rid of reflective code. eclipse/xtext-core#506
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Dietrich <[email protected]>
  • Loading branch information
cdietrich committed Nov 23, 2017
1 parent 901a6d9 commit fec1f24
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*******************************************************************************/
package org.eclipse.xtext.common.types.xtext.ui;

import java.lang.reflect.Method;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
Expand All @@ -24,7 +23,6 @@
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.WorkingCopyOwner;
import org.eclipse.jdt.core.compiler.IProblem;
import org.eclipse.jdt.core.search.IJavaSearchConstants;
import org.eclipse.jdt.core.search.IJavaSearchScope;
Expand Down Expand Up @@ -243,13 +241,9 @@ protected IJavaSearchScope createSearchScope(IJavaProject project, JvmType super
return new IntersectingJavaSearchScope(); // empty intersection
}
try {
// Method is available in JDT 3.6 or better
// more than twice as fast as the older alternative
Method method = SearchEngine.class.getMethod("createStrictHierarchyScope", IJavaProject.class, IType.class, Boolean.TYPE, Boolean.TYPE, WorkingCopyOwner.class);
method.setAccessible(true);
IJavaSearchScope result = (IJavaSearchScope) method.invoke(null, project, type, Boolean.TRUE, Boolean.TRUE, null);
IJavaSearchScope result = SearchEngine.createStrictHierarchyScope(project, type, Boolean.TRUE, Boolean.TRUE, null);
return result;
} catch (Exception e) {
} catch (JavaModelException e) {
final Collection<JvmType> superTypes = superTypeCollector.collect(superType);
for(JvmType collectedSuperType: superTypes) {
superTypeNames.add(collectedSuperType.getIdentifier());
Expand Down

0 comments on commit fec1f24

Please sign in to comment.