本文整理汇总了Java中com.intellij.psi.util.PsiUtil.isLanguageLevel6OrHigher方法的典型用法代码示例。如果您正苦于以下问题:Java PsiUtil.isLanguageLevel6OrHigher方法的具体用法?Java PsiUtil.isLanguageLevel6OrHigher怎么用?Java PsiUtil.isLanguageLevel6OrHigher使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.psi.util.PsiUtil
的用法示例。
在下文中一共展示了PsiUtil.isLanguageLevel6OrHigher方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: leaveOverrideAnnotation
import com.intellij.psi.util.PsiUtil; //导入方法依赖的package包/类
private boolean leaveOverrideAnnotation(PsiSubstitutor substitutor, PsiMethod method) {
final PsiMethod methodBySignature = MethodSignatureUtil.findMethodBySignature(myClass, method.getSignature(substitutor), false);
if (methodBySignature == null) return false;
final PsiMethod[] superMethods = methodBySignature.findDeepestSuperMethods();
if (superMethods.length == 0) return false;
final boolean is15 = !PsiUtil.isLanguageLevel6OrHigher(methodBySignature);
if (is15) {
for (PsiMethod psiMethod : superMethods) {
final PsiClass aClass = psiMethod.getContainingClass();
if (aClass != null && aClass.isInterface()) {
return false;
}
}
}
return true;
}
示例2: implementMethodInClass
import com.intellij.psi.util.PsiUtil; //导入方法依赖的package包/类
private static void implementMethodInClass(@NotNull PsiMethod method,
@NotNull PsiClass aClass) {
final PsiMethod newMethod = (PsiMethod)aClass.add(method);
final PsiDocComment comment = newMethod.getDocComment();
if (comment != null) {
comment.delete();
}
final PsiModifierList modifierList = newMethod.getModifierList();
modifierList.setModifierProperty(PsiModifier.ABSTRACT, false);
final Project project = aClass.getProject();
final CodeStyleSettings codeStyleSettings =
CodeStyleSettingsManager.getSettings(project);
if (codeStyleSettings.INSERT_OVERRIDE_ANNOTATION &&
PsiUtil.isLanguageLevel6OrHigher(aClass)) {
modifierList.addAnnotation("java.lang.Override");
}
final PsiElementFactory factory =
JavaPsiFacade.getElementFactory(project);
final PsiCodeBlock codeBlock = factory.createCodeBlock();
newMethod.add(codeBlock);
}
示例3: visitMethod
import com.intellij.psi.util.PsiUtil; //导入方法依赖的package包/类
@Override
public void visitMethod(@NotNull PsiMethod method) {
if (method.getNameIdentifier() == null) {
return;
}
if (method.isConstructor()) {
return;
}
if (method.hasModifierProperty(PsiModifier.PRIVATE) ||
method.hasModifierProperty(PsiModifier.STATIC)) {
return;
}
final PsiClass methodClass = method.getContainingClass();
if (methodClass == null) {
return;
}
if (ignoreAnonymousClassMethods && methodClass instanceof PsiAnonymousClass) {
return;
}
if (hasOverrideAnnotation(method)) {
return;
}
final boolean useJdk6Rules = PsiUtil.isLanguageLevel6OrHigher(method);
if (useJdk6Rules) {
if (!isJdk6Override(method, methodClass)) {
return;
}
}
else if (!isJdk5Override(method, methodClass)) {
return;
}
if (ignoreObjectMethods && (MethodUtils.isHashCode(method) ||
MethodUtils.isEquals(method) ||
MethodUtils.isToString(method))) {
return;
}
registerMethodError(method);
}