From bd99585130e4d094c526a79f0c8971742651af27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexey=20Gy=C3=B6ri?= Date: Wed, 3 Feb 2021 03:10:34 -0800 Subject: [PATCH] [2020.3 compat] Add compatibility class for VMOptions VMoptions [started to return Path](https://github.com/JetBrains/intellij-community/commit/c11cdea14dd548bca9dba438bd74c329e966ba69#diff-297f3fbe14cedd57aa946f58e4b40010d9b4f4f40d5b84eec33f4ab99f0b9a91R61) instead of File. We mimic the old behavior for sdk versions < 203. PiperOrigin-RevId: 355359166 --- .../com/google/idea/sdkcompat/general/BaseSdkCompat.java | 9 +++++++++ .../com/google/idea/sdkcompat/general/BaseSdkCompat.java | 9 +++++++++ .../com/google/idea/sdkcompat/general/BaseSdkCompat.java | 9 +++++++++ .../com/google/idea/sdkcompat/general/BaseSdkCompat.java | 7 +++++++ 4 files changed, 34 insertions(+) diff --git a/sdkcompat/v193/com/google/idea/sdkcompat/general/BaseSdkCompat.java b/sdkcompat/v193/com/google/idea/sdkcompat/general/BaseSdkCompat.java index 43f32369bee..2b82510da82 100644 --- a/sdkcompat/v193/com/google/idea/sdkcompat/general/BaseSdkCompat.java +++ b/sdkcompat/v193/com/google/idea/sdkcompat/general/BaseSdkCompat.java @@ -3,6 +3,7 @@ import com.intellij.codeInsight.daemon.LineMarkerInfo; import com.intellij.codeInsight.daemon.LineMarkerProvider; import com.intellij.codeInsight.template.impl.TemplateManagerImpl; +import com.intellij.diagnostic.VMOptions; import com.intellij.diff.DiffContentFactoryImpl; import com.intellij.dvcs.branch.BranchType; import com.intellij.dvcs.branch.DvcsBranchManager; @@ -37,6 +38,7 @@ import com.intellij.usages.Usage; import com.intellij.util.ContentUtilEx; import com.intellij.util.Processor; +import java.io.File; import java.nio.charset.Charset; import java.nio.file.Path; import java.util.Collection; @@ -188,4 +190,11 @@ public static void addTabbedContent( @Nullable Disposable childDisposable) { ContentUtilEx.addTabbedContent(manager, contentComponent, groupPrefix, tabName, select); } + + // #api202: Method return type changed in 2020.3 from File to Path + @Nullable + public static Path getVMOptionsWriteFile() { + File file = VMOptions.getWriteFile(); + return file == null ? null : file.toPath(); + } } diff --git a/sdkcompat/v201/com/google/idea/sdkcompat/general/BaseSdkCompat.java b/sdkcompat/v201/com/google/idea/sdkcompat/general/BaseSdkCompat.java index 508392c3111..fc0ed18e68b 100644 --- a/sdkcompat/v201/com/google/idea/sdkcompat/general/BaseSdkCompat.java +++ b/sdkcompat/v201/com/google/idea/sdkcompat/general/BaseSdkCompat.java @@ -3,6 +3,7 @@ import com.intellij.codeInsight.daemon.LineMarkerInfo; import com.intellij.codeInsight.daemon.LineMarkerProvider; import com.intellij.codeInsight.template.impl.TemplateManagerImpl; +import com.intellij.diagnostic.VMOptions; import com.intellij.diff.DiffContentFactoryImpl; import com.intellij.dvcs.branch.BranchType; import com.intellij.dvcs.branch.DvcsBranchManager; @@ -37,6 +38,7 @@ import com.intellij.usages.Usage; import com.intellij.util.ContentUtilEx; import com.intellij.util.Processor; +import java.io.File; import java.nio.charset.Charset; import java.nio.file.Path; import java.util.Collection; @@ -184,4 +186,11 @@ public static void addTabbedContent( @Nullable Disposable childDisposable) { ContentUtilEx.addTabbedContent(manager, contentComponent, groupPrefix, tabName, select); } + + // #api202: Method return type changed in 2020.3 from File to Path + @Nullable + public static Path getVMOptionsWriteFile() { + File file = VMOptions.getWriteFile(); + return file == null ? null : file.toPath(); + } } diff --git a/sdkcompat/v202/com/google/idea/sdkcompat/general/BaseSdkCompat.java b/sdkcompat/v202/com/google/idea/sdkcompat/general/BaseSdkCompat.java index a72284fe674..b0a65368c5f 100644 --- a/sdkcompat/v202/com/google/idea/sdkcompat/general/BaseSdkCompat.java +++ b/sdkcompat/v202/com/google/idea/sdkcompat/general/BaseSdkCompat.java @@ -3,6 +3,7 @@ import com.intellij.codeInsight.daemon.LineMarkerInfo; import com.intellij.codeInsight.daemon.LineMarkerProvider; import com.intellij.codeInsight.template.impl.TemplateManagerImpl; +import com.intellij.diagnostic.VMOptions; import com.intellij.diff.DiffContentFactoryImpl; import com.intellij.dvcs.branch.BranchType; import com.intellij.dvcs.branch.DvcsBranchManager; @@ -37,6 +38,7 @@ import com.intellij.usages.Usage; import com.intellij.util.ContentUtilEx; import com.intellij.util.Processor; +import java.io.File; import java.nio.charset.Charset; import java.nio.file.Path; import java.util.Collection; @@ -187,4 +189,11 @@ public static void addTabbedContent( ContentUtilEx.addTabbedContent( manager, contentComponent, groupPrefix, tabName, select, childDisposable); } + + // #api202: Method return type changed in 2020.3 from File to Path + @Nullable + public static Path getVMOptionsWriteFile() { + File file = VMOptions.getWriteFile(); + return file == null ? null : file.toPath(); + } } diff --git a/sdkcompat/v203/com/google/idea/sdkcompat/general/BaseSdkCompat.java b/sdkcompat/v203/com/google/idea/sdkcompat/general/BaseSdkCompat.java index a72284fe674..54e7da4e749 100644 --- a/sdkcompat/v203/com/google/idea/sdkcompat/general/BaseSdkCompat.java +++ b/sdkcompat/v203/com/google/idea/sdkcompat/general/BaseSdkCompat.java @@ -3,6 +3,7 @@ import com.intellij.codeInsight.daemon.LineMarkerInfo; import com.intellij.codeInsight.daemon.LineMarkerProvider; import com.intellij.codeInsight.template.impl.TemplateManagerImpl; +import com.intellij.diagnostic.VMOptions; import com.intellij.diff.DiffContentFactoryImpl; import com.intellij.dvcs.branch.BranchType; import com.intellij.dvcs.branch.DvcsBranchManager; @@ -187,4 +188,10 @@ public static void addTabbedContent( ContentUtilEx.addTabbedContent( manager, contentComponent, groupPrefix, tabName, select, childDisposable); } + + // #api202: Method return type changed in 2020.3 from File to Path + @Nullable + public static Path getVMOptionsWriteFile() { + return VMOptions.getWriteFile(); + } }