-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Labels
CraftTweakerAll Issues that are needed by CraftTweakerAll Issues that are needed by CraftTweakerJavaIntegrationAll issues that relate to integrating ZenCode with existing Java CodeAll issues that relate to integrating ZenCode with existing Java Code
Milestone
Description
We want to create Expansions that have Generic Type Parameters from JavaIntegration code.
Basically, we want to be able use Java Annotations to register the equivalent of this:
public expand <T> KnownTag<T> {
public get T? first => this.empty ? null : this.elements[0];
}For that we need multiple things working:
- Define Type parameters for
@ZenCodeType.Expansionclasses.- Define Type bounds for these type parameters
- Define Name of these parameters
- Be able to use these parameters inside the
@ZenCodeType.Expansion#valuemethod
Jared already started with some work:
https://github.com/ZenCodeLang/ZenCode/tree/feature/expansion-generics
Acceptance Criteria:
- Test cases (valid code):
- Simple case with unbounded/default bounded
<T> - Case with type bound
<T: CommandStringDisplayable> - Case with super bound
<T super SomeType> - Case with multiple generic Parameters
<T, U> - Case where the number of Generic bounds and type bounds don't match
<T> expand Function<T, T> - Case where the type bounds reference each other
<T, U expands T> expand Function<T, U> - Case where the expansion is generic and the added method itself also
public <T> expand SomeType<T> { public <U> doSomethingWith(U: value): void; }
- Simple case with unbounded/default bounded
- Test Cases (invalid code):
- Specify Type Parameters that are not used in the expansion
<T> expand string - Specify Type parameters whose bounds are not proper
<T: string> expand Recipe<T> - Specify two type parameters with the same name
<T, T> expand Function<T, T>
- Specify Type Parameters that are not used in the expansion
Metadata
Metadata
Assignees
Labels
CraftTweakerAll Issues that are needed by CraftTweakerAll Issues that are needed by CraftTweakerJavaIntegrationAll issues that relate to integrating ZenCode with existing Java CodeAll issues that relate to integrating ZenCode with existing Java Code