@Override public void visitField(@NotNull PsiField field) { super.visitField(field); if (field instanceof PsiEnumConstant) { return; } if (!field.hasModifierProperty(PsiModifier.STATIC) || !field.hasModifierProperty(PsiModifier.FINAL)) { return; } final String name = field.getName(); if (name == null) { return; } final PsiType type = field.getType(); if (onlyCheckImmutables && !ClassUtils.isImmutable(type)) { return; } if (isValid(name)) { return; } registerFieldError(field, name); }
private static boolean hasGetAndSet(@NonNull String getPrefix, @NonNull String setPrefix, @NonNull PsiClass cls, @NonNull PsiField field) { boolean isPublic = field.hasModifierProperty(PsiModifier.PUBLIC); if (isPublic) return true; String fieldName = captureName(field.getName()); String getMethodName = getPrefix + fieldName; String setMethodName = setPrefix + fieldName; PsiMethod[] gets = cls.findMethodsByName(getMethodName, true); PsiMethod[] sets = cls.findMethodsByName(setMethodName, true); boolean hasGet = gets.length > 0; boolean hasSet = sets.length > 0; return hasGet && hasSet; }
public String getAllModifierProperties( LightModifierList modifierList ) { final StringBuilder builder = StringBuilderSpinAllocator.alloc(); try { for( String modifier : modifierList.getModifiers() ) { if( !PsiModifier.PACKAGE_LOCAL.equals( modifier ) ) { builder.append( modifier ).append( ' ' ); } } return builder.toString(); } finally { StringBuilderSpinAllocator.dispose( builder ); } }
public static boolean isGroovyStaticMemberStub(StubElement<?> stub) { StubElement<?> modifierOwner = stub instanceof GrMethodStub ? stub : stub.getParentStub(); StubElement<GrModifierList> type = modifierOwner.findChildStubByType(GroovyElementTypes.MODIFIERS); if (!(type instanceof GrModifierListStub)) { return false; } int mask = ((GrModifierListStub)type).getModifiersFlags(); if (GrModifierListImpl.hasMaskExplicitModifier(PsiModifier.PRIVATE, mask)) { return false; } if (GrModifierListImpl.hasMaskExplicitModifier(PsiModifier.STATIC, mask)) { return true; } StubElement parent = modifierOwner.getParentStub(); StubElement classStub = parent == null ? null : parent.getParentStub(); if (classStub instanceof GrTypeDefinitionStub && (((GrTypeDefinitionStub)classStub).isAnnotationType() || ((GrTypeDefinitionStub)classStub).isInterface())) { return true; } return false; }
@Override public void visitClass(@NotNull PsiClass aClass) { if (aClass.hasModifierProperty(PsiModifier.PUBLIC) || aClass.hasModifierProperty(PsiModifier.PROTECTED) || aClass.hasModifierProperty(PsiModifier.PRIVATE)) { return; } if (!ClassUtils.isInnerClass(aClass)) { return; } if (ignoreEnums && aClass.isEnum()) { return; } if (ignoreInterfaces && aClass.isInterface()) { return; } final PsiElement parent = aClass.getParent(); // parent must be class to not warn on // the type parameters of classes, anonymous classes and // enum constants for example. if (!(parent instanceof PsiClass)) { return; } registerClassError(aClass); }
@Override public void visitAnnotation(GrAnnotation annotation) { super.visitAnnotation(annotation); PsiElement parent = annotation.getParent().getParent(); if (parent == null || !(parent instanceof GrTypeDefinition)) return; if (SINGLETON.equals(annotation.getQualifiedName())) { GrTypeDefinition typeDefinition = (GrTypeDefinition)parent; PsiMethod[] methods = typeDefinition.getMethods(); for (PsiMethod method : methods) { if (method.isConstructor()) { PsiModifierList modifierList = method.getModifierList(); if (modifierList.hasModifierProperty(PsiModifier.PUBLIC)) { registerClassError(typeDefinition); } } } } }
@Override public void visitField(PsiField field) { super.visitField(field); if (field.hasModifierProperty(PsiModifier.FINAL)) { return; } final PsiClass containingClass = field.getContainingClass(); if (containingClass == null) { return; } if (!InheritanceUtil.isInheritor(containingClass, CommonClassNames.JAVA_LANG_EXCEPTION)) { return; } registerFieldError(field, field); }
private static boolean methodCallExpressionDefinitelyRecurses( GrMethodCallExpression exp, GrMethod method) { final GrExpression invoked = exp.getInvokedExpression(); if (invoked instanceof GrReferenceExpression) { final GrReferenceExpression methodExpression = (GrReferenceExpression) invoked; final PsiMethod referencedMethod = exp.resolveMethod(); if (referencedMethod == null) { return false; } final GrExpression qualifier = methodExpression.getQualifierExpression(); if (referencedMethod.equals(method)) { if (method.hasModifierProperty(PsiModifier.STATIC) || method.hasModifierProperty(PsiModifier.PRIVATE)) { return true; } if (qualifier == null || qualifier instanceof GrReferenceExpression && PsiUtil.isThisReference(qualifier)) { return true; } } if (expressionDefinitelyRecurses(qualifier, method)) { return true; } } return callExpressionDefinitelyRecurses(exp, method); }
@Override protected JPanel createFindWhatPanel() { JPanel findWhatPanel = new JPanel(); findWhatPanel.setBorder(IdeBorderFactory.createTitledBorder(FindBundle.message("find.what.group"), true)); findWhatPanel.setLayout(new BoxLayout(findWhatPanel, BoxLayout.Y_AXIS)); myCbUsages = addCheckboxToPanel(FindBundle.message("find.what.usages.checkbox"), getFindUsagesOptions().isUsages, findWhatPanel, true); PsiClass psiClass = (PsiClass)getPsiElement(); myCbMethodsUsages = addCheckboxToPanel(FindBundle.message("find.what.methods.usages.checkbox"), getFindUsagesOptions().isMethodsUsages, findWhatPanel, true); if (!psiClass.isAnnotationType()) { myCbFieldsUsages = addCheckboxToPanel(FindBundle.message("find.what.fields.usages.checkbox"), getFindUsagesOptions().isFieldsUsages, findWhatPanel, true); if (psiClass.isInterface()){ myCbImplementingClasses = addCheckboxToPanel(FindBundle.message("find.what.implementing.classes.checkbox"), getFindUsagesOptions().isImplementingClasses, findWhatPanel, true); myCbDerivedInterfaces = addCheckboxToPanel(FindBundle.message("find.what.derived.interfaces.checkbox"), getFindUsagesOptions().isDerivedInterfaces, findWhatPanel, true); } else if (!psiClass.hasModifierProperty(PsiModifier.FINAL)){ myCbDerivedClasses = addCheckboxToPanel(FindBundle.message("find.what.derived.classes.checkbox"), getFindUsagesOptions().isDerivedClasses, findWhatPanel, true); } } return findWhatPanel; }
public static PsiMethod checkSuperMethod(@NotNull PsiMethod method, @NotNull String actionString) { PsiClass aClass = method.getContainingClass(); if (aClass == null) return method; PsiMethod superMethod = method.findDeepestSuperMethod(); if (superMethod == null) return method; if (ApplicationManager.getApplication().isUnitTestMode()) return superMethod; PsiClass containingClass = superMethod.getContainingClass(); SuperMethodWarningDialog dialog = new SuperMethodWarningDialog( method.getProject(), DescriptiveNameUtil.getDescriptiveName(method), actionString, containingClass.isInterface() || superMethod.hasModifierProperty(PsiModifier.ABSTRACT), containingClass.isInterface(), aClass.isInterface(), containingClass.getQualifiedName() ); dialog.show(); if (dialog.getExitCode() == DialogWrapper.OK_EXIT_CODE) return superMethod; if (dialog.getExitCode() == SuperMethodWarningDialog.NO_EXIT_CODE) return method; return null; }
@Override public void visitField(@NotNull PsiField field) { super.visitField(field); if (!field.hasModifierProperty(PsiModifier.STATIC)) { return; } final PsiTypeElement typeElement = field.getTypeElement(); if (typeElement == null) { return; } if (!ConcreteClassUtil.typeIsConcreteClass(typeElement, ignoreAbstractClasses)) { return; } final String variableName = field.getName(); registerError(typeElement, variableName); }
@Override @NotNull public PsiVariable getPsi(PsiManager manager, final String containingClassName) { if (myPsi != null) return myPsi; Boolean isStatic = isStatic(); String type = getType(); if (type == null || type.trim().isEmpty()) { type = CommonClassNames.JAVA_LANG_OBJECT; } myPsi = new GrDynamicImplicitProperty(manager, getName(), type, containingClassName); if (isStatic != null && isStatic.booleanValue()) { myPsi.getModifierList().addModifier(PsiModifier.STATIC); } return myPsi; }
@Override public void visitField(@NotNull PsiField field) { super.visitField(field); if (field.hasModifierProperty(PsiModifier.STATIC) && field.hasModifierProperty(PsiModifier.FINAL)) { return; } final String fieldName = field.getName(); if (fieldName == null) { return; } if (!fieldName.equals(fieldName.toUpperCase())) { return; } registerFieldError(field); }
public void testPublicVisibility() throws Exception { doTest((rootDir, rootAfter) -> { PsiClass aClass = myJavaFacade.findClass("Test", GlobalSearchScope.projectScope(myProject)); assertNotNull("Class Test not found", aClass); final ArrayList<PsiMethod> methods = new ArrayList<>(); methods.add(aClass.findMethodsByName("foos", false)[0]); final ArrayList<PsiField> fields = new ArrayList<>(); fields.add(aClass.findFieldByName("myT", false)); final ExtractClassProcessor processor = new ExtractClassProcessor(aClass, fields, methods, new ArrayList<>(), "", null, "Extracted", PsiModifier.PUBLIC, false, Collections.<MemberInfo>emptyList()); processor.run(); LocalFileSystem.getInstance().refresh(false); FileDocumentManager.getInstance().saveAllDocuments(); }); }
@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); }
@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; } } }
@Override protected String showDialog() { Project project = getProject(); final JavaPsiFacade facade = JavaPsiFacade.getInstance(project); Module module = myModuleSelector.getModule(); if (module == null) { Messages.showErrorDialog(project, ExecutionBundle.message("module.not.specified.error.text"), CommonBundle.getErrorTitle()); return null; } GlobalSearchScope scope = myIncludeLibraryClasses ? module.getModuleWithDependenciesAndLibrariesScope(true) : module.getModuleWithDependenciesScope(); PsiClass initialSelection = facade.findClass(getText(), scope); TreeClassChooser chooser = createTreeClassChooser(project, scope, initialSelection, new ClassFilter() { @Override public boolean isAccepted(PsiClass aClass) { if (aClass.isInterface()) return false; final PsiModifierList modifierList = aClass.getModifierList(); return modifierList == null || !modifierList.hasModifierProperty(PsiModifier.ABSTRACT); } }); if (chooser == null) return null; chooser.showDialog(); PsiClass selClass = chooser.getSelected(); return selClass != null ? selClass.getQualifiedName() : null; }
@Override public void visitMethod(@NotNull PsiMethod method) { //note: no call to super; if (!CloneUtils.isClone(method)) { return; } if (method.hasModifierProperty(PsiModifier.ABSTRACT) || method.hasModifierProperty(PsiModifier.NATIVE)) { return; } final PsiClass containingClass = method.getContainingClass(); if (containingClass == null) { return; } if (containingClass.isInterface() || containingClass.isAnnotationType()) { return; } if (CloneUtils.onlyThrowsException(method)) { return; } if (MethodCallUtils.containsSuperMethodCall(HardcodedMethodConstants.CLONE, method)) { return; } registerMethodError(method); }
@Override protected InspectionGadgetsFix buildFix(Object... infos) { return new InspectionGadgetsFix() { @Override public void doFix(Project project, ProblemDescriptor descriptor) { final PsiMethod element = PsiTreeUtil.getParentOfType(descriptor.getPsiElement(), PsiMethod.class); if (element != null) { new MakeMethodStaticProcessor(project, element, new Settings(m_replaceQualifier, null, null)).run(); } } @Override @NotNull public String getName() { return InspectionGadgetsBundle.message("change.modifier.quickfix", PsiModifier.STATIC); } @NotNull @Override public String getFamilyName() { return ChangeModifierFix.FAMILY_NAME; } }; }
@Override public void visitMethod(@NotNull PsiMethod method) { // no call to super, so it doesn't drill down final PsiClass aClass = method.getContainingClass(); if (aClass == null) { return; } if (aClass.isInterface() || aClass.isAnnotationType()) { return; } if (method.hasModifierProperty(PsiModifier.PRIVATE)) { return; } if (!SerializationUtils.isReadObject(method) && !SerializationUtils.isWriteObject(method)) { return; } if (!SerializationUtils.isSerializable(aClass)) { return; } registerMethodError(method); }
@Override public void visitField(@NotNull PsiField field) { super.visitField(field); if (!field.hasModifierProperty(PsiModifier.PUBLIC)) { return; } if (!field.hasModifierProperty(PsiModifier.STATIC)) { return; } final PsiType type = field.getType(); if (!(type instanceof PsiArrayType)) { return; } if (CollectionUtils.isConstantEmptyArray(field)) { return; } registerFieldError(field); }
@Override public void visitClass(PsiClass aClass) { if (aClass.isInterface() || aClass.isAnnotationType()) { return; } final PsiClass superClass = aClass.getSuperClass(); if (superClass == null) { return; } if (superClass.hasModifierProperty(PsiModifier.ABSTRACT)) { return; } if (!UtilityClassUtil.isUtilityClass(superClass)) { return; } if (ignoreUtilityClasses && UtilityClassUtil.isUtilityClass(aClass, false)) { return; } registerClassError(aClass, superClass); }
@Override public void visitMethod(@NotNull PsiMethod method) { //note: no call to super @NonNls final String methodName = method.getName(); if (!"suite".equals(methodName)) { return; } final PsiClass aClass = method.getContainingClass(); if (aClass == null) { return; } if (!InheritanceUtil.isInheritor(aClass, "junit.framework.TestCase")) { return; } final PsiParameterList parameterList = method.getParameterList(); if (parameterList.getParametersCount() != 0) { return; } if (method.hasModifierProperty(PsiModifier.STATIC)) { return; } registerMethodError(method); }
@Override public SearchScope getAdditionalUseScope(@NotNull PsiElement element) { if (element instanceof PomTargetPsiElement) { PomTarget target = ((PomTargetPsiElement)element).getTarget(); if (target instanceof DomTarget) { DomElement domElement = ((DomTarget)target).getDomElement(); if (domElement instanceof ExtensionPoint) { return createProjectXmlFilesScope(element); } } } if (element instanceof PsiClass && PsiUtil.isIdeaProject(element.getProject()) && ((PsiClass)element).hasModifierProperty(PsiModifier.PUBLIC)) { return createProjectXmlFilesScope(element); } return null; }
@Override public void visitClass(PsiClass aClass) { super.visitClass(aClass); if (aClass.isInterface() || aClass.isEnum()) { return; } if (!aClass.hasModifierProperty(PsiModifier.PUBLIC) || aClass.hasModifierProperty(PsiModifier.ABSTRACT)) { return; } final PsiMethod[] constructors = aClass.getConstructors(); if (constructors.length > 0) { return; } if (SerializationUtils.isExternalizable(aClass)) { return; } registerClassError(aClass, Boolean.TRUE); }
@Override public void collectFields(@NotNull GrTypeDefinition psiClass, @NotNull Collection<GrField> collector) { GrModifierList modifierList = psiClass.getModifierList(); if (modifierList == null) return; for (GrAnnotation annotation : modifierList.getAnnotations()) { String qname = annotation.getQualifiedName(); String logger = ourLoggers.get(qname); if (logger != null) { String fieldName = PsiUtil.getAnnoAttributeValue(annotation, "value", "log"); GrLightField field = new GrLightField(psiClass, fieldName, logger); field.setNavigationElement(annotation); field.getModifierList().setModifiers(PsiModifier.PRIVATE, PsiModifier.FINAL, PsiModifier.STATIC); field.setOriginInfo("created by @" + annotation.getShortName()); collector.add(field); } } }
@Nullable @Override protected Object getAbstractColumnValue(GrMemberInfo memberInfo) { if (!(memberInfo.getMember() instanceof PsiMethod)) return null; if (memberInfo.isStatic()) return null; PsiMethod method = (PsiMethod)memberInfo.getMember(); if (method.hasModifierProperty(PsiModifier.ABSTRACT)) { final Boolean fixedAbstract = myMemberInfoModel.isFixedAbstract(memberInfo); if (fixedAbstract != null) return fixedAbstract; } if (!myMemberInfoModel.isAbstractEnabled(memberInfo)) { return myMemberInfoModel.isAbstractWhenDisabled(memberInfo); } else { return memberInfo.isToAbstract(); } }
@Override public void visitField(@NotNull PsiField field) { //no call to super, so we don't drill into anonymous classes if (!field.hasModifierProperty(PsiModifier.STATIC) || !field.hasModifierProperty(PsiModifier.PUBLIC) || !field.hasModifierProperty(PsiModifier.FINAL)) { return; } final PsiClass containingClass = field.getContainingClass(); if (containingClass == null) { return; } if (containingClass.isInterface() || containingClass.isAnnotationType() || containingClass.isEnum()) { return; } if (!containingClass.hasModifierProperty(PsiModifier.ABSTRACT)) { return; } registerFieldError(field); }
@Override public void visitField(@NotNull PsiField field) { super.visitField(field); if (field.hasModifierProperty(PsiModifier.STATIC)) { return; } final PsiTypeElement typeElement = field.getTypeElement(); if (typeElement == null) { return; } if (!ConcreteClassUtil.typeIsConcreteClass(typeElement, ignoreAbstractClasses)) { return; } final String variableName = field.getName(); registerError(typeElement, variableName); }
public void visitMethod(JavaContext context, PsiMethod method) { boolean isPublicMethod = method.hasModifierProperty(PsiModifier.PUBLIC); if (!isPublicMethod) return; JavaEvaluator evaluator = context.getEvaluator(); if (evaluator == null) return; PsiParameterList parameterList = method.getParameterList(); PsiParameter[] psiParameters = parameterList.getParameters(); boolean hasBeanParameter = false; for (PsiParameter p : psiParameters) { PsiType type = p.getType(); if (!(type instanceof PsiClassType)) continue; PsiClassType classType = (PsiClassType) type; PsiClass psiCls = classType.resolve(); if (psiCls == null) continue; hasBeanParameter = Utils.isCustomBean(context, psiCls); if (hasBeanParameter) break; } if (hasBeanParameter) { mMethods.add(method); } }
private PsiMethod plantMethodInPsiClass( PsiMethod refMethod, PsiClass psiClass, PsiClass extClass ) { if( null != refMethod ) { ManPsiElementFactory manPsiElemFactory = ManPsiElementFactory.instance(); String methodName = refMethod.getName(); ManLightMethodBuilder method = manPsiElemFactory.createLightMethod( psiClass.getManager(), methodName ) .withMethodReturnType( refMethod.getReturnType() ) .withContainingClass( psiClass ); PsiElement navElem = findExtensionMethodNavigationElement( extClass, refMethod ); if( navElem != null ) { method.withNavigationElement( navElem ); } addModifier( refMethod, method, PsiModifier.PUBLIC ); addModifier( refMethod, method, PsiModifier.STATIC ); addModifier( refMethod, method, PsiModifier.PACKAGE_LOCAL ); addModifier( refMethod, method, PsiModifier.PROTECTED ); for( PsiTypeParameter tv : refMethod.getTypeParameters() ) { method.withTypeParameter( tv ); } PsiParameter[] parameters = refMethod.getParameterList().getParameters(); for( PsiParameter psiParameter : parameters ) { method.withParameter( psiParameter.getName(), psiParameter.getType() ); } for( PsiClassType psiClassType : refMethod.getThrowsList().getReferencedTypes() ) { method.withException( psiClassType ); } return method; } return null; }
public void setModifierProperty( @PsiModifier.ModifierConstant String name, boolean value ) throws IncorrectOperationException { if( value ) { addModifier( name ); } else { if( hasModifierProperty( name ) ) { removeModifier( name ); } } }
private void removeModifier( @PsiModifier.ModifierConstant String name ) { final Collection<String> myModifiers = collectAllModifiers(); myModifiers.remove( name ); clearModifiers(); for( String modifier : myModifiers ) { addModifier( modifier ); } }
private Collection<String> collectAllModifiers() { Collection<String> result = new HashSet<>(); for( @PsiModifier.ModifierConstant String modifier : ALL_MODIFIERS ) { if( hasModifierProperty( modifier ) ) { result.add( modifier ); } } return result; }
public static boolean isStructurallyAssignable_Laxed( PsiClass toType, PsiClass fromType, TypeVarToTypeMap inferenceMap, boolean structural ) { if( fromType == PsiType.NULL ) { return true; } List<Pair<PsiMethod, PsiSubstitutor>> toMethods = toType.getAllMethodsAndTheirSubstitutors(); inferenceMap.setStructural( true ); for( Pair<PsiMethod, PsiSubstitutor> pair : toMethods ) { PsiMethod toMi = pair.getFirst(); if( isObjectMethod( toMi ) ) { continue; } if( toMi.getContainingClass().getModifierList().findAnnotation( "manifold.ext.ExtensionMethod" ) != null ) { continue; } if( toMi.hasModifierProperty( PsiModifier.DEFAULT ) || toMi.hasModifierProperty( PsiModifier.STATIC ) ) { continue; } PsiMethod fromMi = findAssignableMethod( structural, fromType, toMi, inferenceMap ); if( fromMi == null ) { return false; } } return true; }
public void report(PsiModifierList list) { for(String modifier : PsiModifier.MODIFIERS){ if (list.hasExplicitModifier(modifier) || list.hasModifierProperty(modifier)) { System.out.println(" PsiModifier -> "+modifier); } } }
private void markLeakSuspects(PsiElement element, PsiElement lambdaBody, @NonNull final JavaContext context) { if (element instanceof PsiReferenceExpression) { PsiReferenceExpression ref = (PsiReferenceExpression) element; if (ref.getQualifierExpression() == null) { PsiElement res = ref.resolve(); if (!(res instanceof PsiParameter)) { if (!(res instanceof PsiClass)) { boolean error = false; if (res instanceof PsiLocalVariable) { PsiLocalVariable lVar = (PsiLocalVariable) res; if (!isParent(lambdaBody, lVar.getParent())) { error = true; } } if (res instanceof PsiField) { PsiField field = (PsiField) res; final PsiModifierList modifierList = field.getModifierList(); if (modifierList == null) { error = true; } else if (!modifierList.hasExplicitModifier(PsiModifier.STATIC)) { error = true; } } if (error) { context.report(ISSUE, element, context.getNameLocation(element), "Possible leak"); } } } } } for (PsiElement psiElement : element.getChildren()) { markLeakSuspects(psiElement, lambdaBody, context); } }
public String getTypeIconName() { if (end instanceof PsiField) { PsiField f = (PsiField) end; return ((PsiModifierList)f.getModifierList()).hasModifierProperty(PsiModifier.STATIC) ? "nodes/staticField" : "nodes/field"; } return null; }
@NotNull private static GrVariableDeclaration generateDeclaration(@NotNull GrIntroduceContext context, @NotNull GroovyIntroduceVariableSettings settings) { final GroovyPsiElementFactory factory = GroovyPsiElementFactory.getInstance(context.getProject()); final String[] modifiers = settings.isDeclareFinal() ? new String[]{PsiModifier.FINAL} : null; final GrVariableDeclaration declaration = factory.createVariableDeclaration(modifiers, "foo", settings.getSelectedType(), settings.getName()); generateInitializer(context, declaration.getVariables()[0]); return declaration; }
/** Always return true since we wanna get all vars in scope */ @Override public boolean execute(@NotNull PsiElement pe, @NotNull ResolveState state){ if(pe instanceof PsiVariable){ final PsiVariable pvar = (PsiVariable)pe; final String pvar_name = pvar.getName(); if(pvar_name.startsWith(myPrefix)){ if(!myStaticSensitiveFlag || (!myStaticScopeFlag || pvar.hasModifierProperty(PsiModifier.STATIC))){ myResultList.add(pvar); } } } return true; }