Skip to content

Commit

Permalink
fix(plugin/Piece): remove accidental extra XML tags
Browse files Browse the repository at this point in the history
Accidentally introduced in 16afeb8
  • Loading branch information
xeruf committed Jan 29, 2021
1 parent 82f3d1b commit 23589a1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions plugin/src/shared/sc/plugin2021/Piece.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package sc.plugin2021

import com.thoughtworks.xstream.annotations.XStreamAlias
import com.thoughtworks.xstream.annotations.XStreamAsAttribute
import com.thoughtworks.xstream.annotations.XStreamOmitField

/** Ein Spielstein mit Farbe, position und entsprechend transformierter Form. */
@XStreamAlias(value = "piece")
Expand Down Expand Up @@ -36,9 +37,8 @@ data class Piece(
private constructor(color: Color, kind: PieceShape, transformation: Pair<Rotation, Boolean>, position: Coordinates):
this(color, kind, transformation.first, transformation.second, position)

// The following two fields have their lazy calculation implemented by hand
// because XStream doesn't call constructors...

// The following two fields have their lazy calculation implemented by hand because XStream doesn't initialize objects normally
@XStreamOmitField
private lateinit var _shape: Set<Coordinates>
/** Die normalisierte Form des Steins. */
val shape: Set<Coordinates>
Expand All @@ -48,6 +48,7 @@ data class Piece(
return _shape
}

@XStreamOmitField
private lateinit var _coordinates: Set<Coordinates>
/** Die tatsächlichen Koordinaten, die der Stein am Ende haben soll. */
val coordinates: Set<Coordinates>
Expand Down
1 change: 1 addition & 0 deletions plugin/src/test/sc/plugin2021/PieceTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class PieceTest: WordSpec({
</piece>
""".trimIndent())
) { piece, xml ->
piece.coordinates // trigger lazy variables
piece shouldSerializeTo xml
}
}
Expand Down

0 comments on commit 23589a1

Please sign in to comment.