mirror of
https://gitee.com/jmix/cuba.git
synced 2024-12-05 04:38:10 +08:00
Refs #1800 Make method Scripting.loadClass() generic to avoid type cast warnings
This commit is contained in:
parent
b30972a371
commit
06cfa265a9
@ -92,7 +92,7 @@ public interface Scripting {
|
||||
* @return class or null if not found
|
||||
*/
|
||||
@Nullable
|
||||
Class loadClass(String name);
|
||||
<T> Class<T> loadClass(String name);
|
||||
|
||||
/**
|
||||
* DEPRECATED - use {@link Resources#getResourceAsStream(String)}
|
||||
|
@ -37,9 +37,8 @@ import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* <p>$Id$</p>
|
||||
*
|
||||
* @author krivopustov
|
||||
* @version $Id$
|
||||
*/
|
||||
public abstract class AbstractScripting implements Scripting {
|
||||
|
||||
@ -227,6 +226,7 @@ public abstract class AbstractScripting implements Scripting {
|
||||
@Override
|
||||
public <T> T runGroovyScript(String name, Map<String, Object> context) {
|
||||
Binding binding = createBinding(context);
|
||||
//noinspection unchecked
|
||||
return (T) runGroovyScript(name, binding);
|
||||
}
|
||||
|
||||
@ -236,8 +236,9 @@ public abstract class AbstractScripting implements Scripting {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class loadClass(String name) {
|
||||
public <T> Class<T> loadClass(String name) {
|
||||
try {
|
||||
//noinspection unchecked
|
||||
return getGroovyClassLoader().loadClass(name, true, false);
|
||||
} catch (ClassNotFoundException e) {
|
||||
return null;
|
||||
|
Loading…
Reference in New Issue
Block a user