Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🛠️ Fix: Handle Deprecated Constructors & Improve Logging in DeprecatedHandler #2

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Manas-Dikshit
Copy link

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