com.intellij.lang.jvm.JvmModifier Java Examples
The following examples show how to use
com.intellij.lang.jvm.JvmModifier.
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: AuxMethodInvalidSignatureDetector.java From aircon with MIT License | 5 votes |
@Override protected void visitAuxMethod(final UMethod node) { final JvmModifier visibilityModifier = ElementUtils.getVisibilityModifier(node); final boolean staticMethod = ElementUtils.isStatic(node); if (visibilityModifier.equals(JvmModifier.PRIVATE) || !staticMethod) { report(node, getFix(node, staticMethod)); } }
Example #2
Source File: AuxMethodInvalidSignatureDetector.java From aircon with MIT License | 5 votes |
private LintFix getFix(final UMethod node, final boolean staticMethod) { final LintFix.GroupBuilder builder = LintFix.create() .group(); builder.add(getFix(node, staticMethod, JvmModifier.PACKAGE_LOCAL)); builder.add(getFix(node, staticMethod, JvmModifier.PUBLIC)); return builder.build(); }
Example #3
Source File: AuxMethodInvalidSignatureDetector.java From aircon with MIT License | 5 votes |
private LintFix getFix(final UMethod node, final boolean staticMethod, JvmModifier visibilityModifier) { final MethodFixBuilder methodFixBuilder = new MethodFixBuilder(mContext, node, "Change to " + getModifierName(visibilityModifier) + " static method").setVisibility(visibilityModifier); if (!staticMethod) { methodFixBuilder.addModifier(JvmModifier.STATIC); } return methodFixBuilder.build(); }
Example #4
Source File: ElementUtils.java From aircon with MIT License | 5 votes |
public static JvmModifier getVisibilityModifier(UMethod method) { for (JvmModifier jvmModifier : method.getModifiers()) { switch (jvmModifier) { case PUBLIC: case PACKAGE_LOCAL: case PROTECTED: case PRIVATE: return jvmModifier; } } return method.getContainingClass() .isInterface() ? JvmModifier.PUBLIC : JvmModifier.PACKAGE_LOCAL; }
Example #5
Source File: BuckTestDetector.java From buck with Apache License 2.0 | 5 votes |
private static boolean isJUnit3TestCaseClass(PsiClass psiClass) { if (psiClass.hasModifier(JvmModifier.PUBLIC) && !psiClass.hasModifier(JvmModifier.ABSTRACT)) { PsiClass superClass = psiClass.getSuperClass(); while (superClass != null) { if ("junit.framework.TestCase".equals(superClass.getQualifiedName())) { return true; } superClass = superClass.getSuperClass(); } } return false; }
Example #6
Source File: BuckTestDetector.java From buck with Apache License 2.0 | 5 votes |
private static boolean isJUnit3TestMethod(PsiMethod psiMethod) { return psiMethod.hasModifier(JvmModifier.PUBLIC) && !psiMethod.hasModifier(JvmModifier.STATIC) && !psiMethod.hasModifier(JvmModifier.ABSTRACT) && PsiType.VOID.equals(psiMethod.getReturnType()) && psiMethod.getName().startsWith("test") && psiMethod.getParameterList().isEmpty(); }
Example #7
Source File: AuxMethodInvalidSignatureDetector.java From aircon with MIT License | 4 votes |
private String getModifierName(final JvmModifier visibility) { return visibility == JvmModifier.PACKAGE_LOCAL ? "package-local" : visibility.name() .toLowerCase(); }
Example #8
Source File: ElementUtils.java From aircon with MIT License | 4 votes |
public static boolean isStatic(UMethod element) { return element.hasModifier(JvmModifier.STATIC); }
Example #9
Source File: MethodFixBuilder.java From aircon with MIT License | 4 votes |
public MethodFixBuilder setVisibility(JvmModifier visibility) { final JvmModifier visibilityModifier = ElementUtils.getVisibilityModifier(mTarget); replacePattern(String.format(".*(%s).*", getModifierName(visibilityModifier)), getModifierName(visibility)); return this; }
Example #10
Source File: MethodFixBuilder.java From aircon with MIT License | 4 votes |
public MethodFixBuilder addModifier(JvmModifier modifier) { final String currentReturnType = mTarget.getReturnType() .getPresentableText(); replacePattern(String.format(".*()%s " + METHOD_NAME_REGEX, currentReturnType), getModifierName(modifier) + " "); return this; }
Example #11
Source File: MethodFixBuilder.java From aircon with MIT License | 4 votes |
private String getModifierName(final JvmModifier visibility) { return visibility == JvmModifier.PACKAGE_LOCAL ? "" : visibility.name() .toLowerCase(); }
Example #12
Source File: BuckTestDetector.java From buck with Apache License 2.0 | 4 votes |
private static boolean isPotentialJUnit4TestClass(PsiClass psiClass) { return psiClass.hasModifier(JvmModifier.PUBLIC) && !psiClass.hasModifier(JvmModifier.ABSTRACT); }
Example #13
Source File: BuckTestDetector.java From buck with Apache License 2.0 | 4 votes |
private static boolean isPotentialTestNGTestClass(PsiClass psiClass) { return psiClass.hasModifier(JvmModifier.PUBLIC) && !psiClass.hasModifier(JvmModifier.ABSTRACT); }
Example #14
Source File: BuckTestDetector.java From buck with Apache License 2.0 | 4 votes |
private static boolean isJUnit4TestMethod(PsiMethod psiMethod) { return hasAnnotation(psiMethod, "org.junit.Test") && !psiMethod.hasModifier(JvmModifier.ABSTRACT); }
Example #15
Source File: BuckTestDetector.java From buck with Apache License 2.0 | 4 votes |
private static boolean isTestNGTestMethod(PsiMethod psiMethod) { return hasAnnotation(psiMethod, "org.testng.annotations.Test") && !psiMethod.hasModifier(JvmModifier.ABSTRACT); }