gwtproject / gwt

GWT Open Source Project
http://www.gwtproject.org
1.53k stars 378 forks source link

The GWT compiler reports a non-existent error near "delete" keyword #9839

Open cronostorie opened 1 year ago

cronostorie commented 1 year ago

FormData.java.txt

GWT version: 2.10.0 Browser (with version): Edge ver.114.0.1823.51, Chrome ver. 114.0.5735.134, Firefox ver. 114.0.1 Operating System: Windows 11


Description

At compile time, GWT reports an error in the FormData class near the "delete" keyword.

... Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors. [ERROR] Errors in 'file:/.../client/jso/data/FormData.java' [ERROR] Line 37: missing name after . operator

  this.delete(name);

-----------^

/**

The FormData class doesn't seem to have any errors.

Steps to reproduce

Compile FormData.java class

Known workarounds

None

tbroyer commented 1 year ago

AFAICT, this is because delete is a JS keyword and they couldn't be used as identifiers in early versions of JS; and JSNI uses an oldish JS parser that probably didn't support that.

That should work with JsInterop though.

zbynek commented 1 year ago

You can use elemental2.dom.FormData instead of creating your own class for this. With JSNI being discouraged in favor of JsInterop I'm not sure if anyone is interested in fixing JSNI bugs.