Skip to content

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

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ktoso
Copy link
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

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".

resolves swiftlang#228
@ktoso
Copy link
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'

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