-
Notifications
You must be signed in to change notification settings - Fork 298
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
NPE demonstration #19
Conversation
Maybe not 'directly' 😉 , but actually the NPE is from the test setup.
the set of classes to analyze is still all classes not annotated with
The difference applies, when the condition on those classes is evaluated. The test you were patching, is simply supposed to check this filtering, thus it's not the right place to look for differences between Maybe you can elaborate, what you're trying to do in your real life architecture test, to see why it behaves unexpected in your case? |
…an be ignored. Remove @Allow from Okay.java and the violation will be reported (likewise, add it to Bad.java and the test will pass). Note that annotations may not be @retention(SOURCE) to be picked up.
From what I read on the linked issue, you're trying to ignore some known violations by annotating classes that may violate the rule? I've added a simple demo here: |
- switch to Java8 - newline at EOF
Thank you for 7a7e3d5. It shows my usecase. However, when executing it in my case, I get
The class HtmlToUnicodeFormatter is annotated with the annotation allowing to access the evil class: JabRef/jabref@cd5a87c#diff-65cb57dfbc237c0545ddfe947ed5a12c I have no clue, why the minimal example works, but in a larger setting, it does not.
21:03:31.692 [main] INFO com.tngtech.archunit.core.importer.JavaClassProcessor - Analysing class 'org/jabref/logic/formatter/bibtexfields/HtmlToUnicodeFormatter'
21:03:31.692 [main] INFO com.tngtech.archunit.core.importer.JavaClassProcessor - Analysing class 'org/jabref/logic/formatter/bibtexfields/HtmlToUnicodeFormatter'
21:03:31.692 [main] DEBUG com.tngtech.archunit.core.importer.JavaClassProcessor - Found interfaces [org.jabref.logic.layout.LayoutFormatter, org.jabref.model.cleanup.Formatter] on class 'org/jabref/logic/formatter/bibtexfields/HtmlToUnicodeFormatter'
21:03:31.692 [main] DEBUG com.tngtech.archunit.core.importer.JavaClassProcessor - Found interfaces [org.jabref.logic.layout.LayoutFormatter, org.jabref.model.cleanup.Formatter] on class 'org/jabref/logic/formatter/bibtexfields/HtmlToUnicodeFormatter'
21:03:31.692 [main] DEBUG com.tngtech.archunit.core.importer.JavaClassProcessor - Found superclass com.tngtech.archunit.base.Optional$Present@3f6979b2 on class 'org/jabref/logic/formatter/bibtexfields/HtmlToUnicodeFormatter'
21:03:31.692 [main] DEBUG com.tngtech.archunit.core.importer.JavaClassProcessor - Found superclass com.tngtech.archunit.base.Optional$Present@3f6979b2 on class 'org/jabref/logic/formatter/bibtexfields/HtmlToUnicodeFormatter'
I added some debug output concerning the annotations at 6ca5a8a, but currently not used in my project. |
I think it's what I tried to point out in the last part of the commit message of my simple POC. ArchUnit analyses bytecode, but your annotation has
You need at least |
I totally overlooked that. 😞 Thank you for your patience and time 👍 Now everything works. |
No problem, glad you got it working 😄 Let me know if you run into any further problems!! |
I wanted to check the behavior of `noClasses: All classes having an annotation should be the same as no classes with not that annotation. But that test case simply throws an NPE. I don't know the reason for it. Maybe @codecholeric sees it directly.