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

Cannot get references of a method within a class #28388

Closed
IMS94 opened this issue Feb 2, 2021 · 0 comments · Fixed by #29788
Closed

Cannot get references of a method within a class #28388

IMS94 opened this issue Feb 2, 2021 · 0 comments · Fixed by #29788
Assignees
Labels
Area/SemanticAPI Semantic API Related Issues #Compiler SwanLakeDump All issues planned for Swan Lake GA release Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Type/Bug

Comments

@IMS94
Copy link
Contributor

IMS94 commented Feb 2, 2021

Description:

When find all references of a method within a class is clicked (in VS Code plugin), it doesn't show any references and the following error is printed in the plugin's output.

rename/sources/project/modules/module2/module2.bal', [16:25], error: 'class io.ballerina.compiler.api.impl.symbols.BallerinaMethodSymbol cannot be cast to class io.ballerina.compiler.api.impl.symbols.BallerinaSymbol (io.ballerina.compiler.api.impl.symbols.BallerinaMethodSymbol and io.ballerina.compiler.api.impl.symbols.BallerinaSymbol are in unnamed module of loader 'app')'}
java.lang.ClassCastException: class io.ballerina.compiler.api.impl.symbols.BallerinaMethodSymbol cannot be cast to class io.ballerina.compiler.api.impl.symbols.BallerinaSymbol (io.ballerina.compiler.api.impl.symbols.BallerinaMethodSymbol and io.ballerina.compiler.api.impl.symbols.BallerinaSymbol are in unnamed module of loader 'app')
	at io.ballerina.compiler.api.impl.BallerinaSemanticModel.getInternalSymbol(BallerinaSemanticModel.java:325)
	at io.ballerina.compiler.api.impl.BallerinaSemanticModel.references(BallerinaSemanticModel.java:178)
	at org.ballerinalang.langserver.util.references.ReferencesUtil.lambda$getReferences$1(ReferencesUtil.java:67)
	at java.base/java.lang.Iterable.forEach(Iterable.java:75)
	at org.ballerinalang.langserver.util.references.ReferencesUtil.getReferences(ReferencesUtil.java:65)
	at org.ballerinalang.langserver.BallerinaTextDocumentService.lambda$references$4(BallerinaTextDocumentService.java:275)
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700)
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1692)
	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:177)

This is the class I used,

# Person  
public class Person {
    private string name;
    private int age;
    private string identificationNo;

    public function init(string name, int age, string identificationNo) {
        self.name = name;
        self.age = age;
        self.identificationNo = identificationNo;
    }

    public function getName() returns string {
        return self.name;
    }

    public function getAge() returns int {
        return self.age;
    }

    public function getIdentificationNo() returns string {
        return self.identificationNo;
    }
}
@pubudu91 pubudu91 self-assigned this Feb 2, 2021
@pubudu91 pubudu91 added Area/SemanticAPI Semantic API Related Issues #Compiler Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Type/Bug labels Feb 2, 2021
@nadeeshaan nadeeshaan added the SwanLakeDump All issues planned for Swan Lake GA release label Feb 12, 2021
@nadeeshaan nadeeshaan added this to the Ballerina Swan Lake - Beta milestone Feb 12, 2021
@pubudu91 pubudu91 added this to To do in Sprint 28 - Language Support Virtual Team via automation Mar 15, 2021
@pubudu91 pubudu91 moved this from To do to Plan for This sprint in Sprint 28 - Language Support Virtual Team Mar 16, 2021
@pubudu91 pubudu91 modified the milestones: Ballerina Swan Lake - Beta, Ballerina Swan Lake - Beta RC1 Mar 29, 2021
@pubudu91 pubudu91 assigned dulajdilshan and unassigned pubudu91 Mar 29, 2021
@dulajdilshan dulajdilshan removed this from Plan for This sprint in Sprint 28 - Language Support Virtual Team Apr 1, 2021
@dulajdilshan dulajdilshan moved this from To do to Plan for This sprint in Sprint 29 - Language Support Virtual Team Apr 1, 2021
@dulajdilshan dulajdilshan moved this from Plan for This sprint to In progress in Sprint 29 - Language Support Virtual Team Apr 1, 2021
@Kishanthan Kishanthan modified the milestones: Ballerina Swan Lake - Alpha5, Ballerina Swan Lake - Alpha6 Apr 7, 2021
@dulajdilshan dulajdilshan moved this from In progress to PR Sent in Sprint 29 - Language Support Virtual Team Apr 8, 2021
Sprint 29 - Language Support Virtual Team automation moved this from PR Sent to Done Apr 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area/SemanticAPI Semantic API Related Issues #Compiler SwanLakeDump All issues planned for Swan Lake GA release Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Type/Bug
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

5 participants