Giter Site home page Giter Site logo

`defaultFallback` annotation attribute on class cause `defaultFallback` handling conflicts on methods with different return types. about sentinel HOT 4 OPEN

dowenliu-xyz avatar dowenliu-xyz commented on July 22, 2024
`defaultFallback` annotation attribute on class cause `defaultFallback` handling conflicts on methods with different return types.

from sentinel.

Comments (4)

dowenliu-xyz avatar dowenliu-xyz commented on July 22, 2024

这个问题的修复似乎与 #3386 类似,也要修改 ResourceMetadataRegistry 这个类。我现在不能确定是否代码冲突。等到 #3395 被合并或其他什么方式解决了 #3386 再处理这个 Bug。

我会在这几天先尝试完成 idea 插件对类级别注解的支持。

from sentinel.

dowenliu-xyz avatar dowenliu-xyz commented on July 22, 2024

仔细分析了这个bug,不只是 class 级 annotation 会导致这个情况。
只要有多个不同返回值类型的方法的 blockHandlerfallbackdefaultFallback 尝试使用同一处理类的相同名称的处理方法,都有可能会触发这个 bug 里。
具体来说:

  • defaultFallback 不同的方法尝试使用相同处理类中同名的处理方法,只要有一个方法的处理器方法能成功解析就必定触发这个 bug
  • fallbackblockHandler 不同的方法如果方法返回值不同(至少没有继承关系),如果尝试使用同一类中同名处理方法,只要有一个方法的处理器能成功解析就会触发这个 bug。

    如果有多个解析成功,且它们的参数类型列表不同,会触发 #3386

  • 不论是 blockHandlerfallback 还是 defaultFallback ,如果声明了值,但全都解析失败,找不到实际可用的处理器方法,会巧合的避过这个 bug。

另外,因为类级别注解的查找、非 static 处理方法的查找还会跨继承关系查找,可能实际会有更复杂的冲突情况

from sentinel.

dowenliu-xyz avatar dowenliu-xyz commented on July 22, 2024

插件 Alibaba Sentinel Annotation Support 版本已更新,对类注解提供了相关支持,同时对该bug情形进行了检查报错:

Kapture.2024-05-23.at.16.04.07.mp4

from sentinel.

dowenliu-xyz avatar dowenliu-xyz commented on July 22, 2024

这个问题的修复似乎与 #3386 类似,也要修改 ResourceMetadataRegistry 这个类。我现在不能确定是否代码冲突。等到 #3395 被合并或其他什么方式解决了 #3386 再处理这个 Bug。

我会在这几天先尝试完成 idea 插件对类级别注解的支持。

有谁能给我讲下,在类上使用注解的设计意图、实际场景吗?我在想是修复这个bug,还是提议干掉类注解。

from sentinel.

Related Issues (20)

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.