diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 064ed2486..842c1bd79 100755
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -123,6 +123,7 @@ dependencies {
implementation(projects.eventbusEvents)
implementation(projects.subprojects.aaptcompiler)
implementation(projects.subprojects.javacServices)
+ implementation(projects.subprojects.javapoet)
implementation(projects.subprojects.xmlUtils)
implementation(projects.subprojects.projects)
implementation(projects.subprojects.toolingApi)
diff --git a/app/src/main/assets/data/common/tooling-api-all.jar b/app/src/main/assets/data/common/tooling-api-all.jar
index a25ad46d3..2aa15b4fa 100644
Binary files a/app/src/main/assets/data/common/tooling-api-all.jar and b/app/src/main/assets/data/common/tooling-api-all.jar differ
diff --git a/lsp/java/src/main/java/com/itsaky/androidide/utils/ClassBuilder.kt b/app/src/main/java/com/itsaky/androidide/utils/ClassBuilder.kt
similarity index 76%
rename from lsp/java/src/main/java/com/itsaky/androidide/utils/ClassBuilder.kt
rename to app/src/main/java/com/itsaky/androidide/utils/ClassBuilder.kt
index 2fb3a0266..571d0b928 100644
--- a/lsp/java/src/main/java/com/itsaky/androidide/utils/ClassBuilder.kt
+++ b/app/src/main/java/com/itsaky/androidide/utils/ClassBuilder.kt
@@ -1,3 +1,20 @@
+/*
+ * This file is part of AndroidIDE.
+ *
+ * AndroidIDE is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AndroidIDE is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with AndroidIDE. If not, see .
+ */
+
package com.itsaky.androidide.utils
import android.os.Bundle
diff --git a/lsp/java/build.gradle.kts b/lsp/java/build.gradle.kts
index 36e470b43..3ceb484e2 100644
--- a/lsp/java/build.gradle.kts
+++ b/lsp/java/build.gradle.kts
@@ -53,6 +53,7 @@ dependencies {
implementation(projects.lsp.api)
implementation(projects.subprojects.javac)
implementation(projects.subprojects.javacServices)
+ implementation(projects.subprojects.javapoet)
implementation(projects.subprojects.googleJavaFormat)
implementation(libs.androidx.ktx)
diff --git a/lsp/java/src/main/java/com/itsaky/androidide/lsp/java/providers/completion/ScopeCompletionProvider.kt b/lsp/java/src/main/java/com/itsaky/androidide/lsp/java/providers/completion/ScopeCompletionProvider.kt
index 4b9bd6437..77c0d189d 100644
--- a/lsp/java/src/main/java/com/itsaky/androidide/lsp/java/providers/completion/ScopeCompletionProvider.kt
+++ b/lsp/java/src/main/java/com/itsaky/androidide/lsp/java/providers/completion/ScopeCompletionProvider.kt
@@ -20,13 +20,10 @@ package com.itsaky.androidide.lsp.java.providers.completion
import com.itsaky.androidide.lsp.api.IServerSettings
import com.itsaky.androidide.lsp.api.describeSnippet
import com.itsaky.androidide.lsp.java.compiler.CompileTask
-import com.itsaky.androidide.lsp.java.compiler.CompilerProvider
import com.itsaky.androidide.lsp.java.compiler.JavaCompilerService
import com.itsaky.androidide.lsp.java.edits.MultipleClassImportEditHandler
-import com.itsaky.androidide.lsp.java.parser.ParseTask
import com.itsaky.androidide.lsp.java.utils.EditHelper
import com.itsaky.androidide.lsp.java.utils.EditHelper.repeatSpaces
-import com.itsaky.androidide.lsp.java.utils.FindHelper
import com.itsaky.androidide.lsp.java.utils.JavaPoetUtils.Companion.buildMethod
import com.itsaky.androidide.lsp.java.utils.JavaPoetUtils.Companion.print
import com.itsaky.androidide.lsp.java.utils.ScopeHelper
@@ -38,22 +35,18 @@ import com.itsaky.androidide.lsp.models.MatchLevel.NO_MATCH
import com.itsaky.androidide.progress.ProgressManager.Companion.abortIfCancelled
import com.itsaky.androidide.projects.FileManager
import com.squareup.javapoet.MethodSpec.Builder
-import openjdk.source.tree.ClassTree
-import openjdk.source.tree.MethodTree
-import openjdk.source.tree.Tree.Kind.CLASS
-import openjdk.source.util.TreePath
-import openjdk.source.util.Trees
import java.nio.file.Path
-import java.util.*
-import java.util.function.*
+import java.util.function.Predicate
import jdkx.lang.model.element.ElementKind.METHOD
import jdkx.lang.model.element.ExecutableElement
import jdkx.lang.model.element.Modifier.FINAL
import jdkx.lang.model.element.Modifier.PRIVATE
import jdkx.lang.model.element.Modifier.STATIC
-import jdkx.lang.model.element.TypeElement
import jdkx.lang.model.type.DeclaredType
-import jdkx.tools.JavaFileObject
+import openjdk.source.tree.ClassTree
+import openjdk.source.tree.Tree.Kind.CLASS
+import openjdk.source.util.TreePath
+import openjdk.source.util.Trees
/**
* Provides completions using [openjdk.source.tree.Scope].
@@ -162,8 +155,7 @@ class ScopeCompletionProvider(
// Print the method details and the annotations
// Print the method details and the annotations
- val indent =
- EditHelper.indent(FileManager.getDocumentContents(file), cursor.toInt())
+ val indent = EditHelper.indent(FileManager.getDocumentContents(file), cursor.toInt())
val builder: Builder
try {
builder = buildMethod(method, types, type)
@@ -195,8 +187,7 @@ class ScopeCompletionProvider(
}
imports.removeIf { "java.lang." == it || fileImports.contains(it) || filePackage == it }
- item.additionalEditHandler =
- MultipleClassImportEditHandler(imports, fileImports, file)
+ item.additionalEditHandler = MultipleClassImportEditHandler(imports, fileImports, file)
return item
}
}
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 33004656d..2bba95bcf 100755
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -73,12 +73,13 @@ include(
":subprojects:framework-stubs",
":subprojects:fuzzysearch",
":subprojects:google-java-format",
- ":subprojects:jdk-compiler",
- ":subprojects:jdk-jdeps",
+ ":subprojects:java-compiler",
":subprojects:javac",
":subprojects:javac-services",
- ":subprojects:java-compiler",
+ ":subprojects:javapoet",
":subprojects:jaxp",
+ ":subprojects:jdk-compiler",
+ ":subprojects:jdk-jdeps",
":subprojects:jdt",
":subprojects:layoutlib-api",
":subprojects:projects",
diff --git a/subprojects/javapoet/.gitignore b/subprojects/javapoet/.gitignore
new file mode 100644
index 000000000..42afabfd2
--- /dev/null
+++ b/subprojects/javapoet/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/subprojects/javapoet/build.gradle.kts b/subprojects/javapoet/build.gradle.kts
new file mode 100644
index 000000000..2a18f3fb4
--- /dev/null
+++ b/subprojects/javapoet/build.gradle.kts
@@ -0,0 +1,24 @@
+/*
+ * This file is part of AndroidIDE.
+ *
+ * AndroidIDE is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AndroidIDE is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with AndroidIDE. If not, see .
+ */
+
+plugins {
+ kotlin("jvm")
+}
+
+dependencies {
+ implementation(projects.subprojects.javaCompiler)
+}
\ No newline at end of file
diff --git a/lsp/java/src/main/java/com/squareup/javapoet/AnnotationSpec.java b/subprojects/javapoet/src/main/java/com/squareup/javapoet/AnnotationSpec.java
similarity index 100%
rename from lsp/java/src/main/java/com/squareup/javapoet/AnnotationSpec.java
rename to subprojects/javapoet/src/main/java/com/squareup/javapoet/AnnotationSpec.java
diff --git a/lsp/java/src/main/java/com/squareup/javapoet/ArrayTypeName.java b/subprojects/javapoet/src/main/java/com/squareup/javapoet/ArrayTypeName.java
similarity index 100%
rename from lsp/java/src/main/java/com/squareup/javapoet/ArrayTypeName.java
rename to subprojects/javapoet/src/main/java/com/squareup/javapoet/ArrayTypeName.java
diff --git a/lsp/java/src/main/java/com/squareup/javapoet/ClassName.java b/subprojects/javapoet/src/main/java/com/squareup/javapoet/ClassName.java
similarity index 100%
rename from lsp/java/src/main/java/com/squareup/javapoet/ClassName.java
rename to subprojects/javapoet/src/main/java/com/squareup/javapoet/ClassName.java
diff --git a/lsp/java/src/main/java/com/squareup/javapoet/CodeBlock.java b/subprojects/javapoet/src/main/java/com/squareup/javapoet/CodeBlock.java
similarity index 100%
rename from lsp/java/src/main/java/com/squareup/javapoet/CodeBlock.java
rename to subprojects/javapoet/src/main/java/com/squareup/javapoet/CodeBlock.java
diff --git a/lsp/java/src/main/java/com/squareup/javapoet/CodeWriter.java b/subprojects/javapoet/src/main/java/com/squareup/javapoet/CodeWriter.java
similarity index 100%
rename from lsp/java/src/main/java/com/squareup/javapoet/CodeWriter.java
rename to subprojects/javapoet/src/main/java/com/squareup/javapoet/CodeWriter.java
diff --git a/lsp/java/src/main/java/com/squareup/javapoet/FieldSpec.java b/subprojects/javapoet/src/main/java/com/squareup/javapoet/FieldSpec.java
similarity index 100%
rename from lsp/java/src/main/java/com/squareup/javapoet/FieldSpec.java
rename to subprojects/javapoet/src/main/java/com/squareup/javapoet/FieldSpec.java
diff --git a/lsp/java/src/main/java/com/squareup/javapoet/ImportCollectingCodeWriter.java b/subprojects/javapoet/src/main/java/com/squareup/javapoet/ImportCollectingCodeWriter.java
similarity index 77%
rename from lsp/java/src/main/java/com/squareup/javapoet/ImportCollectingCodeWriter.java
rename to subprojects/javapoet/src/main/java/com/squareup/javapoet/ImportCollectingCodeWriter.java
index b765477cd..3551da0fc 100644
--- a/lsp/java/src/main/java/com/squareup/javapoet/ImportCollectingCodeWriter.java
+++ b/subprojects/javapoet/src/main/java/com/squareup/javapoet/ImportCollectingCodeWriter.java
@@ -17,13 +17,12 @@
package com.squareup.javapoet;
-import androidx.annotation.NonNull;
-
import java.io.IOException;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
+import org.jetbrains.annotations.NotNull;
/**
* A code writer implementation which is used by {@link TypeName} to provide list of classes that
@@ -65,7 +64,7 @@ public class ImportCollectingCodeWriter extends CodeWriter {
this.importClasses.add(qualifiedName);
}
- @NonNull
+ @NotNull
public Set getImportClasses() {
return importClasses;
}
@@ -74,43 +73,43 @@ public class ImportCollectingCodeWriter extends CodeWriter {
emit("$L", annotationSpec);
}
- public void emit(@NonNull ArrayTypeName arrayTypeName) throws IOException {
+ public void emit(@NotNull ArrayTypeName arrayTypeName) throws IOException {
arrayTypeName.emit(this);
}
- public void emit(@NonNull ClassName className) throws IOException {
+ public void emit(@NotNull ClassName className) throws IOException {
className.emit(this);
}
- public void emit(@NonNull FieldSpec field) throws IOException {
+ public void emit(@NotNull FieldSpec field) throws IOException {
field.emit(this, Collections.emptySet());
}
- public void emit(@NonNull MethodSpec methodSpec) throws IOException {
+ public void emit(@NotNull MethodSpec methodSpec) throws IOException {
methodSpec.emit(this, "Constructor", Collections.emptySet());
}
- public void emit(@NonNull ParameterizedTypeName parameterizedTypeName) throws IOException {
+ public void emit(@NotNull ParameterizedTypeName parameterizedTypeName) throws IOException {
parameterizedTypeName.emit(this);
}
- public void emit(@NonNull ParameterSpec parameterSpec) throws IOException {
+ public void emit(@NotNull ParameterSpec parameterSpec) throws IOException {
parameterSpec.emit(this, false);
}
- public void emit(@NonNull TypeName typeName) throws IOException {
+ public void emit(@NotNull TypeName typeName) throws IOException {
typeName.emit(this);
}
- public void emit(@NonNull TypeSpec typeSpec) throws IOException {
+ public void emit(@NotNull TypeSpec typeSpec) throws IOException {
typeSpec.emit(this, null, Collections.emptySet());
}
- public void emit(@NonNull TypeVariableName typeVariableName) throws IOException {
+ public void emit(@NotNull TypeVariableName typeVariableName) throws IOException {
typeVariableName.emit(this);
}
- public void emit(@NonNull WildcardTypeName wildcardTypeName) throws IOException {
+ public void emit(@NotNull WildcardTypeName wildcardTypeName) throws IOException {
wildcardTypeName.emit(this);
}
}
diff --git a/lsp/java/src/main/java/com/squareup/javapoet/JavaFile.java b/subprojects/javapoet/src/main/java/com/squareup/javapoet/JavaFile.java
similarity index 100%
rename from lsp/java/src/main/java/com/squareup/javapoet/JavaFile.java
rename to subprojects/javapoet/src/main/java/com/squareup/javapoet/JavaFile.java
diff --git a/lsp/java/src/main/java/com/squareup/javapoet/LineWrapper.java b/subprojects/javapoet/src/main/java/com/squareup/javapoet/LineWrapper.java
similarity index 100%
rename from lsp/java/src/main/java/com/squareup/javapoet/LineWrapper.java
rename to subprojects/javapoet/src/main/java/com/squareup/javapoet/LineWrapper.java
diff --git a/lsp/java/src/main/java/com/squareup/javapoet/MethodSpec.java b/subprojects/javapoet/src/main/java/com/squareup/javapoet/MethodSpec.java
similarity index 100%
rename from lsp/java/src/main/java/com/squareup/javapoet/MethodSpec.java
rename to subprojects/javapoet/src/main/java/com/squareup/javapoet/MethodSpec.java
diff --git a/lsp/java/src/main/java/com/squareup/javapoet/NameAllocator.java b/subprojects/javapoet/src/main/java/com/squareup/javapoet/NameAllocator.java
similarity index 100%
rename from lsp/java/src/main/java/com/squareup/javapoet/NameAllocator.java
rename to subprojects/javapoet/src/main/java/com/squareup/javapoet/NameAllocator.java
diff --git a/lsp/java/src/main/java/com/squareup/javapoet/ParameterSpec.java b/subprojects/javapoet/src/main/java/com/squareup/javapoet/ParameterSpec.java
similarity index 100%
rename from lsp/java/src/main/java/com/squareup/javapoet/ParameterSpec.java
rename to subprojects/javapoet/src/main/java/com/squareup/javapoet/ParameterSpec.java
diff --git a/lsp/java/src/main/java/com/squareup/javapoet/ParameterizedTypeName.java b/subprojects/javapoet/src/main/java/com/squareup/javapoet/ParameterizedTypeName.java
similarity index 100%
rename from lsp/java/src/main/java/com/squareup/javapoet/ParameterizedTypeName.java
rename to subprojects/javapoet/src/main/java/com/squareup/javapoet/ParameterizedTypeName.java
diff --git a/lsp/java/src/main/java/com/squareup/javapoet/TypeName.java b/subprojects/javapoet/src/main/java/com/squareup/javapoet/TypeName.java
similarity index 100%
rename from lsp/java/src/main/java/com/squareup/javapoet/TypeName.java
rename to subprojects/javapoet/src/main/java/com/squareup/javapoet/TypeName.java
diff --git a/lsp/java/src/main/java/com/squareup/javapoet/TypeSpec.java b/subprojects/javapoet/src/main/java/com/squareup/javapoet/TypeSpec.java
similarity index 100%
rename from lsp/java/src/main/java/com/squareup/javapoet/TypeSpec.java
rename to subprojects/javapoet/src/main/java/com/squareup/javapoet/TypeSpec.java
diff --git a/lsp/java/src/main/java/com/squareup/javapoet/TypeVariableName.java b/subprojects/javapoet/src/main/java/com/squareup/javapoet/TypeVariableName.java
similarity index 100%
rename from lsp/java/src/main/java/com/squareup/javapoet/TypeVariableName.java
rename to subprojects/javapoet/src/main/java/com/squareup/javapoet/TypeVariableName.java
diff --git a/lsp/java/src/main/java/com/squareup/javapoet/Util.java b/subprojects/javapoet/src/main/java/com/squareup/javapoet/Util.java
similarity index 100%
rename from lsp/java/src/main/java/com/squareup/javapoet/Util.java
rename to subprojects/javapoet/src/main/java/com/squareup/javapoet/Util.java
diff --git a/lsp/java/src/main/java/com/squareup/javapoet/WildcardTypeName.java b/subprojects/javapoet/src/main/java/com/squareup/javapoet/WildcardTypeName.java
similarity index 100%
rename from lsp/java/src/main/java/com/squareup/javapoet/WildcardTypeName.java
rename to subprojects/javapoet/src/main/java/com/squareup/javapoet/WildcardTypeName.java