mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/amakeev/run-configs'
This commit is contained in:
@@ -633,8 +633,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());
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user