}
}
Expression createNativeStaticValue(ClassNameBand classNameBand, int line, int column) {
if (classNameBand.size() < 2) {
throw new ParseException("native static need a field name.", line, column);
}
final String fieldName = classNameBand.pop();
final Class clazz = toClass(classNameBand, line, column);
final String path = StringUtil.concat(clazz.getName(), ".", fieldName);
if (!this.engine.getNativeSecurityManager().access(path)) {
throw new ParseException("Not accessable of native path: ".concat(path), line, column);
}
final Field field;
try {
field = clazz.getField(fieldName);
} catch (NoSuchFieldException ex) {
throw new ParseException("No such field: ".concat(path), line, column);
}
if (ClassUtil.isStatic(field)) {
ClassUtil.setAccessible(field);
if (ClassUtil.isFinal(field)) {
try {
return new DirectValue(field.get(null), line, column);
} catch (Exception ex) {
throw new ParseException("Failed to get static field value: ".concat(path), ex, line, column);
}
} else {
return new NativeStaticValue(field, line, column);
}
} else {
throw new ParseException("No a static field: ".concat(path), line, column);
}
}