Added throw CoreException to each method using Enum's fromInt function

This commit is contained in:
Sylvain Berfini 2017-10-10 13:37:27 +02:00
parent ce7f650f40
commit 03a625226b
2 changed files with 2 additions and 1 deletions

View file

@ -186,6 +186,7 @@ class JavaTranslator(object):
methodDict['enumCast'] = type(_method.returnType) is AbsApi.EnumType
methodDict['classCast'] = type(_method.returnType) is AbsApi.ClassType
methodDict['params'] = ''
methodDict['native_params'] = 'long nativePtr'
methodDict['static_native_params'] = ''

View file

@ -127,7 +127,7 @@ class {{classImplName}} implements {{className}} {
{{#methods}}
private native {{return_native}} {{name}}({{native_params}});
public {{return}} {{name}}({{params}}) {{#exception}}throws CoreException{{/exception}} {
public {{return}} {{name}}({{params}}) {{#exception}}throws CoreException{{/exception}}{{#enumCast}}throws CoreException{{/enumCast}} {
{{#exception}}int exceptionResult = {{/exception}}{{return_keyword}}{{#enumCast}}{{return}}.fromInt({{/enumCast}}{{#classCast}}({{return}}){{/classCast}}{{name}}(nativePtr{{native_params_impl}}){{#enumCast}}){{/enumCast}};
{{#exception}}if (exceptionResult != 0) throw new CoreException("{{name}} returned value " + exceptionResult){{/exception}}
}