Nashorn bug JDK8u40 “Method Code Too Large”

假装没事ソ 提交于 2019-12-08 03:54:40

Sure, latest developer repo for the 8u branch is available at http://hg.openjdk.java.net/jdk8u/jdk8u-dev/nashorn. It will soon become the development stage for 8u60, though but you'll be able to get the 8u40 code here then: http://hg.openjdk.java.net/jdk8u/jdk8u40-dev/nashorn. FWIW, 8u and 9 code for Nashorn are almost entirely identical so far (so far, we backported everything from 9 to 8u except for some parser changes that don't actually affect externally observable behavior).

Speaking of your problem: if we need to generate a JS-to-Java adapter class for a Java class of +6000 methods, then it'll indeed fail as the constructor of the class will have code for looking up 6000 JS functions in the adapted object, and that'll indeed be too large. We might supposedly come up with some different way of organizing the constructor but it seems like an awful lot of work for a hopefully rare case of people having humongous classes.

Alternatively, we could check whether we only create adapters when they're really needed. Your above code snippet looks like the adapter is not strictly necessary at that point, so it might be that in certain scenarios we're overeager to create adapter classes. Do you have a full stack trace maybe?

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!