问题
I need to call a function in test.bal. Function is written in function.bal file in the same module. Return type of the function is jdbc:Client.
function.bal :
import ballerinax/java.jdbc;
public function createDbConn() returns jdbc:Client{
jdbc:Client testDbConn = new({
url: "jdbc:mysql://localhost:3306/testDB",
username: "testUsername",
password: "testPassword",
poolOptions: {maximumPoolSize: 5},
dbOptions: {useSSL: false}
});
return testDbConn;
}
Before invoking this method in test.bal, there's no compilation error. Then I'm trying to invoke the function in test.bal as below
jdbc:Client testDbConn = createDbConn();
...//more code in here
var selectFromDb = testDbConn->select("SELECT * FROM test", testData);
After method invoking, this gives a compile error as follows in function.bal
undocumented return parameter
What's the reason for this error? Can't I use jdbc:Client as the return type?
PS: This is a warning, not a compile error
回答1:
undocumented return parameter
should be a warning, this is when you have incomplete function documentation.
But mere invocation of the function should not produce this kind of documentation warning.
Can you try adding method return documentation to that method.
# + return - This is the description of the return value of
# the `doThatOnObject` function.
See Ballerina doc comment examples here.
If the error still persists please report a bug at https://github.com/ballerina-platform/ballerina-lang/issues
来源:https://stackoverflow.com/questions/58300618/ballerina-v-1-0-error-in-calling-function-with-jdbcclient-return-type-undoc