mirror of
https://gitee.com/zhangsken/AndroidIDE.git
synced 2026-10-16 07:49:44 +08:00
Provide error message if method cannot be overridden
This commit is contained in:
@@ -17,6 +17,8 @@
|
||||
|
||||
package com.itsaky.lsp.java.models;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.Collections;
|
||||
import java.util.Objects;
|
||||
@@ -59,6 +61,7 @@ public class JavaServerConfiguration {
|
||||
return Objects.equals(getClassPaths(), that.getClassPaths());
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
return "JavaServerConfiguration{" + "classPaths=" + classPaths + '}';
|
||||
|
||||
+4
-3
@@ -146,7 +146,7 @@ class ScopeCompletionProvider(
|
||||
// Override is not possible
|
||||
return method(task, listOf(method), !endsWithParen, partialName, matchRatio)
|
||||
}
|
||||
|
||||
|
||||
// Print the method details and the annotations
|
||||
// Print the method details and the annotations
|
||||
val indent = EditHelper.indent(FileStore.contents(completingFile), cursor.toInt())
|
||||
@@ -154,9 +154,10 @@ class ScopeCompletionProvider(
|
||||
try {
|
||||
builder = buildMethod(method, types, type)
|
||||
} catch (error: Throwable) {
|
||||
log.error("Cannot override method:", method.simpleName)
|
||||
log.error("Cannot override method:", method.simpleName, error.message)
|
||||
return method(task, listOf(method), !endsWithParen, partialName, matchRatio)
|
||||
}
|
||||
|
||||
val imports = mutableSetOf<String>()
|
||||
val methodSpec = builder.build()
|
||||
var insertText = print(methodSpec, imports, false)
|
||||
@@ -173,7 +174,7 @@ class ScopeCompletionProvider(
|
||||
if (item.additionalTextEdits == null) {
|
||||
item.additionalTextEdits = mutableListOf()
|
||||
}
|
||||
|
||||
|
||||
imports.removeIf { "java.lang." == it || fileImports.contains(it) || filePackage == it }
|
||||
if (imports.isNotEmpty()) {
|
||||
for (className in imports) {
|
||||
|
||||
Reference in New Issue
Block a user