public void removeEntryPoint(RefElement anEntryPoint) { if (anEntryPoint instanceof RefClass) { RefClass refClass = (RefClass) anEntryPoint; if (!refClass.isInterface()) { anEntryPoint = refClass.getDefaultConstructor(); } } if (anEntryPoint == null) return; myTemporaryEntryPoints.remove(anEntryPoint); Set<Map.Entry<String, SmartRefElementPointer>> set = myPersistentEntryPoints.entrySet(); String key = null; for (Map.Entry<String, SmartRefElementPointer> entry : set) { SmartRefElementPointer value = entry.getValue(); if (value.getRefElement() == anEntryPoint) { key = entry.getKey(); break; } } if (key != null) { myPersistentEntryPoints.remove(key); ((RefElementImpl) anEntryPoint).setEntry(false); } if (anEntryPoint.isPermanentEntry() && anEntryPoint.isValid()) { final Project project = anEntryPoint.getElement().getProject(); final EntryPointsManagerImpl entryPointsManager = getInstance(project); if (this != entryPointsManager) { entryPointsManager.removeEntryPoint(anEntryPoint); } } }
private void setDefaultConstructor(RefMethodImpl defaultConstructor) { if (defaultConstructor != null) { for (RefClass superClass : getBaseClasses()) { RefMethodImpl superDefaultConstructor = (RefMethodImpl) superClass.getDefaultConstructor(); if (superDefaultConstructor != null) { superDefaultConstructor.addInReference(defaultConstructor); defaultConstructor.addOutReference(superDefaultConstructor); } } } myDefaultConstructor = defaultConstructor; }
private static void ignoreElement( @NotNull ProblemDescriptionsProcessor processor, @NotNull RefEntity refElement) { processor.ignoreElement(refElement); if (refElement instanceof RefClass) { RefClass refClass = (RefClass) refElement; RefMethod defaultConstructor = refClass.getDefaultConstructor(); if (defaultConstructor != null) { processor.ignoreElement(defaultConstructor); return; } } RefEntity owner = refElement.getOwner(); if (owner instanceof RefElement) { processor.ignoreElement(owner); } }
private void checkForSuperCall(PsiMethod method) { if (isConstructor()) { PsiCodeBlock body = method.getBody(); if (body == null) return; PsiStatement[] statements = body.getStatements(); boolean isBaseExplicitlyCalled = false; if (statements.length > 0) { PsiStatement first = statements[0]; if (first instanceof PsiExpressionStatement) { PsiExpression firstExpression = ((PsiExpressionStatement) first).getExpression(); if (firstExpression instanceof PsiMethodCallExpression) { PsiExpression qualifierExpression = ((PsiMethodCallExpression) firstExpression) .getMethodExpression() .getQualifierExpression(); if (qualifierExpression instanceof PsiReferenceExpression) { @NonNls String text = qualifierExpression.getText(); if ("super".equals(text) || text.equals("this")) { isBaseExplicitlyCalled = true; } } } } } if (!isBaseExplicitlyCalled) { for (RefClass superClass : getOwnerClass().getBaseClasses()) { RefMethodImpl superDefaultConstructor = (RefMethodImpl) superClass.getDefaultConstructor(); if (superDefaultConstructor != null) { superDefaultConstructor.addInReference(this); addOutReference(superDefaultConstructor); } } } } }