bluelinelabs / bluelinelabs/LoganSquare

Can't serialize an array

Open
#189 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
3.2k
Forks
303
PR merge metrics
No merged PRs in 30d

Description

```
apt 'com.bluelinelabs:logansquare-compiler:1.3.6'
compile 'com.bluelinelabs:logansquare:1.3.6'
```
```
@JsonObject
public class AnsiFont implements Serializable {

private static final long serialVersionUID = 1L;

@JsonField
private String foregroundColor;

@JsonField
private String backgroundColor;

@JsonField
private boolean underline = false;

@JsonField
private boolean hyperLink = false;

public String getForegroundColor() {
return foregroundColor;
}

public void setForegroundColor(String foregroundColor) {
this.foregroundColor = foregroundColor;
}

public String getBackgroundColor() {
return backgroundColor;
}

public void setBackgroundColor(String backgroundColor) {
this.backgroundColor = backgroundColor;
}

public boolean isUnderline() {
return underline;
}

public void setUnderline(boolean underline) {
this.underline = underline;
}

public boolean isHyperLink() {
return hyperLink;
}

public void setHyperLink(boolean hyperLink) {
this.hyperLink = hyperLink;
}

public AnsiFont clone(){
return AnsiFont.Builder.anAnsiFont()
.withForegroundColor( foregroundColor )
.withBackgroundColor( backgroundColor )
.withHyperLink( hyperLink )
.withUnderline( underline )
.build();
}

public static class Builder {
private String foregroundColor;
private String backgroundColor;
private boolean underline = false;
private boolean hyperLink = false;

private Builder() {
}

public static Builder anAnsiFont() {
return new Builder();
}

public Builder withForegroundColor(String foregroundColor) {
this.foregroundColor = foregroundColor;
return this;
}

public Builder withBackgroundColor(String backgroundColor) {
this.backgroundColor = backgroundColor;
return this;
}

public Builder withUnderline(boolean underline) {
this.underline = underline;
return this;
}

public Builder withHyperLink(boolean hyperLink) {
this.hyperLink = hyperLink;
return this;
}

public Builder but() {
return anAnsiFont().withForegroundColor(foregroundColor).withBackgroundColor(backgroundColor).withUnderline(underline).withHyperLink(hyperLink);
}

public AnsiFont build() {
AnsiFont ansiFont = new AnsiFont();
ansiFont.setForegroundColor(foregroundColor);
ansiFont.setBackgroundColor(backgroundColor);
ansiFont.setUnderline(underline);
ansiFont.setHyperLink(hyperLink);
return ansiFont;
}
}
}
```
```
AnsiFont[][] fonts = new AnsiFont[30][30];
// NoSuchMapperException
LoganSquare.serialize(fonts);
// NoSuchMapperException
LoganSquare.serialize(fonts[0]);
// Success
LoganSquare.serialize(fonts[0][0]);
```
Any ideas?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the LoganSquare.serialize overloads shown in the report and trace how AnsiFont, AnsiFont[], and AnsiFont[][] are handled. Reproduce the NoSuchMapperException with the supplied examples; done means the reported array forms serialize successfully while the existing single-object case continues to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
backend-api-design
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.