Skip to content

Conversation

@dongjoon-hyun
Copy link
Member

@dongjoon-hyun dongjoon-hyun commented Dec 5, 2022

What changes were proposed in this pull request?

This PR aims to replace the deprecated Class.newInstance with Class.getConstructor.newInstance.

Why are the changes needed?

SPARK-25984 removed these instances at Spark 3.0.0.

SPARK-37145 introduced newly two instances at Spark 3.3.0.

$ git grep classForName | grep newInstance | grep -v getConstructor
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/submit/KubernetesDriverBuilder.scala:        val feature = Utils.classForName[Any](className).newInstance()
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/scheduler/cluster/k8s/KubernetesExecutorBuilder.scala:        val feature = Utils.classForName[Any](className).newInstance()

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Pass the CIs.

This PR aims to replace `Class.newInstance` with `Class.getConstructor.newInstance`,

SPARK-25984 and SPARK-28063 removed these instances before.

SPARK-37145 introduced these new instances at 3.3.0.
@dongjoon-hyun
Copy link
Member Author

dongjoon-hyun commented Dec 5, 2022

Could you review this, @Yikun ? I missed this at SPARK-37145. (#35345)

Copy link
Member

@Yikun Yikun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@dongjoon-hyun
Copy link
Member Author

Thank you for review and approval, @Yikun .

@dongjoon-hyun
Copy link
Member Author

All tests (except documentation generation) are finished. This PR is irrelevant to the doc generation.
Merged to master/3.3.

dongjoon-hyun added a commit that referenced this pull request Dec 5, 2022
### What changes were proposed in this pull request?

This PR aims to replace the deprecated `Class.newInstance` with `Class.getConstructor.newInstance`.

### Why are the changes needed?

SPARK-25984 removed these instances at Spark 3.0.0.

SPARK-37145 introduced newly two instances at Spark 3.3.0.
```
$ git grep classForName | grep newInstance | grep -v getConstructor
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/submit/KubernetesDriverBuilder.scala:        val feature = Utils.classForName[Any](className).newInstance()
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/scheduler/cluster/k8s/KubernetesExecutorBuilder.scala:        val feature = Utils.classForName[Any](className).newInstance()
```

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

Pass the CIs.

Closes #38909 from dongjoon-hyun/SPARK-41385.

Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
(cherry picked from commit 9482906)
Signed-off-by: Dongjoon Hyun <[email protected]>
@dongjoon-hyun dongjoon-hyun deleted the SPARK-41385 branch December 5, 2022 06:28
beliefer pushed a commit to beliefer/spark that referenced this pull request Dec 18, 2022
### What changes were proposed in this pull request?

This PR aims to replace the deprecated `Class.newInstance` with `Class.getConstructor.newInstance`.

### Why are the changes needed?

SPARK-25984 removed these instances at Spark 3.0.0.

SPARK-37145 introduced newly two instances at Spark 3.3.0.
```
$ git grep classForName | grep newInstance | grep -v getConstructor
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/submit/KubernetesDriverBuilder.scala:        val feature = Utils.classForName[Any](className).newInstance()
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/scheduler/cluster/k8s/KubernetesExecutorBuilder.scala:        val feature = Utils.classForName[Any](className).newInstance()
```

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

Pass the CIs.

Closes apache#38909 from dongjoon-hyun/SPARK-41385.

Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants