Skip to content

Commit

Permalink
[ZEPPELIN-823] Remove usage of Scala 2.10 depecrated APIs
Browse files Browse the repository at this point in the history
### What is this PR for?
Remove usage of Scala 2.10 depecrated APIs as a few of these deprecated APIs have been removed in Scala 2..11. This change is an incremental step on enabling Scala 2.11 builds.

### What type of PR is it?
[Improvement]

### What is the Jira issue?
[ZEPPELIN-823](https://issues.apache.org/jira/browse/ZEPPELIN-823)

Author: Luciano Resende <[email protected]>

Closes apache#853 from lresende/scala-210-211-deprecated-apis and squashes the following commits:

4be4cab [Luciano Resende] [ZEPPELIN-823] Remove usage of Scala 2.10 depecrated APIs
  • Loading branch information
lresende authored and Felix Cheung committed Apr 26, 2016
1 parent a63e034 commit c8c26b5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -302,10 +302,10 @@ public void should_parse_accurate_date() throws Exception {
}

private <A> scala.collection.immutable.List<A> toScalaList(java.util.List<A> list) {
return scala.collection.JavaConversions.asScalaIterable(list).toList();
return scala.collection.JavaConversions.collectionAsScalaIterable(list).toList();
}

private <A> java.util.List<A> toJavaList(scala.collection.immutable.List<A> list){
return scala.collection.JavaConversions.asJavaList(list);
return scala.collection.JavaConversions.seqAsJavaList(list);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ public int getProgress(InterpreterContext context) {
public List<String> completion(String buf, int cursor) {
ScalaCompleter c = completor.completer();
Candidates ret = c.complete(buf, cursor);
return scala.collection.JavaConversions.asJavaList(ret.candidates());
return scala.collection.JavaConversions.seqAsJavaList(ret.candidates());
}

private List<File> currentClassPath() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ public List<String> completion(String buf, int cursor) {
}
ScalaCompleter c = completor.completer();
Candidates ret = c.complete(completionText, cursor);
return scala.collection.JavaConversions.asJavaList(ret.candidates());
return scala.collection.JavaConversions.seqAsJavaList(ret.candidates());
}

private String getCompletionTargetString(String text, int cursor) {
Expand Down Expand Up @@ -901,14 +901,14 @@ private int[] getProgressFromStage_1_0x(JobProgressListener sparkListener, Objec

Object completedTaskInfo = null;

completedTaskInfo = JavaConversions.asJavaMap(
completedTaskInfo = JavaConversions.mapAsJavaMap(
(HashMap<Object, Object>) sparkListener.getClass()
.getMethod("stageIdToTasksComplete").invoke(sparkListener)).get(id);

if (completedTaskInfo != null) {
completedTasks += (int) completedTaskInfo;
}
List<Object> parents = JavaConversions.asJavaList((Seq<Object>) stage.getClass()
List<Object> parents = JavaConversions.seqAsJavaList((Seq<Object>) stage.getClass()
.getMethod("parents").invoke(stage));
if (parents != null) {
for (Object s : parents) {
Expand Down Expand Up @@ -937,7 +937,7 @@ private int[] getProgressFromStage_1_1x(JobProgressListener sparkListener, Objec

Method numCompletedTasks = stageUIDataClass.getMethod("numCompleteTasks");
Set<Tuple2<Object, Object>> keys =
JavaConverters.asJavaSetConverter(stageIdData.keySet()).asJava();
JavaConverters.setAsJavaSetConverter(stageIdData.keySet()).asJava();
for (Tuple2<Object, Object> k : keys) {
if (id == (int) k._1()) {
Object uiData = stageIdData.get(k).get();
Expand All @@ -948,7 +948,7 @@ private int[] getProgressFromStage_1_1x(JobProgressListener sparkListener, Objec
logger.error("Error on getting progress information", e);
}

List<Object> parents = JavaConversions.asJavaList((Seq<Object>) stage.getClass()
List<Object> parents = JavaConversions.seqAsJavaList((Seq<Object>) stage.getClass()
.getMethod("parents").invoke(stage));
if (parents != null) {
for (Object s : parents) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import static scala.collection.JavaConversions.asJavaCollection;
import static scala.collection.JavaConversions.asJavaIterable;
import static scala.collection.JavaConversions.asScalaIterable;
import static scala.collection.JavaConversions.collectionAsScalaIterable;

import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
Expand Down Expand Up @@ -95,13 +95,13 @@ public scala.collection.Iterable<Object> checkbox(String name,
for (Tuple2<Object, String> option : asJavaIterable(options)) {
allChecked.add(option._1());
}
return checkbox(name, asScalaIterable(allChecked), options);
return checkbox(name, collectionAsScalaIterable(allChecked), options);
}

public scala.collection.Iterable<Object> checkbox(String name,
scala.collection.Iterable<Object> defaultChecked,
scala.collection.Iterable<Tuple2<Object, String>> options) {
return asScalaIterable(gui.checkbox(name, asJavaCollection(defaultChecked),
return collectionAsScalaIterable(gui.checkbox(name, asJavaCollection(defaultChecked),
tuplesToParamOptions(options)));
}

Expand Down

0 comments on commit c8c26b5

Please sign in to comment.