Skip to content

Annotation @beanGetter spuriously applies to the setter as well #15318

@arewei

Description

@arewei

3.1.2

Minimized code

import com.fasterxml.jackson.annotation.JsonProperty

import scala.annotation.meta.beanGetter
import scala.beans.BeanProperty

class TestBeanProperty {

  @(JsonProperty @beanGetter)(value = "REAL_VALUE")
  @BeanProperty
  var value: String = _

}

After decompilation,

Output

import com.fasterxml.jackson.annotation.JsonProperty;

public class TestBeanProperty {

    @JsonProperty(value="REAL_VALUE")
    private String value;

    @JsonProperty(value="REAL_VALUE")
    public String getValue() {
        return this.value();
    }

    @JsonProperty(value="REAL_VALUE")
    public void setValue(String value) {
        this.value_$eq(value);
    }

    public String value() {
        return this.value;
    }

    public void value_$eq(String x$1) {
        this.value = x$1;
    }
}

Expectation

import com.fasterxml.jackson.annotation.JsonProperty;

public class TestBeanProperty {

    private String value;

    @JsonProperty(value="REAL_VALUE")
    public String getValue() {
        return this.value();
    }

    public void setValue(String value) {
        this.value_$eq(value);
    }

    public String value() {
        return this.value;
    }

    public void value_$eq(String x$1) {
        this.value = x$1;
    }
}

or

import com.fasterxml.jackson.annotation.JsonProperty;

public class TestBeanProperty {
    @JsonProperty(value="REAL_VALUE")
    private String value;

    @JsonProperty(value="REAL_VALUE")
    public String getValue() {
        return this.value();
    }

    public void setValue(String value) {
        this.value_$eq(value);
    }

    public String value() {
        return this.value;
    }

    public void value_$eq(String x$1) {
        this.value = x$1;
    }
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions