TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

J2ObjC is a command-line tool that translates Java to Objective-C

56 点作者 SerCe超过 3 年前

7 条评论

timmg超过 3 年前
I used to work on Sheets. We built the “engine” of Sheets in Java. Then we used GWT to transpile to JS (probably switched to J2CL by now). We built Android version by compiling the Java code against different libraries. And we were the first (or one of?) teams to launch an iOS app using J2ObjC.<p>I was amazed that we were able to pull it off, tbh. The biggest issue that I remember was that the Java collection classes didn’t transpile well to JS. So we made an abstraction over them. Java code used the native collection classes, JS code used native JS arrays, etc.
评论 #29329986 未加载
inDigiNeous超过 3 年前
While working at now long-gone mobile game company Digital Chocolate, they developed their games using a pretty clever but also very complex process of writing the games in Java, then converting that Java to whatever the target mobile phone platform required.<p>For iPhone, which they arrived late to the party, the code was compiled with an tool built inhouse that converted the Java code to Objective-C++, with homemade garbage collection code. The end results were impressive from a standpoint of having the ability to target 50+ different devices at the time (when you still had J2ME phones on the market) but the performance was just not there for the iPhone, the games ran pretty poorly on that platform and ultimately I think that is one of the reasons they went bankrupt.<p>Still, the tech was quite fascinating, very difficult to debug and slow to compile. First you had to run the whole project through the Java -&gt; Objective-C++ converter which took quite some time, and then you had to compile this huge Xcode project, in total I think it could take easily like 30-40 minutes just to get build. Debugging was a pain in the ass also, the code generated was not easy to read or very concise.<p>Wondering if they maybe used this tool ? When was this project started, any idea ?
评论 #29329930 未加载
kaba0超过 3 年前
One should probably also mention its sibling project, J2Cl which translates Java to Javascript (with very very good quality might I say!).<p>With android apps being written in Java, Google (and anyone actually) can share code between the web, android and ios at the same time. I’m no google employee, but from what I’ve read they do use this to share the difficult logic of google drive apps between all platforms, while letting the platform-native frontend do the rest.
评论 #29329232 未加载
karmakaze超过 3 年前
I once had to convert a Java program to C++ and once from Swift to Java (or was it the reverse, it&#x27;s been a while). In each case it could&#x2F;should have been done manually but I was curious how far I could get by automating it since the code bases came complete with unit tests that I could also convert to give some confidence. The challenge with the C++ one was returning heap allocated objects which I merely returned const references that were copied by the caller and that process could repeat through multiple call&#x2F;stack frames. I was concerned about the performance of all the copying but it didn&#x27;t factor in at all. I&#x27;d say that 95%+ was automated and worth taking the approach. The Swift one was way more challenging in that I didn&#x27;t know it and got annoyed by the number of different ways that lambda functions can be written. Swift syntax is special.
joselfr超过 3 年前
<i>J2ObjC does not provide any sort of platform-independent UI toolkit, nor are there any plans to do so in the future. We believe that iOS UI code needs to be written in Objective-C, Objective-C++ or Swift using Apple&#x27;s iOS SDK (Android UIs using Android&#x27;s API, web app UIs using GWT, etc.).</i><p>Weird statement by the company who created flutter.
评论 #29329923 未加载
评论 #29330117 未加载
评论 #29329039 未加载
评论 #29329234 未加载
评论 #29330367 未加载
alex_suzuki超过 3 年前
Not trying to diminish the achievement, but this is really old and I’d be surprised if it’s still relevant for a significant number of people, seeing that native iOS and macOS development has moved to Swift for quite some time now, and using Java as language for some kind of proto-codebase feels like a niche case.
评论 #29330096 未加载
评论 #29329971 未加载
评论 #29332677 未加载
Apocryphon超过 3 年前
Was this at all related to Apportable, which Google acquired?<p><a href="https:&#x2F;&#x2F;www.crunchbase.com&#x2F;organization&#x2F;apportable" rel="nofollow">https:&#x2F;&#x2F;www.crunchbase.com&#x2F;organization&#x2F;apportable</a>
评论 #29334021 未加载