Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can it support Opaque types? #25

Open
shengbinxu opened this issue Nov 30, 2023 · 4 comments
Open

Can it support Opaque types? #25

shengbinxu opened this issue Nov 30, 2023 · 4 comments

Comments

@shengbinxu
Copy link

I have a custom type:

      - id: time
        size: 6
        type: bcd_encoding

It is defined in Java code as follows:

public class BcdEncoding extends KaitaiStruct {

    private BcdEncoding _root;

    public BcdEncoding(KaitaiStream _io) {
        super(_io);
        _read();
    }

    public BcdEncoding(KaitaiStream _io, KaitaiStruct _parent, BcdEncoding _root) {
        super(_io);
        this._parent = _parent;
        this._root = _root == null ? this : _root;
        _read();
    }
......
}

When running, an error occurs:

cl = class io.kaitai.struct.visualized.BcdEncoding
java.util.concurrent.ExecutionException: java.lang.NoSuchFieldException: _attrStart
        at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
        at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
        at java.desktop/javax.swing.SwingWorker.get(SwingWorker.java:613)
        at io.kaitai.struct.visualizer.DataNode$1.done(DataNode.java:175)
        at java.desktop/javax.swing.SwingWorker$5.run(SwingWorker.java:750)
        at java.desktop/javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.run(SwingWorker.java:848)
        at java.desktop/sun.swing.AccumulativeRunnable.run(AccumulativeRunnable.java:112)
        at java.desktop/javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.actionPerformed(SwingWorker.java:858)
        at java.desktop/javax.swing.Timer.fireActionPerformed(Timer.java:311)
        at java.desktop/javax.swing.Timer$DoPostEvent.run(Timer.java:243)
        at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
        at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
        at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
        at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
        at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
        at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Caused by: java.lang.NoSuchFieldException: _attrStart
        at java.base/java.lang.Class.getDeclaredField(Class.java:2610)
        at io.kaitai.struct.visualizer.DebugAids.fromStruct(DebugAids.java:48)
        at io.kaitai.struct.visualizer.DataNode$1.doInBackground(DataNode.java:140)
        at io.kaitai.struct.visualizer.DataNode$1.doInBackground(DataNode.java:99)
        at java.desktop/javax.swing.SwingWorker$1.call(SwingWorker.java:304)

If it can be supported, this tool would be perfect. It could be used as a .ksy file debugger by first writing the .ksy file and then debugging with the Kaitai Struct GUI to verify if the results match the expectations.

@shengbinxu
Copy link
Author

@MatrixEditor do you have any suggestion?

@MatrixEditor
Copy link

First of all, it looks like you are not using v0.11 which fixes some issues. Nevertheless, the issue is related to an attribute which is usually present in generated Java classes. This one is important, because the old version and new GUI depend on it to display a struct graphically.

You can generate a Java file manually and compare it with your file to find missing fields.

@shengbinxu
Copy link
Author

shengbinxu commented Dec 7, 2023

First of all, it looks like you are not using v0.11 which fixes some issues. Nevertheless, the issue is related to an attribute which is usually present in generated Java classes. This one is important, because the old version and new GUI depend on it to display a struct graphically.

You can generate a Java file manually and compare it with your file to find missing fields.
Thank you for your enthusiastic reply!

I'm a bit confused.

  1. Which library version does v0.11 refer to?

@MatrixEditor
Copy link

#24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants