GenericResolutionException class final

Exception thrown when generic type resolution fails during dynamic analysis or reflection-based processing.

This typically occurs when:

  • A generic type parameter cannot be inferred or resolved
  • The type arguments are incompatible with the expected type
  • Reflection or metadata inspection encounters an ambiguous or unsupported generic

Extends RuntimeResolverException, preserving support for:

  • message — a human-readable description of the failure
  • cause — optional underlying exception
  • stackTrace — optional diagnostic stack trace

Usage Example

throw GenericResolutionException(
  "Failed to resolve type parameter T for Repository<User>",
  cause: TypeError(),
);

Design Notes

  • Provides clear diagnostics for generic type resolution failures.
  • Supports exception chaining for deeper analysis of root causes.
  • Typically used during reflection, repository building, or dynamic wiring.

Example Behavior

Context Result
Generic parameter T missing ❌ Throws GenericResolutionException
Type argument incompatible ❌ Throws with detailed message
Ambiguous or unknown generic ❌ Throws

See Also

Inheritance
Available extensions

Constructors

GenericResolutionException(String message, {Object? cause, StackTrace? stackTrace})
Exception thrown when generic type resolution fails during dynamic analysis or reflection-based processing.

Properties

cause Object?
The underlying cause of this exception, if any.
finalinherited
hashCode int
The hash code for this object.
no setterinherited
message String
The message describing the error.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stackTrace StackTrace
The associated stack trace.
finalinherited

Methods

getCause() Object
The cause of this exception, if any.
inherited
getMessage() String
The message associated with this exception.
inherited
getStackTrace() StackTrace
The stack trace associated with this exception.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
printStackTrace([bool useErrorPrint = false]) → void

Available on Error, provided by the ErrorExtensions extension

Prints the error along with its stack trace.
printStackTrace([StackTrace? stacktrace, bool useErrorPrint = false]) → void

Available on Exception, provided by the ExceptionExtensions extension

Prints the exception and optional StackTrace if available.
printStackTrace([bool useErrorPrint = false]) → void

Available on RuntimeException, provided by the RuntimeExceptionExtensions extension

Extension on RuntimeException to support pretty stack trace printing.
printStackTrace([bool useErrorPrint = false]) → void

Available on Throwable, provided by the ThrowableExtensions extension

Extension on Throwable to support printing stack traces in a unified way.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited