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

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

Closed
arewei opened this issue May 30, 2022 · 0 comments · Fixed by #16445
Closed

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

arewei opened this issue May 30, 2022 · 0 comments · Fixed by #16445
Assignees
Labels
area:annotations itype:bug Spree Suitable for a future Spree
Milestone

Comments

@arewei
Copy link

arewei commented May 30, 2022

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;
    }
}
@arewei arewei added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels May 30, 2022
@bishabosha bishabosha changed the title Annotation @BeanProperty and @beanGetter does not work Annotation @beanGetter spuriously applies to the setter as well May 30, 2022
@szymon-rd szymon-rd added area:annotations and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels May 30, 2022
@odersky odersky added the Spree Suitable for a future Spree label Jun 12, 2022
@dwijnand dwijnand assigned smarter and dwijnand and unassigned smarter and dwijnand Nov 30, 2022
lrytz added a commit that referenced this issue Dec 14, 2022
@Kordyjan Kordyjan added this to the 3.3.0 milestone Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:annotations itype:bug Spree Suitable for a future Spree
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants