瀏覽代碼

ob-java.el: Do not wrap a main method in a main method

* lisp/ob-java.el (org-babel-expand-body:java): The code was checking
for existence of a class declaration before wrapping the content of
the code block in a main method, but it should be checking for
existence of a main method.
Ian Martins 4 年之前
父節點
當前提交
c38fda993d
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      lisp/ob-java.el

+ 1 - 1
lisp/ob-java.el

@@ -296,7 +296,7 @@ is simplest to expand the code block from the inside out."
       ;; wrap main.  If there are methods defined, but no main method
       ;; and no class, wrap everything in a generic main method.
       (goto-char (point-min))
-      (when (and (not (re-search-forward org-babel-java--class-re nil t))
+      (when (and (not (re-search-forward org-babel-java--main-re nil t))
                  (not (re-search-forward org-babel-java--any-method-re nil t)))
         (org-babel-java--move-past org-babel-java--package-re) ; if package is defined, move past it
         (org-babel-java--move-past org-babel-java--imports-re) ; if imports are defined, move past them