Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Java 11 #401

Merged
merged 6 commits into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
aws-region: eu-west-1
- uses: actions/setup-java@v3
with:
java-version: "8"
java-version: "11"
distribution: "corretto"
cache: "sbt"
- name: Build the stack
Expand Down
2 changes: 1 addition & 1 deletion .java-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.8.0_332
11.0.20.8.1
2 changes: 1 addition & 1 deletion apps/checker/app/model/MatcherError.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ case class MatcherError(error: String, id: Option[String] = None) {
}

object MatcherError {
implicit val writes = new Writes[MatcherError] {
implicit val writes: Writes[MatcherError] = new Writes[MatcherError] {
def writes(response: MatcherError) = Json.obj(
"type" -> response.`type`,
"id" -> response.id,
Expand Down
2 changes: 1 addition & 1 deletion apps/checker/app/model/MatcherResponse.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ case class MatcherResponse(
}

object MatcherResponse {
implicit val writes = new Writes[MatcherResponse] {
implicit val writes: Writes[MatcherResponse] = new Writes[MatcherResponse] {
def writes(response: MatcherResponse) = Json.obj(
"type" -> response.`type`,
"categoryIds" -> response.categoryIds,
Expand Down
2 changes: 1 addition & 1 deletion apps/checker/app/model/MatcherWorkComplete.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ case class MatcherWorkComplete() {
}

object MatcherWorkComplete {
implicit val writes = new Writes[MatcherWorkComplete] {
implicit val writes: Writes[MatcherWorkComplete] = new Writes[MatcherWorkComplete] {
def writes(model: MatcherWorkComplete) = Json.obj(
"type" -> model.`type`
)
Expand Down
7 changes: 3 additions & 4 deletions apps/checker/test/scala/services/MatcherPoolTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@ import org.scalatest.matchers.should.Matchers
import com.softwaremill.diffx.scalatest.DiffShouldMatcher._
import com.softwaremill.diffx.generic.auto._

import scala.concurrent.{ExecutionContext, Promise}
import scala.concurrent.{ExecutionContext, ExecutionContextExecutor, Future, Promise}
import scala.util.Failure
import scala.util.Success
import play.api.libs.concurrent.DefaultFutures
import utils.Matcher

import scala.concurrent.duration.FiniteDuration
import scala.concurrent.Future

/** A mock matcher to test the pool implementation. Doesn't complete work until a response is
* provided, to test queue behaviour.
Expand Down Expand Up @@ -85,8 +84,8 @@ class MockMatcherThatThrows(e: Throwable) extends Matcher {

class MatcherPoolTest extends AsyncFlatSpec with Matchers {
def timeLimit() = 1 second
private implicit val ec = ExecutionContext.global
private implicit val system = ActorSystem()
private implicit val ec: ExecutionContextExecutor = ExecutionContext.global
private implicit val system: ActorSystem = ActorSystem()

private def getResponseRule(id: Int) = RegexRule(
id = "test-rule",
Expand Down
2 changes: 1 addition & 1 deletion apps/checker/test/scala/utils/TimerTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import scala.concurrent.Await
import scala.concurrent.duration._

class TimerTest extends AnyFlatSpec with Matchers with IdiomaticMockito {
implicit val executionContext = ExecutionContext.Implicits.global
implicit val executionContext: ExecutionContext = ExecutionContext.Implicits.global

behavior of "time"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ object LTRule {
ltRule
}

implicit val patternWrites = new Writes[Pattern] {
implicit val patternWrites: Writes[Pattern] = new Writes[Pattern] {
def writes(pattern: Pattern) = JsString(pattern.toString)
}
implicit val patternReads: Reads[Pattern] = JsPath.read[String].map { regex =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ sealed trait Suggestion {

object TextSuggestion {
implicit val reads: Reads[TextSuggestion] = Json.reads[TextSuggestion]
implicit val writes = new Writes[TextSuggestion] {
implicit val writes: Writes[TextSuggestion] = new Writes[TextSuggestion] {
def writes(suggestion: TextSuggestion) = Json.obj(
"type" -> suggestion.`type`
) ++ Json.writes[TextSuggestion].writes(suggestion)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.gu.typerighter.model

import play.api.libs.json.Json
import play.api.libs.json.{Json, OWrites, Reads}

object TextRange {
implicit val reads = Json.reads[TextRange]
implicit val writes = Json.writes[TextRange]
implicit val reads: Reads[TextRange] = Json.reads[TextRange]
implicit val writes: OWrites[TextRange] = Json.writes[TextRange]
}

case class TextRange(from: Int, to: Int) {
Expand Down
4 changes: 2 additions & 2 deletions apps/rule-manager/app/service/RuleManager.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ import db.{DbRuleDraft, DbRuleLive, RuleTagDraft, RuleTagLive}
import db.DbRuleDraft.autoSession
import model.{LTRuleCoreForm, LTRuleXMLForm, RegexRuleForm}
import play.api.data.FormError
import play.api.libs.json.Json
import play.api.libs.json.{Json, OWrites}
import scalikejdbc.DBSession

object AllRuleData {
implicit val writes = Json.writes[AllRuleData]
implicit val writes: OWrites[AllRuleData] = Json.writes[AllRuleData]
}

/* All the data associated with a rule, including the current draft rule, the active
Expand Down
2 changes: 1 addition & 1 deletion apps/rule-manager/test/db/DBTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import play.api.db.Databases
import play.api.db.evolutions.{Evolutions, InconsistentDatabase}

trait DBTest extends BeforeAndAfter { self: Suite =>
private implicit val loader = ConfigLoader.stringLoader
private implicit val loader: ConfigLoader[String] = ConfigLoader.stringLoader
private val config = Configuration.load(Environment.simple(), Map.empty)

private val url = config.get("db.default.url")
Expand Down
4 changes: 2 additions & 2 deletions apps/rule-manager/test/service/RuleTestingSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ import play.core.server.Server
import play.api.test._

import scala.concurrent.duration.DurationInt
import scala.concurrent.{Await, ExecutionContext, Future}
import scala.concurrent.{Await, ExecutionContext, ExecutionContextExecutor, Future}

class RuleTestingSpec extends AnyFlatSpec with Matchers with IdiomaticMockito {
val as: ActorSystem = ActorSystem()
implicit val materializer: Materializer = Materializer(as)
private implicit val ec = ExecutionContext.global
private implicit val ec: ExecutionContextExecutor = ExecutionContext.global

/** Mock responses from our CAPI client and checker service when parsing responses.
*
Expand Down
5 changes: 2 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import sys.process._

name := "typerighter"
ThisBuild / organization := "com.gu"
ThisBuild / scalaVersion := "2.13.7"
ThisBuild / scalaVersion := "2.13.11"
ThisBuild / version := "1.0-SNAPSHOT"
ThisBuild / scalacOptions := Seq(
"-encoding",
"UTF-8",
"-target:jvm-1.8",
"-release:11",
"-deprecation",
"-Xfatal-warnings",
"-Xlint:unused",
Expand Down Expand Up @@ -104,7 +104,6 @@ def playProject(label: String, projectName: String, domainPrefix: String, devHtt
"-J-XX:InitialRAMFraction=2",
"-J-XX:MaxMetaspaceSize=300m",
"-J-XX:+PrintGCDetails",
"-J-XX:+PrintGCDateStamps",
s"-J-Dlogs.home=/var/log/${packageName.value}",
s"-J-Xloggc:/var/log/${packageName.value}/gc.log"
),
Expand Down
4 changes: 2 additions & 2 deletions riff-raff.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ deployments:
prependStackToCloudFormationStackName: false
amiParametersToTags:
AMITyperighterchecker:
Recipe: editorial-tools-focal-java8-ngrams-ARM-cdk-base
Recipe: editorial-tools-focal-java11-ngrams-ARM-cdk-base
BuiltBy: amigo
AMITyperighterrulemanager:
Recipe: editorial-tools-focal-java8-ngrams-ARM-cdk-base
Recipe: editorial-tools-focal-java11-ARM-WITH-cdk-base
BuiltBy: amigo
amiEncrypted: true
templateStagePaths:
Expand Down
Loading