;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. (byte-code "\300\301!\210\300\302!\210\303\304\305\306\307\310%\210\311\312\313\314\315DD\316\307\304\317\320&\210\311\321\313\314\322DD\323\307\304\317\324&\210\311\325\313\314\326DD\327\307\304\317\330&\210\311\331\313\314\332DD\333\307\304\317\334&\210\311\335\313\314\336DD\337\307\304\317\330&\210\311\340\313\314\341DD\342\307\304\317\343&\207" [require javaimp-maven javaimp-gradle custom-declare-group javaimp nil "Add and reorder Java import statements in Maven/Gradle\nprojects" :group c custom-declare-variable javaimp-import-group-alist funcall function #[0 "\300\207" [(("\\`java\\." . 10) ("\\`javax\\." . 15))] 1] "Specifies how to group classes and how to order resulting\ngroups in the imports list.\n\nEach element should be of the form (CLASSNAME-REGEXP . ORDER)\nwhere CLASSNAME-REGEXP is a regexp matching the fully qualified\nclass name. Lowest-order groups are placed earlier.\n\nThe order of classes which were not matched is defined by\n`javaimp-import-default-order'." :type (alist :key-type string :value-type integer) javaimp-import-default-order #[0 "\300\207" [50] 1] "Defines the order of classes which were not matched by\n`javaimp-import-group-alist'" integer javaimp-java-home #[0 "\300\301!\207" [getenv "JAVA_HOME"] 2] "Path to the JDK. Directory jre/lib underneath this path is\nsearched for JDK libraries. By default, it is initialized from\nthe JAVA_HOME environment variable." string javaimp-additional-source-dirs #[0 "\300\207" [nil] 1] "List of directories where additional (e.g. generated)\nsource files reside.\n\nEach directory is a relative path from ${project.build.directory} project\nproperty value.\n\nTypically you would check documentation for a Maven plugin, look\nat the parameter's default value there and add it to this list.\n\nE.g. \"${project.build.directory}/generated-sources/\"\nbecomes \"generated-sources/\" (note the absence\nof the leading slash.\n\nCustom values set in plugin configuration in pom.xml are not\nsupported yet." (repeat (string :tag "Relative directory")) javaimp-jar-program #[0 "\300\207" [#1="jar"] 1 #1#] "Path to the `jar' program used to read contents of jar files.\nCustomize it if the program is not on `exec-path'." javaimp-include-current-module-classes #[0 "\300\207" [t] 1] "If non-nil, current module's classes are included into\ncompletion alternatives. `javaimp-add-import' will find all java\nfiles in the current project and add their fully-qualified names\nto the completion alternatives list." boolean] 8) #@18 Visited projects (defvar javaimp-project-forest nil (#$ . 2631)) #@75 Alist of cached jars. Each element is of the form (FILE . CACHED-JAR). (defvar javaimp-cached-jars nil (#$ . 2702)) #@265 Loads a project and its submodules. DIR should point to a directory containing pom.xml / build.gradle[.kts]. After being processed by this command, the module tree becomes known to javaimp and `javaimp-add-import' may be called inside any module file. (fn DIR) (defalias 'javaimp-visit-project #[257 "\301\302!!\303C\304\305P\240!\203\306\242!\2027\304\307P\240!\204,\304\310P\240!\2033\311\242!\2027\312\313\"\211\205K\314\315\316\"\"\211B\317\320\"\207" [javaimp-project-forest expand-file-name file-name-as-directory nil file-readable-p "pom.xml" javaimp--maven-visit "build.gradle" "build.gradle.kts" javaimp--gradle-visit error "Could not find build file in dir %s" seq-remove make-closure #[257 "\303\211! >\204\304\305\306D\"\210\307H!\n>\2042\304\305\310\303! >\204,\304\305\306D\"\210\307HD\"\210\303! >\204A\304\305\306D\"\210\211\307H\311H\300\242\232\207" [V0 cl-struct-javaimp-node-tags cl-struct-javaimp-module-tags type-of signal wrong-type-argument javaimp-node 3 javaimp-module 4] 8 "\n\n(fn TREE)"] message "Loaded tree for %s"] 8 (#$ . 2828) "DVisit Maven or Gradle project in directory: "]) #@13 (fn NODE) (defalias 'javaimp--update-module-maybe #[257 "\302!>\204\303\304\305D\"\210\211\306H\307\302! >\204\"\303\304\310D\"\210\311H\204B\312\313\302! >\204:\303\304\310D\"\210\314H\"\210\315\262\211\203\f\204\f\302!>\204Z\303\304\305D\"\210\211\306H\316\302! >\204m\303\304\310D\"\210\306H!\203\215\317\320\302! >\204\205\303\304\310D\"\210\306H!!\202\216\321\316\302! >\204\236\303\304\310D\"\210\322H!\203\277\317\320\302! >\204\267\303\304\310D\"\210\322H!!\202\300\321]\317\302! >\204\323\303\304\310D\"\210\323H!V\203\364\312\324\302! >\204\354\303\304\310D\"\210\314H\"\210\315\262\210\302!>\204\303\304\305D\"\210\211\314H\262\202C\210\211\205Z\302! >\204 \303\304\310D\"\210\325H!\326!\327 \302! >\204:\303\304\310D\"\210\211\311I\266\302! >\204Q\303\304\310D\"\210\211\323I\262\266\203\207" [cl-struct-javaimp-node-tags cl-struct-javaimp-module-tags type-of signal wrong-type-argument javaimp-node 3 nil javaimp-module 8 message "Loading dependencies: %s" 1 t file-exists-p float-time javaimp--get-file-ts -1 4 9 "Reloading dependencies for %s (some build-file changed)" 10 javaimp--split-native-path current-time] 12 (#$ . 3985)]) #@13 (fn FILE) (defalias 'javaimp--get-jar-classes #[257 "\302\"A\211\204#\303\304\305\306!\307\310!&\262BB\202\200\311\306\312! >\2044\313\314\315D\"\210\316H!!\311\312! >\204I\313\314\315D\"\210\317H!V\203\200\312! >\204`\313\314\315D\"\210\211\211\320\310!I\266\312! >\204x\313\314\315D\"\210\211\211\317\321 I\266\312! >\204\217\313\314\315D\"\210\211\320H\207" [javaimp-cached-jars cl-struct-javaimp-cached-jar-tags assoc make-javaimp-cached-jar :file :read-ts javaimp--get-file-ts :classes javaimp--fetch-jar-classes float-time type-of signal wrong-type-argument javaimp-cached-jar 1 2 3 current-time] 10 (#$ . 5224)]) #@13 (fn FILE) (defalias 'javaimp--fetch-jar-classes #[257 "\303\304\"\210\305\306\307\"r\211q\210\310\311\"\216\312=\205\313\314\n\315\307\315\316\317\320\"&\210eb\210\321\322\315\307#\203:\323\324!\210\202+eb\210\315\325\326\315\307#\203P\327\330!B\262\202>\211\262+\207" [system-type coding-system-for-read javaimp-jar-program message "Reading classes in file: %s" generate-new-buffer " *temp*" t make-closure #[0 "\301\300!\205 \302\300!\207" [V0 buffer-name kill-buffer] 2] cygwin utf-8-dos process-file nil "tf" javaimp-cygpath-convert-maybe windows search-forward "/" replace-match "." re-search-forward "\\(^[[:alnum:]._]+\\)\\.class$" match-string 1] 11 (#$ . 5888)]) #@18 (fn PREDICATE) (defalias 'javaimp--find-node #[257 "\3012\211\205\211@\302\"\210A\266\202\202\2620\207" [javaimp-project-forest found javaimp--find-node-in-tree-1] 6 (#$ . 6585)]) #@18 (fn PREDICATE) (defalias 'javaimp--select-nodes #[257 "\301\302\303\304\305\306\"\"#\207" [javaimp-project-forest apply seq-concatenate list mapcar make-closure #[257 "\301\300\"\207" [V0 javaimp--select-nodes-from-tree] 4 "\n\n(fn TREE)"]] 8 (#$ . 6784)]) #@23 (fn TREE PREDICATE) (defalias 'javaimp--find-node-in-tree #[514 "\3002 \301\"0\207" [found javaimp--find-node-in-tree-1] 5 (#$ . 7053)]) #@23 (fn TREE PREDICATE) (defalias 'javaimp--find-node-in-tree-1 #[514 "\205F\211\301!>\204\302\303\304D\"\210\305H!\203 \306\307\"\210\301!>\204/\302\303\304D\"\210\310H\211\205D\211@\311\"\210A\266\202\2022\262\207" [cl-struct-javaimp-node-tags type-of signal wrong-type-argument javaimp-node 3 throw found 2 javaimp--find-node-in-tree-1] 7 (#$ . 7201)]) #@23 (fn TREE PREDICATE) (defalias 'javaimp--select-nodes-from-tree #[514 "\205@\301\302!>\204\303\304\305D\"\210\306H!\205C\307\310\311\312\313\314\"\302 !>\2049\303\304\305 D\"\210\315H\"#\"\207" [cl-struct-javaimp-node-tags append type-of signal wrong-type-argument javaimp-node 3 apply seq-concatenate list mapcar make-closure #[257 "\301\300\"\207" [V0 javaimp--select-nodes-from-tree] 4 "\n\n(fn CHILD)"] 2] 13 (#$ . 7582)]) #@18 (fn PREDICATE) (defalias 'javaimp-find-module #[257 "\301!\211\205\302!>\204\303\304\305D\"\210\211\306H\207" [cl-struct-javaimp-node-tags javaimp--find-node type-of signal wrong-type-argument javaimp-node 3] 6 (#$ . 8038)]) #@18 (fn PREDICATE) (defalias 'javaimp-select-modules #[257 "\300\301\302!\"\207" [mapcar javaimp-node-contents javaimp--select-nodes] 5 (#$ . 8279)]) #@343 Imports classname in the current file. Interactively, asks for a class to import, adds import statement and calls `javaimp-organize-imports'. Import statements are not duplicated. Completion alternatives are constructed based on this module's dependencies' classes, JDK classes and top-level classes in the current module. (fn CLASSNAME) (defalias 'javaimp-add-import #[257 "\300 \210\301\302B!\207" [barf-if-buffer-read-only javaimp-organize-imports ordinary] 4 (#$ . 8435) (byte-code "\304\206\305\306!!\307\310\311\"!\206\305\312\"\313!\210\314! >\204)\315\316\317D\"\210\211\320H\321\322\323\211\314!\n>\204@\315\316\324D\"\210\325H\326 \"\327\330\331\332\333\"#\262 \205W\334!\"\335\336\335\211\337\340 !&C\207" [buffer-file-name cl-struct-javaimp-node-tags cl-struct-javaimp-module-tags javaimp-include-current-module-classes expand-file-name error "Buffer is not visiting a file!" javaimp--find-node make-closure #[257 "\302\303\304\300\"\305! >\204\306\307\310D\"\210\311H\"\207" [V0 cl-struct-javaimp-module-tags seq-some make-closure #[257 "\301\300\"\207" [V0 string-prefix-p] 4 "\n\n(fn DIR)"] type-of signal wrong-type-argument javaimp-module 6] 7 "\n\n(fn M)"] "Cannot find module by file: %s" javaimp--update-module-maybe type-of signal wrong-type-argument javaimp-node 3 completing-read "Import: " append javaimp-module 8 javaimp--get-jdk-jars apply seq-concatenate list mapcar javaimp--get-jar-classes javaimp--get-module-classes nil t symbol-name symbol-at-point] 13)]) #@66 Returns list of top-level classes in current module (fn MODULE) (defalias 'javaimp--get-module-classes #[257 "\302\303\304\305!>\204\306\307\310D\"\210\311H\"\303\312\313\" \"\"\207" [cl-struct-javaimp-module-tags javaimp-additional-source-dirs append seq-mapcat #[257 "\300!\205\n\301\302\"\207" [file-accessible-directory-p javaimp--get-directory-classes nil] 4 "\n\n(fn DIR)"] type-of signal wrong-type-argument javaimp-module 6 make-closure #[257 "\302\300! >\204\303\304\305\300D\"\210\300\306H\307!P\310!\205 \311\312\"\207" [V0 cl-struct-javaimp-module-tags type-of signal wrong-type-argument javaimp-module 7 file-name-as-directory file-accessible-directory-p javaimp--get-directory-classes nil] 5 "\n\n(fn REL-DIR)"]] 8 (#$ . 9961)]) #@19 (fn DIR PREFIX) (defalias 'javaimp--get-directory-classes #[514 "\300\301\302\303\"\304\305\306\307\310\311$\"\"\312\313\314\301\302\315  #\304\316\306 \307\211\311$\"\"#\"\207" [append mapcar make-closure #[257 "\300\301@!P\207" [V0 file-name-sans-extension] 4 "\n\n(fn FILE)"] seq-filter #[257 "\211A@?\207" [] 2 "\n\n(fn FILE)"] directory-files-and-attributes nil "\\.java\\'" t apply seq-concatenate list #[257 "\211@\302\300\303!P\301\304Q\"\207" [V0 V1 javaimp--get-directory-classes file-name-as-directory "."] 7 "\n\n(fn SUBDIR)"] #[257 "\211A@\300=\205 \211@\301\235?\207" [t ("." "..")] 3 "\n\n(fn FILE)"]] 16 (#$ . 10728)]) #@869 Groups import statements according to the value of `javaimp-import-group-alist' (which see) and prints resulting groups leaving one blank line between groups. If the file already contains some import statements, this command rewrites them, starting with the same place. Else, if the the file contains package directive, this command inserts one blank line below and then imports. Otherwise, imports are inserted at the beginning of buffer. Classes within a single group are ordered in a lexicographic order. Imports not matched by any regexp in `javaimp-import-group-alist' are assigned a default order defined by `javaimp-import-default-order'. NEW-IMPORTS is a list of additional imports; each element should be of the form (CLASS . TYPE), where CLASS is a string and TYPE is `ordinary' or `static'. Interactively, NEW-IMPORTS is nil. (fn &rest NEW-IMPORTS) (defalias 'javaimp-organize-imports #[128 "\300 \210\212eb\210\301 \211@A@\302AA\"\211\203E\203&b\210\303y\210`|\210\304!\210\305\306\307#\262\310\311\"\312\313\"\262\314!\262\266\204\202J\315\316!\266\204)\207" [barf-if-buffer-read-only javaimp--parse-imports append nil javaimp--prepare-for-insertion cl-delete-duplicates :test #[514 "@@\232\207" #1=[] 4 "\n\n(fn FIRST SECOND)"] mapcar #[257 "\302@\303#\206\n B\207" [javaimp-import-group-alist javaimp-import-default-order assoc-default string-match] 5 "\n\n(fn IMPORT)"] sort #[514 "AAU\203@@@@\231\207AAW\207" #1# 4 "\n\n(fn FIRST SECOND)"] javaimp--insert-imports message "Nothing to organize!"] 9 (#$ . 11382) nil]) #@32 Returns (FIRST LAST . IMPORTS) (defalias 'javaimp--parse-imports #[0 "\300\211\211\301\302\300\303#\203.\304\305!\203\306\202\307\304\310!\211BB\266\203\311 \262\204\262\202BB\207" [nil re-search-forward "^\\s-*import\\s-+\\(static\\s-+\\)?\\([._[:word:]]+\\)" t match-string 1 static ordinary 2 line-beginning-position] 7 (#$ . 12962)]) #@14 (fn START) (defalias 'javaimp--prepare-for-insertion #[257 "\211\203\211b\207\300\301\302\303#\203\"\302\210m\203\304c\210\202\302y\210\304c\207eb\207" [re-search-forward "^\\s-*package\\s-" nil t 10] 5 (#$ . 13324)]) #@16 (fn IMPORTS) (defalias 'javaimp--insert-imports #[257 "\300\301\"\300\302\"\303\304\"\210\203\211\203\305c\210\303\306\"\207" [seq-filter #[257 "\211@A\300=\207" [static] 3 "\n\n(fn ELT)"] #[257 "\211@A\300=\207" [ordinary] 3 "\n\n(fn ELT)"] javaimp--insert-import-group "import static %s;" 10 "import %s;"] 6 (#$ . 13558)]) #@24 (fn PATTERN IMPORTS) (defalias 'javaimp--insert-import-group #[514 "\300\211\205+\211@\211A\203\211U\204\301c\210\302@@\"\301\261\210\262A\266\202\202\207" [nil 10 format] 9 (#$ . 13900)]) #@79 Forget loaded trees state. With prefix arg, also reset jars cache. (fn ARG) (defalias 'javaimp-reset #[257 "\302\211\205 \302\211\207" [javaimp-project-forest javaimp-cached-jars nil] 3 (#$ . 14113) "P"]) (provide 'javaimp)