senny/emacs-eclim — Issue #37: eclim-java-import-missing throws an error on emacs24
Author: amardeep
Created: 2012-02-03 01:14:23+00:00
State: open

Starting with the following basic file missing include for IOExceptoin:

import java.io.File;
import java.util.*;

public class EclimImportTest {

public static void main(String[] args) throws IOException {

}

}

when i run eclim-java-import-missing, i get the following error:
Debugger entered--Lisp error: (args-out-of-range "java.io.File" 0 17)
substring-no-properties("java.io.File" 0 17)
(equal (substring-no-properties string 0 (string-width prefix)) prefix)
string-startswith-p("java.io.File" "asposewobfuscated")
cl-position("java.io.File" ("android" "antenna" "antlr" "ar" "asposewobfuscated" "asquare" "atg" "au" "beaver" "bibtex" "bmsi" "bsh" "ccl" "cern" "ChartDirector" "checkers" "com" "COM" "common" "contribs" "corejava" "cryptix" "cybervillains" "dalvik" "danbikel" "de" "EDU" "eg" "eu" "examples" "fat" "fit" "fitlibrary" "fmpp" "freemarker" "gnu" "groovy" "groovyjarjarantlr" "groovyjarjarasm" "hak" "hep" "ie" "imageinfo" "info" "it" "jal" "Jama" "japa" "japacheckers" "jas" ...) 0 nil nil)
position("java.io.File" ("android" "antenna" "antlr" "ar" "asposewobfuscated" "asquare" "atg" "au" "beaver" "bibtex" "bmsi" "bsh" "ccl" "cern" "ChartDirector" "checkers" "com" "COM" "common" "contribs" "corejava" "cryptix" "cybervillains" "dalvik" "danbikel" "de" "EDU" "eg" "eu" "examples" "fat" "fit" "fitlibrary" "fmpp" "freemarker" "gnu" "groovy" "groovyjarjarantlr" "groovyjarjarasm" "hak" "hep" "ie" "imageinfo" "info" "it" "jal" "Jama" "japa" "japacheckers" "jas" ...) :test string-startswith-p)
apply(position "java.io.File" ("android" "antenna" "antlr" "ar" "asposewobfuscated" "asquare" "atg" "au" "beaver" "bibtex" "bmsi" "bsh" "ccl" "cern" "ChartDirector" "checkers" "com" "COM" "common" "contribs" "corejava" "cryptix" "cybervillains" "dalvik" "danbikel" "de" "EDU" "eg" "eu" "examples" "fat" "fit" "fitlibrary" "fmpp" "freemarker" "gnu" "groovy" "groovyjarjarantlr" "groovyjarjarasm" "hak" "hep" "ie" "imageinfo" "info" "it" "jal" "Jama" "japa" "japacheckers" "jas" ...) (:test string-startswith-p))
find("java.io.File" ("android" "antenna" "antlr" "ar" "asposewobfuscated" "asquare" "atg" "au" "beaver" "bibtex" "bmsi" "bsh" "ccl" "cern" "ChartDirector" "checkers" "com" "COM" "common" "contribs" "corejava" "cryptix" "cybervillains" "dalvik" "danbikel" "de" "EDU" "eg" "eu" "examples" "fat" "fit" "fitlibrary" "fmpp" "freemarker" "gnu" "groovy" "groovyjarjarantlr" "groovyjarjarasm" "hak" "hep" "ie" "imageinfo" "info" "it" "jal" "Jama" "japa" "japacheckers" "jas" ...) :test string-startswith-p)
(or (find imp non-ordered :test (function string-startswith-p)) :default)
(setq key (or (find imp non-ordered :test (function string-startswith-p)) :default))
(while (consp --cl-var--) (setq imp (car --cl-var--)) (setq key (or (find imp non-ordered :test (function string-startswith-p)) :default)) (puthash key (cons imp (gethash key sorted)) sorted) (setq --cl-var-- (cdr --cl-var--)))
(let* ((--cl-var-- (sort imports (function string<))) (imp nil) (key nil)) (while (consp --cl-var--) (setq imp (car --cl-var--)) (setq key (or (find imp non-ordered :test (function string-startswith-p)) :default)) (puthash key (cons imp (gethash key sorted)) sorted) (setq --cl-var-- (cdr --cl-var--))) nil)
(catch (quote --cl-block-nil--) (let* ((--cl-var-- (sort imports (function string<))) (imp nil) (key nil)) (while (consp --cl-var--) (setq imp (car --cl-var--)) (setq key (or (find imp non-ordered :test (function string-startswith-p)) :default)) (puthash key (cons imp (gethash key sorted)) sorted) (setq --cl-var-- (cdr --cl-var--))) nil))
(cl-block-wrapper (catch (quote --cl-block-nil--) (let* ((--cl-var-- (sort imports (function string<))) (imp nil) (key nil)) (while (consp --cl-var--) (setq imp (car --cl-var--)) (setq key (or (find imp non-ordered :test (function string-startswith-p)) :default)) (puthash key (cons imp (gethash key sorted)) sorted) (setq --cl-var-- (cdr --cl-var--))) nil)))
(block nil (let* ((--cl-var-- (sort imports (function string<))) (imp nil) (key nil)) (while (consp --cl-var--) (setq imp (car --cl-var--)) (setq key (or (find imp non-ordered :test (function string-startswith-p)) :default)) (puthash key (cons imp (gethash key sorted)) sorted) (setq --cl-var-- (cdr --cl-var--))) nil))
(loop for imp in (sort imports (function string<)) for key = (or (find imp non-ordered :test (function string-startswith-p)) :default) do (puthash key (cons imp (gethash key sorted)) sorted))
(let* ((non-ordered (loop for a in imports-order for r = (cdr imports-order) then (cdr r) while (string< a (car r)) finally return r)) (sorted (make-hash-table))) (loop for imp in (sort imports (function string<)) for key = (or (find imp non-ordered :test (function string-startswith-p)) :default) do (puthash key (cons imp (gethash key sorted)) sorted)) (remove-duplicates (loop for key in (cons :default non-ordered) append (reverse (gethash key sorted))) :test (function string=)))
eclim--java-sort-imports(("java.util.*") ("com.google" "android" "antenna" "antlr" "ar" "asposewobfuscated" "asquare" "atg" "au" "beaver" "bibtex" "bmsi" "bsh" "ccl" "cern" "ChartDirector" "checkers" "com" "COM" "common" "contribs" "corejava" "cryptix" "cybervillains" "dalvik" "danbikel" "de" "EDU" "eg" "eu" "examples" "fat" "fit" "fitlibrary" "fmpp" "freemarker" "gnu" "groovy" "groovyjarjarantlr" "groovyjarjarasm" "hak" "hep" "ie" "imageinfo" "info" "it" "jal" "Jama" "japa" "japacheckers" ...))
(write-imports (eclim--java-sort-imports imports imports-order))
(let ((imports (remove-if (function eclim--java-ignore-import-p) (remove-if (lambda (x) (member x unused-imports)) (append (eclim--java-extract-imports) additional-imports))))) (write-imports (eclim--java-sort-imports imports imports-order)))
(progn (fset (quote write-imports) (function* (lambda (imports) (block write-imports (loop for imp in imports for last-import-first-part = nil then first-part for first-part = (first (eclim--java-package-components imp)) do (progn (unless ... ...) (insert ...))))))) (let ((imports (remove-if (function eclim--java-ignore-import-p) (remove-if (lambda (x) (member x unused-imports)) (append (eclim--java-extract-imports) additional-imports))))) (write-imports (eclim--java-sort-imports imports imports-order))))
(unwind-protect (progn (fset (quote write-imports) (function* (lambda (imports) (block write-imports (loop for imp in imports for last-import-first-part = nil then first-part for first-part = (first ...) do (progn ... ...)))))) (let ((imports (remove-if (function eclim--java-ignore-import-p) (remove-if (lambda ... ...) (append ... additional-imports))))) (write-imports (eclim--java-sort-imports imports imports-order)))) (if --cl-letf-bound-- (fset (quote write-imports) --cl-letf-save--) (fmakunbound (quote write-imports))))
(let* ((--cl-letf-bound-- (fboundp (quote write-imports))) (--cl-letf-save-- (and --cl-letf-bound-- (symbol-function (quote write-imports))))) (unwind-protect (progn (fset (quote write-imports) (function* (lambda (imports) (block write-imports (loop for imp in imports for last-import-first-part = nil then first-part for first-part = ... do ...))))) (let ((imports (remove-if (function eclim--java-ignore-import-p) (remove-if ... ...)))) (write-imports (eclim--java-sort-imports imports imports-order)))) (if --cl-letf-bound-- (fset (quote write-imports) --cl-letf-save--) (fmakunbound (quote write-imports)))))
(letf (((symbol-function (quote write-imports)) (function* (lambda (imports) (block write-imports (loop for imp in imports for last-import-first-part = nil then first-part for first-part = (first ...) do (progn ... ...))))))) (let ((imports (remove-if (function eclim--java-ignore-import-p) (remove-if (lambda (x) (member x unused-imports)) (append (eclim--java-extract-imports) additional-imports))))) (write-imports (eclim--java-sort-imports imports imports-order))))
(letf* (((symbol-function (quote write-imports)) (function* (lambda (imports) (block write-imports (loop for imp in imports for last-import-first-part = nil then first-part for first-part = (first ...) do (progn ... ...))))))) (let ((imports (remove-if (function eclim--java-ignore-import-p) (remove-if (lambda (x) (member x unused-imports)) (append (eclim--java-extract-imports) additional-imports))))) (write-imports (eclim--java-sort-imports imports imports-order))))
(flet ((write-imports (imports) (loop for imp in imports for last-import-first-part = nil then first-part for first-part = (first (eclim--java-package-components imp)) do (progn (unless (equal last-import-first-part first-part) (newline)) (insert (format "import %s;\n" imp)))))) (let ((imports (remove-if (function eclim--java-ignore-import-p) (remove-if (lambda (x) (member x unused-imports)) (append (eclim--java-extract-imports) additional-imports))))) (write-imports (eclim--java-sort-imports imports imports-order))))
(save-excursion (flet ((write-imports (imports) (loop for imp in imports for last-import-first-part = nil then first-part for first-part = (first (eclim--java-package-components imp)) do (progn (unless (equal last-import-first-part first-part) (newline)) (insert (format "import %s;\n" imp)))))) (let ((imports (remove-if (function eclim--java-ignore-import-p) (remove-if (lambda ... ...) (append ... additional-imports))))) (write-imports (eclim--java-sort-imports imports imports-order)))))
eclim--java-organize-imports(("com.google" "android" "antenna" "antlr" "ar" "asposewobfuscated" "asquare" "atg" "au" "beaver" "bibtex" "bmsi" "bsh" "ccl" "cern" "ChartDirector" "checkers" "com" "COM" "common" "contribs" "corejava" "cryptix" "cybervillains" "dalvik" "danbikel" "de" "EDU" "eg" "eu" "examples" "fat" "fit" "fitlibrary" "fmpp" "freemarker" "gnu" "groovy" "groovyjarjarantlr" "groovyjarjarasm" "hak" "hep" "ie" "imageinfo" "info" "it" "jal" "Jama" "japa" "japacheckers" ...) ("java.io.IOException" "java.util.*"))
(progn (eclim--java-organize-imports imports-order (list (if (string-endswith-p import type) import (concat import "." type)))))
(if import (progn (eclim--java-organize-imports imports-order (list (if (string-endswith-p import type) import (concat import "." type))))))
(when import (eclim--java-organize-imports imports-order (list (if (string-endswith-p import type) import (concat import "." type)))))
(let* ((candidates (append (cdr (assoc (quote imports) unused)) nil)) (type (cdr (assoc (quote type) unused))) (import (if (= 1 (length candidates)) (car candidates) (eclim--completing-read (concat "Missing type '" type "'") candidates)))) (when import (eclim--java-organize-imports imports-order (list (if (string-endswith-p import type) import (concat import "." type))))))
(while (< (setq --cl-idx-- (1+ --cl-idx--)) (length --cl-vec--)) (setq unused (aref --cl-vec-- --cl-idx--)) (let* ((candidates (append (cdr (assoc (quote imports) unused)) nil)) (type (cdr (assoc (quote type) unused))) (import (if (= 1 (length candidates)) (car candidates) (eclim--completing-read (concat "Missing type '" type "'") candidates)))) (when import (eclim--java-organize-imports imports-order (list (if (string-endswith-p import type) import (concat import "." type)))))))
(let* ((--cl-vec-- (json-read-from-string (replace-regexp-in-string "'" "\"" (first (eclim/execute-command "java_import_missing" "-p" "-f"))))) (--cl-idx-- -1) (unused nil)) (while (< (setq --cl-idx-- (1+ --cl-idx--)) (length --cl-vec--)) (setq unused (aref --cl-vec-- --cl-idx--)) (let* ((candidates (append (cdr (assoc ... unused)) nil)) (type (cdr (assoc (quote type) unused))) (import (if (= 1 (length candidates)) (car candidates) (eclim--completing-read (concat "Missing type '" type "'") candidates)))) (when import (eclim--java-organize-imports imports-order (list (if (string-endswith-p import type) import (concat import "." type))))))) nil)
(catch (quote --cl-block-nil--) (let* ((--cl-vec-- (json-read-from-string (replace-regexp-in-string "'" "\"" (first (eclim/execute-command "java_import_missing" "-p" "-f"))))) (--cl-idx-- -1) (unused nil)) (while (< (setq --cl-idx-- (1+ --cl-idx--)) (length --cl-vec--)) (setq unused (aref --cl-vec-- --cl-idx--)) (let* ((candidates (append (cdr ...) nil)) (type (cdr (assoc ... unused))) (import (if (= 1 ...) (car candidates) (eclim--completing-read ... candidates)))) (when import (eclim--java-organize-imports imports-order (list (if ... import ...)))))) nil))
(cl-block-wrapper (catch (quote --cl-block-nil--) (let* ((--cl-vec-- (json-read-from-string (replace-regexp-in-string "'" "\"" (first ...)))) (--cl-idx-- -1) (unused nil)) (while (< (setq --cl-idx-- (1+ --cl-idx--)) (length --cl-vec--)) (setq unused (aref --cl-vec-- --cl-idx--)) (let* ((candidates (append ... nil)) (type (cdr ...)) (import (if ... ... ...))) (when import (eclim--java-organize-imports imports-order (list ...))))) nil)))
(block nil (let* ((--cl-vec-- (json-read-from-string (replace-regexp-in-string "'" "\"" (first (eclim/execute-command "java_import_missing" "-p" "-f"))))) (--cl-idx-- -1) (unused nil)) (while (< (setq --cl-idx-- (1+ --cl-idx--)) (length --cl-vec--)) (setq unused (aref --cl-vec-- --cl-idx--)) (let* ((candidates (append (cdr ...) nil)) (type (cdr (assoc ... unused))) (import (if (= 1 ...) (car candidates) (eclim--completing-read ... candidates)))) (when import (eclim--java-organize-imports imports-order (list (if ... import ...)))))) nil))
(loop for unused across (json-read-from-string (replace-regexp-in-string "'" "\"" (first (eclim/execute-command "java_import_missing" "-p" "-f")))) do (let* ((candidates (append (cdr (assoc (quote imports) unused)) nil)) (type (cdr (assoc (quote type) unused))) (import (if (= 1 (length candidates)) (car candidates) (eclim--completing-read (concat "Missing type '" type "'") candidates)))) (when import (eclim--java-organize-imports imports-order (list (if (string-endswith-p import type) import (concat import "." type)))))))
(progn (loop for unused across (json-read-from-string (replace-regexp-in-string "'" "\"" (first (eclim/execute-command "java_import_missing" "-p" "-f")))) do (let* ((candidates (append (cdr (assoc ... unused)) nil)) (type (cdr (assoc (quote type) unused))) (import (if (= 1 (length candidates)) (car candidates) (eclim--completing-read (concat "Missing type '" type "'") candidates)))) (when import (eclim--java-organize-imports imports-order (list (if (string-endswith-p import type) import (concat import "." type))))))))
(if imports-order (progn (loop for unused across (json-read-from-string (replace-regexp-in-string "'" "\"" (first (eclim/execute-command "java_import_missing" "-p" "-f")))) do (let* ((candidates (append (cdr ...) nil)) (type (cdr (assoc ... unused))) (import (if (= 1 ...) (car candidates) (eclim--completing-read ... candidates)))) (when import (eclim--java-organize-imports imports-order (list (if ... import ...))))))))
(when imports-order (loop for unused across (json-read-from-string (replace-regexp-in-string "'" "\"" (first (eclim/execute-command "java_import_missing" "-p" "-f")))) do (let* ((candidates (append (cdr (assoc ... unused)) nil)) (type (cdr (assoc (quote type) unused))) (import (if (= 1 (length candidates)) (car candidates) (eclim--completing-read (concat "Missing type '" type "'") candidates)))) (when import (eclim--java-organize-imports imports-order (list (if (string-endswith-p import type) import (concat import "." type))))))))
(let* ((imports-order (eclim/execute-command "java_import_order" "-p")) (eclim-auto-save (and eclim-auto-save (not nil)))) (when imports-order (loop for unused across (json-read-from-string (replace-regexp-in-string "'" "\"" (first (eclim/execute-command "java_import_missing" "-p" "-f")))) do (let* ((candidates (append (cdr ...) nil)) (type (cdr (assoc ... unused))) (import (if (= 1 ...) (car candidates) (eclim--completing-read ... candidates)))) (when import (eclim--java-organize-imports imports-order (list (if ... import ...))))))))
(eclim/with-results imports-order ("java_import_order" "-p") (loop for unused across (json-read-from-string (replace-regexp-in-string "'" "\"" (first (eclim/execute-command "java_import_missing" "-p" "-f")))) do (let* ((candidates (append (cdr (assoc ... unused)) nil)) (type (cdr (assoc (quote type) unused))) (import (if (= 1 (length candidates)) (car candidates) (eclim--completing-read (concat "Missing type '" type "'") candidates)))) (when import (eclim--java-organize-imports imports-order (list (if (string-endswith-p import type) import (concat import "." type))))))))
eclim-java-import-missing()
call-interactively(eclim-java-import-missing t nil)
execute-extended-command(nil)
call-interactively(execute-extended-command nil nil)