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

22 views
Skip to first unread message

Udo

unread,
Mar 14, 2013, 7:39:35 AM3/14/13
to 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

unread,
Mar 15, 2013, 7:36:28 AM3/15/13
to 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

unread,
Apr 2, 2013, 11:05:20 AM4/2/13
to java2...@googlegroups.com
I tried out j2s.update.3.6.v20130303.zip but the problem persists.

Udo
Reply all
Reply to author
Forward
0 new messages