Skip to content

Commit ac91c59

Browse files
committed
Use valueOf factory method instead of constructor
1 parent a8673c1 commit ac91c59

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

core/src/processing/core/PShapeSVG.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1811,7 +1811,7 @@ public Font(PShapeSVG parent, XML properties) {
18111811
namedGlyphs.put(fg.name, fg);
18121812
}
18131813
if (fg.unicode != 0) {
1814-
unicodeGlyphs.put(new Character(fg.unicode), fg);
1814+
unicodeGlyphs.put(Character.valueOf(fg.unicode), fg);
18151815
}
18161816
}
18171817
glyphs[glyphCount++] = fg;
@@ -1845,7 +1845,7 @@ public void drawString(PGraphics g, String str, float x, float y, float size) {
18451845
char[] c = str.toCharArray();
18461846
for (int i = 0; i < c.length; i++) {
18471847
// call draw on each char (pulling it w/ the unicode table)
1848-
FontGlyph fg = unicodeGlyphs.get(new Character(c[i]));
1848+
FontGlyph fg = unicodeGlyphs.get(Character.valueOf(c[i]));
18491849
if (fg != null) {
18501850
fg.draw(g);
18511851
// add horizAdvX/unitsPerEm to the x coordinate along the way
@@ -1863,7 +1863,7 @@ public void drawChar(PGraphics g, char c, float x, float y, float size) {
18631863
float s = size / face.unitsPerEm;
18641864
g.translate(x, y);
18651865
g.scale(s, -s);
1866-
FontGlyph fg = unicodeGlyphs.get(new Character(c));
1866+
FontGlyph fg = unicodeGlyphs.get(Character.valueOf(c));
18671867
if (fg != null) g.shape(fg);
18681868
g.popMatrix();
18691869
}
@@ -1874,7 +1874,7 @@ public float textWidth(String str, float size) {
18741874
char[] c = str.toCharArray();
18751875
for (int i = 0; i < c.length; i++) {
18761876
// call draw on each char (pulling it w/ the unicode table)
1877-
FontGlyph fg = unicodeGlyphs.get(new Character(c[i]));
1877+
FontGlyph fg = unicodeGlyphs.get(Character.valueOf(c[i]));
18781878
if (fg != null) {
18791879
w += (float) fg.horizAdvX / face.unitsPerEm;
18801880
}

core/src/processing/data/JSONObject.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1492,7 +1492,7 @@ static protected Object stringToValue(String string) {
14921492
return d;
14931493
}
14941494
} else {
1495-
Long myLong = new Long(string);
1495+
Long myLong = Long.valueOf(string);
14961496
if (myLong.longValue() == myLong.intValue()) {
14971497
return Integer.valueOf(myLong.intValue());
14981498
} else {

0 commit comments

Comments
 (0)