Record Class ConflictReport
java.lang.Object
java.lang.Record
cloud.opencode.base.classloader.conflict.ConflictReport
- Record Components:
conflicts- className to list of JarInfo where it appears (only entries with 2+ JARs) 类名到其出现的 JarInfo 列表的映射(仅包含 2+ 个 JAR 的条目)totalConflicts- the total number of conflicting class entries | 冲突类条目的总数totalClassesScanned- the total number of classes scanned | 扫描的类总数
public record ConflictReport(Map<String, List<JarInfo>> conflicts, int totalConflicts, int totalClassesScanned)
extends Record
Immutable report of JAR class conflicts
JAR 类冲突的不可变报告
Contains a mapping of fully-qualified class names to the list of JAR files in which they appear. Only classes found in two or more JARs are included.
包含完全限定类名到其出现的 JAR 文件列表的映射。仅包含在两个或多个 JAR 中发现的类。
Features | 主要功能:
- Deep defensive copy on construction - 构造时深度防御性复制
- Filter conflicts by JAR path - 按 JAR 路径过滤冲突
- Human-readable summary generation - 生成人类可读摘要
- Immutable and thread-safe - 不可变且线程安全
Usage Examples | 使用示例:
ConflictReport report = JarConflictDetector.detect(jar1, jar2);
if (report.hasConflicts()) {
System.out.println(report.summary());
Set<String> classes = report.conflictingClasses();
}
Security | 安全性:
- Thread-safe: Yes (immutable, deep copy) - 线程安全: 是(不可变,深度复制)
- Since:
- JDK 25, opencode-base-classloader V1.0.3
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConflictReport(Map<String, List<JarInfo>> conflicts, int totalConflicts, int totalClassesScanned) Creates a new ConflictReport with deep defensive copy 创建新的 ConflictReport 并进行深度防御性复制 -
Method Summary
Modifier and TypeMethodDescriptionGet the set of all conflicting class names 获取所有冲突类名的集合Returns the value of theconflictsrecord component.final booleanIndicates whether some other object is "equal to" this one.getConflictsForJar(Path jarPath) Get conflicts involving a specific JAR file 获取涉及特定 JAR 文件的冲突booleanCheck if any conflicts were detected 检查是否检测到冲突final inthashCode()Returns a hash code value for this object.summary()Generate a human-readable summary of the conflict report 生成冲突报告的人类可读摘要final StringtoString()Returns a string representation of this record class.intReturns the value of thetotalClassesScannedrecord component.intReturns the value of thetotalConflictsrecord component.
-
Constructor Details
-
ConflictReport
public ConflictReport(Map<String, List<JarInfo>> conflicts, int totalConflicts, int totalClassesScanned) Creates a new ConflictReport with deep defensive copy 创建新的 ConflictReport 并进行深度防御性复制- Parameters:
conflicts- className to list of JarInfo | 类名到 JarInfo 列表totalConflicts- total conflict count | 冲突总数totalClassesScanned- total classes scanned | 扫描类总数
-
-
Method Details
-
hasConflicts
public boolean hasConflicts()Check if any conflicts were detected 检查是否检测到冲突- Returns:
- true if conflicts exist | 存在冲突返回 true
-
conflictingClasses
-
getConflictsForJar
-
summary
Generate a human-readable summary of the conflict report 生成冲突报告的人类可读摘要- Returns:
- summary string | 摘要字符串
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
conflicts
-
totalConflicts
public int totalConflicts()Returns the value of thetotalConflictsrecord component.- Returns:
- the value of the
totalConflictsrecord component
-
totalClassesScanned
public int totalClassesScanned()Returns the value of thetotalClassesScannedrecord component.- Returns:
- the value of the
totalClassesScannedrecord component
-