Skip to content

Conversation

@DougGregor
Copy link
Member

Improve the experience of producing Java2Swift.config files from Jar files and better cope with layers of Swift-wrapped Java libraries. This includes:

  • Filtering out nested classes from Jar files, since we cannot handle them yet
  • Combining the class paths from all of the dependent Java2Swift.config files with the one being used and providing those to the JVM instance
  • Fixing an issue where Java2Swift would generate func init() for a Java method named init

Read the `classPath` field from each config file and feed the
concatenated class path into the Java virtual machine instance we
create. As part of this, clean up the code path that emits a
configuration file with all of the classes within a Jar file.
The `ignoreUnrecognized` parameter to `JavaVirtualMachine.shared()` tells
the JVM not to complain about options it doesn't recognize, which tends
to mask usage errors. Change the default from `true` to `false`.
…ft.config

We aren't ready to handle nested classes just yet.
@DougGregor DougGregor merged commit 36f49d1 into swiftlang:main Oct 17, 2024
11 checks passed
@DougGregor DougGregor deleted the java2swift-jar-files branch October 17, 2024 17:45
var classPathPieces: [String] = classpath
switch generationMode {
case .configuration(jarFile: let jarFile):
// * Jar file (in `-jar-file` mode)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't notice this before, -jar probably would spell nicer for the option btw.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure! PR incoming

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.

2 participants