mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-03 15:05:32 +00:00
Java keywords cannot be used as package/class name
This commit is contained in:
parent
19182ffddf
commit
31fe3a1cd8
@ -194,7 +194,23 @@ fun genStubManifest(srcDir: File, outDir: File): String {
|
||||
val pkgNames = names.distinctBy { it.toLowerCase(Locale.ROOT) }
|
||||
|
||||
var idx = 0
|
||||
fun genCmpName() = "${pkgNames[idx++]}.${names.random(kRANDOM)}"
|
||||
fun isJavaKeyword(name: String) = when (name) {
|
||||
"do", "if", "for", "int", "new", "try" -> true
|
||||
else -> false
|
||||
}
|
||||
|
||||
fun genCmpName() : String {
|
||||
var pkgName : String
|
||||
do {
|
||||
pkgName = pkgNames[idx++]
|
||||
} while (isJavaKeyword(pkgName))
|
||||
|
||||
var clzName : String
|
||||
do {
|
||||
clzName = names.random(kRANDOM)
|
||||
} while (isJavaKeyword(clzName))
|
||||
return "${pkgName}.${clzName}"
|
||||
}
|
||||
|
||||
fun genClass(clzName: String, type: String) {
|
||||
val (pkg, name) = clzName.split('.')
|
||||
|
Loading…
Reference in New Issue
Block a user