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]: NPE in semanticModel.typeOf() API on resource path access action #39070

Closed
IMS94 opened this issue Dec 15, 2022 · 1 comment · Fixed by #40026
Closed

[Bug]: NPE in semanticModel.typeOf() API on resource path access action #39070

IMS94 opened this issue Dec 15, 2022 · 1 comment · Fixed by #40026
Assignees
Labels
Area/CodeAction Language Server Code Actions Area/SemanticAPI Semantic API Related Issues #Compiler Reason/EngineeringMistake The issue occurred due to a mistake made in the past. Team/CompilerFETools Semantic API, Formatter, Shell Type/Bug

Comments

@IMS94
Copy link
Contributor

IMS94 commented Dec 15, 2022

Description

In the following code:

import ballerina/http;

public function main() returns error? {
    http:Client cl= check new("");
    cl->/"path1"/path2/.post(<cursor>);
}

at cursor, following exception is printed:

Error - 4:28:07 PM] Operation 'text/codeAction' failed! {uri: '/home/imesha/Documents/WSO2/Ballerina/Projects/test_project/test.bal', [5:30]- [5:30], error: 'java.lang.NullPointerException'}
java.lang.NullPointerException
	at io.ballerina.compiler.api.impl.BallerinaSemanticModel.getDeterminedType(BallerinaSemanticModel.java:320)
	at io.ballerina.compiler.api.impl.BallerinaSemanticModel.typeOf(BallerinaSemanticModel.java:314)
	at org.ballerinalang.langserver.codeaction.CodeActionRouter.getMatchedTypeSymbol(CodeActionRouter.java:171)
	at org.ballerinalang.langserver.codeaction.CodeActionRouter.getAvailableCodeActions(CodeActionRouter.java:84)
	at org.ballerinalang.langserver.codeaction.BallerinaCodeActionExtension.execute(BallerinaCodeActionExtension.java:49)
	at org.ballerinalang.langserver.codeaction.BallerinaCodeActionExtension.execute(BallerinaCodeActionExtension.java:37)
	at org.ballerinalang.langserver.LangExtensionDelegator.codeActions(LangExtensionDelegator.java:169)
	at org.ballerinalang.langserver.BallerinaTextDocumentService.lambda$codeAction$8(BallerinaTextDocumentService.java:334)
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:642)
	at java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:479)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)

Steps to Reproduce

No response

Affected Version(s)

No response

OS, DB, other environment details and versions

No response

Related area

-> Editor

Related issue(s) (optional)

No response

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response

@IMS94 IMS94 added Type/Bug Team/CompilerFETools Semantic API, Formatter, Shell Area/SemanticAPI Semantic API Related Issues #Compiler Area/CodeAction Language Server Code Actions labels Dec 15, 2022
@pcnfernando pcnfernando moved this from BackLog to Planned for Sprint in Ballerina Team Main Board Mar 17, 2023
@sanjana sanjana moved this from Planned for Sprint to In Progress in Ballerina Team Main Board Mar 27, 2023
@sanjana sanjana moved this from In Progress to PR Sent in Ballerina Team Main Board Mar 29, 2023
@github-project-automation github-project-automation bot moved this from PR Sent to Done in Ballerina Team Main Board Aug 9, 2023
@github-actions
Copy link

github-actions bot commented Aug 9, 2023

This issue is NOT closed with a proper Reason/ label. Make sure to add proper reason label before closing. Please add or leave a comment with the proper reason label now.

      - Reason/EngineeringMistake - The issue occurred due to a mistake made in the past.
      - Reason/Regression - The issue has introduced a regression.
      - Reason/MultipleComponentInteraction - Issue occured due to interactions in multiple components.
      - Reason/Complex - Issue occurred due to complex scenario.
      - Reason/Invalid - Issue is invalid.
      - Reason/Other - None of the above cases.

@pcnfernando pcnfernando added the Reason/EngineeringMistake The issue occurred due to a mistake made in the past. label Aug 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area/CodeAction Language Server Code Actions Area/SemanticAPI Semantic API Related Issues #Compiler Reason/EngineeringMistake The issue occurred due to a mistake made in the past. Team/CompilerFETools Semantic API, Formatter, Shell Type/Bug
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants