Skip to content
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]: Unable to obtain AnnotationSymbol for annotation node #43525

Open
MohamedSabthar opened this issue Oct 25, 2024 · 0 comments
Open

[Bug]: Unable to obtain AnnotationSymbol for annotation node #43525

MohamedSabthar opened this issue Oct 25, 2024 · 0 comments
Labels
needTriage The issue has to be inspected and labeled manually Type/Bug userCategory/Compilation

Comments

@MohamedSabthar
Copy link
Member

Description

For the Ballerina code snippet below, the compiler plugin does not return a valid symbol and instead returns an empty value:

import ballerina/http;

type ServiceContract2 service object {
    *http:ServiceContract;

    @http:ResourceConfig {
        cors: {
            allowOrigins: ["*"]
        }
    }
    resource function get .() returns string;
}

In the plugin code, the perform method is triggered on the annotation node:

// The perform method will be invoked on the annotation node
public void perform(SyntaxNodeAnalysisContext context) {
    // context.node() here returns the http:ResourceConfig annotation node
    Optional<Symbol> symbol = context.semanticModel().symbol(context.node());
    // The symbol is empty here
}

The issue arises when trying to retrieve the symbol for the http:ResourceConfig annotation node using the context's semantic model. The returned symbol is empty, which is not the expected behavior.

Steps to Reproduce

No response

Affected Version(s)

No response

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

@ballerina-bot ballerina-bot added needTriage The issue has to be inspected and labeled manually userCategory/Compilation labels Oct 25, 2024
@MohamedSabthar MohamedSabthar changed the title [Bug]: Unable to obtain AnnotationSymbol for annotation defined in the object function. [Bug]: Unable to obtain AnnotationSymbol for annotation node Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needTriage The issue has to be inspected and labeled manually Type/Bug userCategory/Compilation
Projects
Status: No status
Development

No branches or pull requests

2 participants