# google/j2objc

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/google-j2objc).**

6,041 stars · 997 forks · Java · NOASSERTION

## Links

- GitHub: https://github.com/google/j2objc
- Homepage: http://j2objc.org
- awesome-repositories: https://awesome-repositories.com/repository/google-j2objc.md

## Description

j2objc is a source-to-source compiler and transpiler that converts Java source code into Objective-C. It functions as a cross-platform logic porter, allowing application logic and data models written in Java to be shared and executed on iOS. To support this translation, the project provides an Objective-C implementation of core Java classes and APIs to emulate the Java runtime environment.

The system includes specialized translation for Java libraries and provides mapping for dependency injection and static analysis annotations to preserve metadata. It also enables the conversion of JUnit tests into executable binaries to verify logical consistency on mobile hardware.

To optimize the resulting iOS applications, the project provides tools for unused code detection and dead code elimination. It further allows for the replacement of automatically translated classes with hand-written native implementations to increase execution speed.

## Tags

### Programming Languages & Runtimes

- [Source-to-Source Compilers](https://awesome-repositories.com/f/programming-languages-runtimes/source-to-source-compilers.md) — Translates Java source code directly into Objective-C syntax to allow logic sharing across platforms.
- [Cross-Platform Logic Porters](https://awesome-repositories.com/f/programming-languages-runtimes/cross-platform-logic-porters.md) — Migrates Java business logic and dependencies into native iOS libraries for consistent behavior across operating systems.
- [Java Runtime Emulations](https://awesome-repositories.com/f/programming-languages-runtimes/java-runtime-emulations.md) — Provides a compatible implementation of core Java classes and APIs in Objective-C to enable execution on iOS.
- [Java to Objective-C Translation](https://awesome-repositories.com/f/programming-languages-runtimes/java-to-objective-c-translation.md) — Converts Java source code into Objective-C to share application logic and data models across platforms. ([source](https://github.com/google/j2objc#readme))
- [Runtime Environment Emulators](https://awesome-repositories.com/f/programming-languages-runtimes/python-language-features/runtime-environment-emulators.md) — Implements core Java classes and APIs in Objective-C to replicate the Java runtime environment on iOS. ([source](https://github.com/google/j2objc/tree/master/jre_emul))
- [Java Virtual Machine Runtimes](https://awesome-repositories.com/f/programming-languages-runtimes/runtime-execution-environments/runtime-environments/language-runtimes/java-virtual-machine-runtimes.md) — Provides core Java APIs and runtime environments within an Objective-C project to support translated code.
- [PHP to C++ Translation](https://awesome-repositories.com/f/programming-languages-runtimes/source-code-compilers/c-source-translators/configuration-to-c-translation/php-to-c-translation.md) — Converts Java source code into Objective-C to run existing libraries and logic on iOS devices.
- [Source-to-C Transpilers](https://awesome-repositories.com/f/programming-languages-runtimes/source-code-compilers/source-to-c-transpilers.md) — Translates Java source code into Objective-C to enable sharing of application logic and data models on iOS.
- [Native Performance Overrides](https://awesome-repositories.com/f/programming-languages-runtimes/class-method-definitions/class-extensions/core-class-replacements/native-performance-overrides.md) — Allows replacing automatically translated classes with hand-written native Objective-C implementations to increase execution speed. ([source](https://github.com/google/j2objc/tree/master/jre_emul))
- [Manual Native Overrides](https://awesome-repositories.com/f/programming-languages-runtimes/node-js-native-addons/rust-implementations/native-hook-implementations/manual-native-overrides.md) — Allows replacing automatically translated classes with hand-written native implementations to increase execution speed.

### Software Engineering & Architecture

- [Source-to-Source Translation](https://awesome-repositories.com/f/software-engineering-architecture/syntax-tree-analysis/source-to-source-translation.md) — Converts Java source code directly into Objective-C syntax to enable logic sharing across different operating systems.
- [Cross-Platform Logic Sharing](https://awesome-repositories.com/f/software-engineering-architecture/cross-platform-logic-sharing.md) — Allows writing business logic and data models once in Java and sharing them across different operating systems.
- [Dependency Reachability Analysis](https://awesome-repositories.com/f/software-engineering-architecture/dependency-reachability-analysis.md) — Identifies unused classes and methods by tracing paths from public entry points to enable dead code removal.

### Operating Systems & Systems Programming

- [Language Runtime Emulators](https://awesome-repositories.com/f/operating-systems-systems-programming/systems-programming/runtime-libraries/language-runtime-emulators.md) — Implements core Java classes and standard APIs in Objective-C to provide a compatible runtime environment on iOS.

### Development Tools & Productivity

- [Dead Code Elimination](https://awesome-repositories.com/f/development-tools-productivity/dead-code-elimination.md) — Provides an automation tool that removes unused code elements to reduce the final iOS binary size. ([source](https://github.com/google/j2objc/tree/master/tree_shaker))
- [Unused Code Identification](https://awesome-repositories.com/f/development-tools-productivity/dependency-analysis-tools/code-dependency-analysis/unused-code-identification.md) — Analyzes source files to identify classes and methods that are unreachable from defined public entry points. ([source](https://github.com/google/j2objc/tree/master/tree_shaker))
- [Library Translation](https://awesome-repositories.com/f/development-tools-productivity/java-library-integrations/library-translation.md) — Converts Java source code and dependencies into Objective-C libraries for use in iOS environments. ([source](https://github.com/google/j2objc/tree/master/guava))

### Mobile Development

- [iOS Application Optimization](https://awesome-repositories.com/f/mobile-development/ios-application-optimization.md) — Reduces binary size by removing dead code and replacing translated classes with native Objective-C implementations.

### Testing & Quality Assurance

- [Cross-Implementation Consistency Verification](https://awesome-repositories.com/f/testing-quality-assurance/cross-client-compatibility-validation/cross-implementation-consistency-verification.md) — Translates Java unit tests to verify that the Objective-C implementation remains logically consistent with the original Java.
- [Cross-Platform Unit Test Conversion](https://awesome-repositories.com/f/testing-quality-assurance/software-testing/testing-frameworks/unit/unit-testing/cross-platform-unit-test-conversion.md) — Converts Java test classes into executable binaries to verify individual code units on iOS hardware. ([source](https://github.com/google/j2objc/tree/master/junit))
- [Test Suite Transpilers](https://awesome-repositories.com/f/testing-quality-assurance/test-execution-reports/test-suite-transpilers.md) — Converts JUnit source tests into a format compatible with iOS to verify logical consistency. ([source](https://github.com/google/j2objc/blob/master/README.md))
- [Cross-Platform Test Execution](https://awesome-repositories.com/f/testing-quality-assurance/testing-infrastructure-management/cross-platform-test-execution.md) — Enables the execution of the same test suites on iOS to verify logic consistency with the original Java code. ([source](https://github.com/google/j2objc#readme))
- [Test Porting](https://awesome-repositories.com/f/testing-quality-assurance/testing-infrastructure-management/cross-platform-test-execution/test-porting.md) — Translates Java unit tests into executable binaries to verify logical consistency on iOS hardware.

### Part of an Awesome List

- [Code Generation](https://awesome-repositories.com/f/awesome-lists/devtools/code-generation.md) — Transpiles Java code to Objective-C for iOS development.
- [Developer Tools](https://awesome-repositories.com/f/awesome-lists/devtools/developer-tools.md) — Translator for porting Java code to Objective-C.
- [Virtual Machines](https://awesome-repositories.com/f/awesome-lists/devtools/virtual-machines.md) — Translate Java source to Objective-C for iOS.
