Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Commit

Permalink
fix(projects): add null check for simple name while creating ClassInfo (
Browse files Browse the repository at this point in the history
fixes #1411)
  • Loading branch information
itsaky committed Oct 30, 2023
1 parent 9bb932f commit 3b28681
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ private constructor(
companion object {

@JvmStatic
fun create(name: String): ClassInfo {
fun create(name: String): ClassInfo? {
val isTopLevel = name.indexOf('$') == -1

val simpleName =
Expand All @@ -49,6 +49,10 @@ private constructor(
name
}

if (simpleName.isBlank()) {
return null
}

val packageName =
if (name.contains('.')) {
name.substringBeforeLast('.')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ class JarFsClasspathReader : IClasspathReader {
name = name.replace('/', '.')
}

builder.add(ClassInfo.create(name))
ClassInfo.create(name)?.also {
builder.add(it)
}

return super.visitFile(file, attrs)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@ class ZipFileClasspathReader : IClasspathReader {
if (name.contains('/')) {
name = name.replace('/', '.')
}

classes.add(ClassInfo.create(name))

ClassInfo.create(name)?.also { classInfo ->
classes.add(classInfo)
}
}
}
}
Expand Down

0 comments on commit 3b28681

Please sign in to comment.