Skip to content

920: Added new Magento version support (2.4.4-beta4) for the UCT feature #922

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified resources/uct/api/indexes.API_COVERAGE.idc
Binary file not shown.
Binary file not shown.
Binary file modified resources/uct/existence/indexes.EXISTENCE.idc
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ public enum SupportedVersion {
V2422("2.4.2-p2"),
V243("2.4.3"),
V2431("2.4.3-p1"),
V2441("2.4.4-beta1"),
V2442("2.4.4-beta2");
V2444("2.4.4-beta4");

private final String version;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ public final class VersionStateManager {
private final ExistenceStateIndex existenceStateIndex;
private final ApiCoverageStateIndex apiCoverageStateIndex;
private final Boolean isSetIgnoreFlag;
private final SupportedVersion currentVersion;
private final SupportedVersion targetVersion;
private SupportedVersion currentVersion;
private SupportedVersion targetVersion;
private final List<SupportedVersion> versionsToLoad;

/**
Expand All @@ -48,6 +48,7 @@ public static synchronized VersionStateManager getInstance(
)) {
instance = new VersionStateManager(project);
}

return instance;
}

Expand Down Expand Up @@ -115,6 +116,8 @@ private VersionStateManager(final @NotNull Project project) {
currentVersion = settingsService.getCurrentVersionOrDefault();
targetVersion = settingsService.getTargetVersion();
versionsToLoad = new LinkedList<>();
// Correct settings if stored data isn't valid for current supported versions state.
correctSettings(project);

deprecationStateIndex = new DeprecationStateIndex();
compute(deprecationStateIndex);
Expand All @@ -126,6 +129,35 @@ private VersionStateManager(final @NotNull Project project) {
compute(apiCoverageStateIndex);
}

/**
* Correct settings if corrupted.
*
* @param project Project
*/
@SuppressWarnings("PMD.AvoidSynchronizedAtMethodLevel")
private synchronized void correctSettings(final @NotNull Project project) {
final UctSettingsService settingsService = UctSettingsService.getInstance(project);
final List<String> allVersions = SupportedVersion.getSupportedVersions();

if (currentVersion == null
|| SupportedVersion.getVersion(currentVersion.getVersion()) == null) {
final SupportedVersion correctCurrentVersion = SupportedVersion.getVersion(
allVersions.get(0)
);
settingsService.setCurrentVersion(correctCurrentVersion);
currentVersion = correctCurrentVersion;
}

if (targetVersion == null
|| SupportedVersion.getVersion(targetVersion.getVersion()) == null) {
final SupportedVersion correctTargetVersion = SupportedVersion.getVersion(
allVersions.get(allVersions.size() - 1)
);
settingsService.setTargetVersion(correctTargetVersion);
targetVersion = correctTargetVersion;
}
}

/**
* Check if current instance is valid for settings.
*
Expand Down