Giter Site home page Giter Site logo

Comments (4)

zhaoyb1990 avatar zhaoyb1990 commented on May 19, 2024

不太能理解,实际参数类型和声明类型理论基类是一致的,换成声明类型就没问题了吗?(我理解如果按你的分析实际参数类型是Runnable声明类型是Callable,那么报错会发生在TtlCallable.get((Callable)parameterArray[0])

针对这个错误异常,TtlRunnable.get((Runnable)parameterArray[0])既然已经生效,说明此处的parameterArray[0]确实是一个Runnable,那么即使没有启用ttl,这个也会有强转异常。

from jvm-sandbox-repeater.

dknebula avatar dknebula commented on May 19, 2024

不太能理解,实际参数类型和声明类型理论基类是一致的,换成声明类型就没问题了吗?(我理解如果按你的分析实际参数类型是Runnable声明类型是Callable,那么报错会发生在TtlCallable.get((Callable)parameterArray[0])

针对这个错误异常,TtlRunnable.get((Runnable)parameterArray[0])既然已经生效,说明此处的parameterArray[0]确实是一个Runnable,那么即使没有启用ttl,这个也会有强转异常。

parameterArray[0] instanceOf Runnable
parameterArray[0] instanceOf Callable
都是True的情况会报错

SomeTask someTask = ...

// someTask 既是Callable, 也是Runnable
assert someTask instanceOf Callable
assert someTask instanceOf Runnable

// 用强转, 显式声明调用 ExecutorService.submit(Callable task)
executorService.submit((Callable) someTask); // repeater会报错

from jvm-sandbox-repeater.

zhaoyb1990 avatar zhaoyb1990 commented on May 19, 2024

OK,了解了,目前这种写法确实有问题,未考虑到同时实现两个的情况,有空的话帮忙提个PR。谢谢。

from jvm-sandbox-repeater.

zhaoyb1990 avatar zhaoyb1990 commented on May 19, 2024

Merged

from jvm-sandbox-repeater.

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.