From dafec55bd6a17390b15131eb0e837f9b250b030f Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Mon, 12 Mar 2012 20:03:39 +0400 Subject: [PATCH] reverted --- .../roots/impl/LibraryOrderEntryBaseImpl.java | 36 +++++++++---------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/openapi/roots/impl/LibraryOrderEntryBaseImpl.java b/platform/lang-impl/src/com/intellij/openapi/roots/impl/LibraryOrderEntryBaseImpl.java index b54061961b3f..33b2495a0364 100644 --- a/platform/lang-impl/src/com/intellij/openapi/roots/impl/LibraryOrderEntryBaseImpl.java +++ b/platform/lang-impl/src/com/intellij/openapi/roots/impl/LibraryOrderEntryBaseImpl.java @@ -27,7 +27,6 @@ import com.intellij.util.ArrayUtil; import com.intellij.util.NullableFunction; import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import java.util.List; @@ -38,9 +37,9 @@ abstract class LibraryOrderEntryBaseImpl extends OrderEntryBaseImpl { private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.roots.impl.LibraryOrderEntryBaseImpl"); protected final ProjectRootManagerImpl myProjectRootManagerImpl; @NotNull protected DependencyScope myScope = DependencyScope.COMPILE; - @Nullable private RootProvider myCurrentlySubscribedRootProvider = null; + private RootProvider myCurrentlySubscribedRootProvider = null; - LibraryOrderEntryBaseImpl(@NotNull RootModelImpl rootModel, @NotNull ProjectRootManagerImpl instanceImpl) { + LibraryOrderEntryBaseImpl(RootModelImpl rootModel, ProjectRootManagerImpl instanceImpl) { super(rootModel); myProjectRootManagerImpl = instanceImpl; } @@ -49,65 +48,65 @@ abstract class LibraryOrderEntryBaseImpl extends OrderEntryBaseImpl { updateFromRootProviderAndSubscribe(); } - @Override @NotNull - public VirtualFile[] getFiles(@NotNull OrderRootType type) { + public VirtualFile[] getFiles(OrderRootType type) { if (type == OrderRootType.COMPILATION_CLASSES) { return getRootFiles(OrderRootType.CLASSES); } - if (type == OrderRootType.PRODUCTION_COMPILATION_CLASSES) { + else if (type == OrderRootType.PRODUCTION_COMPILATION_CLASSES) { if (!myScope.isForProductionCompile()) { return VirtualFile.EMPTY_ARRAY; } return getRootFiles(OrderRootType.CLASSES); } + else if (type == OrderRootType.CLASSES_AND_OUTPUT) { + return myScope == DependencyScope.PROVIDED ? VirtualFile.EMPTY_ARRAY : getRootFiles(OrderRootType.CLASSES); + } return getRootFiles(type); } - @Override @NotNull - public String[] getUrls(@NotNull OrderRootType type) { + public String[] getUrls(OrderRootType type) { LOG.assertTrue(!getRootModel().getModule().isDisposed()); RootProvider rootProvider = getRootProvider(); if (rootProvider == null) return ArrayUtil.EMPTY_STRING_ARRAY; if (type == OrderRootType.COMPILATION_CLASSES) { return rootProvider.getUrls(OrderRootType.CLASSES); } - if (type == OrderRootType.PRODUCTION_COMPILATION_CLASSES) { + else if (type == OrderRootType.PRODUCTION_COMPILATION_CLASSES) { if (!myScope.isForProductionCompile()) { return ArrayUtil.EMPTY_STRING_ARRAY; } return rootProvider.getUrls(OrderRootType.CLASSES); } + else if (type == OrderRootType.CLASSES_AND_OUTPUT) { + return myScope == DependencyScope.PROVIDED ? ArrayUtil.EMPTY_STRING_ARRAY : rootProvider.getUrls(OrderRootType.CLASSES); + } return rootProvider.getUrls(type); } - public VirtualFile[] getRootFiles(@NotNull OrderRootType type) { + public VirtualFile[] getRootFiles(OrderRootType type) { RootProvider rootProvider = getRootProvider(); return rootProvider == null ? VirtualFile.EMPTY_ARRAY : filterDirectories(rootProvider.getFiles(type)); } - protected VirtualFile[] filterDirectories(@NotNull VirtualFile[] files) { + protected VirtualFile[] filterDirectories(VirtualFile[] files) { List filtered = ContainerUtil.mapNotNull(files, new NullableFunction() { - @Override - public VirtualFile fun(@NotNull VirtualFile file) { + public VirtualFile fun(VirtualFile file) { return file.isDirectory() ? file : null; } }); return VfsUtil.toVirtualFileArray(filtered); } - @Nullable protected abstract RootProvider getRootProvider(); - @NotNull @SuppressWarnings({"UnusedDeclaration"}) - public String[] getRootUrls(@NotNull OrderRootType type) { + public String[] getRootUrls(OrderRootType type) { RootProvider rootProvider = getRootProvider(); return rootProvider == null ? ArrayUtil.EMPTY_STRING_ARRAY : rootProvider.getUrls(type); } - @Override @NotNull public final Module getOwnerModule() { return getRootModel().getModule(); @@ -115,7 +114,6 @@ abstract class LibraryOrderEntryBaseImpl extends OrderEntryBaseImpl { protected void updateFromRootProviderAndSubscribe() { getRootModel().makeExternalChange(new Runnable() { - @Override public void run() { resubscribe(getRootProvider()); } @@ -127,7 +125,7 @@ abstract class LibraryOrderEntryBaseImpl extends OrderEntryBaseImpl { subscribe(wrapper); } - private void subscribe(@Nullable RootProvider wrapper) { + private void subscribe(RootProvider wrapper) { if (wrapper != null) { myProjectRootManagerImpl.subscribeToRootProvider(this, wrapper); }