Compile error appears when I try to use the class that created by myself

I create a class as below:

public class user_info {
    private String account;
    public String getAccount() {
        return account;
    }
    public user_info(String account) {
        super();
        this.account = account;
    }
}

when I use it in the keyword as below:

@CompileStatic

@com.kms.katalon.core.annotation.Keyword

public static user_info getUserInfo(String account){

user_info test = new user_info(“test”)

return test
}

the compile error appears in the Katalon Studio, why this happened?

Can you remove @CompileStatic and try again? I would like to clarify that using improper coding will not be supported if there is an issue with it :slight_smile:

Regards

@“Vinh Nguyen” The error stand still after remove @CompileStatic

In this case, please show me how you use that in your test script. And also please post ‘compile error’ message as well. From my side, I think using that approach will not work from Katalon Studio.

@“Vinh Nguyen” please refer to the snapshot

搜狗截图20171221135532.png

搜狗截图20171221135707.png

搜狗截图20171221135749.png

Hi simple,

As I can see, the current scripting mode of Katalon Studio doesn’t support that. You can only define new custom keywords from Custom Keywords editor, and you can’t call keyword annotation like that to be used in your test script. Please define your new custom keyword using the proper declaration of Katalon Studio.
https://docs.katalon.com/display/KD/Define+custom+keywords

Regards