cangjie-reflect-and-annotation

Explain Cangjie reflection API and annotation usage with examples.

2|Updated Mar 10, 2026
One-click install
npx skills add https://github.com/zhenzhizhi12/NexusAgent --skill cangjie-reflect-and-annotation-zhenzhizhi12
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cangjie-reflect-and-annotation
Source: https://github.com/zhenzhizhi12/NexusAgent/tree/main/.opencode/skills/common-skill-l1/reflect_and_annotation
Command: npx skills add https://github.com/zhenzhizhi12/NexusAgent --skill cangjie-reflect-and-annotation-zhenzhizhi12

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers understand and utilize advanced features of the Cangjie language, specifically its reflection capabilities and various annotation types for controlling program behavior and metadata.

Core Features & Use Cases

  • Integer Overflow Annotations: Control how integer arithmetic handles overflow with @OverflowThrowing, @OverflowWrapping, and @OverflowSaturating.
  • Custom Annotations: Define and apply custom metadata using @Annotation for type-safe, declarative programming.
  • Reflection with TypeInfo: Inspect and interact with types, members, and functions at runtime.
  • Use Case: When dealing with critical financial calculations in Cangjie, use @OverflowThrowing to ensure no silent data corruption occurs, or use custom annotations to mark specific methods for code generation tools.

Quick Start

Explain how to use the @OverflowWrapping annotation with the addition operator in Cangjie.

Frequently Asked Questions about cangjie-reflect-and-annotation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I control integer overflow in Cangjie language arithmetic operations?

Cangjie controls integer overflow using annotations like `@OverflowThrowing`, `@OverflowWrapping`, and `@OverflowSaturating`. Applying these ensures critical arithmetic operations handle overflow by throwing errors, wrapping values, or saturating bounds.

How do I use reflection to inspect types at runtime in Cangjie programming?

Cangjie reflection uses the `TypeInfo` API to inspect and interact with types, members, and functions at runtime. You retrieve type metadata through `TypeInfo` to facilitate dynamic runtime introspection and manage program structures.

Can I define custom annotations in Cangjie for declarative metadata management?

Yes, Cangjie allows defining custom annotations using the `@Annotation` system. You can apply type-safe, declarative metadata to classes or methods, enabling code generation tools to identify and process specific targets dynamically.

What is the difference between @OverflowThrowing and @OverflowSaturating in Cangjie?

`@OverflowThrowing` halts execution by throwing an error upon integer overflow, preventing silent data corruption. `@OverflowSaturating` clamps the arithmetic result to the maximum or minimum integer bounds instead of throwing or wrapping.

When do I need to use the Cangjie TypeInfo API for runtime introspection?

Use the Cangjie `TypeInfo` API when your program requires dynamic behavior based on type structures, such as retrieving custom annotations at runtime or inspecting class members to automate metadata-driven logic.

Does Cangjie support built-in annotations for testing and integer wrapping?

Yes, Cangjie provides built-in annotations for testing frameworks and integer overflow control. Annotations like `@OverflowWrapping` specifically modify arithmetic operators to wrap values upon exceeding integer limits.