diff --git a/CHANGE-NOTES.md b/CHANGE-NOTES.md index ceba45ae6..a99ed53b8 100644 --- a/CHANGE-NOTES.md +++ b/CHANGE-NOTES.md @@ -1,6 +1,7 @@ # Changelog ## v5.1.1 +- Fixed: compatibility issues with latest 2024.3 EAPs ## v5.1.0 - Added: support for IntelliJ 2024.3. diff --git a/frontend/actions/src/main/java/com/virtuslab/gitmachete/frontend/actions/base/BaseSlideInBelowAction.java b/frontend/actions/src/main/java/com/virtuslab/gitmachete/frontend/actions/base/BaseSlideInBelowAction.java index f2b23a6f7..e303e3b37 100644 --- a/frontend/actions/src/main/java/com/virtuslab/gitmachete/frontend/actions/base/BaseSlideInBelowAction.java +++ b/frontend/actions/src/main/java/com/virtuslab/gitmachete/frontend/actions/base/BaseSlideInBelowAction.java @@ -7,12 +7,14 @@ import static com.virtuslab.gitmachete.frontend.resourcebundles.GitMacheteBundle.getString; import static org.apache.commons.text.StringEscapeUtils.escapeHtml4; +import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Collections; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.project.Project; import com.intellij.openapi.vcs.VcsNotifier; import git4idea.GitRemoteBranch; import git4idea.branch.GitNewBranchOptions; @@ -157,6 +159,7 @@ public void actionPerformed(AnActionEvent anActionEvent) { } @ContinuesInBackground + @SuppressWarnings("KotlinInternalInJava") private Tuple2<@Nullable String, UiThreadUnsafeRunnable> getBranchNameAndPreSlideInRunnable( GitRepository gitRepository, String startPoint, @@ -188,7 +191,26 @@ public void actionPerformed(AnActionEvent anActionEvent) { if (remoteBranch == null) { return Tuple.of(branchName, () -> { - val gitBranchCheckoutOperation = new GitBranchCheckoutOperation(project, Collections.singletonList(gitRepository)); + // TODO (#1938): replace with a non-reflective call once 2024.2 is no longer supported + Constructor constructor; + try { + // Since 243.19420.21-EAP-SNAPSHOT + constructor = GitBranchCheckoutOperation.class.getConstructor(Project.class, java.util.Collection.class); + } catch (NoSuchMethodException e) { + try { + // Before 243.19420.21-EAP-SNAPSHOT + constructor = GitBranchCheckoutOperation.class.getConstructor(Project.class, java.util.List.class); + } catch (NoSuchMethodException e1) { + throw new RuntimeException(e1); + } + } + GitBranchCheckoutOperation gitBranchCheckoutOperation; + try { + gitBranchCheckoutOperation = (GitBranchCheckoutOperation) constructor.newInstance(project, + Collections.singletonList(gitRepository)); + } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } val git4IdeaOptions = options.toGit4IdeaOptions(); try { // Since 233.10527.20-EAP-SNAPSHOT @@ -202,8 +224,8 @@ public void actionPerformed(AnActionEvent anActionEvent) { throw new RuntimeException(e); } } catch (NoSuchMethodException e) { - // Before 233.10527.20-EAP-SNAPSHOT try { + // Before 233.10527.20-EAP-SNAPSHOT Method perform = GitBranchCheckoutOperation.class.getDeclaredMethod("perform", String.class, GitNewBranchOptions.class); perform.invoke(gitBranchCheckoutOperation, startPoint, git4IdeaOptions); diff --git a/intellij-versions.properties b/intellij-versions.properties index 105e66649..aeb526b41 100644 --- a/intellij-versions.properties +++ b/intellij-versions.properties @@ -1,4 +1,4 @@ -eapOfLatestSupportedMajor=243.18137.10-EAP-SNAPSHOT +eapOfLatestSupportedMajor=243.19420.21-EAP-SNAPSHOT earliestSupportedMajor=2022.3 earliestSupportedMajorKotlinVersion=1.7 latestMinorsOfOldSupportedMajors=2022.3.3,2023.1.7,2023.2.8,2023.3.8,2024.1.6 diff --git a/src/test/java/com/virtuslab/archunit/UIThreadUnsafeMethodInvocationsTestSuite.java b/src/test/java/com/virtuslab/archunit/UIThreadUnsafeMethodInvocationsTestSuite.java index 0bc8460bb..b3eb5a47a 100644 --- a/src/test/java/com/virtuslab/archunit/UIThreadUnsafeMethodInvocationsTestSuite.java +++ b/src/test/java/com/virtuslab/archunit/UIThreadUnsafeMethodInvocationsTestSuite.java @@ -144,7 +144,7 @@ public void only_ui_thread_unsafe_code_units_should_call_other_ui_thread_unsafe_ "git4idea.ui.ComboBoxWithAutoCompletion.setPlaceholder(java.lang.String)", "git4idea.ui.ComboBoxWithAutoCompletion.setPrototypeDisplayValue(java.lang.Object)", "git4idea.ui.ComboBoxWithAutoCompletion.setUI(javax.swing.plaf.ComboBoxUI)", - "git4idea.ui.branch.GitBranchCheckoutOperation.(com.intellij.openapi.project.Project, java.util.List)", + "git4idea.ui.branch.GitBranchCheckoutOperation.(com.intellij.openapi.project.Project, java.util.Collection)", "git4idea.validators.GitBranchValidatorKt.checkRefName(java.lang.String)", "git4idea.validators.GitBranchValidatorKt.checkRefNameEmptyOrHead(java.lang.String)", "git4idea.validators.GitBranchValidatorKt.conflictsWithLocalBranch(java.util.Collection, java.lang.String)",