private void restrictAPIVersions(VersionView upperBoundView) {
        VersionView selectedAPIView = getSelectedAPIVersionView();
        LanguageOrApiVersion selectedAPIVersion = selectedAPIView.getVersion();
        LanguageOrApiVersion upperBound = upperBoundView.getVersion();
        EnumEntries<LanguageVersion> languageVersions = LanguageVersion.getEntries();
        List<VersionView> permittedAPIVersions = new ArrayList<>(languageVersions.size());

        final VersionView latestStable = getLatestStableVersion();

        int index = 0;
        int latestStableIndex = languageVersions.size();
        for (LanguageVersion version : languageVersions) {
            if (index > latestStableIndex) {
                break;
            }
            ApiVersion apiVersion = ApiVersion.createByLanguageVersion(version);
            if (!isLessOrEqual(apiVersion, upperBound) && (index < latestStableIndex)) {
                latestStableIndex = index;
            }
            if (!apiVersion.isUnsupported()) {
                permittedAPIVersions.add(new VersionView.Specific(version));
            }
            index++;
        }

        if (isLessOrEqual(latestStable.getVersion(), upperBound) && !permittedAPIVersions.contains(latestStable)) {
            permittedAPIVersions.add(latestStable);
        }

        apiVersionComboBox.setModel(new MutableCollectionComboBoxModel<>(permittedAPIVersions));
        if (isJpsCompilerVisible()) {
            languageVersionComboBox.setModel(new MutableCollectionComboBoxModel<>(permittedAPIVersions));
        }

        VersionView selectedItem =
                VersionComparatorUtil.compare(selectedAPIVersion.getVersionString(), upperBound.getVersionString()) <= 0
                ? selectedAPIView
                : upperBoundView;
        apiVersionComboBox.setSelectedItem(selectedItem);
        if (isJpsCompilerVisible()) {
            languageVersionComboBox.setSelectedItem(selectedItem);
        }
    }
private void restrictAPIVersions(VersionView upperBoundView)