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

get rid of some of the warnings in Java2Swift generated sources: generics #200

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

Conversation

AbdAlRahmanGad
Copy link
Contributor

@AbdAlRahmanGad AbdAlRahmanGad commented Dec 11, 2024

Tries to solve #169

I got rid of some of the warning but I'm now stuck.

The following classes were translated appropriately

JavaOptional.swift
HashMap.swift
HashSet.swift
JavaSet.swift
List.swift

These classes were generated with a different order of methods and variables, I don't know why that happened.

JavaClass.swift
JavaString.swift
BitSet.swift

This class generates a bad translation which is not a valid class, I don't know why that happedned.

URLClassLoader.swift

if translator.usedGenericParameterNames.contains(name) {
name = "\(baseName)\(index)"
}
return name
Copy link
Collaborator

Choose a reason for hiding this comment

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

This would probably have to be more contextual "in this context (of a function or type) there already was a T used so make it a T1". Especially with types nested in other types where there's a T outside and then another T etc...

Copy link
Collaborator

@ktoso ktoso left a comment

Choose a reason for hiding this comment

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

Yeah that's roughly the idea, other than pursuing it more and trying what will work out in the end I'm not sure I have much hints to provide here. You'll have to work out how to avoid the conflicts and just think through edge cases you uncover

@ktoso ktoso self-requested a review December 12, 2024 05:50
@AbdAlRahmanGad
Copy link
Contributor Author

I tried running java-generate on a fresh copy of the main branch, but the issue still persists.

Even without my changes, these files result in a different order of methods and variables:

JavaClass.swift
JavaString.swift
BitSet.swift

And this file generates a non-valid class:

URLClassLoader.swift

Should I file an issue on this?

@ktoso
Copy link
Collaborator

ktoso commented Dec 13, 2024

Huh I see, then yeah please file an issue and ofc help on resolving it would also be welcome but otherwise we'll find some time :)

@AbdAlRahmanGad
Copy link
Contributor Author

Huh I see, then yeah please file an issue and ofc help on resolving it would also be welcome but otherwise we'll find some time :)

I'd really like to help! But for now and until mid-January, I will be busy with college projects and final exams.

As of the state of this PR, should I resume working on it when the issue is resolved?

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