Record Class PackageSplitReport

java.lang.Object
java.lang.Record
cloud.opencode.base.classloader.diagnostic.PackageSplitReport
Record Components:
packageName - the fully qualified package name | 完全限定包名
classLoaderNames - the names of ClassLoaders containing classes from this package | 包含此包中类的 ClassLoader 名称列表

public record PackageSplitReport(String packageName, List<String> classLoaderNames) extends Record
Immutable report of a package split across multiple ClassLoaders 跨多个 ClassLoader 拆分的包的不可变报告

Represents a Java package whose classes are spread across two or more ClassLoaders, which violates the Java module system's package uniqueness guarantee and can cause runtime errors or security issues.

表示类分布在两个或多个 ClassLoader 中的 Java 包, 这违反了 Java 模块系统的包唯一性保证,可能导致运行时错误或安全问题。

Features | 主要功能:

  • Records split package name and involved loaders - 记录拆分包名和涉及的加载器
  • Defensive copies for immutability - 防御性拷贝以保证不可变性

Usage Examples | 使用示例:

PackageSplitReport report = new PackageSplitReport(
    "com.example.service",
    List.of("appLoader", "pluginLoader")
);

Security | 安全性:

  • Thread-safe: Yes (immutable record) - 线程安全: 是 (不可变记录)
Since:
JDK 25, opencode-base-classloader V1.0.3
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Constructor Details

    • PackageSplitReport

      public PackageSplitReport(String packageName, List<String> classLoaderNames)
      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

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • packageName

      public String packageName()
      Returns the value of the packageName record component.
      Returns:
      the value of the packageName record component
    • classLoaderNames

      public List<String> classLoaderNames()
      Returns the value of the classLoaderNames record component.
      Returns:
      the value of the classLoaderNames record component