From 51f58843e9bc82de2d3923eb25aaf49deeb4d1b1 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Thu, 27 Aug 2015 10:11:10 +0200 Subject: [PATCH] attempt to fix cdataAfterNewLine test --- .../src/com/intellij/util/ReflectionUtil.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/platform/util/src/com/intellij/util/ReflectionUtil.java b/platform/util/src/com/intellij/util/ReflectionUtil.java index bb59c184bd81..2ce688100ef2 100644 --- a/platform/util/src/com/intellij/util/ReflectionUtil.java +++ b/platform/util/src/com/intellij/util/ReflectionUtil.java @@ -488,22 +488,32 @@ public class ReflectionUtil { for (Annotation annotation : aClass.getAnnotations()) { if (annotation.annotationType().getName().equals("kotlin.jvm.internal.KotlinClass")) { Constructor[] constructors = aClass.getDeclaredConstructors(); - if (constructors.length > 0) { + Exception exception = e; + ctorLoop: + for (int i = 0; i < constructors.length; i++) { try { - Constructor constructor = constructors[0]; + Constructor constructor = constructors[i]; try { constructor.setAccessible(true); } catch (Throwable ignored) { } + Class[] parameterTypes = constructor.getParameterTypes(); + for (Class type : parameterTypes) { + if (type.getName().equals("kotlin.jvm.internal.DefaultConstructorMarker")) { + continue ctorLoop; + } + } + //noinspection unchecked - return (T)constructor.newInstance(new Object[constructor.getParameterTypes().length]); + return (T)constructor.newInstance(new Object[parameterTypes.length]); } catch (Exception e1) { - throw new RuntimeException(e1); + exception = e1; } } + throw new RuntimeException(exception); } }