You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[ERROR] Foo.java:[75,26] cannot find symbol
symbol: method _read()
location: variable data of type io.kaitai.struct.KaitaiStruct
[ERROR] Foo.java:[80,26] cannot find symbol
symbol: method _read()
location: variable data of type io.kaitai.struct.KaitaiStruct
since _read is not defined in KaitaiStruct. Since the variable is not always of type KaitaiStruct (I've seen some cases where it's Object instead, but haven't been able to come up with a simple example that exhibits that behavior), we cannot simply add _read as an abstract method.
If debug is disabled, the code is OK because the call to _read happens in the constructor instead of separately.
I've discovered a workaround, though: adding
repeat: exprrepeat-expr: 1
to the type-switched field causes the compiler to create a more specifically typed temporary variable on which _read is called. Perhaps the correct solution here is to change the compiler to always use a temporary in debug mode.
The text was updated successfully, but these errors were encountered:
Thanks for the report and detailed explanation! I'll try to think of something to fix this. Anyway, hopefully _read() will be part of standard interface soon, i.e. as in this branch.
With a structure like this:
Kaitai generates code which looks like this:
This gives the following compilation error:
since
_read
is not defined inKaitaiStruct
. Since the variable is not always of typeKaitaiStruct
(I've seen some cases where it'sObject
instead, but haven't been able to come up with a simple example that exhibits that behavior), we cannot simply add_read
as an abstract method.If debug is disabled, the code is OK because the call to _read happens in the constructor instead of separately.
I've discovered a workaround, though: adding
to the type-switched field causes the compiler to create a more specifically typed temporary variable on which
_read
is called. Perhaps the correct solution here is to change the compiler to always use a temporary in debug mode.The text was updated successfully, but these errors were encountered: