From 38f46b04c367a2ac3863ca3907c5d22c873dd56a Mon Sep 17 00:00:00 2001 From: "Gregory.Shrago" Date: Mon, 13 Aug 2012 22:10:07 +0400 Subject: [PATCH] fix return RMI types 2 --- .../intellij/execution/rmi/RemoteUtil.java | 20 ++++--------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/platform/util/src/com/intellij/execution/rmi/RemoteUtil.java b/platform/util/src/com/intellij/execution/rmi/RemoteUtil.java index a0f9984d956a..1c323c549f51 100644 --- a/platform/util/src/com/intellij/execution/rmi/RemoteUtil.java +++ b/platform/util/src/com/intellij/execution/rmi/RemoteUtil.java @@ -114,8 +114,8 @@ public class RemoteUtil { }, classLoader); } - public static T handleRemoteResult(Object value, Object requestor) throws Exception { - return RemoteUtil.handleRemoteResult(value, Object.class, requestor.getClass().getClassLoader(), false); + public static T handleRemoteResult(Object value, Class clazz, Object requestor) throws Exception { + return RemoteUtil.handleRemoteResult(value, clazz, requestor.getClass().getClassLoader(), false); } private static T handleRemoteResult(Object value, Class methodReturnType, ClassLoader classLoader, boolean substituteClassLoader) throws Exception { @@ -128,20 +128,8 @@ public class RemoteUtil { result = substituteClassLoader? substituteClassLoader(value, classLoader) : value; } } - else if (value instanceof Collection) { - Collection c = (Collection)value; - - if (value instanceof Set) { - LinkedHashSet set = new LinkedHashSet(); - for (Object o : c) { - set.add(handleRemoteResult(o, Object.class, classLoader, substituteClassLoader)); - } - - result = set; - } - else { - result = Arrays.asList((Object[])handleRemoteResult(c.toArray(), Object.class, classLoader, substituteClassLoader)); - } + else if (value instanceof List && methodReturnType.isInterface()) { + result = Arrays.asList((Object[])handleRemoteResult(((List)value).toArray(), Object.class, classLoader, substituteClassLoader)); } else if (value instanceof Object[]) { Object[] array = (Object[])value;