Skip to content

Commit

Permalink
removed varargs annotation from Params.setDefault taking multiple params
Browse files Browse the repository at this point in the history
  • Loading branch information
jkbradley committed Jul 23, 2015
1 parent e0b7ba5 commit 6016dc6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
5 changes: 4 additions & 1 deletion mllib/src/main/scala/org/apache/spark/ml/param/params.scala
Original file line number Diff line number Diff line change
Expand Up @@ -476,11 +476,14 @@ trait Params extends Identifiable with Serializable {
/**
* Sets default values for a list of params.
*
* Note: Java developers should use the single-parameter [[setDefault()]].
* Annotating this with varargs can cause compilation failures due to a Scala compiler bug.
* See SPARK-9268.
*
* @param paramPairs a list of param pairs that specify params and their default values to set
* respectively. Make sure that the params are initialized before this method
* gets called.
*/
@varargs
protected final def setDefault(paramPairs: ParamPair[_]*): this.type = {
paramPairs.foreach { p =>
setDefault(p.param.asInstanceOf[Param[Any]], p.value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,8 @@ private void init() {
new DoubleArrayParam(this, "myDoubleArrayParam", "this is a double param");

setDefault(myIntParam(), 1);
setDefault(myIntParam().w(1));
setDefault(myDoubleParam(), 0.5);
setDefault(myIntParam().w(1), myDoubleParam().w(0.5));
setDefault(myDoubleArrayParam(), new double[] {1.0, 2.0});
setDefault(myDoubleArrayParam().w(new double[] {1.0, 2.0}));
}

@Override
Expand Down

0 comments on commit 6016dc6

Please sign in to comment.