From 9fbb5a436ebc007d19adc20fcee7ebf08e4aec3b Mon Sep 17 00:00:00 2001 From: Ian Martins Date: Thu, 12 Nov 2020 05:09:11 -0500 Subject: [PATCH 1/2] 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. --- lisp/ob-java.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/ob-java.el b/lisp/ob-java.el index d8d4db852..92e873f0d 100644 --- a/lisp/ob-java.el +++ b/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 -- 2.25.1