Skip to content

Conversation

@madisvain
Copy link
Contributor

Summary

Fixes #93

Several SWIG directives that are not Java-specific were previously inside the #ifdef SWIGJAVA block, making them unavailable to other language bindings (Python, C#, etc.).

This PR moves the following language-agnostic constructs outside #ifdef SWIGJAVA:

  • %apply type mappings (result_t, int64_t, uint64_t, int32_t, uint16_t)
  • %extend / %ignore for CDocWriter, CDocReader, Recipient, Lock, DataBuffer, DataConsumer, CertificateList, NetworkBackend::ShareInfo, JSONConfiguration
  • %feature("director") declarations for all 6 director classes
  • %template(LockVector)relocated after %include "Lock.h" to fix template instantiation ordering

All Java-specific code (JNI typemaps, %typemap(javacode), %typemap(javaimports), etc.) remains inside the #ifdef SWIGJAVA guard.

Verification

The generated Java SWIG output was compared before and after this change:

  • All 26 .java files are identical (only CDocJNI.java differs in declaration order due to LockVector moving after Lock.h)
  • The generated CDoc_wrap.cxx has the same line count (10944 lines) with only function ordering differences
  • Same SWIG warnings in both cases

This is a no-op refactoring for Java that enables future language bindings to reuse the shared directives.

Test plan

  • Verify existing Java SWIG bindings still compile and work
  • Verify %template(LockVector) works correctly after Lock.h include

Several SWIG directives that are not Java-specific were previously
inside the #ifdef SWIGJAVA block, making them unavailable to other
language bindings (Python, C#, etc.).

Moved the following language-agnostic constructs outside #ifdef SWIGJAVA:
- %apply type mappings (result_t, int64_t, uint64_t, etc.)
- %extend/%ignore for CDocWriter, CDocReader, Recipient, Lock,
  DataBuffer, DataConsumer, CertificateList, NetworkBackend::ShareInfo,
  JSONConfiguration
- %feature("director") declarations for all 6 director classes
- %template(LockVector) - relocated after %include "Lock.h" to fix
  template instantiation ordering (fixes open-eid#93)

All Java-specific code (JNI typemaps, javacode, javaimports, etc.)
remains inside the #ifdef SWIGJAVA guard. The generated Java SWIG
output is functionally identical.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@lauris71 lauris71 merged commit a12576e into open-eid:master Feb 11, 2026
18 checks passed
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

Successfully merging this pull request may close these issues.

Python SWIG bindings: LockVector template declared before Lock class is included

3 participants