Given source code, class names can be found in available .jar
files, and import statements can be generated, for Java and for Kotlin.
This currently only works for OpenJDK 8, not OpenJDK 11 and beyond.
Includes the autoimport
utility for looking up packages, given the start of a class name.
Experimental functionality for organizing imports is also included.
$ autoimport FilePe
import java.io.*; // FilePermissionCollection
import java.io.*; // FilePermission
import sun.security.tools.policytool.*; // FilePerm
import net.rubygrapefruit.platform.*; // FilePermissionException
$ autoimport -e FileSystem
import java.io.*; // FileSystem
Main.java:
package com.example.demo;
public class Main {
public static void main(String[] args) {
List<String> names = new ArrayList<>();
names.add("Alice");
names.add("Bob");
Map<String, Integer> ageMapping = new HashMap<>();
ageMapping.put("Alice", 30);
ageMapping.put("Bob", 25);
for (String name : names) {
System.out.println(name + " is " + ageMapping.get(name) + " years old.");
}
}
}
- Searches directories of
.jar
files for class names. - Given the start of the class name, searches for the matching shortest class, and also returns the import path (like
java.io.*
). - Also searches
*/lib/src.zip
files, if found. - Intended to be used for simple autocompletion of class names.
- Version: 1.5.2
- License: BSD-3
- Author: Alexander F. Rødseth <xyproto@archlinux.org>