Skip to content

Remove deprecated Attributes.getFirst/getFirstAttribute (since Akka 2.5.7)#3291

Open
He-Pin wants to merge 1 commit into
apache:mainfrom
He-Pin:remove/deprecated-attributes-getFirst
Open

Remove deprecated Attributes.getFirst/getFirstAttribute (since Akka 2.5.7)#3291
He-Pin wants to merge 1 commit into
apache:mainfrom
He-Pin:remove/deprecated-attributes-getFirst

Conversation

@He-Pin

@He-Pin He-Pin commented Jul 4, 2026

Copy link
Copy Markdown
Member

Motivation

Attributes.getFirst and getFirstAttribute were deprecated since Akka 2.5.7. The replacement API is get and getAttribute.

Modification

Removed the following deprecated methods from Attributes:

  • getFirstAttribute(Class, default) - deprecated since Akka 2.5.7
  • getFirstAttribute(Class) - deprecated since Akka 2.5.7
  • getFirst[T](default) - deprecated since Akka 2.5.7
  • getFirst[T] - deprecated since Akka 2.5.7

Updated test files to use get instead of getFirst:

  • AttributesSpec.scala: removed getFirst assertions
  • SinkSpec.scala: changed getFirst to get, removed tests exclusively testing getFirst
  • BidiFlowSpec.scala: changed getFirst to get
  • GraphDSLCompileSpec.scala: changed getFirst to get
  • AttributesTest.java: removed test methods for getFirstAttribute

Result

Deprecated API removed. Users should use get and getAttribute instead.

Tests

Tests updated to use the replacement API.

@pjfanning

pjfanning commented Jul 4, 2026

Copy link
Copy Markdown
Member

This method is used - apache/pekko-http#470

@He-Pin He-Pin force-pushed the remove/deprecated-attributes-getFirst branch from cffd44d to 875d740 Compare July 5, 2026 06:13
@He-Pin He-Pin marked this pull request as ready for review July 5, 2026 07:57
@He-Pin He-Pin requested a review from pjfanning July 5, 2026 07:58
@He-Pin He-Pin added this to the 2.0.0-M4 milestone Jul 5, 2026
@He-Pin He-Pin added the t:stream Pekko Streams label Jul 5, 2026
…nce Akka 2.5.7)

Motivation:
The getFirst and getFirstAttribute methods were deprecated since Akka 2.5.7
because attributes should always be accessed using the most-specific getter
(get/getAttribute), not the least-specific getter.

Modification:
Remove the four deprecated methods: getFirstAttribute(Class, default),
getFirstAttribute(Class), getFirst[T](default), getFirst[T]. Update tests
to use the non-deprecated get/getAttribute methods. Remove tests that
specifically tested getFirst behavior.

Result:
Only the most-specific attribute accessors (get/getAttribute) remain.

Tests:
Not run - deprecated API cleanup with test updates

References:
None - deprecated API cleanup
@He-Pin He-Pin force-pushed the remove/deprecated-attributes-getFirst branch from 875d740 to 953de25 Compare July 6, 2026 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t:stream Pekko Streams

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants