feat: ignore 'package-info' when indexing sources and libraries

This commit is contained in:
Akash Yadav
2023-02-26 10:46:28 +05:30
parent 3e6b08ec44
commit 886a0cacfa
5 changed files with 5 additions and 9 deletions
Binary file not shown.
@@ -166,9 +166,9 @@ public class SourceFileManager extends ForwardingJavaFileManager<JavacFileManage
String className = removeExtension(source.path.getFileName().toString());
if (!packageName.isEmpty()) className = packageName + "." + className;
return className;
} else {
return super.inferBinaryName(location, file);
}
return super.inferBinaryName(location, file);
}
@Override
@@ -31,7 +31,8 @@ public class DocumentUtils {
return name.endsWith(".java")
&& Files.exists(file)
&& !Files.isDirectory(file)
&& !name.equals("module-info.java");
&& !name.equals("module-info.java")
&& !name.equals("package-info.java");
}
public static boolean isXmlFile(Path file) {
@@ -55,10 +55,6 @@ abstract class ModuleProject(
private val log = ILogger.newInstance(javaClass.simpleName)
companion object {
const val PROP_USAGE = "org.gradle.usage"
const val USAGE_API = "java-api"
const val USAGE_RUNTIME = "java-runtime"
@JvmStatic val COMPLETION_MODULE_KEY = Lookup.Key<ModuleProject>()
}
@@ -102,7 +98,6 @@ abstract class ModuleProject(
abstract fun getCompileModuleProjects(): List<ModuleProject>
/** Finds the source files and classes from source directories and classpaths and indexes them. */
@Suppress("UnstableApiUsage")
internal fun indexSourcesAndClasspaths() {
log.info("Indexing sources and classpaths for project:", path)
indexSources()
@@ -61,7 +61,7 @@ class JarFsClasspathReader : IClasspathReader {
override fun visitFile(file: Path, attrs: BasicFileAttributes): FileVisitResult {
var name = file.pathString
if (!name.endsWith(".class")) {
if (name.endsWith("/package-info.class") || !name.endsWith(".class")) {
return CONTINUE
}