File tree Expand file tree Collapse file tree 3 files changed +11
-26
lines changed Expand file tree Collapse file tree 3 files changed +11
-26
lines changed Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ import logger.LazyLogging
99import scala .collection .mutable .LinkedHashSet
1010
1111import scala .reflect .ClassTag
12- import firrtl . macros . Macros
12+ import java . lang . reflect . Modifier
1313
1414object Dependency {
1515 def apply [A <: DependencyAPI [_]: ClassTag ]: Dependency [A ] = {
@@ -33,7 +33,16 @@ object Dependency {
3333 }
3434 }
3535
36- private def isSingleton (obj : AnyRef ): Boolean = Macros .isSingletonImpl(obj)
36+ private def isSingleton (obj : Any ): Boolean = {
37+ val clazz = obj.getClass
38+ try {
39+ // Check if the class has a static field named "MODULE$"
40+ val moduleField = clazz.getDeclaredField(" MODULE$" )
41+ Modifier .isStatic(moduleField.getModifiers)
42+ } catch {
43+ case _ : NoSuchFieldException => false
44+ }
45+ }
3746}
3847
3948case class Dependency [+ A <: DependencyAPI [_]](id : Either [Class [_ <: A ], A with Singleton ]) {
You can’t perform that action at this time.
0 commit comments