Giter Site home page Giter Site logo

xiazunyang / discovery Goto Github PK

View Code? Open in Web Editor NEW
53.0 1.0 10.0 225 KB

辅助Android开发者在多模块工程间跨模块获取接口(或抽象类)的实现类的开源库,可实现模块的顺序初始化、业务的动态组合等实现。基于AGP和ASM开发。

Kotlin 100.00%
gradle asm multiple-modules modularization android arouter spi dag-init like-router

discovery's Issues

获取不到父类为抽象类的实现

定义如下:

@Discoverable
abstract class InitTask {

    abstract fun wang(): String
}

实现类:

@Implementation
class SampleTask : InitTask() {
    override fun wang(): String {
        return "I'm sample task"
    }
}

@Implementation
class SampleTask2 : InitTask() {
    override fun wang(): String {
        return "I'm sample task2"
    }
}

获取代码:

val allInstances = Discoveries.getAllInstances<InitTask>() // size = 0
val allImplementClasses = Discoveries.getAllImplementClasses<InitTask>() // size = 0

PS:

  • Plugin 版本测试了 1.4.0 和 1.4.1 版本
  • 相同配置 InitTask 定义为 interface 时获取代码可以正常工作

最小可复现工程:
DiscoveryDemo.zip

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.