java-native-access / java-native-access/jna

Support for dynamic structures

Open
#255 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs info
Dominant language
Java
Stars
8.9k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

By "dynamic" I mean a structure which I know at runtime.
I wanted to code something like

public class DynStructure extends Structure {
    public DynStructure(Object[] vals) {
         .....
        }
}

and at first I thought that would possible: I'd associate a dummy field name to each value, I'd override getFieldOrder() to return that list (in the order) and I'd override getFieldList() to return my pseudo Fields ... but that's not possible, because Structure relies on reflection and that dependence is difficult to change in a extended class (for one thing Field objects are not instatiable)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Structure, especially getFieldOrder() and getFieldList(), and review how its reflection dependency prevents the proposed DynStructure from supplying runtime-known fields. The issue mentions pseudo Fields and dummy names but does not define an implementation or test path; done would require an agreed design and support for structures whose fields are known only at runtime.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.