Skip to content

πŸ› οΈ Fix: Handle Deprecated Constructors & Improve Logging in DeprecatedHandler#2

Open
Manas-Dikshit wants to merge 2 commits intodubbo:mainfrom
Manas-Dikshit:main
Open

πŸ› οΈ Fix: Handle Deprecated Constructors & Improve Logging in DeprecatedHandler#2
Manas-Dikshit wants to merge 2 commits intodubbo:mainfrom
Manas-Dikshit:main

Conversation

@Manas-Dikshit
Copy link
Copy Markdown

This PR fixes an issue in DeprecatedHandler where deprecated constructors were not being processed. Additionally, it enhances the functionality by improving logging, tracking method usage, and adding compile-time warnings.

πŸ”§ Fixes & Enhancements:
βœ… Handles Deprecated Constructors: Previously, only deprecated methods were tracked. Now, constructors are also processed.
βœ… Adds SLF4J Logging: A Logger is injected to warn whenever a deprecated method/constructor is invoked.
βœ… Includes Stack Trace Logging: Helps trace where deprecated methods/constructors are being used.
βœ… Generates Compiler Warnings: Shows a @deprecated warning at compile time when such methods/constructors are processed.
βœ… Ensures Proper AST Modification: Uses TreeTranslator to inject logging and tracking statements at method/constructor entry.

πŸ” Changes in Code:
Updated process() to detect both methods and constructors.
Added logger initialization and a logger.warn() statement to print a warning when a deprecated method is called.
Injected DeprecatedMethodInvocationCounter.onDeprecatedMethodCalled() to track method usage.
Added apContext.getMessager().printMessage() to generate compile-time warnings.
πŸš€ Next Steps:
Review the changes and verify logging behavior.
Run unit tests to ensure both methods and constructors are handled correctly.
Merge the PR to enhance deprecated method tracking in Apache Dubbo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant