From 7d0767b77e51494f4aaf75e9c7f07d57dd83d4ba Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Wed, 23 Sep 2009 11:52:49 +0400 Subject: [PATCH] IDEADEV-40483 Maven: runtime dependencies should be on the test classpath --- .../module/impl/scopes/ModuleWithDependenciesScope.java | 6 ++---- .../openapi/roots/impl/LibraryOrderEntryBaseImpl.java | 6 ------ .../intellij/openapi/roots/impl/ModuleOrderEntryImpl.java | 4 ++-- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/openapi/module/impl/scopes/ModuleWithDependenciesScope.java b/platform/lang-impl/src/com/intellij/openapi/module/impl/scopes/ModuleWithDependenciesScope.java index 3ecd251847f9..e5005dfd5b69 100644 --- a/platform/lang-impl/src/com/intellij/openapi/module/impl/scopes/ModuleWithDependenciesScope.java +++ b/platform/lang-impl/src/com/intellij/openapi/module/impl/scopes/ModuleWithDependenciesScope.java @@ -88,10 +88,8 @@ public class ModuleWithDependenciesScope extends GlobalSearchScope { } } if (orderEntry instanceof ExportableOrderEntry) { - if (((ExportableOrderEntry)orderEntry).getScope() == DependencyScope.RUNTIME) { - continue; - } - if (!myIncludeTests && ((ExportableOrderEntry)orderEntry).getScope() == DependencyScope.TEST) { + DependencyScope scope = ((ExportableOrderEntry)orderEntry).getScope(); + if (!myIncludeTests && (scope == DependencyScope.TEST || scope == DependencyScope.RUNTIME)) { continue; } } 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 9a2c91d6c2d3..3163a14f3195 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 @@ -73,9 +73,6 @@ abstract class LibraryOrderEntryBaseImpl extends OrderEntryBaseImpl { @NotNull public VirtualFile[] getFiles(OrderRootType type) { if (type == OrderRootType.COMPILATION_CLASSES) { - if (myScope == DependencyScope.RUNTIME) { - return VirtualFile.EMPTY_ARRAY; - } return myRootContainers.get(OrderRootType.CLASSES).getDirectories(); } else if (type == OrderRootType.PRODUCTION_COMPILATION_CLASSES) { @@ -94,9 +91,6 @@ abstract class LibraryOrderEntryBaseImpl extends OrderEntryBaseImpl { public String[] getUrls(OrderRootType type) { LOG.assertTrue(!getRootModel().getModule().isDisposed()); if (type == OrderRootType.COMPILATION_CLASSES) { - if (myScope == DependencyScope.RUNTIME) { - return ArrayUtil.EMPTY_STRING_ARRAY; - } return myRootContainers.get(OrderRootType.CLASSES).getUrls(); } else if (type == OrderRootType.PRODUCTION_COMPILATION_CLASSES) { diff --git a/platform/lang-impl/src/com/intellij/openapi/roots/impl/ModuleOrderEntryImpl.java b/platform/lang-impl/src/com/intellij/openapi/roots/impl/ModuleOrderEntryImpl.java index 5dd4c4533bee..3ed3798b43a0 100644 --- a/platform/lang-impl/src/com/intellij/openapi/roots/impl/ModuleOrderEntryImpl.java +++ b/platform/lang-impl/src/com/intellij/openapi/roots/impl/ModuleOrderEntryImpl.java @@ -110,7 +110,7 @@ public class ModuleOrderEntryImpl extends OrderEntryBaseImpl implements ModuleOr VirtualFile[] getFiles(OrderRootType type, Set processed) { if (myModule != null && !processed.contains(myModule) && !myModule.isDisposed()) { processed.add(myModule); - if (myScope == DependencyScope.RUNTIME && (type == OrderRootType.COMPILATION_CLASSES || type == OrderRootType.PRODUCTION_COMPILATION_CLASSES)) { + if (myScope == DependencyScope.RUNTIME && type == OrderRootType.PRODUCTION_COMPILATION_CLASSES) { return VirtualFile.EMPTY_ARRAY; } if (myScope == DependencyScope.TEST && type == OrderRootType.PRODUCTION_COMPILATION_CLASSES) { @@ -134,7 +134,7 @@ public class ModuleOrderEntryImpl extends OrderEntryBaseImpl implements ModuleOr public String[] getUrls (OrderRootType rootType, Set processed) { if (myModule != null && !processed.contains(myModule) && !myModule.isDisposed()) { processed.add(myModule); - if (myScope == DependencyScope.RUNTIME && (rootType == OrderRootType.COMPILATION_CLASSES || rootType == OrderRootType.PRODUCTION_COMPILATION_CLASSES)) { + if (myScope == DependencyScope.RUNTIME && rootType == OrderRootType.PRODUCTION_COMPILATION_CLASSES) { return ArrayUtil.EMPTY_STRING_ARRAY; } if (myScope == DependencyScope.TEST && rootType == OrderRootType.PRODUCTION_COMPILATION_CLASSES) {