Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*bug fix* wrong overload invocation of overloaded functions - new idea #281

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Roee-BY
Copy link

@Roee-BY Roee-BY commented Feb 5, 2023

As a continuation of #247 , what if instead of throwing an error we will just warn the user and notify him which overload was selected.

the original pull request message:
"the function invocation mechanism was choosing the first compatible func according the the args and available overloads but there was a bug since some types that are available in java are unified into one type in JS for example JS number can be int double float or long hence choosing the first might cause a problem (in my case an android app crashes due to the incorrect overload). instead of the current mechanism i have implemented a mechanism that goes over all of the overloads and if there is more then one matching overload it invokes the method throwIfDispatcherAmbiguous(dispatcher) which will alert the user about the multiple a available overloads and ask his to choose which one to use."

Roee-BY and others added 4 commits September 22, 2022 13:45
the function invocation mechanism was choosing the first compatible func according the the args and available overloads but there was a bug since some types that are available in java are unified into one type in JS for example JS number can be int double float or long hence choosing the first might cause a problem (in my case an android app crashes due to the incorrect overload). instead of the current mechanism i have implemented a mechanism that goes over all of the overloads and if there is more then one matching overload it invokes the method throwIfDispatcherAmbiguous(dispatcher) which will alert the user about the multiple a available overloads and ask his to choose which one to use.
Copy link
Member

@oleavr oleavr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Apologies for taking so long to get to this, I've been spread too thin.

I think this is good approach, but this needs test coverage before it can be merged. We need to ensure that we cover the different cases.

lib/class-factory.js Outdated Show resolved Hide resolved
lib/class-factory.js Outdated Show resolved Hide resolved
lib/class-factory.js Outdated Show resolved Hide resolved
lib/class-factory.js Outdated Show resolved Hide resolved
@Roee-BY Roee-BY requested a review from oleavr May 14, 2024 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants