From 22ae1714e63a768d1c8d615c01cb27593e38b534 Mon Sep 17 00:00:00 2001 From: Anton Makeev Date: Thu, 12 Jan 2017 14:49:31 +0100 Subject: [PATCH] [reverted as unnecessary] ReflectionUtil.isPotentiallyThisCapturing (ref: CPP-8052 Newly created run configuration for executable target should automatically set executable to this target: inner TestData class instances cause leaks) --- .../src/com/intellij/util/ReflectionUtil.java | 4 ---- .../openapi/util/ReflectionUtilTest.java | 24 ------------------- 2 files changed, 28 deletions(-) diff --git a/platform/util/src/com/intellij/util/ReflectionUtil.java b/platform/util/src/com/intellij/util/ReflectionUtil.java index fde8aaa29fe4..6fac82974424 100644 --- a/platform/util/src/com/intellij/util/ReflectionUtil.java +++ b/platform/util/src/com/intellij/util/ReflectionUtil.java @@ -576,8 +576,4 @@ public class ReflectionUtil { return JBIterable.of(aClass.getSuperclass()).append(aClass.getInterfaces()); } }; - - public static boolean isPotentiallyThisCapturing(Class clazz) { - return clazz.getEnclosingClass() != null && !Modifier.isStatic(clazz.getModifiers()); - } } \ No newline at end of file diff --git a/platform/util/testSrc/com/intellij/openapi/util/ReflectionUtilTest.java b/platform/util/testSrc/com/intellij/openapi/util/ReflectionUtilTest.java index fcd84e834ee7..d1a86208d7fd 100644 --- a/platform/util/testSrc/com/intellij/openapi/util/ReflectionUtilTest.java +++ b/platform/util/testSrc/com/intellij/openapi/util/ReflectionUtilTest.java @@ -60,30 +60,6 @@ public class ReflectionUtilTest extends TestCase { assertNull(Reset.STATIC_STRING); } - @SuppressWarnings("InnerClassMayBeStatic") - class Nested {} - static class Inner { - @SuppressWarnings("InnerClassMayBeStatic") - class Nested2 {} - static class Inner2 {} - } - public void testIsPotentiallyThisCapturing() throws Exception { - class Local { - @SuppressWarnings("InnerClassMayBeStatic") - class Nested3 {} - } - - assertTrue(ReflectionUtil.isPotentiallyThisCapturing(new Object(){}.getClass())); - assertTrue(ReflectionUtil.isPotentiallyThisCapturing(Local.class)); - assertTrue(ReflectionUtil.isPotentiallyThisCapturing(Nested.class)); - assertTrue(ReflectionUtil.isPotentiallyThisCapturing(Local.Nested3.class)); - assertTrue(ReflectionUtil.isPotentiallyThisCapturing(Inner.Nested2.class)); - - assertFalse(ReflectionUtil.isPotentiallyThisCapturing(Object.class)); - assertFalse(ReflectionUtil.isPotentiallyThisCapturing(Inner.class)); - assertFalse(ReflectionUtil.isPotentiallyThisCapturing(Inner.Inner2.class)); - } - @Override protected void setUp() throws Exception { super.setUp();