You should be able to suppress the warnings by adding the annotation
"@SuppressWarnings("unchecked")" on the methods that use raw Collections.
You could also put the return value of queryForList in a raw List (no generics) and then
copy those items into a type-specific List. Something like:
List foo = sqlMap.queryForList("mapname",criteria);
List<MyListType> bar = new ArrayList<MyListType>();
for(Iterator it = foo.iterator; it.hasNext;){
bar.add((MyListType)it.next());
}
return bar;
This gets you around the warnings, at the cost of copying a potentially large list every
time it's loaded. You're probably better off with @SuppressWarnings or the Xlint compiler
setting.
On a side note to the ibatis devs, what's the road map for having ibatis query methods
return type-specific collections? Will you ever do so (since that would break backwards
compatibility, right?)?
b
Enrique Ferreyra wrote:
My english is limited :)
I know this, i mean if there is a better way for code that and get no
warnings, or this warnings are so normal that the better choice is
-Xlint ??
Thanks
Meindert escribió:
Am using netBeans 5.0 and removed in 'Additional Compiler Options' the
option; -Xlint
This field can be found under Project Properties=>Build=>Compiling
MEINDERT -----Original Message-----
From: Enrique Ferreyra [mailto:[EMAIL PROTECTED] Sent: 07 April
2006 01:19 PM
To: [email protected]
Subject: Warnings at queryForList
Maybe this is a more java laguage question than ibatis, but someone
can tell me how to avoid this warnings ? Not suppressing them, doing
the things fine.
C:\svnjava\ccem-base\src\com\ccem\megatone\base\LegajoPick.java:144:
warning: [unchecked] unchecked cast
found : java.util.List
required:
java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
items = (List<Map<String, Object>>)
DefaultProfile.getSqlMap().queryForList("pick-legajo", parametrosSqlMap);
C:\svnjava\ccem-base\src\com\ccem\megatone\stock\DepositoPick.java:147:
warning: [unchecked] unchecked cast
found : java.util.List
required:
java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
items = (List<Map<String, Object>>)
DefaultProfile.getSqlMap().queryForList("pick-deposito",
parametrosSqlMap);
C:\svnjava\ccem-base\src\com\ccem\megatone\stock\ServicePick.java:145:
warning: [unchecked] unchecked cast
found : java.util.List
required:
java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
items = (List<Map<String, Object>>)
DefaultProfile.getSqlMap().queryForList("pick-service",
parametrosSqlMap);
3 warnings
Thanks