diff --git a/java/testFramework/src/com/intellij/testFramework/PsiTestCase.java b/java/testFramework/src/com/intellij/testFramework/PsiTestCase.java index 9568c1193eca..4015fb4b3ce8 100644 --- a/java/testFramework/src/com/intellij/testFramework/PsiTestCase.java +++ b/java/testFramework/src/com/intellij/testFramework/PsiTestCase.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. @@ -69,22 +69,28 @@ public abstract class PsiTestCase extends ModuleTestCase { super.tearDown(); } - protected PsiFile createDummyFile(String fileName, String text) throws IncorrectOperationException { + @NotNull + protected PsiFile createDummyFile(@NotNull String fileName, @NotNull String text) throws IncorrectOperationException { FileType type = FileTypeRegistry.getInstance().getFileTypeByFileName(fileName); return PsiFileFactory.getInstance(myProject).createFileFromText(fileName, type, text); } - protected PsiFile createFile(@NonNls String fileName, String text) throws Exception { + @NotNull + protected PsiFile createFile(@NonNls @NotNull String fileName, @NotNull String text) throws Exception { return createFile(myModule, fileName, text); } - protected PsiFile createFile(Module module, String fileName, String text) throws Exception { + + @NotNull + protected PsiFile createFile(@NotNull Module module, @NotNull String fileName, @NotNull String text) throws Exception { File dir = createTempDirectory(); VirtualFile vDir = LocalFileSystem.getInstance().refreshAndFindFileByPath(dir.getCanonicalPath().replace(File.separatorChar, '/')); + assert vDir != null : dir; return createFile(module, vDir, fileName, text); } - protected PsiFile createFile(final Module module, final VirtualFile vDir, final String fileName, final String text) throws IOException { + @NotNull + protected PsiFile createFile(@NotNull final Module module, @NotNull final VirtualFile vDir, @NotNull final String fileName, @NotNull final String text) throws IOException { return new WriteAction() { @Override protected void run(Result result) throws Throwable { diff --git a/platform/platform-impl/src/com/intellij/openapi/project/ex/ProjectManagerEx.java b/platform/platform-impl/src/com/intellij/openapi/project/ex/ProjectManagerEx.java index e89294983da4..ad61d683d3fb 100644 --- a/platform/platform-impl/src/com/intellij/openapi/project/ex/ProjectManagerEx.java +++ b/platform/platform-impl/src/com/intellij/openapi/project/ex/ProjectManagerEx.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 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. @@ -57,6 +57,7 @@ public abstract class ProjectManagerEx extends ProjectManager { public abstract void openTestProject(@NotNull Project project); @TestOnly + @NotNull // returns remaining open test projects public abstract Collection closeTestProject(@NotNull Project project);