add inner class aw processing
All checks were successful
Publish to snapshot maven / build (push) Successful in 21s
All checks were successful
Publish to snapshot maven / build (push) Successful in 21s
This commit is contained in:
parent
bdc9fe585c
commit
3138da0797
|
@ -23,7 +23,7 @@ object AccessWidener {
|
||||||
|
|
||||||
private val PARSER = TomlParser()
|
private val PARSER = TomlParser()
|
||||||
|
|
||||||
private var awHash = ""
|
private val awHashes = mutableMapOf<Project, String>()
|
||||||
private val HEADER = Pattern.compile("accessWidener\\s+v[12]\\s+.*").asMatchPredicate()
|
private val HEADER = Pattern.compile("accessWidener\\s+v[12]\\s+.*").asMatchPredicate()
|
||||||
private val SEPARATOR = "[\\t ]+".toRegex()
|
private val SEPARATOR = "[\\t ]+".toRegex()
|
||||||
|
|
||||||
|
@ -54,8 +54,8 @@ object AccessWidener {
|
||||||
fun needsUpdate(project: Project): Boolean {
|
fun needsUpdate(project: Project): Boolean {
|
||||||
getAWFile(project)?.let {
|
getAWFile(project)?.let {
|
||||||
val hash = Hashing.sha256().hashBytes(it.readBytes()).toString()
|
val hash = Hashing.sha256().hashBytes(it.readBytes()).toString()
|
||||||
if (hash != awHash) {
|
if (!awHashes.containsKey(project) || hash != awHashes[project]) {
|
||||||
awHash = hash
|
awHashes[project] = hash
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -298,4 +298,21 @@ class AWClassVisitor(
|
||||||
}
|
}
|
||||||
return super.visitMethod(access, name, descriptor, signature, exceptions)
|
return super.visitMethod(access, name, descriptor, signature, exceptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun visitInnerClass(name: String?, outerName: String?, innerName: String?, acc: Int) {
|
||||||
|
var access = acc
|
||||||
|
val e = classMap[name!!]
|
||||||
|
if (e != null) {
|
||||||
|
access = access and (Opcodes.ACC_PRIVATE or Opcodes.ACC_PROTECTED or Opcodes.ACC_PUBLIC).inv()
|
||||||
|
access = access or e.type.access
|
||||||
|
}
|
||||||
|
if (fields.containsKey(name) || methods.containsKey(name) || mutations.containsKey(
|
||||||
|
name
|
||||||
|
)
|
||||||
|
) { // make all classes with modifications public as well
|
||||||
|
access = access and (Opcodes.ACC_PRIVATE or Opcodes.ACC_PROTECTED or Opcodes.ACC_PUBLIC).inv()
|
||||||
|
access = access or Opcodes.ACC_PUBLIC
|
||||||
|
}
|
||||||
|
super.visitInnerClass(name, outerName, innerName, access)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ import com.electronwill.nightconfig.core.io.WritingMode
|
||||||
import com.electronwill.nightconfig.toml.TomlParser
|
import com.electronwill.nightconfig.toml.TomlParser
|
||||||
import com.electronwill.nightconfig.toml.TomlWriter
|
import com.electronwill.nightconfig.toml.TomlWriter
|
||||||
import dev.frogmc.phytotelma.Constants
|
import dev.frogmc.phytotelma.Constants
|
||||||
import dev.frogmc.phytotelma.PhytotelmaPlugin
|
|
||||||
import dev.frogmc.phytotelma.ProjectStorage
|
import dev.frogmc.phytotelma.ProjectStorage
|
||||||
import dev.frogmc.phytotelma.nest.Nester
|
import dev.frogmc.phytotelma.nest.Nester
|
||||||
import org.gradle.api.DefaultTask
|
import org.gradle.api.DefaultTask
|
||||||
|
|
Loading…
Reference in a new issue