Record Class DuplicateClassReport
java.lang.Object
java.lang.Record
cloud.opencode.base.classloader.diagnostic.DuplicateClassReport
- Record Components:
className- the fully qualified class name | 完全限定类名classLoaderNames- the names of ClassLoaders containing this class | 包含此类的 ClassLoader 名称列表locations- the resource URL locations where the class was found | 发现此类的资源 URL 位置列表
public record DuplicateClassReport(String className, List<String> classLoaderNames, List<String> locations)
extends Record
Immutable report of a class found in multiple ClassLoaders
在多个 ClassLoader 中发现的重复类的不可变报告
Represents a single class that was found to exist in two or more ClassLoaders,
which may lead to classpath conflicts, ClassCastException, or unexpected
behavior at runtime.
表示在两个或多个 ClassLoader 中发现存在的单个类,
这可能导致类路径冲突、ClassCastException 或运行时意外行为。
Features | 主要功能:
- Records class name, loader names, and resource locations - 记录类名、加载器名称和资源位置
- Defensive copies for immutability - 防御性拷贝以保证不可变性
Usage Examples | 使用示例:
DuplicateClassReport report = new DuplicateClassReport(
"com.example.Foo",
List.of("loader1", "loader2"),
List.of("file:/path/a.jar", "file:/path/b.jar")
);
Security | 安全性:
- Thread-safe: Yes (immutable record) - 线程安全: 是 (不可变记录)
- Since:
- JDK 25, opencode-base-classloader V1.0.3
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theclassLoaderNamesrecord component.Returns the value of theclassNamerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of thelocationsrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
DuplicateClassReport
public DuplicateClassReport(String className, List<String> classLoaderNames, List<String> locations) Compact constructor with validation and defensive copies 带验证和防御性拷贝的紧凑构造器- Throws:
NullPointerException- if any parameter is null | 当任何参数为 null 时IllegalArgumentException- if classLoaderNames has fewer than 2 entries | 当 classLoaderNames 少于 2 个条目时
-
-
Method Details
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
className
-
classLoaderNames
Returns the value of theclassLoaderNamesrecord component.- Returns:
- the value of the
classLoaderNamesrecord component
-
locations
-