-
Notifications
You must be signed in to change notification settings - Fork 735
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
[Bug]: Annotations in the service type is not visible at the service object at runtime #42760
Comments
The related spec section is https://ballerina.io/spec/lang/master/#section_8.3.2 |
According to the spec this annotation should be visible
|
IMO, the current behaviour is correct.
Static type for the constructor and inherent type of the constructed object aren't the same. The static type is just the contextually-expected type for the constructor. The annotations come from the constructor, not the static type. The actual object constructor can have the same annotations as the expected type, but with different values. Since we don't have implementation inheritance, a method will always be implemented in an object constructor or a class, with which we can then include annotations. If you need May be different for fields though - #38535. |
@MaryamZi Are you suggesting to get the annotation values of the |
Not suggesting combining per se, just suggesting how to access the annotations, it's up to the user to decide how/when to access what. Generally, I'd expect relying on the annotations from the constructor. |
Description
I have defined a service object type and added serveral annotations to the type as well as the resource functions. Those annotations are not visible in runtime when I access the service object provided by the service declaration approach.
Steps to Reproduce
Sample Ballerina code:
Affected Version(s)
Ballerina SwanLake Update 9 (2201.9.0)
OS, DB, other environment details and versions
No response
Related area
-> Compilation
Related issue(s) (optional)
No response
Suggested label(s) (optional)
No response
Suggested assignee(s) (optional)
No response
The text was updated successfully, but these errors were encountered: