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]: Error message seems incorrect when calling a Java instance method via a client resource method #40226

Closed
gabilang opened this issue Apr 17, 2023 · 2 comments · Fixed by #40276
Assignees
Labels
Area/JavaInterop Java interoperability in Ballerina Reason/EngineeringMistake The issue occurred due to a mistake made in the past. Team/jBallerina All the issues related to BIR, JVM backend code generation and runtime Type/Bug
Milestone

Comments

@gabilang
Copy link
Contributor

Description

$title

Steps to Reproduce

Ballerina:

public client isolated class Client {

    public isolated function init() {
    }
    isolated function newFoo() returns handle = @java:Constructor {
        'class: "javalibs.app.Foo"
    } external;

    isolated resource function get xyz/[string p1]/[string p2] (handle h) returns float = @java:Method {
        'class: "javalibs.app.Foo",
        name: "getResource"
    } external;
}

public function main() {
    Client cl = new Client();
    handle h = cl.newFoo();
    float f = cl->/xyz/["asd"]/jef.get(h);
}

Java:

public class Foo {

    public Foo() {
    }

    public double getResource(BObject self, BString p1, BString p2) {
        return 2.4;
    }
}

error:

ERROR [main.bal:(206:5,209:16)] {ballerina/jballerina.java}METHOD_NOT_FOUND 'No such public static method 'getResource' with '3' parameter(s) found in class 'class javalibs.app.Foo''

Affected Version(s)

No response

OS, DB, other environment details and versions

No response

Related area

-> Runtime

Related issue(s) (optional)

No response

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response

@gabilang gabilang added Type/Bug Team/jBallerina All the issues related to BIR, JVM backend code generation and runtime Area/JavaInterop Java interoperability in Ballerina labels Apr 17, 2023
@gabilang gabilang self-assigned this Apr 19, 2023
@gabilang
Copy link
Contributor Author

The above case should be supported as it currently working for static methods.

@github-actions
Copy link

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.

@warunalakshitha warunalakshitha added the Reason/EngineeringMistake The issue occurred due to a mistake made in the past. label Jun 16, 2023
@warunalakshitha warunalakshitha added this to the 2201.7.0 milestone Jun 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area/JavaInterop Java interoperability in Ballerina Reason/EngineeringMistake The issue occurred due to a mistake made in the past. Team/jBallerina All the issues related to BIR, JVM backend code generation and runtime Type/Bug
Projects
Archived in project
2 participants