Browse Source

move cast back after type compatibility check

master
Stefan Bodewig 7 years ago
parent
commit
e8117b6d3c
1 changed files with 2 additions and 3 deletions
  1. +2
    -3
      src/main/org/apache/tools/ant/types/selectors/modifiedselector/ModifiedSelector.java

+ 2
- 3
src/main/org/apache/tools/ant/types/selectors/modifiedselector/ModifiedSelector.java View File

@@ -404,13 +404,12 @@ public class ModifiedSelector extends BaseExtendSelector
clazz = Class.forName(classname);
}

@SuppressWarnings("unchecked")
T rv = (T) clazz.newInstance();
Object rv = clazz.newInstance();

if (!type.isInstance(rv)) {
throw new BuildException("Specified class (%s) %s", classname, msg);
}
return rv;
return (T) rv;
} catch (ClassNotFoundException e) {
throw new BuildException("Specified class (%s) not found.", classname);
} catch (Exception e) {


Loading…
Cancel
Save