From b13f32b568e54bb0470dbb2ed4f7b03923d86e11 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Wed, 2 Sep 2015 19:03:04 +0300 Subject: [PATCH] check for project leak method --- .../openapi/project/impl/ProjectImpl.java | 2 +- .../com/intellij/testFramework/LeakHunter.java | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectImpl.java b/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectImpl.java index e8ebea95c75b..7158a5c424fd 100644 --- a/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectImpl.java @@ -110,7 +110,7 @@ public class ProjectImpl extends PlatformComponentManagerImpl implements Project } @TestOnly - boolean isLight() { + public boolean isLight() { return myLight; } diff --git a/platform/testFramework/src/com/intellij/testFramework/LeakHunter.java b/platform/testFramework/src/com/intellij/testFramework/LeakHunter.java index 9e83afc215ae..4e6ec007e776 100644 --- a/platform/testFramework/src/com/intellij/testFramework/LeakHunter.java +++ b/platform/testFramework/src/com/intellij/testFramework/LeakHunter.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,12 +47,6 @@ import java.util.Map; public class LeakHunter { private static final Map allFields = new THashMap(); private static final Field[] EMPTY_FIELD_ARRAY = new Field[0]; - private static final Processor NOT_DEFAULT_PROJECT = new Processor() { - @Override - public boolean process(Project project) { - return !project.isDefault(); - } - }; @NotNull private static Field[] getAllFields(@NotNull Class aClass) { @@ -158,8 +152,14 @@ public class LeakHunter { private static final Key REPORTED_LEAKED = Key.create("REPORTED_LEAKED"); @TestOnly public static void checkProjectLeak() throws Exception { - checkLeak(ApplicationManager.getApplication(), ProjectImpl.class); - checkLeak(Extensions.getRootArea(), ProjectImpl.class, NOT_DEFAULT_PROJECT); + Processor isReallyLeak = new Processor() { + @Override + public boolean process(Project project) { + return !project.isDefault() && !((ProjectImpl)project).isLight(); + } + }; + checkLeak(ApplicationManager.getApplication(), ProjectImpl.class, isReallyLeak); + checkLeak(Extensions.getRootArea(), ProjectImpl.class, isReallyLeak); } @TestOnly