Skip to content

Commit

Permalink
fix bad simpleName in json client; fixes #1108
Browse files Browse the repository at this point in the history
  • Loading branch information
stoicflame committed Mar 21, 2022
1 parent 80384e8 commit 0d7beb5
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,11 @@ public String getPropertyName(DecoratedExecutableElement method) {
}
}

return getSimpleName(method);
}

@Override
public String getSimpleName(DecoratedExecutableElement method) {
if (method.isGetter() || method.isSetter()) {
return method.getPropertyName();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,11 @@ public String getPropertyName(DecoratedExecutableElement method) {
}
}

return getSimpleName(method);
}

@Override
public String getSimpleName(DecoratedExecutableElement method) {
if (method.isGetter() || method.isSetter()) {
return method.getPropertyName();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ public String getPropertyName(DecoratedExecutableElement method) {
return method.getPropertyName();
}

@Override
public String getSimpleName(DecoratedExecutableElement method) {
return method.getPropertyName();
}

@Override
public boolean isPaired(DecoratedExecutableElement getter, DecoratedExecutableElement setter) {
if (getter == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class PropertyElement extends DecoratedExecutableElement {
private final DecoratedExecutableElement setter;
private final DecoratedExecutableElement getter;
private final String propertyName;
private final String simpleName;
private final TypeMirror propertyType;

/**
Expand All @@ -57,6 +58,7 @@ public PropertyElement(DecoratedExecutableElement getter, DecoratedExecutableEle
this.getter = getter;
this.setter = setter;
this.propertyName = spec.getPropertyName(getter != null ? getter : setter);
this.simpleName = spec.getSimpleName(getter != null ? getter : setter);

TypeMirror propertyType = null;
if (getter != null) {
Expand Down Expand Up @@ -107,12 +109,11 @@ public TypeMirror getPropertyType() {
*/
@Override
public Name getSimpleName() {
return this.env.getElementUtils().getName(this.propertyName);
return this.env.getElementUtils().getName(this.simpleName);
}

/**
* Make sure the property name is calculated correctly.
* cd
*/
@Override
public String getPropertyName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ public interface PropertySpec {

String getPropertyName(DecoratedExecutableElement method);

String getSimpleName(DecoratedExecutableElement method);

boolean isPaired(DecoratedExecutableElement getter, DecoratedExecutableElement setter);
}

0 comments on commit 0d7beb5

Please sign in to comment.