Skip to content

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

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

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
@He-Pin
He-Pin force-pushed the remove/deprecated-attributes-getFirst branch 2 times, most recently from 953de25 to 1617372 Compare July 8, 2026 18:15
…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 1617372 to 2c07833 Compare July 14, 2026 04:08
@He-Pin

He-Pin commented Jul 14, 2026

Copy link
Copy Markdown
Member Author

This PR is blocked by a cross-project dependency:

I've requested @pjfanning to review pekko-http PR #470 to unblock this chain.

@pjfanning

Copy link
Copy Markdown
Member

The pekko http pr is blocked. The link above is wrong. Why is it so important to remove this API that we actually need?

@pjfanning pjfanning left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-1 from me

@He-Pin He-Pin closed this Jul 14, 2026
@He-Pin He-Pin removed this from the 2.0.0-M4 milestone Jul 14, 2026
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