Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/kotlin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从Kotlin访问JavaBean属性_Kotlin - Fatal编程技术网

从Kotlin访问JavaBean属性

从Kotlin访问JavaBean属性,kotlin,Kotlin,我使用标准bean约定导入了WSED Java类: public class Request { protected String vin; public String getVin() { return vin; } public void setVin(String value) { this.vin = value; } } 我希望在Kotlin中使用nice属性语法使用此类: override fun sear

我使用标准bean约定导入了WSED Java类:

public class Request {
    protected String vin;

    public String getVin() {
        return vin;
    }

    public void setVin(String value) {
        this.vin = value;
    }
}
我希望在Kotlin中使用nice属性语法使用此类:

override fun search(request: Request): Response {
  log.info("search(vin={})", request.vin);
  ...
但此代码不编译:

Error:(59, 64) Kotlin: Cannot access 'vin': it is 'protected/*protected and package*/' in 'SmvSearchRequest'

request.getVin()
当然可以工作,但这看起来并不比Java好。有没有办法将这些类视为属性持有者?

这是M13之前缺少的,现在已在M13中修复,请参见

这不是一个真正的bug。更新:引用的问题(KT-400)已经解决,问题中的代码现在应该可以正常工作了。你能更新一下答案吗。