-
Notifications
You must be signed in to change notification settings - Fork 36
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
non-null object-typed args should be checked for shared functions #2410
Comments
I want to disagree, sounds too expensive for too little gain. Not our fault if shitty Java authors don’t correctly call beautiful Ceylon code ;) We should probably implement this, bench it, and then decide if it’s too expensive. |
Well |
But I’m pretty sure non-null non-primitive parameter types are the most common case, and the way you wrote it in the issue description, we would also (completely unnecessarily) suffer this cost for every Ceylon→Ceylon call. |
Sure, the cost would be small, but I agree with @lucaswerkmeister, validating every argument is too much. And who knows, there could be weird hotspot issues, at least with the method call as written. I'm also not sure that handwritten Java code calling Ceylon code is a common pattern. If true, this would mostly be for frameworks. Which you've already said should be using direct field manipulation 😜. |
An alternative form to generate, without Ceylon→Ceylon cost, would be: public static void xxx(final .java.lang.Object oo) {
.com.redhat.ceylon.compiler.java.Util.checkNull(oo);
.com.example.xxx$canonical$(oo);
}
public static void xxx$canonical$(final .java.lang.Object oo) {
.ceylon.language.print_.print(.ceylon.language.String.instance(oo.toString()));
} where all Ceylon code would directly call the |
Well I just observed an NPE in the IDE Ceylon code. |
How about adding |
Something I sorta vaguely thought we already did, but don't do is properly validate arguments that might be coming from Java code. Given this:
We should generate:
The text was updated successfully, but these errors were encountered: