Bug: java.util.LinkedHashMap is defined as an 'optionals' dependency of java.util.LinkedHashSet.

24 views
Skip to first unread message

Udo

unread,
Dec 17, 2013, 12:46:53 PM12/17/13
to java2...@googlegroups.com

The j2slib file LinkedHashSet.js starts like this:


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


I.e. it defines "java.util.HashSet" and "$.Set" as 'musts' dependencies of java.util.LinkedHashSet , and "java.util.LinkedHashMap" as an 'optional' dependency.

As the LinkedHashMap is only "optional" it may happen the class LinkedHashMap is not yet loaded when a LinkedHashSet constructor is called, e.g. like this one:

$_K(c$,
function(){
$_R(this,java.util.LinkedHashSet,[new java.util.LinkedHashMap()]);
});

This leads to an 

Uncaught TypeError: undefined is not a function


Moving the java.util.LinkedHashMap to the 'musts' parameter array solves the problem:

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



Feel free to use the fix.


Udo
Reply all
Reply to author
Forward
0 new messages