You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by jo...@apache.org on 2017/04/18 16:58:27 UTC

zeppelin git commit: Revert "[ZEPPELIN-658] Scala: not accepting companion objects if defined in different lines"

Repository: zeppelin
Updated Branches:
  refs/heads/branch-0.7 c9f2c5fb2 -> 11d6fb38a


Revert "[ZEPPELIN-658] Scala: not accepting companion objects if defined in different lines"

This reverts commit 0629d93709f13c9196becfd90a65dd3a444f516f.


Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/11d6fb38
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/11d6fb38
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/11d6fb38

Branch: refs/heads/branch-0.7
Commit: 11d6fb38a432be8b6e2871aaa04c23cf7d91fd7b
Parents: c9f2c5f
Author: Jongyoul Lee <jo...@gmail.com>
Authored: Wed Apr 19 01:33:01 2017 +0900
Committer: Jongyoul Lee <jo...@gmail.com>
Committed: Wed Apr 19 01:58:08 2017 +0900

----------------------------------------------------------------------
 .../apache/zeppelin/spark/SparkInterpreter.java | 23 +-------------------
 .../zeppelin/spark/SparkInterpreterTest.java    | 11 ----------
 2 files changed, 1 insertion(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/11d6fb38/spark/src/main/java/org/apache/zeppelin/spark/SparkInterpreter.java
----------------------------------------------------------------------
diff --git a/spark/src/main/java/org/apache/zeppelin/spark/SparkInterpreter.java b/spark/src/main/java/org/apache/zeppelin/spark/SparkInterpreter.java
index a2eeac6..6edf654 100644
--- a/spark/src/main/java/org/apache/zeppelin/spark/SparkInterpreter.java
+++ b/spark/src/main/java/org/apache/zeppelin/spark/SparkInterpreter.java
@@ -1172,34 +1172,13 @@ public class SparkInterpreter extends Interpreter {
     context.out.clear();
     Code r = null;
     String incomplete = "";
-    boolean inComment = false;
 
     for (int l = 0; l < linesToRun.length; l++) {
       String s = linesToRun[l];
       // check if next line starts with "." (but not ".." or "./") it is treated as an invocation
       if (l + 1 < linesToRun.length) {
         String nextLine = linesToRun[l + 1].trim();
-        boolean continuation = false;
-        if (nextLine.isEmpty()
-           || nextLine.startsWith("//")         // skip empty line or comment
-           || nextLine.startsWith("}")
-           || nextLine.startsWith("object")) {  // include "} object" for Scala companion object
-          continuation = true;
-        } else if (!inComment && nextLine.startsWith("/*")) {
-          inComment = true;
-          continuation = true;
-        } else if (inComment && nextLine.lastIndexOf("*/") >= 0) {
-          inComment = false;
-          continuation = true;
-        } else if (nextLine.length() > 1
-                && nextLine.charAt(0) == '.'
-                && nextLine.charAt(1) != '.'     // ".."
-                && nextLine.charAt(1) != '/') {  // "./"
-          continuation = true;
-        } else if (inComment) {
-          continuation = true;
-        }
-        if (continuation) {
+        if (nextLine.startsWith(".") && !nextLine.startsWith("..") && !nextLine.startsWith("./")) {
           incomplete += s + "\n";
           continue;
         }

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/11d6fb38/spark/src/test/java/org/apache/zeppelin/spark/SparkInterpreterTest.java
----------------------------------------------------------------------
diff --git a/spark/src/test/java/org/apache/zeppelin/spark/SparkInterpreterTest.java b/spark/src/test/java/org/apache/zeppelin/spark/SparkInterpreterTest.java
index 8552e24..58b5e91 100644
--- a/spark/src/test/java/org/apache/zeppelin/spark/SparkInterpreterTest.java
+++ b/spark/src/test/java/org/apache/zeppelin/spark/SparkInterpreterTest.java
@@ -127,17 +127,6 @@ public class SparkInterpreterTest {
   }
 
   @Test
-  public void testNextLineComments() {
-    assertEquals(InterpreterResult.Code.SUCCESS, repl.interpret("\"123\"\n/*comment here\n*/.toInt", context).code());
-  }
-
-  @Test
-  public void testNextLineCompanionObject() {
-    String code = "class Counter {\nvar value: Long = 0\n}\n // comment\n\n object Counter {\n def apply(x: Long) = new Counter()\n}";
-    assertEquals(InterpreterResult.Code.SUCCESS, repl.interpret(code, context).code());
-  }
-
-  @Test
   public void testEndWithComment() {
     assertEquals(InterpreterResult.Code.SUCCESS, repl.interpret("val c=1\n//comment", context).code());
   }