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
| Class | Role |
|---|---|
DeprecationStatus | Enum: STABLE, DEPRECATED, REMOVED |
MigrationUrgency | Enum: NONE, PLANNED, IMMEDIATE |
ApiMethod | Method metadata: class, name, status, versions, replacement |
MigrationResult | One classification result including human-readable rationale |
ApiMigrationAnalyzer | analyze(method, targetVersion) + analyzeAll() + blockingResults() |
Classification Rules
| Status | Urgency | Meaning |
|---|---|---|
| STABLE | NONE | No action needed |
| DEPRECATED | PLANNED | Migrate before the removal version |
| REMOVED | IMMEDIATE | Must 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.