[SPARK-3543] Write TaskContext in Java and expose it through a static accessor.

can u go through the file and use only one line to separate functions