Giter VIP home page Giter VIP logo

Comments (8)

Taywee avatar Taywee commented on July 19, 2024

https://stackoverflow.com/questions/19313259/java-get-method-with-interface-parameter-with-its-implementation

It seems that this can be resolved by working through permutations of the argument's base classes in the case of a NoSuchMethodException. This can explode exponentially in the performance impact (In the case of an actual missing method when using 3 arguments with 10 base classes each, it will incur 1000 lookups before actually giving up), but normal use shouldn't cause any of these kinds of issues. In any case memoization can curtail most expense in repeated calls.

from ublu.

Taywee avatar Taywee commented on July 19, 2024

It's also notable that the JavaCallHelper won't work when a method is declared in an interface or superclass, because it uses getDeclaredMethod instead of getMethod.

from ublu.

jwoehr avatar jwoehr commented on July 19, 2024

from ublu.

Taywee avatar Taywee commented on July 19, 2024

prrimarg doesn't work, because it still manages it as a String, and doesn't find the method that takes a CharSequence, as String.contains requires (CharSequence is an interface that String implements). I can make these changes, I was just opening the issue somewhere so I wouldn't forget.

from ublu.

jwoehr avatar jwoehr commented on July 19, 2024

from ublu.

jwoehr avatar jwoehr commented on July 19, 2024

Anyway, please fix calljava if you are inspired to do so and can do so without breaking existing code. Try to avoid a performance hit. I want to use calljava more and more to create extensions rather than expand the base system.

from ublu.

Taywee avatar Taywee commented on July 19, 2024

It shouldn't break existing code. It should not cause a performance hit, because the classes will be checked as-is first before checking interfaces and superclasses, so if there is an exact match, it should operate in constant time as before. With memoization, the individual call worst-case is polynomial time, but the amortized time would reduce to constant, but this only really helps for long-running programs and in loops.

Either way, existing working uses should continue to work as expected with no performance impact, and cases that returned a NoSuchMethodException will be fixed with a one-time performance impact per session.

from ublu.

jwoehr avatar jwoehr commented on July 19, 2024

from ublu.

Related Issues (15)

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.