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

Enhance DSL API to work around Nashorn interoperability issue with overloading and varargs #3644

Closed
lukaseder opened this issue Sep 20, 2014 · 0 comments

Comments

@lukaseder
Copy link
Member

When using jOOQ with Nashorn, there may be a couple of interoperability issues related to overloading and varargs, as documented here:
http://blog.jooq.org/2014/09/19/learn-how-nashorn-prevents-effective-api-evolution-on-a-new-level

In short, when there are two methods like these:

interface SelectFromStep {
    SelectWhereStep from(String);
    SelectWhereStep from(TableLike<?>...);
}

... then, Nashorn will try to coerce argument types to string via JavaScript's ToString() function, before considering variable arity methods. I.e. the following call will result in calling from(String):

DSL.using(configuration)
   .select(...)
   .from(GENERATED_TABLE_REFERENCE);

While the linked blog post shows a couple of workarounds at the call-site, it would probably be more user-friendly to circumvent this issue by also providing a non-varargs, single-argument method that takes tables:

interface SelectFromStep {
    SelectWhereStep from(String);
    SelectWhereStep from(TableLike<?>);
    SelectWhereStep from(TableLike<?>...);
}

This should be applied throughout the API, where this can be done backwards-compatibly according to jOOQ's understanding of sematic versioning

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant