本文整理汇总了Java中com.intellij.psi.PsiMethod.getNameIdentifier方法的典型用法代码示例。如果您正苦于以下问题:Java PsiMethod.getNameIdentifier方法的具体用法?Java PsiMethod.getNameIdentifier怎么用?Java PsiMethod.getNameIdentifier使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.psi.PsiMethod
的用法示例。
在下文中一共展示了PsiMethod.getNameIdentifier方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitMethod
import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
@Override
public void visitMethod(PsiMethod method) {
super.visitMethod(method);
if (!TestNGUtil.hasTest(method)) {
return;
}
final PsiIdentifier nameIdentifier = method.getNameIdentifier();
if (nameIdentifier == null) {
return;
}
final String name = method.getName();
if (isValid(name)) {
return;
}
if (!isOnTheFly() && MethodUtils.hasSuper(method)) {
return;
}
if (LibraryUtil.isOverrideOfLibraryMethod(method)) {
return;
}
registerMethodError(method, name);
}
示例2: visitMethod
import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
@Override
public void visitMethod(PsiMethod method) {
super.visitMethod(method);
if (!TestUtils.isJUnit4TestMethod(method) || !TestUtils.isRunnable(method)) {
return;
}
final PsiIdentifier nameIdentifier = method.getNameIdentifier();
if (nameIdentifier == null) {
return;
}
final String name = method.getName();
if (isValid(name)) {
return;
}
if (!isOnTheFly() && MethodUtils.hasSuper(method)) {
return;
}
if (LibraryUtil.isOverrideOfLibraryMethod(method)) {
return;
}
registerMethodError(method, name);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:JUnit4MethodNamingConventionInspectionBase.java
示例3: visitMethod
import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
@Override
public void visitMethod(PsiMethod method) {
super.visitMethod(method);
if (!TestUtils.isJUnit3TestMethod(method) || !TestUtils.isRunnable(method)) {
return;
}
final PsiIdentifier nameIdentifier = method.getNameIdentifier();
if (nameIdentifier == null) {
return;
}
final String name = method.getName();
if (isValid(name)) {
return;
}
if (!isOnTheFly() && MethodUtils.hasSuper(method)) {
return;
}
if (LibraryUtil.isOverrideOfLibraryMethod(method)) {
return;
}
registerMethodError(method, name);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:JUnit3MethodNamingConventionInspectionBase.java
示例4: visitMethod
import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
@Override
public void visitMethod(@NotNull PsiMethod method) {
super.visitMethod(method);
if (method.isConstructor()) {
return;
}
if (!method.hasModifierProperty(PsiModifier.NATIVE)) {
return;
}
final PsiIdentifier nameIdentifier = method.getNameIdentifier();
if (nameIdentifier == null) {
return;
}
final String name = method.getName();
if (isValid(name)) {
return;
}
if (!isOnTheFly() && MethodUtils.hasSuper(method)) {
return;
}
if (LibraryUtil.isOverrideOfLibraryMethod(method)) {
return;
}
registerMethodError(method, name);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:NativeMethodNamingConventionInspectionBase.java
示例5: visitMethod
import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
@Override
public void visitMethod(@NotNull PsiMethod method) {
//no call to super, so we don't drill into anonymous classes
if (method.isConstructor()) {
return;
}
if (method.hasModifierProperty(PsiModifier.SYNCHRONIZED)) {
return;
}
if (method.getNameIdentifier() == null) {
return;
}
final PsiMethod[] superMethods = method.findSuperMethods();
for (final PsiMethod superMethod : superMethods) {
if (superMethod.hasModifierProperty(PsiModifier.SYNCHRONIZED)) {
registerMethodError(method);
return;
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:NonSynchronizedMethodOverridesSynchronizedMethodVisitor.java
示例6: visitMethod
import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
@Override
public void visitMethod(@NotNull PsiMethod method) {
// note: no call to super
if (method.getNameIdentifier() == null) {
return;
}
if (!method.isConstructor()) {
return;
}
if (ignoreScope != Scope.NONE) {
switch (ignoreScope.ordinal()) {
case 3: if (method.hasModifierProperty(PsiModifier.PROTECTED)) return;
case 2: if (method.hasModifierProperty(PsiModifier.PACKAGE_LOCAL)) return;
case 1: if (method.hasModifierProperty(PsiModifier.PRIVATE)) return;
}
}
final PsiParameterList parameterList = method.getParameterList();
final int parametersCount = parameterList.getParametersCount();
if (parametersCount <= getLimit()) {
return;
}
registerMethodError(method, Integer.valueOf(parametersCount));
}
示例7: visitMethod
import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
@Override
public void visitMethod(@NotNull PsiMethod method) {
// note: no call to super
if (method.getNameIdentifier() == null) {
return;
}
if (method.isConstructor()) {
return;
}
final PsiParameterList parameterList = method.getParameterList();
final int parametersCount = parameterList.getParametersCount();
if (parametersCount <= getLimit()) {
return;
}
if (LibraryUtil.isOverrideOfLibraryMethod(method)) {
return;
}
registerMethodError(method, Integer.valueOf(parametersCount));
}
示例8: visitMethod
import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
@Override
public void visitMethod(@NotNull PsiMethod method) {
// note: no call to super
if (method.getNameIdentifier() == null) {
return;
}
if (ignoreEqualsMethod) {
if (MethodUtils.isEquals(method)) {
return;
}
}
final int returnPointCount = calculateReturnPointCount(method);
if (returnPointCount <= getLimit()) {
return;
}
registerMethodError(method, Integer.valueOf(returnPointCount));
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:MultipleReturnPointsPerMethodInspection.java
示例9: visitMethod
import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
@Override
public void visitMethod(@NotNull PsiMethod method) {
// note: no call to super
if (method.getNameIdentifier() == null) {
return;
}
final CouplingVisitor visitor = new CouplingVisitor(
method, m_includeJavaClasses, m_includeLibraryClasses);
method.accept(visitor);
final int coupling = visitor.getNumDependencies();
if (coupling <= getLimit()) {
return;
}
registerMethodError(method, Integer.valueOf(coupling));
}
示例10: visitMethod
import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
@Override
public void visitMethod(@NotNull PsiMethod method) {
// note: no call to super
if (method.getNameIdentifier() == null) {
return;
}
final NegationCountVisitor visitor = new NegationCountVisitor(ignoreInAssert);
method.accept(visitor);
final int negationCount = visitor.getCount();
if (negationCount <= 3) {
return;
}
if (m_ignoreInEquals && MethodUtils.isEquals(method)) {
return;
}
registerMethodError(method, Integer.valueOf(negationCount));
}
示例11: getMethodStartLineNumber
import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
private static int getMethodStartLineNumber(@NotNull PsiMethod method, @NotNull Document document) {
if (method.getNameIdentifier() == null)
return -1;
int offset = method.getNameIdentifier().getTextOffset();
return document.getLineNumber(offset);
}
示例12: visitMethod
import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
@Override
public void visitMethod(@NotNull PsiMethod method) {
// note: no call to super
if (method.getNameIdentifier() == null) {
return;
}
final NestingDepthVisitor visitor = new NestingDepthVisitor(getLimit());
method.accept(visitor);
final int count = visitor.getMaximumDepth();
if (count <= getLimit()) {
return;
}
registerMethodError(method, Integer.valueOf(count));
}
示例13: visitMethod
import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
@Override
public void visitMethod(@NotNull PsiMethod method) {
final PsiClass aClass = method.getContainingClass();
if (aClass == null) {
return;
}
if (method.getNameIdentifier() == null) {
return;
}
final String methodName = method.getName();
final MethodSignature signature = method.getSignature(PsiSubstitutor.EMPTY);
PsiClass ancestorClass = aClass.getSuperClass();
final Set<PsiClass> visitedClasses = new HashSet<PsiClass>();
while (ancestorClass != null) {
if (!visitedClasses.add(ancestorClass)) {
return;
}
final PsiMethod[] methods =
ancestorClass.findMethodsByName(methodName, false);
for (final PsiMethod testMethod : methods) {
final MethodSignature testSignature = testMethod.getSignature(PsiSubstitutor.EMPTY);
if (!signature.equals(testSignature)) {
continue;
}
if (testMethod.hasModifierProperty(PsiModifier.STATIC) &&
!testMethod.hasModifierProperty(PsiModifier.PRIVATE)) {
registerMethodError(method);
return;
}
}
ancestorClass = ancestorClass.getSuperClass();
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:MethodOverridesStaticMethodInspectionBase.java
示例14: visitMethod
import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
@Override
public void visitMethod(@NotNull PsiMethod method) {
// no call to super, so it doesn't drill down into inner classes
if (method.isConstructor()) {
return;
}
if (method.getNameIdentifier() == null) {
return;
}
final PsiClass containingClass = method.getContainingClass();
if (containingClass == null) {
return;
}
final PsiClass parent = containingClass.getSuperClass();
if (parent == null) {
return;
}
final String parentName = parent.getName();
if (parentName == null) {
return;
}
final String methodName = method.getName();
if (!methodName.equals(parentName)) {
return;
}
registerMethodError(method);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:MethodNameSameAsParentNameInspectionBase.java
示例15: visitMethod
import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
@Override
public void visitMethod(@NotNull PsiMethod method) {
super.visitMethod(method);
if (method.isConstructor() || method.hasModifierProperty(PsiModifier.STATIC)) {
return;
}
if (method.hasModifierProperty(PsiModifier.NATIVE) && isInspectionEnabled("NativeMethodNamingConvention", method)) {
return;
}
final PsiIdentifier nameIdentifier = method.getNameIdentifier();
if (nameIdentifier == null) {
return;
}
if (TestUtils.isRunnable(method)) {
if (TestUtils.isJUnit4TestMethod(method) && isInspectionEnabled("JUnit4MethodNamingConvention", method)) {
return;
}
if (TestUtils.isJUnit3TestMethod(method) && isInspectionEnabled("JUnit3MethodNamingConvention", method)) {
return;
}
}
if (isTestNGTestMethod(method) && isInspectionEnabled("TestNGMethodNamingConvention", method)) {
return;
}
final String name = method.getName();
if (isValid(name)) {
return;
}
if (!isOnTheFly() && MethodUtils.hasSuper(method)) {
return;
}
if (LibraryUtil.isOverrideOfLibraryMethod(method)) {
return;
}
registerMethodError(method, name);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:37,代码来源:InstanceMethodNamingConventionInspectionBase.java