Skip to content

Commit

Permalink
[2020.3 compat] Add compatibility class for VMOptions
Browse files Browse the repository at this point in the history
VMoptions [started to return Path](JetBrains/intellij-community@c11cdea#diff-297f3fbe14cedd57aa946f58e4b40010d9b4f4f40d5b84eec33f4ab99f0b9a91R61) instead of File. We mimic the old behavior for sdk versions < 203.

PiperOrigin-RevId: 357899352
  • Loading branch information
AlexeyGy authored and copybara-github committed Feb 17, 2021
1 parent 3da61a1 commit 58c2bf1
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}
}

0 comments on commit 58c2bf1

Please sign in to comment.