apache / apache/pekko-http

Usage of implicit method attributeKey defined in object JavaMapping, which is not accessible here

Open
#1,056 1 comment 2 reactions 0 assignees View on GitHub
Dominant language
Scala
Stars
196
Forks
55
Avg merge
4d 52m
Merged PRs (30d)
74

Description

## Steps

### build.sbt

```scala
scalaVersion := "3.8.4"

val pekkoVersion = "2.0.0-M3"

libraryDependencies ++= Seq(
"org.apache.pekko" %% "pekko-actor-typed" % pekkoVersion,
"org.apache.pekko" %% "pekko-stream" % pekkoVersion,
"org.apache.pekko" %% "pekko-http" % "2.0.0-M1"
)

scalacOptions += "-deprecation"
```

### project/build.properties

```properties
sbt.version=1.12.11
```

### A.scala

```scala
import org.apache.pekko.http.scaladsl.model.HttpRequest
import org.apache.pekko.http.scaladsl.model.AttributeKeys

class A {
def b(request: HttpRequest) = request.attribute(AttributeKeys.remoteAddress)
}
```

## Problem

```
[warn] 5 | def b(request: HttpRequest) = request.attribute(AttributeKeys.remoteAddress)
[warn] | ^
[warn] |Usage of implicit method attributeKey defined in object JavaMapping, which is not accessible here. In Scala 3.10, this implicit will no longer be found.
```

## Note

- https://github.com/scala/scala3/pull/25608
- https://github.com/scala/scala3/pull/25516

Contributor guide

Open the contributing guide

Research direction

Reproduce the warning with the build.sbt, project/build.properties, and A.scala example, starting at AttributeKeys.remoteAddress and request.attribute. Trace the implicit attributeKey lookup and the JavaMapping visibility involved, using the linked Scala 3 changes for context. Done means the example compiles without this deprecation warning under the stated Scala version.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.