Skip to content

Commit

Permalink
Add method to merge two Classpath objects.
Browse files Browse the repository at this point in the history
  • Loading branch information
christiandeange committed Feb 23, 2024
1 parent b9c493d commit d14f9a1
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,20 @@ internal constructor(
inputClasses.removeIf { it.qualifiedName == classname }
}

/**
* Adds an entire set of other classes from another classpath to this one.
* Any classes you have defined in this classpath will be overwritten if also present in the other one.
*/
fun addClasspath(other: Classpath) {
inputClasses += other.inputClasses

classCache += other.classCache
constructorCache += other.constructorCache
fieldCache += other.fieldCache
methodCache += other.methodCache
annotationCache += other.annotationCache
}

/** Returns the mutable class definition for the given class. */
operator fun get(clazz: Class<*>): ClassReference = synchronized(this) {
get(clazz.canonicalName)
Expand Down

0 comments on commit d14f9a1

Please sign in to comment.