Skip to content
VIRAJ

Case OS · Open source / Swift

Swift Java

A missing Java package should fail, not emit invalid source

  • SWIFT
  • JAVA
  • MERGED

The issue

jextract treated a missing or empty javaPackage as success and wrote package ; — Java that does not compile. The same path ran in JNI and FFM, whether --java-package was omitted or set to "" in swift-java.config. Tracked as swift-java#919.

The fix

SwiftToJava.run() now requires a non-empty package before analysis or any generated output. --java-package stays optional so the name can still come from config. Whitespace-only names and empty segments (com..foo) are rejected. Tests cover nil, empty, whitespace, empty segments, and a valid package.

Technology

  • Swift
  • Java
  • jextract
  • Swift Testing