mirror of
https://github.com/moparisthebest/JdbcMapper
synced 2024-12-22 07:18:51 -05:00
Fix generated code causing warnings
This commit is contained in:
parent
564df7b022
commit
3fb9559ba7
@ -254,11 +254,19 @@ public class CompileTimeResultSetMapper {
|
||||
public void toArray(final Writer w, final String[] keys, final TypeMirror componentTypeMirror, MaxRows maxRows, String cal, final String cleaner, final ReflectionFields reflectionFields) throws IOException, ClassNotFoundException {
|
||||
final String returnTypeString = componentTypeMirror.toString();
|
||||
writeCollection(w, keys, "java.util.List<" + returnTypeString + ">", "java.util.ArrayList", componentTypeMirror, maxRows, cal, cleaner, reflectionFields);
|
||||
w.write("\t\t\treturn _colret.toArray(new ");
|
||||
// have to strip generics to avoid "generic array creation" compilation failure
|
||||
// have to strip generics to avoid "generic array creation" compilation failure
|
||||
final int indexOfGeneric = returnTypeString.indexOf('<');
|
||||
w.write(indexOfGeneric < 0 ? returnTypeString : returnTypeString.substring(0, indexOfGeneric));
|
||||
w.write("[_colret.size()]);\n");
|
||||
if(indexOfGeneric < 0) {
|
||||
w.write("\t\t\treturn _colret.toArray(new ");
|
||||
w.write(returnTypeString);
|
||||
w.write("[_colret.size()]);\n");
|
||||
} else {
|
||||
w.write("\t\t\t@SuppressWarnings(\"unchecked\")\n");
|
||||
w.append("\t\t\tfinal ").append(returnTypeString).append("[] _warnret = _colret.toArray(new ");
|
||||
w.write(returnTypeString.substring(0, indexOfGeneric));
|
||||
w.write("[_colret.size()]);\n");
|
||||
w.write("\t\t\treturn _warnret;\n");
|
||||
}
|
||||
}
|
||||
|
||||
public void toListIterator(final Writer w, final String[] keys, final TypeMirror componentTypeMirror, MaxRows maxRows, String cal, final String cleaner, final ReflectionFields reflectionFields) throws IOException, ClassNotFoundException {
|
||||
|
5
pom.xml
5
pom.xml
@ -268,6 +268,10 @@
|
||||
<exclude>**/PrestoPersonDAOTest.java</exclude>
|
||||
<exclude>**/PrestoSQLParserTest.java</exclude>
|
||||
</testExcludes>
|
||||
<compilerArgs>
|
||||
<compilerArg>-Xlint:unchecked</compilerArg>
|
||||
<compilerArg>-XDignore.symbol.file</compilerArg>
|
||||
</compilerArgs>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>testCompile</goal>
|
||||
@ -324,6 +328,7 @@
|
||||
<compilerArgs>
|
||||
<compilerArg>-parameters</compilerArg>
|
||||
<compilerArg>-Xlint:unchecked</compilerArg>
|
||||
<compilerArg>-XDignore.symbol.file</compilerArg>
|
||||
</compilerArgs>
|
||||
</configuration>
|
||||
<goals>
|
||||
|
Loading…
Reference in New Issue
Block a user