google / j2objc

A Java to iOS Objective-C translation tool and runtime.
http://j2objc.org
Apache License 2.0
5.99k stars 968 forks source link

generated file hierarchy package headers may conflict with C++ files #739

Open bolsinga opened 8 years ago

bolsinga commented 8 years ago

Our app is ObjC & C++ and we also use CocoaPods. When trying to bring some j2objc code into the app, the C++ code will find the file "java/lang/Float.h" and complain (since it isn't C++ stdlib float.h). This is because all the header paths are searched (at least the way our code uses CocoaPods).

If these j2objc headers were generated in a flat manner (such as "java_lang_float.h") they would not conflict with C++.

Is there another workaround I haven't been able to find? Thanks.

kstanger commented 8 years ago

There's no such workaround that I know of. You're suggestion is a good one. We currently support a --no-package-directories flag that puts all generated files in the top-level directory, with the same basename. It would probably be possible to add a similar flag for the naming format you suggest. The main problem is that with --no-package-directories we have to make an exception for all JRE classes, since the includes we distribute for the JRE emulation library have the package directories. To support flat JRE headers we may need to create a separate distribution.

bolsinga commented 8 years ago

Thanks. Yes, I think it would require a different distribution, just for the jre_emul's headers. I'm working towards a patch now to see what I get.

jonasbark commented 8 years ago

Any news on this issue?

bolsinga commented 4 years ago

Any news on this issue?

I’d worked around this and no longer require it for any projects. In my opinion this can be closed.

tomball commented 4 years ago

It's still open because as Keith mentioned, it's a great idea. One problem blocking our distribution multiple sets of headers is that we're at GitHub's maximum distribution file size. However, the bigger issue is how to easily migrate projects to different include paths. Anyone's ideas on how to avoid breaking everyone without bloating our distribution would be very appreciated.