MP-2974 Suppress class-not-found problems from transitive optional dependencies - #1550
Open
VLhsiotor wants to merge 1 commit into
Open
MP-2974 Suppress class-not-found problems from transitive optional dependencies#1550VLhsiotor wants to merge 1 commit into
VLhsiotor wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
[MP-2974] Unresolved optional dependencies must not be highlighted as errors.
The verifier already suppresses
ClassNotFoundProblems that originate from a plugin's optional parts when the triggering optional dependency is missing (this is expected — the code is only loaded when the optional dependency is present). However, this suppression only worked for directly declared, top-level optional descriptors. For transitive / nested optional dependencies the analysis silently did nothing, so those class-not-found problems leaked as errors even though the missing dependency is optional.Root cause
buildClassReachabilityGraph(ClassReachabilityAnalysis.kt) marks the classes of the optional parts so that problems inside them can be recognized as expected. It had two limitations:idePlugin.optionalDescriptors(the top level). An optional descriptor nested inside another optional descriptor (a transitive optional dependency) was never found, so its classes were not marked as optional.descriptor.dependency == missingDependency.dependency. Module dependencies are normalized by the graph builder into a proxy type that is not object-equal to the descriptor's original dependency, so module optional dependencies (e.g.com.intellij.modules.clion.cmake) never matched.Fix
PluginXmlUtil.getAllClassesReferencedFromXmldoes not descend into nested descriptors on its own).Only
ClassReachabilityAnalysis.ktchanges; the guard inPluginVerifieris untouched, sincegetDirectMissingDependencies()already contains the (flattened) transitive optional dependencies.Scope note
This addresses the case where an unresolved optional dependency produces actual compatibility errors (
ClassNotFoundProblem). It does not change how a missing optional dependency is rendered in the dependency tree (the informational(failed) (optional)line), which is a separate presentation concern.