Skip to content

Latest commit

 

History

History
31 lines (20 loc) · 1.76 KB

File metadata and controls

31 lines (20 loc) · 1.76 KB

ADR-0004: Java 8 Minimum Target and Android Compatibility

Status

Accepted

Context

The SDK targets both server-side Java applications and Android applications. Android historically lagged the JVM ecosystem — Android API 21 (Lollipop) supports Java 8 language features with some limitations. The project must:

  • Compile and run on Java 8+
  • Be compatible with Android API 21+ (via the optional com.google.android:android stub)
  • Avoid Java 9+ APIs (modules, var, new collection factories) in production code

Git history shows an explicit decision: "ignore jdk>8 due to android dependencies" and the pom.xml pin <java.version>1.8</java.version>.

Decision

  • Set <java.version>1.8</java.version> in pom.xml for both source and target compiler flags.
  • Include com.google.android:android as an optional compile-time dependency to provide Android API stubs without forcing Android as a required dependency for JVM-only consumers.
  • Pin <android.platform>21</android.platform> as the minimum API level.
  • Keep all production Java code in src/main/java/ at Java 8 language level. Tests in src/test/kotlin/ may use Kotlin language features freely.

Consequences

  • Enables: SDK works on Android 5.0+ (API 21) and all Java 8+ server environments without modification.
  • Constrains: Cannot use Java 9+ APIs (var, List.of(), Map.of(), Optional.ifPresentOrElse(), etc.) in production code. New contributors accustomed to modern Java must be vigilant.
  • Testing: Robolectric is included in test scope for Android-specific test scenarios.
  • CI: The devcontainer uses Temurin JDK 8 base image (multi-arch, supports Apple Silicon natively) to catch any accidental Java 9+ API usage.