Remove usage of setAccessible
#1449
Labels
bug
Something isn't working
priority:3
Neutral - not a core feature or affects less than 40% of users
v2
Version 2
Milestone
We use
java.lang.reflect.AcessibleObject#setAccessible
to reflectively access fields in both the matrics and SQS utilities. We should try and remove this, if we can.What were you trying to accomplish?
Expected Behavior
No need to reflectively access private object information in the libraries themselves. In tests this is fine.
Current Behavior
Examples:
powertools-lambda-java/powertools-metrics/src/main/java/software/amazon/cloudwatchlogs/emf/model/MetricsLoggerHelper.java
Line 36 in 4d3484f
powertools-lambda-java/powertools-sqs/src/main/java/software/amazon/lambda/powertools/sqs/SqsUtils.java
Line 619 in 4d3484f
powertools-lambda-java/powertools-metrics/src/main/java/software/amazon/lambda/powertools/metrics/internal/LambdaMetricsAspect.java
Line 56 in 4d3484f
Possible Solution
We can either 1/ find a way to avoid the need or 2/ say "this is too hard, we will remove it in V2 by changing the interface". However we should be confident that there is no way forward with the existing interface.
Steps to Reproduce (for bugs)
Environment
The text was updated successfully, but these errors were encountered: