com.intellij.codeInspection.InspectionManager Java Examples
The following examples show how to use
com.intellij.codeInspection.InspectionManager.
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: UnusedCppSymbolInspection.java From CppTools with Apache License 2.0 | 6 votes |
@Override @Nullable public ProblemDescriptor[] checkFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly) { if (file.getFileType() != CppSupportLoader.CPP_FILETYPE) return EMPTY; if (HighlightUtils.debug) { HighlightUtils.trace(file, null, "Inspections about to start:"); } final HighlightCommand command = HighlightUtils.getUpToDateHighlightCommand(file, file.getProject()); if (command.isUpToDate()) command.awaitInspections(file.getProject()); if (HighlightUtils.debug) { HighlightUtils.trace(file, null, "Adding inspection errors:"); } final ProblemDescriptor[] problemDescriptors = command.addInspectionErrors(manager); // System.out.println("Finished inspections--:" + getClass() + "," + (System.currentTimeMillis() - command.started)); return problemDescriptors; }
Example #2
Source File: StructureAnnotationDeclaredCorrectlyInspection.java From attic-polygene-java with Apache License 2.0 | 6 votes |
@Nullable protected final ProblemDescriptor[] verifyAnnotationDeclaredCorrectly( @NotNull PsiVariable psiVariable, @NotNull PsiAnnotation structureAnnotation, @NotNull InspectionManager manager ) { StructureAnnotationDeclarationValidationResult annotationCheck = validateStructureAnnotationDeclaration( psiVariable ); switch( annotationCheck ) { case invalidInjectionType: String message = message( "injections.structure.annotation.declared.correctly.error.invalid.injection.type", psiVariable.getType().getCanonicalText() ); AbstractFix removeStructureAnnotationFix = createRemoveAnnotationFix( structureAnnotation ); ProblemDescriptor problemDescriptor = manager.createProblemDescriptor( structureAnnotation, message, removeStructureAnnotationFix, GENERIC_ERROR_OR_WARNING ); return new ProblemDescriptor[]{ problemDescriptor }; } return null; }
Example #3
Source File: MixinsAnnotationDeclaredOnMixinType.java From attic-polygene-java with Apache License 2.0 | 6 votes |
@Override public ProblemDescriptor[] checkClass( @NotNull PsiClass psiClass, @NotNull InspectionManager manager, boolean isOnTheFly ) { PsiAnnotation mixinsAnnotation = getMixinsAnnotation( psiClass ); if( mixinsAnnotation == null ) { return null; } if( psiClass.isInterface() ) { return null; } String message = message( "mixins.annotation.declared.on.mixin.type.error.declared.on.class" ); RemoveInvalidMixinClassReferenceFix fix = new RemoveInvalidMixinClassReferenceFix( mixinsAnnotation ); ProblemDescriptor problemDescriptor = manager.createProblemDescriptor( mixinsAnnotation, message, fix, GENERIC_ERROR_OR_WARNING ); return new ProblemDescriptor[]{ problemDescriptor }; }
Example #4
Source File: UppercaseStatePropInspection.java From litho with Apache License 2.0 | 6 votes |
@Nullable @Override public ProblemDescriptor[] checkMethod( @NotNull PsiMethod method, @NotNull InspectionManager manager, boolean isOnTheFly) { if (!LithoPluginUtils.isLithoSpec(method.getContainingClass())) { return ProblemDescriptor.EMPTY_ARRAY; } return Optional.of(method) .map(PsiMethod::getParameterList) .map(PsiParameterList::getParameters) .map( psiParameters -> Stream.of(psiParameters) .filter(LithoPluginUtils::isPropOrState) .filter(UppercaseStatePropInspection::isFirstLetterCapital) .map(PsiParameter::getNameIdentifier) .filter(Objects::nonNull) .map(identifier -> createWarning(identifier, manager, isOnTheFly)) .toArray(ProblemDescriptor[]::new)) .orElse(ProblemDescriptor.EMPTY_ARRAY); }
Example #5
Source File: PythonFacetInspection.java From intellij-pants-plugin with Apache License 2.0 | 6 votes |
@Override @Nullable public ProblemDescriptor[] checkFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly) { if (shouldAddPythonSdk(file)) { LocalQuickFix[] fixes = new LocalQuickFix[]{new AddPythonFacetQuickFix()}; ProblemDescriptor descriptor = manager.createProblemDescriptor( file.getNavigationElement(), PantsBundle.message("pants.info.python.facet.missing"), isOnTheFly, fixes, ProblemHighlightType.GENERIC_ERROR_OR_WARNING ); return new ProblemDescriptor[]{descriptor}; } return null; }
Example #6
Source File: PythonPluginInspection.java From intellij-pants-plugin with Apache License 2.0 | 6 votes |
@Override @Nullable public ProblemDescriptor[] checkFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly) { if (PantsUtil.isBUILDFileName(file.getName()) && !PantsUtil.isPythonAvailable() && PantsUtil.isPantsProject(file.getProject())) { LocalQuickFix[] fixes = new LocalQuickFix[]{new AddPythonPluginQuickFix()}; ProblemDescriptor descriptor = manager.createProblemDescriptor( file.getNavigationElement(), PantsBundle.message("pants.info.python.plugin.missing"), isOnTheFly, fixes, ProblemHighlightType.GENERIC_ERROR_OR_WARNING ); return new ProblemDescriptor[]{descriptor}; } return null; }
Example #7
Source File: BuildFileTypeInspection.java From intellij-pants-plugin with Apache License 2.0 | 6 votes |
@Override @Nullable public ProblemDescriptor[] checkFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly) { if (PantsUtil.isBUILDFileName(file.getName()) && PantsUtil.isPythonAvailable() && PantsUtil.isPantsProject(file.getProject())) { if (file.getFileType() != PythonFileType.INSTANCE) { LocalQuickFix[] fixes = new LocalQuickFix[]{new TypeAssociationFix()}; ProblemDescriptor descriptor = manager.createProblemDescriptor( file.getNavigationElement(), PantsBundle.message("pants.info.mistreated.build.file"), isOnTheFly, fixes, ProblemHighlightType.GENERIC_ERROR_OR_WARNING ); return new ProblemDescriptor[]{descriptor}; } } return null; }
Example #8
Source File: IgnoreRelativeEntryInspection.java From idea-gitignore with MIT License | 6 votes |
/** * Checks if entries are relative. * * @param file current working file yo check * @param manager {@link InspectionManager} to ask for {@link ProblemDescriptor}'s from * @param isOnTheFly true if called during on the fly editor highlighting. Called from Inspect Code action * otherwise * @return <code>null</code> if no problems found or not applicable at file level */ @Nullable @Override public ProblemDescriptor[] checkFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly) { if (!(file instanceof IgnoreFile)) { return null; } final ProblemsHolder problemsHolder = new ProblemsHolder(manager, file, isOnTheFly); file.acceptChildren(new IgnoreVisitor() { @Override public void visitEntry(@NotNull IgnoreEntry entry) { String path = entry.getText().replaceAll("\\\\(.)", "$1"); if (path.contains("./")) { problemsHolder.registerProblem(entry, IgnoreBundle.message("codeInspection.relativeEntry.message"), new IgnoreRelativeEntryFix(entry)); } super.visitEntry(entry); } }); return problemsHolder.getResultsArray(); }
Example #9
Source File: UnusedVariableInspection.java From intellij-xquery with Apache License 2.0 | 6 votes |
@Override public ProblemDescriptor[] checkFile(PsiFile file, InspectionManager manager, boolean isOnTheFly) { if (!(file instanceof XQueryFile)) { return null; } List<XQueryVarName> unusedVariables = new ArrayList<XQueryVarName>(); XQueryFile xQueryFile = (XQueryFile) file; for (XQueryVarName varName : xQueryFile.getVariableNames()) { if (isReference(varName) || isPublicDeclaredVariable(varName)) continue; if (variableIsNotUsed(varName, xQueryFile)) unusedVariables.add(varName); } if (unusedVariables.size() > 0) { return buildProblemDescriptionsForUnusedVariables(manager, unusedVariables); } else { return null; } }
Example #10
Source File: InvalidVersionInspection.java From intellij-xquery with Apache License 2.0 | 6 votes |
@Override public ProblemDescriptor[] checkFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly) { if (!(file instanceof XQueryFile)) { return null; } XQueryVersionDecl versionDecl = PsiTreeUtil.findChildOfType(file, XQueryVersionDecl.class); XQueryVersion version = versionDecl != null ? versionDecl.getVersion() : null; if (version != null) { String versionString = version.getVersionString(); XQueryLanguageVersion languageVersion = XQueryLanguageVersion.valueFor(versionString); if (languageVersion == null) { ProblemDescriptor problem = manager.createProblemDescriptor(versionDecl.getVersion(), getDescription(versionString), (LocalQuickFix) null, WEAK_WARNING, true); return new ProblemDescriptor[]{problem}; } } return null; }
Example #11
Source File: DefaultFunctionNamespaceSameAsModuleNamespace.java From intellij-xquery with Apache License 2.0 | 6 votes |
@Override public ProblemDescriptor[] checkFile(PsiFile file, InspectionManager manager, boolean isOnTheFly) { if (!(file instanceof XQueryFile)) { return null; } XQueryFile xQueryFile = (XQueryFile) file; XQueryModuleDecl moduleDeclaration = xQueryFile.getModuleDeclaration(); XQueryDefaultFunctionNamespaceDecl defaultNamespaceFunctionDeclaration = xQueryFile.getDefaultNamespaceFunctionDeclaration(); if (moduleDeclaration != null && defaultNamespaceFunctionDeclaration != null) { String namespace = moduleDeclaration.getNamespace(); XQueryURILiteral uriLiteral = defaultNamespaceFunctionDeclaration.getURILiteral(); String defaultFunctionNamespace = uriLiteral != null ? removeQuotOrAposIfNeeded(uriLiteral.getText()) : null; if (!StringUtils.equals(defaultFunctionNamespace, namespace) && !FN.getNamespace().equals(defaultFunctionNamespace)) { return createProblemDescriptor(manager, uriLiteral); } } return null; }
Example #12
Source File: NamespacePrefixFromFileName.java From intellij-xquery with Apache License 2.0 | 6 votes |
@Override public ProblemDescriptor[] checkFile(PsiFile file, InspectionManager manager, boolean isOnTheFly) { if (!(file instanceof XQueryFile)) { return null; } final XQueryModuleDecl moduleDeclaration = ((XQueryFile) file).getModuleDeclaration(); if (moduleDeclaration != null && moduleDeclaration.getNamespacePrefix() != null && moduleDeclaration.getURILiteral() != null && !namespacePrefixIsDerivedFromFileName(moduleDeclaration)) { ProblemDescriptor[] problemDescriptors = new ProblemDescriptor[1]; problemDescriptors[0] = manager.createProblemDescriptor(moduleDeclaration.getNamespacePrefix(), "Namespace prefix should be derived from file name part in URI", (LocalQuickFix) null, GENERIC_ERROR_OR_WARNING, true); return problemDescriptors; } else { return null; } }
Example #13
Source File: MismatchedImportsInspection.java From needsmoredojo with Apache License 2.0 | 6 votes |
@Override public ProblemDescriptor[] checkFile(@NotNull PsiFile file, @NotNull final InspectionManager manager, boolean isOnTheFly) { if(!isEnabled(file.getProject())) { return new ProblemDescriptor[0]; } DefineResolver resolver = new DefineResolver(); final List<ProblemDescriptor> descriptors = new ArrayList<ProblemDescriptor>(); Set<JSCallExpression> expressions = resolver.getAllImportBlocks(file); for(JSCallExpression expression : expressions) { addProblemsForBlock(expression, descriptors, file, manager); } return descriptors.toArray(new ProblemDescriptor[0]); }
Example #14
Source File: ViewOfflineResultsAction.java From consulo with Apache License 2.0 | 6 votes |
@Nonnull public static InspectionResultsView showOfflineView(@Nonnull Project project, @Nonnull Map<String, Map<String, Set<OfflineProblemDescriptor>>> resMap, @Nonnull InspectionProfile inspectionProfile, @Nonnull String title) { final AnalysisScope scope = new AnalysisScope(project); final InspectionManagerEx managerEx = (InspectionManagerEx)InspectionManager.getInstance(project); final GlobalInspectionContextImpl context = managerEx.createNewGlobalContext(false); context.setExternalProfile(inspectionProfile); context.setCurrentScope(scope); context.initializeTools(new ArrayList<Tools>(), new ArrayList<Tools>(), new ArrayList<Tools>()); final InspectionResultsView view = new InspectionResultsView(project, inspectionProfile, scope, context, new OfflineInspectionRVContentProvider(resMap, project)); ((RefManagerImpl)context.getRefManager()).inspectionReadActionStarted(); view.update(); TreeUtil.selectFirstNode(view.getTree()); context.addView(view, title); return view; }
Example #15
Source File: ModifierNotAllowedInspection.java From intellij-latte with MIT License | 6 votes |
@Nullable @Override public ProblemDescriptor[] checkFile(@NotNull PsiFile file, @NotNull final InspectionManager manager, final boolean isOnTheFly) { if (!(file instanceof LatteFile)) { return null; } final List<ProblemDescriptor> problems = new ArrayList<>(); file.acceptChildren(new PsiRecursiveElementWalkingVisitor() { @Override public void visitElement(PsiElement element) { if (element instanceof LatteMacroTag) { checkClassicMacro((LatteMacroTag) element, problems, manager, isOnTheFly); } else { super.visitElement(element); } } }); return problems.toArray(new ProblemDescriptor[0]); }
Example #16
Source File: HaxeUnresolvedSymbolInspection.java From intellij-haxe with Apache License 2.0 | 6 votes |
@Nullable @Override public ProblemDescriptor[] checkFile(@NotNull PsiFile file, @NotNull final InspectionManager manager, final boolean isOnTheFly) { if (!(file instanceof HaxeFile)) return null; final List<ProblemDescriptor> result = new ArrayList<ProblemDescriptor>(); new HaxeAnnotatingVisitor() { @Override protected void handleUnresolvedReference(HaxeReferenceExpression reference) { PsiElement nameIdentifier = reference.getReferenceNameElement(); if (nameIdentifier == null) return; result.add(manager.createProblemDescriptor( nameIdentifier, TextRange.from(0, nameIdentifier.getTextLength()), getDisplayName(), ProblemHighlightType.LIKE_UNKNOWN_SYMBOL, isOnTheFly )); } }.visitFile(file); return ArrayUtil.toObjectArray(result, ProblemDescriptor.class); }
Example #17
Source File: ThriftUnresolvedSymbolInspection.java From intellij-thrift with Apache License 2.0 | 5 votes |
@Nullable @Override public ProblemDescriptor[] checkFile(@NotNull PsiFile file, @NotNull final InspectionManager manager, final boolean isOnTheFly) { final List<ProblemDescriptor> result = new ArrayList<ProblemDescriptor>(); new ThriftVisitor() { @Override public void visitCustomType(@NotNull ThriftCustomType type) { for (PsiReference reference : type.getReferences()) { if (reference.resolve() == null) { result.add(manager.createProblemDescriptor( reference.getElement(), reference.getRangeInElement(), getDisplayName(), ProblemHighlightType.ERROR, isOnTheFly )); } } } public void visitElement(PsiElement element) { super.visitElement(element); element.acceptChildren(this); } }.visitFile(file); return ArrayUtil.toObjectArray(result, ProblemDescriptor.class); }
Example #18
Source File: QuickFixAction.java From consulo with Apache License 2.0 | 5 votes |
private static void refreshViews(@Nonnull Project project, @Nonnull Set<PsiElement> selectedElements, @Nonnull InspectionToolWrapper toolWrapper) { InspectionManagerEx managerEx = (InspectionManagerEx)InspectionManager.getInstance(project); final Set<GlobalInspectionContextImpl> runningContexts = managerEx.getRunningContexts(); for (GlobalInspectionContextImpl context : runningContexts) { for (PsiElement element : selectedElements) { context.ignoreElement(toolWrapper.getTool(), element); } context.refreshViews(); } }
Example #19
Source File: CleanupIntention.java From consulo with Apache License 2.0 | 5 votes |
@Override public void invoke(@Nonnull final Project project, final Editor editor, final PsiFile file) throws IncorrectOperationException { if (!FileModificationService.getInstance().preparePsiElementForWrite(file)) return; final InspectionManager managerEx = InspectionManager.getInstance(project); final GlobalInspectionContextBase globalContext = (GlobalInspectionContextBase)managerEx.createNewGlobalContext(false); final AnalysisScope scope = getScope(project, file); if (scope != null) { final InspectionProfile profile = InspectionProjectProfileManager.getInstance(project).getInspectionProfile(); globalContext.codeCleanup(project, scope, profile, getText(), null, false); } }
Example #20
Source File: CodeCleanupAction.java From consulo with Apache License 2.0 | 5 votes |
@Override protected void runInspections(Project project, AnalysisScope scope) { final InspectionProfile profile = myExternalProfile != null ? myExternalProfile : InspectionProjectProfileManager.getInstance(project).getInspectionProfile(); final InspectionManager managerEx = InspectionManager.getInstance(project); final GlobalInspectionContextBase globalContext = (GlobalInspectionContextBase)managerEx.createNewGlobalContext(false); globalContext.codeCleanup(project, scope, profile, getTemplatePresentation().getText(), null, false); }
Example #21
Source File: UnusedNamespaceDeclarationInspection.java From intellij-xquery with Apache License 2.0 | 5 votes |
private List<ProblemDescriptor> getUnusedNamespaceDeclarationProblems(XQueryFile xQueryFile, InspectionManager manager) { Collection<XQueryNamespaceDecl> unusedNamespaceDeclarations = unusedNamespaceDeclarationsFinder.getUnusedNamespaceSources(xQueryFile); List<ProblemDescriptor> problems = new ArrayList<ProblemDescriptor>(); for (XQueryNamespaceDecl unused : unusedNamespaceDeclarations) { problems.add(manager.createProblemDescriptor(unused, UNUSED_NAMESPACE_DECLARATION, new RemoveElementQuickFix(REMOVE_UNUSED_NAMESPACE_DECLARATION_QUICKFIX_NAME), LIKE_UNUSED_SYMBOL, true)); } return problems; }
Example #22
Source File: UnusedNamespaceDeclarationInspection.java From intellij-xquery with Apache License 2.0 | 5 votes |
@Override public ProblemDescriptor[] checkFile(PsiFile file, InspectionManager manager, boolean isOnTheFly) { if (!(file instanceof XQueryFile)) { return null; } List<ProblemDescriptor> problems = getUnusedNamespaceDeclarationProblems((XQueryFile) file, manager); return problems.toArray(new ProblemDescriptor[problems.size()]); }
Example #23
Source File: DefaultFunctionNamespaceSameAsModuleNamespace.java From intellij-xquery with Apache License 2.0 | 5 votes |
private ProblemDescriptor[] createProblemDescriptor(InspectionManager manager, XQueryURILiteral defaultNamespaceFunctionDeclarationURILiteral) { ProblemDescriptor[] problemDescriptors = new ProblemDescriptor[1]; problemDescriptors[0] = manager.createProblemDescriptor(defaultNamespaceFunctionDeclarationURILiteral, "Default function namespace should be same as module namespace", (LocalQuickFix) null, GENERIC_ERROR_OR_WARNING, true); return problemDescriptors; }
Example #24
Source File: LoadStatementAnnotator.java From intellij with Apache License 2.0 | 5 votes |
private void validateImportTarget(@Nullable StringLiteral target) { if (target == null) { return; } String targetString = target.getStringContents(); if (targetString == null || targetString.startsWith(":") || targetString.startsWith("//") || targetString.startsWith("@") || targetString.length() < 2) { return; } if (targetString.startsWith("/")) { Annotation annotation = markWarning( target, "Deprecated load syntax; loaded Starlark module should by in label format."); InspectionManager inspectionManager = InspectionManager.getInstance(target.getProject()); ProblemDescriptor descriptor = inspectionManager.createProblemDescriptor( target, annotation.getMessage(), DeprecatedLoadQuickFix.INSTANCE, ProblemHighlightType.LIKE_DEPRECATED, true); annotation.registerFix(DeprecatedLoadQuickFix.INSTANCE, null, null, descriptor); return; } markError(target, "Invalid load syntax: missing Starlark module."); }
Example #25
Source File: UnusedImportsInspection.java From intellij-xquery with Apache License 2.0 | 5 votes |
private List<ProblemDescriptor> getUnusedImportProblems(XQueryFile xQueryFile, InspectionManager manager) { Collection<XQueryModuleImport> unusedImports = unusedImportsFinder.getUnusedNamespaceSources(xQueryFile); List<ProblemDescriptor> problems = new ArrayList<ProblemDescriptor>(); for (XQueryModuleImport unused : unusedImports) { problems.add(manager.createProblemDescriptor(unused, UNUSED_IMPORT, new RemoveElementQuickFix(REMOVE_UNUSED_IMPORT_QUICKFIX_NAME), LIKE_UNUSED_SYMBOL, true)); } return problems; }
Example #26
Source File: UnusedImportsInspection.java From intellij-xquery with Apache License 2.0 | 5 votes |
@Override public ProblemDescriptor[] checkFile(PsiFile file, InspectionManager manager, boolean isOnTheFly) { if (! (file instanceof XQueryFile)) { return null; } List<ProblemDescriptor> problems = getUnusedImportProblems((XQueryFile) file, manager); return problems.toArray(new ProblemDescriptor[problems.size()]); }
Example #27
Source File: MarklogicExtendedSyntaxInspection.java From intellij-xquery with Apache License 2.0 | 5 votes |
@Override public ProblemDescriptor[] checkFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly) { if (!(file instanceof XQueryFile)) { return null; } if (((XQueryFile) file).versionIsNotMarklogicSpecific()) { return findMarklogicExtendedSyntax(((XQueryFile) file), manager); } return null; }
Example #28
Source File: UnusedVariableInspection.java From intellij-xquery with Apache License 2.0 | 5 votes |
private ProblemDescriptor[] buildProblemDescriptionsForUnusedVariables(InspectionManager manager, List<XQueryVarName> unusedVariables) { ProblemDescriptor[] problemDescriptors = new ProblemDescriptor[unusedVariables.size()]; int ind = 0; for (XQueryVarName varName : unusedVariables) { final ProblemDescriptor problemDescriptor = manager.createProblemDescriptor(varName, getDescription(varName), (LocalQuickFix) null, LIKE_UNUSED_SYMBOL, true); problemDescriptors[ind++] = problemDescriptor; } return problemDescriptors; }
Example #29
Source File: AppliesToAnnotationDeclaredCorrectlyInspection.java From attic-polygene-java with Apache License 2.0 | 5 votes |
@NotNull private ProblemDescriptor createRemoveAppliesToFilterProblemDescriptor( @NotNull InspectionManager manager, @NotNull String problemMessage, @NotNull PsiAnnotation appliesToAnnotation ) { RemoveAppliesToFilterAnnotationFix fix = new RemoveAppliesToFilterAnnotationFix( appliesToAnnotation ); return manager.createProblemDescriptor( appliesToAnnotation, problemMessage, fix, GENERIC_ERROR_OR_WARNING ); }
Example #30
Source File: DuplicateKeyInspection.java From idea-php-dotenv-plugin with MIT License | 5 votes |
@NotNull private ProblemsHolder analyzeFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly) { DotEnvPsiElementsVisitor visitor = new DotEnvPsiElementsVisitor(); file.acceptChildren(visitor); ProblemsHolder problemsHolder = new ProblemsHolder(manager, file, isOnTheFly); Map<String, PsiElement> existingKeys = new HashMap<>(); Set<PsiElement> markedElements = new HashSet<>(); for(KeyValuePsiElement keyValue : visitor.getCollectedItems()) { final String key = keyValue.getKey(); if(existingKeys.containsKey(key)) { problemsHolder.registerProblem(keyValue.getElement(), "Duplicate key"); PsiElement markedElement = existingKeys.get(key); if(!markedElements.contains(markedElement)) { problemsHolder.registerProblem(markedElement, "Duplicate key"); markedElements.add(markedElement); } } else { existingKeys.put(key, keyValue.getElement()); } } return problemsHolder; }