Skip to content
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

Java std cleanup #11829

Merged
merged 8 commits into from
Nov 21, 2024
Merged

Java std cleanup #11829

merged 8 commits into from
Nov 21, 2024

Conversation

Simn
Copy link
Member

@Simn Simn commented Nov 19, 2024

Opening this so I don't forget. I'll go through everything again and see what else we can (re)move.

@Simn Simn self-assigned this Nov 19, 2024
@Simn
Copy link
Member Author

Simn commented Nov 20, 2024

The String situation is a bit of a mess. The way it currently works is this:

  • java.lang.String is explicitly ignored when loading the Java std.
  • Any reference to it is rewritten to just String.
  • In order to use the actual Java implementation from Haxe code, java.NativeString can be used.

I'd like to change it like so:

  • java.lang.String is loaded like any other class.
  • Any reference to it is rewritten to std.String. This ensures that we don't run into funky resolution problems.
  • Referencing java.lang.String from Haxe code now finds the Java implementation, making java.NativeString obsolete.

This means that there's now a difference between referring to java.lang.String from Haxe code vs. a loaded .jar, but that shouldn't pose a problem because

  1. for any Java-generated JAR we want to end up with our own String like before and
  2. any Haxe-generated JAR will also write the type path out as java.lang.String.

@Simn
Copy link
Member Author

Simn commented Nov 20, 2024

Also, I'd like to do something similar for all the custom classes we currently have in std/java/lang. The abstracts there are useful for interop, but these awful custom externs for java.lang.Integer really shouldn't be a thing.

However, I'll do that in a separate PR because this one is already big enough.

@Simn
Copy link
Member Author

Simn commented Nov 21, 2024

The more I think about it the more controversial this whole java.lang.String change seems. I'll factor it out for this PR so we can look at it separately.

@Simn Simn merged commit b6b8925 into development Nov 21, 2024
99 checks passed
@Simn Simn deleted the java_std_cleanup branch November 21, 2024 07:27
@skial skial mentioned this pull request Nov 22, 2024
1 task
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.

1 participant