generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Drop verb client interfaces #3110
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
1af6356
Box Java verb param and response types
tomdaffurn 6346afc
Don't use super interfaces for generted verb clients
tomdaffurn b751a5b
Delete the interfaces, rename VerbClientDefinition
tomdaffurn 497e94a
fix comments
tomdaffurn d69e183
fix comments
tomdaffurn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
252 changes: 104 additions & 148 deletions
252
...e/ftl-runtime/common/deployment/src/main/java/xyz/block/ftl/deployment/VerbProcessor.java
Large diffs are not rendered by default.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
...untime/ftl-runtime/common/deployment/src/main/java/xyz/block/ftl/deployment/VerbType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package xyz.block.ftl.deployment; | ||
|
||
public enum VerbType { | ||
VERB, | ||
SINK, | ||
SOURCE, | ||
EMPTY | ||
} |
19 changes: 11 additions & 8 deletions
19
jvm-runtime/ftl-runtime/common/runtime/src/main/java/xyz/block/ftl/VerbClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
package xyz.block.ftl; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* A client for a specific verb. | ||
* | ||
* The sink source and empty interfaces allow for different call signatures. | ||
* | ||
* @param <P> The verb parameter type | ||
* @param <R> The verb return type | ||
* Annotation that is used to define a verb client | ||
*/ | ||
public interface VerbClient<P, R> { | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target(ElementType.TYPE) | ||
public @interface VerbClient { | ||
|
||
R call(P param); | ||
String module() default ""; | ||
|
||
String name(); | ||
} |
18 changes: 0 additions & 18 deletions
18
jvm-runtime/ftl-runtime/common/runtime/src/main/java/xyz/block/ftl/VerbClientDefinition.java
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
jvm-runtime/ftl-runtime/common/runtime/src/main/java/xyz/block/ftl/VerbClientEmpty.java
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
jvm-runtime/ftl-runtime/common/runtime/src/main/java/xyz/block/ftl/VerbClientSink.java
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
jvm-runtime/ftl-runtime/common/runtime/src/main/java/xyz/block/ftl/VerbClientSource.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is already
IntVerb
above that has an int response type.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So looking into this I don't know if we need this change:
Currently we generate:
Which is valid, even though the primitive method does not override the interface type, because we actually generate both methods:
https://github.com/TBD54566975/ftl/blob/b0465e3c2d14cb72400b8724058db1445c663619/jvm-runtime/ftl-runtime/common/deployment/src/main/java/xyz/block/ftl/deployment/VerbProcessor.java#L93
Basically in the int -> int case we generate three different methods:
Object -> Object
Long -> Long
long -> long
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The compile error doesn't show up for
IntVerb
because the generated signature ofcall(long)
is different tocall(Long)
inVerbClient
. Need to have an Object param with primitive response value to make the signature the same but different response type.I guess we can restrict boxing to cases where the param is an Object and the response isn't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see what you mean.
I wonder how much implementing
VerbClient
actually matters. For the generated classes I don't think it actually adds anything, and not being able to use primitives is just kinda annoying. I am not 100% happy with the way verb clients currently work anyway, as invocation within the same module is clunky. Let me think about this a bit.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly something like: https://github.com/TBD54566975/ftl/compare/stuartwdouglas/jvm-api-refactor?expand=1