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]: Problem on error message when a method is used wrongly without a receiver. #41414

Closed
NirashaSewwandi opened this issue Sep 19, 2023 · 1 comment · Fixed by #41943
Closed
Assignees
Labels
Team/jBallerina All the issues related to BIR, JVM backend code generation and runtime Type/Bug userCategory/Compilation

Comments

@NirashaSewwandi
Copy link
Contributor

Description

ERROR:

[2023-09-19 21:09:58,198] SEVERE {b7a.log.crash} - Index 1 out of bounds for length 1
java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
at org.wso2.ballerinalang.compiler.bir.codegen.interop.JMethodResolver.isAcceptingBundledParams(JMethodResolver.java:200)
at org.wso2.ballerinalang.compiler.bir.codegen.interop.JMethodResolver.resolveByParamCount(JMethodResolver.java:159)
at org.wso2.ballerinalang.compiler.bir.codegen.interop.JMethodResolver.resolve(JMethodResolver.java:130)
at org.wso2.ballerinalang.compiler.bir.codegen.interop.InteropValidator.validateAndGetJMethod(InteropValidator.java:203)
at org.wso2.ballerinalang.compiler.bir.codegen.interop.InteropValidator.createJInteropFunction(InteropValidator.java:223)
at org.wso2.ballerinalang.compiler.bir.codegen.interop.InteropValidator.getBirFunction(InteropValidator.java:210)
at org.wso2.ballerinalang.compiler.bir.codegen.interop.InteropValidator.validateModuleFunctions(InteropValidator.java:149)
at org.wso2.ballerinalang.compiler.bir.codegen.interop.InteropValidator.validateFunctions(InteropValidator.java:124)
at org.wso2.ballerinalang.compiler.bir.codegen.interop.InteropValidator.validateModulePackages(InteropValidator.java:96)
at org.wso2.ballerinalang.compiler.bir.codegen.interop.InteropValidator.validate(InteropValidator.java:76)
at io.ballerina.projects.JBallerinaBackend.performCodeGen(JBallerinaBackend.java:317)
at io.ballerina.projects.ModuleContext.generateCodeInternal(ModuleContext.java:480)
at io.ballerina.projects.ModuleCompilationState$4.generatePlatformSpecificCode(ModuleCompilationState.java:132)
at io.ballerina.projects.ModuleContext.generatePlatformSpecificCode(ModuleContext.java:387)
at io.ballerina.projects.JBallerinaBackend.performCodeGen(JBallerinaBackend.java:173)
at io.ballerina.projects.JBallerinaBackend.(JBallerinaBackend.java:142)
at io.ballerina.projects.JBallerinaBackend.lambda$from$0(JBallerinaBackend.java:120)
at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1134)
at io.ballerina.projects.PackageCompilation.getCompilerBackend(PackageCompilation.java:172)
at io.ballerina.projects.JBallerinaBackend.from(JBallerinaBackend.java:119)
at io.ballerina.cli.task.CompileTask.execute(CompileTask.java:201)
at io.ballerina.cli.TaskExecutor.executeTasks(TaskExecutor.java:40)
at io.ballerina.cli.cmd.BuildCommand.execute(BuildCommand.java:288)
at java.base/java.util.Optional.ifPresent(Optional.java:183)
at io.ballerina.cli.launcher.Main.main(Main.java:56)

Steps to Reproduce

Run bal build on following bal project

apachePOI.zip

It will get the above error. Problem here is the error message.

To resolve the error : Direct to modules/org.apache.poi/org.apache.poi.bal and change the read() method as follows

public isolated function read(handle receiver) returns int|error = @java:Method`
{
    name: "read",
    'class: "org.apache.poi.openxml4j.util.ZipArchiveThresholdInputStream"
    
} external;

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 Sep 19, 2023
@MaryamZi MaryamZi added Team/jBallerina All the issues related to BIR, JVM backend code generation and runtime and removed needTriage The issue has to be inspected and labeled manually labels Oct 26, 2023
@gabilang gabilang self-assigned this Jan 5, 2024
@gabilang gabilang moved this to Planned for Sprint in Ballerina Team Main Board Jan 5, 2024
@gabilang gabilang moved this from Planned for Sprint to In Progress in Ballerina Team Main Board Jan 5, 2024
@gabilang gabilang moved this from In Progress to PR Sent in Ballerina Team Main Board Jan 8, 2024
@github-project-automation github-project-automation bot moved this from PR Sent to Done in Ballerina Team Main Board Jan 16, 2024
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team/jBallerina All the issues related to BIR, JVM backend code generation and runtime Type/Bug userCategory/Compilation
Projects
Archived in project
4 participants