Skip to content

Commit f9fa6cf

Browse files
committed
Methods in a final class do not also need to be final, use override.
1 parent 199fd98 commit f9fa6cf

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/GenerateProjection.scala

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ object GenerateProjection extends CodeGenerator[Seq[Expression], Projection] {
5353
val nullFunctions =
5454
q"""
5555
private[this] var nullBits = new Array[Boolean](${expressions.size})
56-
final def setNullAt(i: Int) = { nullBits(i) = true }
57-
final def isNullAt(i: Int) = nullBits(i)
56+
override def setNullAt(i: Int) = { nullBits(i) = true }
57+
override def isNullAt(i: Int) = nullBits(i)
5858
""".children
5959

6060
val tupleElements = expressions.zipWithIndex.flatMap {
@@ -82,7 +82,7 @@ object GenerateProjection extends CodeGenerator[Seq[Expression], Projection] {
8282
val iLit = ru.Literal(Constant(i))
8383
q"if(isNullAt($iLit)) { null } else { ${newTermName(s"c$i")} }"
8484
}
85-
q"final def iterator = Iterator[Any](..$allColumns)"
85+
q"override def iterator = Iterator[Any](..$allColumns)"
8686
}
8787

8888
val accessorFailure = q"""scala.sys.error("Invalid ordinal:" + i)"""
@@ -94,7 +94,7 @@ object GenerateProjection extends CodeGenerator[Seq[Expression], Projection] {
9494

9595
q"if(i == $ordinal) { if(isNullAt($i)) return null else return $elementName }"
9696
}
97-
q"final def apply(i: Int): Any = { ..$cases; $accessorFailure }"
97+
q"override def apply(i: Int): Any = { ..$cases; $accessorFailure }"
9898
}
9999

100100
val updateFunction = {
@@ -114,7 +114,7 @@ object GenerateProjection extends CodeGenerator[Seq[Expression], Projection] {
114114
return
115115
}"""
116116
}
117-
q"final def update(i: Int, value: Any): Unit = { ..$cases; $accessorFailure }"
117+
q"override def update(i: Int, value: Any): Unit = { ..$cases; $accessorFailure }"
118118
}
119119

120120
val specificAccessorFunctions = NativeType.all.map { dataType =>
@@ -128,7 +128,7 @@ object GenerateProjection extends CodeGenerator[Seq[Expression], Projection] {
128128
}
129129

130130
q"""
131-
final def ${accessorForType(dataType)}(i: Int):${termForType(dataType)} = {
131+
override def ${accessorForType(dataType)}(i: Int):${termForType(dataType)} = {
132132
..$ifStatements;
133133
$accessorFailure
134134
}"""
@@ -145,7 +145,7 @@ object GenerateProjection extends CodeGenerator[Seq[Expression], Projection] {
145145
}
146146

147147
q"""
148-
final def ${mutatorForType(dataType)}(i: Int, value: ${termForType(dataType)}): Unit = {
148+
override def ${mutatorForType(dataType)}(i: Int, value: ${termForType(dataType)}): Unit = {
149149
..$ifStatements;
150150
$accessorFailure
151151
}"""
@@ -193,7 +193,7 @@ object GenerateProjection extends CodeGenerator[Seq[Expression], Projection] {
193193

194194
val copyFunction =
195195
q"""
196-
final def copy() = new $genericRowType(this.toArray)
196+
override def copy() = new $genericRowType(this.toArray)
197197
"""
198198

199199
val classBody =

0 commit comments

Comments
 (0)