I have a legacy java project with a lot of collections without the use of generics .
The collections basically looks like this example:
Collection myCollectionOfObjects;
public Collection getMyCollectionOfObjects() {
return myCollectionOfObjects;
}
public void setMyCollectionOfObjects(Collection myCollectionOfObjects) {
this.myCollectionOfObjects = myCollectionOfObjects;
}
The collection is filled with strings and are later accessed in JavaScript and the value is retrieved:
myString = myCollectionOfObjects[1].value;
We are looking at upgrading from Weblogic 12c to Weblogic 14, but are facing problems with these collections, due to the fact that Weblogic 14 automatically handles conversion if the collection contains the same type for every entry, and the JavaScript fails because the collection is handled as Collection<String> and not Collection<Object> which in turn means that myCollectionOfObjects[1].value
is undefined.
The obvious solution would of course be to change the legacy code to use generics, but the sheer volume where this is used and the fact that the error occurs in JavaScript at runtime is a big obstacle.
So, my question is if there is anyway to have Weblogic not do the automatic conversion?
I have changed the Collection to Collection<String> which resulted in the code working as it should.
The problem is that, due to the complexity of the legacy code, it is an overwhelming task to find all the places in the code where this can potentially occur.