ktor-http-api-sample icon indicating copy to clipboard operation
ktor-http-api-sample copied to clipboard

IDEA reports an error

Open ghost opened this issue 5 years ago • 1 comments

When I am copying CustomerRoutes.kt:

       delete("{id}") {
            val id = call.parameters["id"] ?: return@delete call.respond(HttpStatusCode.BadRequest)
            if (customerStorage.removeIf  ({ it.id == id }) {
                             //‘removeIf' unresolved;‘it.id' unresolved
                call.respondText("Customer removed correctly", status = HttpStatusCode.Accepted)
            } else {
                call.respondText("Not Found", status = HttpStatusCode.NotFound)
            }
        }

into my project my IDE reports an error said: Unresolved reference: removeIf Unresolved reference: id

Could you tell me how to fix? JDK 11.0.7 JRE 1.8.1u251 IntelliJ IDEA Community Edition 2019.2.4 No Ktor plugins installed

ghost avatar May 27 '20 09:05 ghost

Go to File > Project Structure and make sure the JDK you are using is well configured. The procedure in the link helped me to solve also the issue you reported: https://discuss.kotlinlang.org/t/cannot-access-java-io-serializable-which-is-a-supertype-of/16595/4

antosport82 avatar Apr 06 '21 13:04 antosport82