Lab 01 — Deprecated API Migration Analyzer

What You'll Build

A classifier that takes a set of API methods with their deprecation status and determines the migration urgency for each one, given a target library version.

Apache Context

Apache Spark follows a strict two-major-release deprecation policy. When the JavaRDD API was deprecated in Spark 2.0 in favor of Dataset, it was removed from the primary API surface in Spark 3.x. Callers who skipped the deprecation notices found NoSuchMethodError at runtime after upgrading.

This lab models the logic behind migration scanners like errorprone and the upgrade compatibility reports embedded in tooling such as the Spark Migration Guide.

Running

mvn test

Expected: 10 tests, 0 failures.

Key Classes

ClassRole
DeprecationStatusEnum: STABLE, DEPRECATED, REMOVED
MigrationUrgencyEnum: NONE, PLANNED, IMMEDIATE
ApiMethodMethod metadata: class, name, status, versions, replacement
MigrationResultOne classification result including human-readable rationale
ApiMigrationAnalyzeranalyze(method, targetVersion) + analyzeAll() + blockingResults()

Classification Rules

StatusUrgencyMeaning
STABLENONENo action needed
DEPRECATEDPLANNEDMigrate before the removal version
REMOVEDIMMEDIATEMust migrate — runtime failure guaranteed

Interview Angle

Be ready to explain the difference between source compatibility and binary compatibility. A method can be deprecated at source level but still present in the bytecode (binary-compatible). Removal is what creates NoSuchMethodError. Spark's move from DataFrame to Dataset[Row] was type-alias-only — source change, no binary break.