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

Improve debugging support for annotation processors #575

Merged
merged 1 commit into from
Aug 23, 2024

Conversation

basil
Copy link
Member

@basil basil commented Aug 22, 2024

While recently attempting to debug an annotation processor, I found that all notices were being discarded, apparently due to an IntelliJ issue from 13 years ago that appears to have been resolved since then. This PR re-enables logging of notices and adapts the tests to expect them.

Testing done

mvn clean verify

Comment on lines +72 to +74
String name = t.getQualifiedName().toString().replace('.', '/') + "/" + m.getSimpleName() + ".stapler";
FileObject f = createResource(name);
notice("Generating " + name, m);
Copy link
Member Author

Choose a reason for hiding this comment

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

This was logging an object without a toString() method, which made it impossible to expect a specific value in the tests because the default Object#toString prints a memory address. By printing the name instead, we have a reliable thing to check for in tests, as well as prettier debug output.

@basil basil merged commit 8170998 into jenkinsci:master Aug 23, 2024
13 checks passed
@daniel-beck
Copy link
Member

daniel-beck commented Aug 30, 2024

Annotations in core PR diffs are quite noisy now due to what I suspect is a bug in analysis-model, I filed JENKINS-73709.

@basil basil deleted the debug branch August 30, 2024 22:11
@basil
Copy link
Member Author

basil commented Aug 30, 2024

I see. That is annoying indeed. We could always turn this logging back down (though the test cleanup I did could be retained), but I think it is preferable to roll forward and deal with any downstream issues to the degree it is practical. Otherwise, the next person to try to debug these annotation processors will be in the same undesirable position of getting no debug output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants