LinkedHashSet constructor throws "TypeError" (required class LinkedHashMap not loaded)

已查看 22 次
跳至第一个未读帖子

Udo

未读,
2013年3月14日 07:39:352013/3/14
收件人 java2...@googlegroups.com
It looks like LinkedHashSet does not always load LinkedHashMap before executing its constructors. I get an "undefined is not a function" error inside the default constructor:

$_R(this,java.util.LinkedHashSet,[new java.util.LinkedHashMap()]);
Uncaught TypeError: undefined is not a function


java.util.LinkedHashMap is not defined at that point in time.



I manually made "LinkedHashMap" a required import in the JS file:

$_L(["java.util.HashSet","$.Set","java.util.LinkedHashMap"],"java.util.LinkedHashSet",[],function(){ ...


and this fixed the issue.


I assume adding a @J2SRequireImport(LinkedHashMap.class) in the Java source code would fix this, too.



Udo





Zhou Renjian

未读,
2013年3月15日 07:36:282013/3/15
收件人 java2...@googlegroups.com
Adding LinkedHashMap as  a dependency to LinkedHashSet is OK.

It seems that this a bug of Java2Script class loader. LinkedHashMap should be loaded before calling LinkedHashSet's constructor.

I made some changes to Java2Script class loader in the past few months. Maybe, this bug is fixed. You can test it out:


Regards,
Zhou Renjian


--
You received this message because you are subscribed to the Google Groups "Java2Script" group.
To unsubscribe from this group and stop receiving emails from it, send an email to java2script...@googlegroups.com.
To post to this group, send email to java2...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/java2script/-/yqMkY9LKGC8J.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Udo

未读,
2013年4月2日 11:05:202013/4/2
收件人 java2...@googlegroups.com
I tried out j2s.update.3.6.v20130303.zip but the problem persists.

Udo
回复全部
回复作者
转发
0 个新帖子