HaxeFoundation / HaxeFoundation/hxjava

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

Aperta
#11 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Haxe
Stelle
46
Fork
14
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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`.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Start by tracing the generated Java entry point __hx_invokeField and its call to doGet, using the shown generated code as the reproduction. Check how @:throws declarations are represented for overridden or overloaded native methods; done means the generated Java compiles without an unreported exception at this call site.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
java
Ambito
compilers
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
30/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.