[ https://issues.apache.org/jira/browse/SYSTEMML-866?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15437077#comment-15437077 ]
Deron Eriksson commented on SYSTEMML-866: ----------------------------------------- The following reflection code could be used to fix this issue if it had been an issue: {code} @SuppressWarnings("unchecked") public static List<Object> seqAsJavaList(scala.collection.Seq<Object> inputs) { Method m; try { // JavaConversions.seqAsJavaList() for Scala 2.11 m = JavaConversions.class.getMethod("seqAsJavaList", scala.collection.Seq.class); } catch (NoSuchMethodException e) { try { // JavaConversions.asJavaList() for Scala 2.10 m = JavaConversions.class.getMethod("asJavaList", scala.collection.Seq.class); } catch (NoSuchMethodException e1) { throw new MLContextException( "JavaConversions methods 'seqAsJavaList' (Scala 2.11) and 'asJavaList' (Scala 2.10) not found"); } } try { return (List<Object>) m.invoke(null, inputs); } catch (Exception e) { throw new MLContextException("Exception occurred invoking " + m.getName(), e); } } @SuppressWarnings("unchecked") public static scala.collection.mutable.Map<String, Object> mapAsScalaMap(Map<String, Object> inputs) { Method m; try { // JavaConversions.mapAsScalaMap() for Scala 2.11 m = JavaConversions.class.getMethod("mapAsScalaMap", Map.class); } catch (NoSuchMethodException e) { try { // JavaConversions.asScalaMap() for Scala 2.10 m = JavaConversions.class.getMethod("asScalaMap", Map.class); } catch (NoSuchMethodException e1) { throw new MLContextException( "JavaConversions methods 'mapAsScalaMap' (Scala 2.11) and 'asScalaMap' (Scala 2.10) not found"); } } try { return (scala.collection.mutable.Map<String, Object>) m.invoke(null, inputs); } catch (Exception e) { throw new MLContextException("Exception occurred invoking " + m.getName(), e); } } {code} > Update JavaConversions to support Scala 2.10 and 2.11 > ----------------------------------------------------- > > Key: SYSTEMML-866 > URL: https://issues.apache.org/jira/browse/SYSTEMML-866 > Project: SystemML > Issue Type: Task > Components: APIs > Reporter: Deron Eriksson > Assignee: Deron Eriksson > > Currently the default Scala version for the project is 2.11 but we also have > a profile for Scala 2.10. > Currently the project code is 2.11 compatible but not 2.10 compatible. > I believe the only code changes required from 2.10 to 2.11 were: > JavaConversions.asJavaList -> JavaConversions.seqAsJavaList > JavaConversions.asScalaMap -> JavaConversions.mapAsScalaMap > We should be able to add some reflection to the invocations of these methods > so that we can support Scala 2.10 and 2.11 using the same codebase. -- This message was sent by Atlassian JIRA (v6.3.4#6332)