diff options
author | Li Haoyi <haoyi.sg@gmail.com> | 2018-01-13 22:31:32 -0800 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2018-01-13 22:31:32 -0800 |
commit | ff7eadd0d926a980ae31261bb84900640ca4cd9b (patch) | |
tree | 4269604b19a9471b124743bbeb94ff536863704b /core/src | |
parent | 7589250f87dd70e52cec923dcda5d554a4c7bbcb (diff) | |
download | mill-ff7eadd0d926a980ae31261bb84900640ca4cd9b.tar.gz mill-ff7eadd0d926a980ae31261bb84900640ca4cd9b.tar.bz2 mill-ff7eadd0d926a980ae31261bb84900640ca4cd9b.zip |
Make `Module#reflect` only return instance methods
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/main/scala/mill/define/Module.scala | 3 | ||||
-rw-r--r-- | core/src/test/scala/mill/discover/ConsistencyTests.scala | 4 | ||||
-rw-r--r-- | core/src/test/scala/mill/discover/DiscoveredTests.scala | 4 |
3 files changed, 7 insertions, 4 deletions
diff --git a/core/src/main/scala/mill/define/Module.scala b/core/src/main/scala/mill/define/Module.scala index 064741c4..5eee6ddf 100644 --- a/core/src/main/scala/mill/define/Module.scala +++ b/core/src/main/scala/mill/define/Module.scala @@ -1,5 +1,7 @@ package mill.define +import java.lang.reflect.Modifier + import ammonite.main.Router.Overrides import ammonite.ops.Path @@ -61,6 +63,7 @@ class Module(implicit ctx0: Module.Ctx) extends mill.moduledefs.Cacher{ .getClass .getMethods .filter(_.getParameterCount == 0) + .filter(x => (x.getModifiers & Modifier.STATIC) == 0) .filter(implicitly[ClassTag[T]].runtimeClass isAssignableFrom _.getReturnType) .map(_.invoke(this).asInstanceOf[T]) } diff --git a/core/src/test/scala/mill/discover/ConsistencyTests.scala b/core/src/test/scala/mill/discover/ConsistencyTests.scala index f29273df..dab60a01 100644 --- a/core/src/test/scala/mill/discover/ConsistencyTests.scala +++ b/core/src/test/scala/mill/discover/ConsistencyTests.scala @@ -45,13 +45,13 @@ object ConsistencyTests extends TestSuite{ val inconsistent = Discovered.consistencyCheck( Discovered.mapping(borkedCachedDiamond2) ) - assert(inconsistent == expected) + assert(inconsistent.toSet == expected.toSet) } 'borkedCachedDiamond3 - { val inconsistent = Discovered.consistencyCheck( Discovered.mapping(borkedCachedDiamond3) ) - assert(inconsistent == expected) + assert(inconsistent.toSet == expected.toSet) } } diff --git a/core/src/test/scala/mill/discover/DiscoveredTests.scala b/core/src/test/scala/mill/discover/DiscoveredTests.scala index 06887b93..dfa39050 100644 --- a/core/src/test/scala/mill/discover/DiscoveredTests.scala +++ b/core/src/test/scala/mill/discover/DiscoveredTests.scala @@ -21,12 +21,12 @@ object DiscoveredTests extends TestSuite{ } val flattenedHierarchy = flatten(discovered.mirror) - val expectedHierarchy = Seq( + val expectedHierarchy = Set( nestedModule, nestedModule.classInstance, nestedModule.nested ) - assert(flattenedHierarchy == expectedHierarchy) + assert(flattenedHierarchy.toSet == expectedHierarchy) val mapped = discovered.segmentsToTargets |