HaxeFoundation / HaxeFoundation/hxjava

Error: unreported exception must be caught or declared to be thrown

Open
#11 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Haxe
Stars
46
Forks
14
PR merge metrics
No merged PRs in 30d

Description

If we override / `@:overload` native method marked `throws ServletException, IOException` we need this meta too. Ok, using `@:throws("java.io.IOException, javax.servlet.ServletException")` under the our method declaration. Everything is fine but now we will get the same exception for a different method:

Generated java-code:

``` java
public java.lang.Object __hx_invokeField(java.lang.String field, haxe.root.Array dynargs)
{
{
boolean __temp_executeDef37 = true;
switch (field.hashCode())
{
case 95730379:
{
if (field.equals("doGet"))
{
__temp_executeDef37 = false;
this.doGet(((javax.servlet.http.HttpServletRequest) (dynargs.__get(0)) ), ((javax.servlet.http.HttpServletResponse) (dynargs.__get(1)) ));
}

break;
}

}

if (__temp_executeDef37)
{
return ((haxe.lang.Function) (this.__hx_getField(field, true, false, false)) ).__hx_invokeDynamic(dynargs);
}

}

return null;
}
```

This is because there is clearly calling a method `this.doGet` marked with the `throws`.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.