Skip to content

Add is annotation to JavaClass and fluent API #468

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

Merged
merged 3 commits into from
Nov 8, 2020

Conversation

codecholeric
Copy link
Collaborator

The bytecode provides the opcode ACC_ANNOTATION which denotes those classes that are annotations (e.g. the annotation type of @Deprecated). Same as for the Java Reflection API (which offers Class.isAnnotation()) we should provide this information through JavaClass.
Furthermore we should expose this information through the fluent API to allow easy creation of ArchRules about annotation types.

Since I always have a hard time to identify which tests really have failed on the console (either Gradle just reports something like '3 tests failed' without any details, or it prints out so many details that the test results get lost) I have added some quick hack to print out some sort of test failure report in the end. It is not integrated in a very sophisticated way, but I consider it good enough at the moment, since the reporting might change with future Gradle versions again anyway and the logic responsible for collecting and printing the report at least is contained in one isolated place.

Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
The bytecode provides the opcode `ACC_ANNOTATION` which denotes those classes that are annotations (e.g. the annotation type of `@Deprecated`). Same as for the Java Reflection API (which offers `Class.isAnnotation()`) we should provide this information through `JavaClass`.

Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
To be consistent with `isEnum` we should also provide `that` and `should` syntax elements for `isAnnotation` in the fluent API to allow easily specifying rules about annotation types.

Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
@codecholeric codecholeric force-pushed the add-isAnnotation-to-JavaClass-and-fluent-API branch from f5cc6b5 to dafafab Compare November 8, 2020 16:45
@codecholeric codecholeric merged commit 75da25f into master Nov 8, 2020
@codecholeric codecholeric deleted the add-isAnnotation-to-JavaClass-and-fluent-API branch November 8, 2020 17:44
codecholeric added a commit that referenced this pull request Feb 21, 2021
The bytecode provides the opcode `ACC_ANNOTATION` which denotes those classes that are annotations (e.g. the annotation type of `@Deprecated`). Same as for the Java Reflection API (which offers `Class.isAnnotation()`) we should provide this information through `JavaClass`.
Furthermore we should expose this information through the fluent API to allow easy creation of `ArchRules` about annotation types.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant