Skip to content

Commit

Permalink
Added extra check to proxies
Browse files Browse the repository at this point in the history
  • Loading branch information
WillFP committed Jul 8, 2024
1 parent a9624fe commit 871e084
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,14 @@ private fun loadProxyUncached(clazz: Class<*>): Any {

try {
val found = Class.forName(className)

val constructor = found.getConstructor()
val instance = constructor.newInstance()

if (!clazz.isInstance(instance)) {
throw InvalidProxyException("Proxy class $className does not implement ${clazz.name}")
}

return instance
} catch (e: ClassNotFoundException) {
throw InvalidProxyException("Could not find proxy class $className")
Expand Down

0 comments on commit 871e084

Please sign in to comment.