I've being try to get the list of weapons in Cargo, the problem is that Janino doesn't play well with generics for some odd reason, and I can't define a proper return value for the list List<CargoItemQuantity<String>> container = cargo.getWeapons();
I have to define it like this List container = cargo.getWeapons();
The problem with that is now I've got a list of objects.
I can't cast like this (CargoItemQuantity<String>) container
presumably for the same reason above. Which is OK I guess cause I can do this.... CargoItemQuantity ciq = (CargoItemQuantity) container.get(x);
but... and I don't know why. When I get to this long annoying rabbit hole and have to cast the String. I get this Caused by: org.codehaus.commons.compiler.CompileException: Array initializer not allowed for non-array type "java.lang.String"
grrrrr.... Does anyone have any working examples using this method?
String s = (String) ((CargoItemQuantity) cargo.getWeapons().get(x)).getItem();
Ah so it does... With the use of comments and I narrowed the problem down to this:
private static String makeWep[] = { ... };
private static String[] makeWep = { ... };
Apparently OK in Java 7, not in Java 5.
Damn it. Well this is embarrassing. Janino I would of liked a line number you know...
edit:
OK. I'm in business. Thanks guys.