Java Code Examples for org.eclipse.jdt.core.IType#isInterface()

The following examples show how to use org.eclipse.jdt.core.IType#isInterface() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JavaModelUtil.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public static IType[] getAllSuperTypes(IType type, IProgressMonitor pm) throws JavaModelException {
	try {
		// workaround for 23656
		IType[] superTypes= SuperTypeHierarchyCache.getTypeHierarchy(type).getAllSupertypes(type);
		if (type.isInterface()) {
			IType objekt= type.getJavaProject().findType("java.lang.Object");//$NON-NLS-1$
			if (objekt != null) {
				IType[] superInterfacesAndObject= new IType[superTypes.length + 1];
				System.arraycopy(superTypes, 0, superInterfacesAndObject, 0, superTypes.length);
				superInterfacesAndObject[superTypes.length]= objekt;
				return superInterfacesAndObject;
			}
		}
		return superTypes;
	} finally {
		if (pm != null)
			pm.done();
	}
}
 
Example 2
Source File: AddUnimplementedConstructorsAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void run(IStructuredSelection selection) {
	Shell shell= getShell();
	try {
		IType type= getSelectedType(selection);
		if (type == null) {
			MessageDialog.openInformation(getShell(), getDialogTitle(), ActionMessages.AddUnimplementedConstructorsAction_not_applicable);
			return;
		}
		if (type.isAnnotation()) {
			MessageDialog.openInformation(getShell(), getDialogTitle(), ActionMessages.AddUnimplementedConstructorsAction_annotation_not_applicable);
			return;
		} else if (type.isInterface()) {
			MessageDialog.openInformation(getShell(), getDialogTitle(), ActionMessages.AddUnimplementedConstructorsAction_interface_not_applicable);
			return;
		} else if (type.isEnum()) {
			MessageDialog.openInformation(getShell(), getDialogTitle(), ActionMessages.AddUnimplementedConstructorsAction_enum_not_applicable);
			return;
		}
		run(shell, type, false);
	} catch (CoreException e) {
		ExceptionHandler.handle(e, shell, getDialogTitle(), null);
	}
}
 
Example 3
Source File: AddDelegateMethodsAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private IField[] getSelectedFields(IStructuredSelection selection) {
	List<?> elements= selection.toList();
	if (elements.size() > 0) {
		IField[] result= new IField[elements.size()];
		ICompilationUnit unit= null;
		for (int index= 0; index < elements.size(); index++) {
			if (elements.get(index) instanceof IField) {
				IField field= (IField) elements.get(index);

				if (index == 0) {
					// remember the CU of the first element
					unit= field.getCompilationUnit();
					if (unit == null) {
						return null;
					}
				} else if (!unit.equals(field.getCompilationUnit())) {
					// all fields must be in the same CU
					return null;
				}
				try {
					final IType type= field.getDeclaringType();
					if (type.isInterface() || type.isAnonymous()) {
						return null;
					}
				} catch (JavaModelException exception) {
					JavaPlugin.log(exception);
					return null;
				}

				result[index]= field;
			} else {
				return null;
			}
		}
		return result;
	}
	return null;
}
 
Example 4
Source File: PullUpRefactoringProcessor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected boolean canBeAccessedFrom(final IMember member, final IType target, final ITypeHierarchy hierarchy) throws JavaModelException {
	if (super.canBeAccessedFrom(member, target, hierarchy)) {
		if (target.isInterface())
			return true;
		if (target.equals(member.getDeclaringType()))
			return true;
		if (target.equals(member))
			return true;
		if (member instanceof IMethod) {
			final IMethod method= (IMethod) member;
			final IMethod stub= target.getMethod(method.getElementName(), method.getParameterTypes());
			if (stub.exists())
				return true;
		}
		if (member.getDeclaringType() == null) {
			if (!(member instanceof IType))
				return false;
			if (JdtFlags.isPublic(member))
				return true;
			if (!JdtFlags.isPackageVisible(member))
				return false;
			if (JavaModelUtil.isSamePackage(((IType) member).getPackageFragment(), target.getPackageFragment()))
				return true;
			final IType type= member.getDeclaringType();
			if (type != null)
				return hierarchy.contains(type);
			return false;
		}
		final IType declaringType= member.getDeclaringType();
		if (!canBeAccessedFrom(declaringType, target, hierarchy))
			return false;
		if (declaringType.equals(getDeclaringType()))
			return false;
		return true;
	}
	return false;
}
 
Example 5
Source File: GenerateNewConstructorUsingFieldsAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private IField[] getSelectedFields(IStructuredSelection selection) {
	List<?> elements= selection.toList();
	if (elements.size() > 0) {
		IField[] fields= new IField[elements.size()];
		ICompilationUnit unit= null;
		for (int index= 0; index < elements.size(); index++) {
			if (elements.get(index) instanceof IField) {
				IField field= (IField) elements.get(index);
				if (index == 0) {
					// remember the CU of the first element
					unit= field.getCompilationUnit();
					if (unit == null) {
						return null;
					}
				} else if (!unit.equals(field.getCompilationUnit())) {
					// all fields must be in the same CU
					return null;
				}
				try {
					final IType declaringType= field.getDeclaringType();
					if (declaringType.isInterface() || declaringType.isAnnotation() || declaringType.isAnonymous())
						return null;
				} catch (JavaModelException exception) {
					JavaPlugin.log(exception);
					return null;
				}
				fields[index]= field;
			} else {
				return null;
			}
		}
		return fields;
	}
	return null;
}
 
Example 6
Source File: MemberVisibilityAdjustor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Adjusts the visibility of the specified member.
 *
 * @param element the "source" point from which to calculate the visibility
 * @param referencedMovedElement the moved element which may be adjusted in visibility
 * @param monitor the progress monitor to use
 * @throws JavaModelException if the visibility adjustment could not be computed
 */
private void adjustIncomingVisibility(final IJavaElement element, IMember referencedMovedElement, final IProgressMonitor monitor) throws JavaModelException {
	final ModifierKeyword threshold= getVisibilityThreshold(element, referencedMovedElement, monitor);
	int flags= referencedMovedElement.getFlags();
	IType declaring= referencedMovedElement.getDeclaringType();
	if (declaring != null && declaring.isInterface() || referencedMovedElement instanceof IField && Flags.isEnum(referencedMovedElement.getFlags()))
		return;
	if (hasLowerVisibility(flags, threshold == null ? Modifier.NONE : threshold.toFlagValue()) && needsVisibilityAdjustment(referencedMovedElement, threshold))
		fAdjustments.put(referencedMovedElement, new IncomingMemberVisibilityAdjustment(referencedMovedElement, threshold, RefactoringStatus.createStatus(fVisibilitySeverity, Messages.format(getMessage(referencedMovedElement), new String[] { getLabel(referencedMovedElement), getLabel(threshold)}), JavaStatusContext.create(referencedMovedElement), null, RefactoringStatusEntry.NO_CODE, null)));
}
 
Example 7
Source File: ClassFilter.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public boolean select(Viewer viewer, Object parent, Object element) {
	if (element instanceof IType) {
		try {
			final IType type= (IType)element;
			return type.isInterface() || type.isEnum();
		} catch (JavaModelException ex) {
			return true;
		}
	}
	return true;
}
 
Example 8
Source File: AddDelegateMethodsAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private boolean canEnable(IStructuredSelection selection) throws JavaModelException {
	if (getSelectedFields(selection) != null)
		return true;

	if ((selection.size() == 1) && (selection.getFirstElement() instanceof IType)) {
		IType type= (IType) selection.getFirstElement();
		return type.getCompilationUnit() != null && !type.isInterface() && !type.isAnonymous();
	}

	if ((selection.size() == 1) && (selection.getFirstElement() instanceof ICompilationUnit))
		return true;

	return false;
}
 
Example 9
Source File: GenerateGetterSetterOperation.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
public static boolean supportsGetterSetter(IType type) throws JavaModelException {
	if (type == null || type.isAnnotation() || type.isInterface() || type.getCompilationUnit() == null) {
		return false;
	}

	return true;
}
 
Example 10
Source File: GenerateMethodAbstractAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
void checkAndRun(IType type) throws CoreException {
	if (type == null) {
		MessageDialog.openInformation(getShell(), getErrorCaption(),
				ActionMessages.GenerateMethodAbstractAction_error_not_applicable);
		notifyResult(false);
	}
	if (!ElementValidator.check(type, getShell(), getErrorCaption(), false)
			|| ! ActionUtil.isEditable(fEditor, getShell(), type)) {
		notifyResult(false);
		return;
	}
	if (type == null) {
		MessageDialog.openError(getShell(), getErrorCaption(), ActionMessages.GenerateMethodAbstractAction_error_removed_type);
		notifyResult(false);
		return;
	}
	if (type.isAnnotation()) {
		MessageDialog.openInformation(getShell(), getErrorCaption(), ActionMessages.GenerateMethodAbstractAction_annotation_not_applicable);
		notifyResult(false);
		return;
	}
	if (type.isInterface()) {
		MessageDialog.openInformation(getShell(), getErrorCaption(), ActionMessages.GenerateMethodAbstractAction_interface_not_applicable);
		notifyResult(false);
		return;
	}
	if (type.isEnum()) {
		MessageDialog.openInformation(getShell(), getErrorCaption(), ActionMessages.GenerateMethodAbstractAction_enum_not_applicable);
		notifyResult(false);
		return;
	}
	if (type.isAnonymous()) {
		MessageDialog.openError(getShell(), getErrorCaption(), ActionMessages.GenerateMethodAbstractAction_anonymous_type_not_applicable);
		notifyResult(false);
		return;
	}
	run(getShell(), type);
}
 
Example 11
Source File: OverrideMethodsAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private boolean canEnable(IStructuredSelection selection) throws JavaModelException {
	if ((selection.size() == 1) && (selection.getFirstElement() instanceof IType)) {
		final IType type= (IType) selection.getFirstElement();
		return type.getCompilationUnit() != null && !type.isInterface();
	}
	if ((selection.size() == 1) && (selection.getFirstElement() instanceof ICompilationUnit))
		return true;
	return false;
}
 
Example 12
Source File: JavadocContentAccess2.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Visits the super types of the given <code>currentType</code>.
 *
 * @param currentType
 *            the starting type
 * @param typeHierarchy
 *            a super type hierarchy that contains <code>currentType</code>
 * @return the result from a call to {@link #visit(IType)}, or <code>null</code>
 *         if none of the calls returned a result
 * @throws JavaModelException
 *             unexpected problem
 */
public Object visitInheritDoc(IType currentType, ITypeHierarchy typeHierarchy) throws JavaModelException {
	ArrayList<IType> visited = new ArrayList<>();
	visited.add(currentType);
	Object result = visitInheritDocInterfaces(visited, currentType, typeHierarchy);
	if (result != InheritDocVisitor.CONTINUE) {
		return result;
	}

	IType superClass;
	if (currentType.isInterface()) {
		superClass = currentType.getJavaProject().findType("java.lang.Object"); //$NON-NLS-1$
	} else {
		superClass = typeHierarchy.getSuperclass(currentType);
	}

	while (superClass != null && !visited.contains(superClass)) {
		result = visit(superClass);
		if (result == InheritDocVisitor.STOP_BRANCH) {
			return null;
		} else if (result == InheritDocVisitor.CONTINUE) {
			visited.add(superClass);
			result = visitInheritDocInterfaces(visited, superClass, typeHierarchy);
			if (result != InheritDocVisitor.CONTINUE) {
				return result;
			} else {
				superClass = typeHierarchy.getSuperclass(superClass);
			}
		} else {
			return result;
		}
	}

	return null;
}
 
Example 13
Source File: MethodChecks.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Locates the topmost method of an override ripple and returns it. If none
 * is found, null is returned.
 *
 * @param method the IMethod which may be part of a ripple
 * @param typeHierarchy a ITypeHierarchy of the declaring type of the method. May be null
 * @param monitor an IProgressMonitor
 * @return the topmost method of the ripple, or null if none
 * @throws JavaModelException
 */
public static IMethod getTopmostMethod(IMethod method, ITypeHierarchy typeHierarchy, IProgressMonitor monitor) throws JavaModelException {

	Assert.isNotNull(method);

	ITypeHierarchy hierarchy= typeHierarchy;
	IMethod topmostMethod= null;
	final IType declaringType= method.getDeclaringType();
	if (!declaringType.isInterface()) {
		if ((hierarchy == null) || !declaringType.equals(hierarchy.getType())) {
			hierarchy= declaringType.newTypeHierarchy(monitor);
		}

		IMethod inInterface= isDeclaredInInterface(method, hierarchy, monitor);
		if (inInterface != null && !inInterface.equals(method)) {
			topmostMethod= inInterface;
		}
	}
	if (topmostMethod == null) {
		if (hierarchy == null) {
			hierarchy= declaringType.newSupertypeHierarchy(monitor);
		}
		IMethod overrides= overridesAnotherMethod(method, hierarchy);
		if (overrides != null && !overrides.equals(method)) {
			topmostMethod= overrides;
		}
	}
	return topmostMethod;
}
 
Example 14
Source File: MethodDeclarationCompletionProposal.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public static void evaluateProposals(IType type, String prefix, int offset, int length, int relevance, Set<String> suggestedMethods, Collection<IJavaCompletionProposal> result) throws CoreException {
	IMethod[] methods= type.getMethods();
	if (!type.isInterface()) {
		String constructorName= type.getElementName();
		if (constructorName.length() > 0 && constructorName.startsWith(prefix) && !hasMethod(methods, constructorName) && suggestedMethods.add(constructorName)) {
			result.add(new MethodDeclarationCompletionProposal(type, constructorName, null, offset, length, relevance + 500));
		}
	}

	if (prefix.length() > 0 && !"main".equals(prefix) && !hasMethod(methods, prefix) && suggestedMethods.add(prefix)) { //$NON-NLS-1$
		if (!JavaConventionsUtil.validateMethodName(prefix, type).matches(IStatus.ERROR))
			result.add(new MethodDeclarationCompletionProposal(type, prefix, Signature.SIG_VOID, offset, length, relevance));
	}
}
 
Example 15
Source File: SourceAssistProcessor.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
private Optional<Either<Command, CodeAction>> getGenerateConstructorsAction(CodeActionParams params, IInvocationContext context, IType type, String kind) {
	try {
		if (type == null || type.isAnnotation() || type.isInterface() || type.isAnonymous() || type.getCompilationUnit() == null) {
			return Optional.empty();
		}
	} catch (JavaModelException e) {
		return Optional.empty();
	}

	if (preferenceManager.getClientPreferences().isGenerateConstructorsPromptSupported()) {
		CheckConstructorsResponse status = GenerateConstructorsHandler.checkConstructorStatus(type);
		if (status.constructors.length == 0) {
			return Optional.empty();
		}
		if (status.constructors.length == 1 && status.fields.length == 0) {
			TextEdit edit = GenerateConstructorsHandler.generateConstructors(type, status.constructors, status.fields);
			return convertToWorkspaceEditAction(params.getContext(), type.getCompilationUnit(), ActionMessages.GenerateConstructorsAction_label, kind, edit);
		}

		Command command = new Command(ActionMessages.GenerateConstructorsAction_ellipsisLabel, COMMAND_ID_ACTION_GENERATECONSTRUCTORSPROMPT, Collections.singletonList(params));
		if (preferenceManager.getClientPreferences().isSupportedCodeActionKind(JavaCodeActionKind.SOURCE_GENERATE_CONSTRUCTORS)) {
			CodeAction codeAction = new CodeAction(ActionMessages.GenerateConstructorsAction_ellipsisLabel);
			codeAction.setKind(kind);
			codeAction.setCommand(command);
			codeAction.setDiagnostics(Collections.emptyList());
			return Optional.of(Either.forRight(codeAction));
		} else {
			return Optional.of(Either.forLeft(command));
		}
	}

	return Optional.empty();
}
 
Example 16
Source File: PullUpMemberPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private boolean isDestinationInterface() {
	IType destination= getDestinationType();
	try {
		if (destination != null && destination.isInterface()) {
			return true;
		}
	} catch (JavaModelException exception) {
	    JavaPlugin.log(exception);
	}
	return false;
}
 
Example 17
Source File: ImplementationCollector.java    From eclipse.jdt.ls with Eclipse Public License 2.0 4 votes vote down vote up
private List<T> findMethodImplementations(IProgressMonitor monitor) throws CoreException {
	IMethod method = (IMethod) javaElement;
	try {
		if (cannotBeOverriddenMethod(method)) {
			return null;
		}
	} catch (JavaModelException e) {
		JavaLanguageServerPlugin.logException("Find method implementations failure ", e);
		return null;
	}

	CompilationUnit ast = CoreASTProvider.getInstance().getAST(typeRoot, CoreASTProvider.WAIT_YES, monitor);
	if (ast == null) {
		return null;
	}

	ASTNode node = NodeFinder.perform(ast, region.getOffset(), region.getLength());
	ITypeBinding parentTypeBinding = null;
	if (node instanceof SimpleName) {
		ASTNode parent = node.getParent();
		if (parent instanceof MethodInvocation) {
			Expression expression = ((MethodInvocation) parent).getExpression();
			if (expression == null) {
				parentTypeBinding= Bindings.getBindingOfParentType(node);
			} else {
				parentTypeBinding = expression.resolveTypeBinding();
			}
		} else if (parent instanceof SuperMethodInvocation) {
			// Directly go to the super method definition
			return Collections.singletonList(mapper.convert(method, 0, 0));
		} else if (parent instanceof MethodDeclaration) {
			parentTypeBinding = Bindings.getBindingOfParentType(node);
		}
	}
	final IType receiverType = getType(parentTypeBinding);
	if (receiverType == null) {
		return null;
	}

	final List<T> results = new ArrayList<>();
	try {
		String methodLabel = JavaElementLabelsCore.getElementLabel(method, JavaElementLabelsCore.DEFAULT_QUALIFIED);
		monitor.beginTask(Messages.format(JavaElementImplementationHyperlink_search_method_implementors, methodLabel), 10);
		SearchRequestor requestor = new SearchRequestor() {
			@Override
			public void acceptSearchMatch(SearchMatch match) throws CoreException {
				if (match.getAccuracy() == SearchMatch.A_ACCURATE) {
					Object element = match.getElement();
					if (element instanceof IMethod) {
						IMethod methodFound = (IMethod) element;
						if (!JdtFlags.isAbstract(methodFound)) {
							T result = mapper.convert(methodFound, match.getOffset(), match.getLength());
							if (result != null) {
								results.add(result);
							}
						}
					}
				}
			}
		};

		IJavaSearchScope hierarchyScope;
		if (receiverType.isInterface()) {
			hierarchyScope = SearchEngine.createHierarchyScope(method.getDeclaringType());
		} else {
			if (isFullHierarchyNeeded(new SubProgressMonitor(monitor, 3), method, receiverType)) {
				hierarchyScope = SearchEngine.createHierarchyScope(receiverType);
			} else {
				boolean isMethodAbstract = JdtFlags.isAbstract(method);
				hierarchyScope = SearchEngine.createStrictHierarchyScope(null, receiverType, true, isMethodAbstract, null);
			}
		}

		int limitTo = IJavaSearchConstants.DECLARATIONS | IJavaSearchConstants.IGNORE_DECLARING_TYPE | IJavaSearchConstants.IGNORE_RETURN_TYPE;
		SearchPattern pattern = SearchPattern.createPattern(method, limitTo);
		Assert.isNotNull(pattern);
		SearchParticipant[] participants = new SearchParticipant[] { SearchEngine.getDefaultSearchParticipant() };
		SearchEngine engine = new SearchEngine();
		engine.search(pattern, participants, hierarchyScope, requestor, new SubProgressMonitor(monitor, 7));
		if (monitor.isCanceled()) {
			throw new OperationCanceledException();
		}
	} finally {
		monitor.done();
	}
	return results;
}
 
Example 18
Source File: CreateAsyncInterfaceProposal.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 4 votes vote down vote up
public static List<IJavaCompletionProposal> createProposals(IInvocationContext context, IProblemLocation problem)
    throws JavaModelException {
  String syncTypeName = problem.getProblemArguments()[0];
  IJavaProject javaProject = context.getCompilationUnit().getJavaProject();
  IType syncType = JavaModelSearch.findType(javaProject, syncTypeName);
  if (syncType == null || !syncType.isInterface()) {
    return Collections.emptyList();
  }

  CompilationUnit cu = context.getASTRoot();
  ASTNode coveredNode = problem.getCoveredNode(cu);
  TypeDeclaration syncTypeDecl = (TypeDeclaration) coveredNode.getParent();
  assert (cu.getAST().hasResolvedBindings());

  ITypeBinding syncTypeBinding = syncTypeDecl.resolveBinding();
  assert (syncTypeBinding != null);

  String asyncName = RemoteServiceUtilities.computeAsyncTypeName(problem.getProblemArguments()[0]);
  AST ast = context.getASTRoot().getAST();
  Name name = ast.newName(asyncName);

  /*
   * HACK: NewCUUsingWizardProposal wants a name that has a parent expression so we create an
   * assignment so that the name has a valid parent
   */
  ast.newAssignment().setLeftHandSide(name);

  IJavaElement typeContainer = syncType.getParent();
  if (typeContainer.getElementType() == IJavaElement.COMPILATION_UNIT) {
    typeContainer = syncType.getPackageFragment();
  }

  // Add a create async interface proposal
  CreateAsyncInterfaceProposal createAsyncInterfaceProposal = new CreateAsyncInterfaceProposal(
      context.getCompilationUnit(), name, K_INTERFACE, typeContainer, 2, syncTypeBinding);

  // Add the stock create interface proposal
  NewCompilationUnitUsingWizardProposal fallbackProposal = new NewCompilationUnitUsingWizardProposal(
      context.getCompilationUnit(), name, K_INTERFACE, context.getCompilationUnit().getParent(), 1);

  return Arrays.<IJavaCompletionProposal>asList(createAsyncInterfaceProposal, fallbackProposal);
}
 
Example 19
Source File: LazyGenericTypeProposal.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 3 votes vote down vote up
/**
 * Returns the super interface signatures of <code>subType</code> if
 * <code>superType</code> is an interface, otherwise returns the super
 * type signature.
 *
 * @param subType the sub type signature
 * @param superType the super type signature
 * @return the super type signatures of <code>subType</code>
 * @throws JavaModelException if any java model operation fails
 */
private String[] getSuperTypeSignatures(IType subType, IType superType) throws JavaModelException {
	if (superType.isInterface())
		return subType.getSuperInterfaceTypeSignatures();
	else
		return new String[] {subType.getSuperclassTypeSignature()};
}
 
Example 20
Source File: JavaModelUtil.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * @param type the type to test
 * @return <code>true</code> iff the type is an interface or an annotation
 * @throws JavaModelException thrown when the field can not be accessed
 */
public static boolean isInterfaceOrAnnotation(IType type) throws JavaModelException {
	return type.isInterface();
}