mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java-console] IDEA-344708 JVM Log navigation doesn't support nested classes
- support local classes GitOrigin-RevId: 93ecd046a980980e4a25d8b2e76f72b684bb0a26
This commit is contained in:
committed by
intellij-monorepo-bot
parent
4bd4317c22
commit
888a48604c
+10
-4
@@ -40,11 +40,17 @@ class ClassInfoResolver(val project: Project, private val mySearchScope: GlobalS
|
||||
}
|
||||
}
|
||||
if (result.isEmpty()) {
|
||||
val newShortClassName = findSubclassName(shortClassName)
|
||||
var newShortClassName = findSubclassName(shortClassName)
|
||||
if (newShortClassName?.isNotBlank() == true) {
|
||||
val newTargetPackageName = "$targetPackageName." +
|
||||
shortClassName.substring(0, shortClassName.length - newShortClassName.length - 1)
|
||||
return findClasses(project, scope, newShortClassName, newTargetPackageName)
|
||||
if (!newShortClassName[0].isDigit()) {
|
||||
val newTargetPackageName = "$targetPackageName." +
|
||||
shortClassName.substring(0, shortClassName.length - newShortClassName.length - 1)
|
||||
return findClasses(project, scope, newShortClassName, newTargetPackageName)
|
||||
}
|
||||
else {
|
||||
newShortClassName = shortClassName.take(shortClassName.length - newShortClassName.length - 1)
|
||||
return findClasses(project, scope, newShortClassName, targetPackageName)
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.toList()
|
||||
|
||||
+4
-1
@@ -112,8 +112,11 @@ internal class LogVisitor(private val probableClassName: ProbableClassName) : Ps
|
||||
val shortClassName = probableClassName.fullClassName.substringAfterLast('.')
|
||||
shortClassNames.add(shortClassName)
|
||||
val subclassName = ClassInfoResolver.findSubclassName(shortClassName)
|
||||
if (subclassName != null) {
|
||||
if (!subclassName.isNullOrEmpty()) {
|
||||
shortClassNames.add(subclassName)
|
||||
if (subclassName[0].isDigit()) {
|
||||
shortClassNames.add(shortClassName.substring(0, shortClassName.length - subclassName.length - 1))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+33
@@ -357,4 +357,37 @@ public final class UpperClass {
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
fun testLocalClasses() {
|
||||
LoggingTestUtils.addSlf4J(myFixture)
|
||||
checkColumnFinderJava(
|
||||
fileName = "UpperClass",
|
||||
classText = """
|
||||
package com.example;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public final class UpperClass {
|
||||
private static final Logger logger = LoggerFactory.getLogger(UpperClass.class);
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
class LocalClass{
|
||||
public LocalClass() {
|
||||
System.out.println(this.getClass().getCanonicalName());
|
||||
}
|
||||
}
|
||||
new LocalClass();
|
||||
System.out.println("class com.example.UpperClass${'$'}1LocalClass");
|
||||
}
|
||||
}
|
||||
""".trimIndent(),
|
||||
logItems = listOf(
|
||||
LogItem("java.exe", null),
|
||||
LogItem("1", null),
|
||||
LogItem("class com.example.UpperClass${'$'}1LocalClass", LogicalPosition(5, 19)),
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user