Skip to content

Commit da12c22

Browse files
authored
Merge pull request #364 from cucumber/scala33
🏗️ build: compile for Scala 3.3 (LTS)
2 parents 5dc2344 + 3620e7b commit da12c22

File tree

5 files changed

+34
-35
lines changed

5 files changed

+34
-35
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ See also the [CHANGELOG](https://github.com/cucumber/cucumber-jvm/blob/master/CH
1313

1414
### Changed
1515

16+
- [Build] Upgraded Scala 3 to 3.3.1 (LTS)
17+
1618
### Deprecated
1719

1820
### Removed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ The table below shows the compatible versions:
2121

2222
| Cucumber Scala version | Cucumber Core version | Scala versions |
2323
|------------------------|-----------------------|------------------------|
24+
| 8.18+ | 7.x | 2.12, 2.13, 3.3+ |
2425
| 8.13+ | 7.x | 2.12, 2.13, 3.2+ |
2526
| 8.0-8.12 | 7.x | 2.12, 2.13, 3.0+ |
2627
| 7.x | 6.x | 2.11, 2.12, 2.13, 3.0+ |

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ ThisBuild / homepage := Some(
3232

3333
val scala212 = "2.12.16"
3434
val scala213 = "2.13.12"
35-
val scala3 = "3.2.1"
35+
val scala3 = "3.3.1"
3636

3737
scalaVersion := scala213
3838

integration-tests/common/src/test/scala/cukes/StepDefs.scala

Lines changed: 19 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,28 @@ import scala.jdk.CollectionConverters._
1515
@nowarn
1616
class CukesStepDefinitions extends ScalaDsl with EN {
1717

18+
var calorieCount = 0.0
19+
var intBelly: Int = 0
20+
var longBelly: Long = 0L
21+
var stringBelly: String = ""
22+
var doubleBelly: Double = 0.0
23+
var floatBelly: Float = 0.0f
24+
var shortBelly: Short = 0.toShort
25+
var byteBelly: Byte = 0.toByte
26+
var bigDecimalBelly: BigDecimal = BigDecimal(0)
27+
var bigIntBelly: BigInt = BigInt(0)
28+
var charBelly: Char = 'A'
29+
var boolBelly: Boolean = false
30+
var snake: Snake = null
31+
var person: Person = null
32+
var cukes: JList[Cukes] = null
33+
var gin: Int = 13
34+
var vermouth: Int = 42
35+
var maritinis: Int = 0
36+
1837
Given("""I have {} {string} in my belly""") { (howMany: Int, what: String) =>
1938
}
2039

21-
var calorieCount = 0.0
22-
2340
Given("""^I have the following foods :$""") { (table: DataTable) =>
2441
val maps: JList[JMap[String, String]] =
2542
table.asMaps(classOf[String], classOf[String])
@@ -30,71 +47,55 @@ class CukesStepDefinitions extends ScalaDsl with EN {
3047
assertEquals(calories, calorieCount, 0.0)
3148
}
3249

33-
var intBelly: Int = 0
34-
3550
Given("""I have eaten an int {int}""") { (arg0: Int) =>
3651
intBelly = arg0
3752
}
3853
Then("""^I should have one hundred in my belly$""") { () =>
3954
assertEquals(100, intBelly)
4055
}
4156

42-
var longBelly: Long = 0L
43-
4457
Given("""I have eaten a long {long}""") { (arg0: Long) =>
4558
longBelly = arg0
4659
}
4760
Then("""^I should have long one hundred in my belly$""") { () =>
4861
assertEquals(100L, longBelly)
4962
}
5063

51-
var stringBelly: String = ""
52-
5364
Given("""^I have eaten "(.*)"$""") { (arg0: String) =>
5465
stringBelly = arg0
5566
}
5667
Then("""^I should have numnumnum in my belly$""") { () =>
5768
assertEquals("numnumnum", stringBelly)
5869
}
5970

60-
var doubleBelly: Double = 0.0
61-
6271
Given("""I have eaten {double} doubles""") { (arg0: Double) =>
6372
doubleBelly = arg0
6473
}
6574
Then("""^I should have one and a half doubles in my belly$""") { () =>
6675
assertEquals(1.5, doubleBelly, 0.0)
6776
}
6877

69-
var floatBelly: Float = 0.0f
70-
7178
Given("""I have eaten {} floats""") { (arg0: Float) =>
7279
floatBelly = arg0
7380
}
7481
Then("""^I should have one and a half floats in my belly$""") { () =>
7582
assertEquals(1.5f, floatBelly, 0.0)
7683
}
7784

78-
var shortBelly: Short = 0.toShort
79-
8085
Given("""I have eaten a short {short}""") { (arg0: Short) =>
8186
shortBelly = arg0
8287
}
8388
Then("""^I should have short one hundred in my belly$""") { () =>
8489
assertEquals(100.toShort, shortBelly)
8590
}
8691

87-
var byteBelly: Byte = 0.toByte
88-
8992
Given("""I have eaten a byte {byte}""") { (arg0: Byte) =>
9093
byteBelly = arg0
9194
}
9295
Then("""^I should have two byte in my belly$""") { () =>
9396
assertEquals(2.toByte, byteBelly)
9497
}
9598

96-
var bigDecimalBelly: BigDecimal = BigDecimal(0)
97-
9899
Given("""I have eaten {bigdecimal} big decimals""") {
99100
(arg0: java.math.BigDecimal) =>
100101
bigDecimalBelly = arg0
@@ -103,8 +104,6 @@ class CukesStepDefinitions extends ScalaDsl with EN {
103104
assertEquals(BigDecimal(1.5), bigDecimalBelly)
104105
}
105106

106-
var bigIntBelly: BigInt = BigInt(0)
107-
108107
Given("""I have eaten {biginteger} big int""") {
109108
(arg0: java.math.BigInteger) =>
110109
bigIntBelly = arg0.intValue()
@@ -113,17 +112,13 @@ class CukesStepDefinitions extends ScalaDsl with EN {
113112
assertEquals(BigInt(10), bigIntBelly)
114113
}
115114

116-
var charBelly: Char = 'A'
117-
118115
Given("""I have eaten char '{char}'""") { (arg0: Char) =>
119116
charBelly = 'C'
120117
}
121118
Then("""^I should have character C in my belly$""") { () =>
122119
assertEquals('C', charBelly)
123120
}
124121

125-
var boolBelly: Boolean = false
126-
127122
Given("""I have eaten boolean {boolean}""") { (arg0: Boolean) =>
128123
boolBelly = arg0
129124
}
@@ -144,8 +139,6 @@ class CukesStepDefinitions extends ScalaDsl with EN {
144139
)
145140
}
146141

147-
var snake: Snake = null
148-
149142
Given("""I see in the distance ... {snake}""") { (s: Snake) =>
150143
snake = s
151144
}
@@ -155,8 +148,6 @@ class CukesStepDefinitions extends ScalaDsl with EN {
155148
assertEquals(Symbol(dir), snake.direction)
156149
}
157150

158-
var person: Person = null
159-
160151
Given("""I have a person {person}""") { (p: Person) =>
161152
person = p
162153
}
@@ -165,8 +156,6 @@ class CukesStepDefinitions extends ScalaDsl with EN {
165156
assertEquals(person.hello, s)
166157
}
167158

168-
var cukes: JList[Cukes] = null
169-
170159
Given("^I have eaten the following cukes$") { (cs: JList[Cukes]) =>
171160
cukes = cs
172161
}
@@ -179,10 +168,6 @@ class CukesStepDefinitions extends ScalaDsl with EN {
179168
assertEquals(colors, cukes.asScala.map(_.color).mkString(", "))
180169
}
181170

182-
var gin: Int = 13
183-
var vermouth: Int = 42
184-
var maritinis: Int = 0
185-
186171
Given("^I drink gin and vermouth$") { () =>
187172
gin = 13
188173
vermouth = 42

project/ScalacOptions.scala

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
object ScalacOptions {
22

33
val scalacOptions3 = Seq(
4+
"-encoding",
5+
"utf-8", // Specify character encoding used by source files.
46
"-deprecation", // Emit warning and location for usages of deprecated APIs.
57
"-explain", // Explain type errors in more detail.
68
// "-explaintypes", // Explain type errors in more detail.
@@ -10,6 +12,15 @@ object ScalacOptions {
1012
"-language:higherKinds", // Allow higher-kinded types
1113
"-language:implicitConversions", // Allow definition of implicit functions called views
1214
"-unchecked", // Enable additional warnings where generated code depends on assumptions.
15+
"-Wvalue-discard", // Warn when non-Unit expression results are unused.
16+
"-Wunused:implicits", // Warn if an implicit parameter is unused.
17+
"-Wunused:explicits",
18+
"-Wunused:imports", // Warn if an import selector is not referenced.
19+
"-Wunused:locals", // Warn if a local definition is unused.
20+
"-Wunused:params", // Warn if a value parameter is unused.
21+
"-Wunused:privates", // Warn if a private member is unused.
22+
"-Ykind-projector",
23+
"-Ysafe-init",
1324
"-Xfatal-warnings" // Fail the compilation if there are any warnings.
1425
)
1526

0 commit comments

Comments
 (0)