Skip to content

WIP: wrap-java: print failed-to-import methods and include errors in docc#286

Closed
ktoso wants to merge 0 commit intoswiftlang:mainfrom
ktoso:wip-better-wrap-java-failing-imports
Closed

WIP: wrap-java: print failed-to-import methods and include errors in docc#286
ktoso wants to merge 0 commit intoswiftlang:mainfrom
ktoso:wip-better-wrap-java-failing-imports

Conversation

@ktoso
Copy link
Copy Markdown
Collaborator

@ktoso ktoso commented Jun 25, 2025

Not complete yet -- needed a break from other things and this seemed fun to do.

This way users of a library still get a decl and can figure out when they need a method "why" it wasn't imported. Rather than just having no clue why a method is "missing".

This would now render a "failed to import" method like this:

  ///
  /// ### Swift-Java import errors
  ///
  /// * Failed to convert parameter 'arg1' type 'Type(javaHolder: JavaKit.JavaObjectHolder) to Swift'
  @available(*, unavailable, message: "swift-java was unable to import this method. See doc comments for import error details.")
  @JavaStaticMethod
  public func probablePrime(_ arg0: Int32, _ arg1: SwiftJavaFailedImportType) -> BigInteger!

resolves #228

@ktoso
Copy link
Copy Markdown
Collaborator Author

ktoso commented Jun 25, 2025

Ok that has silly issues since overloads may become redefinitions

/__w/swift-java/swift-java/Samples/JavaDependencySampleApp/.build/plugins/outputs/javadependencysampleapp/JavaCommonsCSV/destination/SwiftJavaPlugin/generated/CSVFormat.swift:448:13: error: invalid redeclaration of 'setHeader'
446 |   @available(*, unavailable, message: "swift-java was unable to import this method. See doc comments for import error details.")
447 |   @JavaMethod
448 |   open func setHeader(_ arg0: SwiftJavaFailedImportType) -> CSVFormat.Builder!
    |             `- error: invalid redeclaration of 'setHeader'

@ktoso ktoso marked this pull request as draft July 9, 2025 06:33
@ktoso ktoso added the jni label Jul 14, 2025
@ktoso ktoso removed the jni label Sep 1, 2025
@ktoso ktoso closed this Mar 10, 2026
@ktoso ktoso force-pushed the wip-better-wrap-java-failing-imports branch from 748a3c7 to 49c1af7 Compare March 10, 2026 08:21
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.

Make not imported methods java->swift unavailable

1 participant