Skip to content

Commit

Permalink
debt: remove reference to internal API com.intellij.ide.plugins.cl.Pl…
Browse files Browse the repository at this point in the history
…uginClassLoader

Signed-off-by: Fred Bricon <[email protected]>
  • Loading branch information
fbricon committed Dec 12, 2023
1 parent 7b5309e commit 1e0ce7e
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import com.intellij.ide.plugins.cl.PluginClassLoader;
import com.intellij.ide.plugins.cl.PluginAwareClassLoader;

import java.lang.reflect.Method;

Expand All @@ -34,14 +34,14 @@ private GsonManager() {
* @return the JsonElement instance with the given class loader and null otherwise.
*/
public static Object getJsonElementFromClassloader(JsonElement elt, ClassLoader actionClassLoader) {
if (elt.getClass().getClassLoader() == actionClassLoader || !(actionClassLoader instanceof PluginClassLoader)) {
if (elt.getClass().getClassLoader() == actionClassLoader || !(actionClassLoader instanceof PluginAwareClassLoader)) {
// - the JsonElement class has the same class loader as the IJ Action class loader
// - or the action class loader is not a PluginClassLoader
// --> do nothing
return null;
}
try {
Class<?> jsonParserClass = ((PluginClassLoader) actionClassLoader).tryLoadingClass(JsonParser.class.getName(), true);
Class<?> jsonParserClass = ((PluginAwareClassLoader) actionClassLoader).tryLoadingClass(JsonParser.class.getName(), true);
if (jsonParserClass != null) {
try {
// Try to get static method JsonParser#parseString from the new version of Gson
Expand Down

0 comments on commit 1e0ce7e

Please sign in to comment.