/** * Creates a new {@link ClassElement} object. * * @param clazz class information. * @return a new {@link ClassElement} object. */ public static ClassElement newClassElement(PsiClass clazz) { ClassElement ce = new ClassElement(); // name ce.setName(clazz.getName()); ce.setQualifiedName(clazz.getQualifiedName()); // super PsiClass superClass = clazz.getSuperClass(); if (superClass != null && !CommonClassNames.JAVA_LANG_OBJECT.equals(superClass.getQualifiedName())) { ce.setSuperName(superClass.getName()); } // interfaces ce.setImplementNames(PsiAdapter.getImplementsClassnames(clazz)); // other ce.setEnum(clazz.isEnum()); ce.setDeprecated(clazz.isDeprecated()); ce.setException(PsiAdapter.isExceptionClass(clazz)); ce.setAbstract(clazz.hasModifierProperty(PsiModifier.ABSTRACT)); ce.setTypeParams(clazz.getTypeParameters().length); return ce; }
public void testDeprecatedAnnotation() throws IOException { setupLoadingFilter(); final PsiClass aClass = myJavaFacade.findClass( "annotations.DeprecatedAnnotation", GlobalSearchScope.moduleScope(myModule)); assertNotNull(aClass); assertTrue(aClass.isDeprecated()); PsiMethod method = aClass.getMethods()[0]; assertTrue(method.isDeprecated()); PsiField field = aClass.getFields()[0]; assertTrue(field.isDeprecated()); teardownLoadingFilter(); }