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

BUPH-21 | add more Annotation Processor documentation #32

Merged
merged 9 commits into from
Dec 9, 2019

Conversation

jpmarcotte
Copy link
Contributor

Also adding @jakemalachowski for some external feedback since he's used them before.

jakemalachowski
jakemalachowski approved these changes Nov 20, 2019
Copy link

@jakemalachowski jakemalachowski left a comment

Choose a reason for hiding this comment

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

Looks good! Just one clarification suggestion.

```
- `AnnotationProcessorKey`: Also used in the fabrication file to tie the annotation to the specific AP.
- `Default Contents`: If no AnnotationProcessor is specified in the fabrication file, this is used instead
- There MUST be a newline between the `AnnotationProcessorKey` and `Default Contents`

Choose a reason for hiding this comment

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

It may be worth being more explicit here that if there are no Default Contents, the end of comment identifier (*/) must still be on a new line.
Eg:
Correct:

/** @neighborhoods-buphalo:annotation-processor Builder.setters
*/

Incorrect:

/** @neighborhoods-buphalo:annotation-processor Builder.setters */

While this line technically covers this case, (as I mentioned in my rescinded approval) I have lost an afternoon to this problem because the incorrect example works with one AP in a template, but once you add a second AP, things break.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought that was the case, but I just tested it and got it to work if I didn't include Default Contents. It may have been fixed since then?

    public const TEST_STRING = "/** @neighborhoods-buphalo:annotation-processor TestSimpleStringAnnotationProcessor */";

plus

      TestSimpleStringAnnotationProcessor:
        processor_fqcn: \Neighborhoods\Buphalo\V1\AnnotationProcessors\SimpleString
        static_context_record:
          string: 'this is a string'

produced

    public const TEST_STRING = "this is a string";

Choose a reason for hiding this comment

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

The problem actually comes up when you have more than 1 annotation processor in a file. Assuming Buphalo uses that same regex matching as Bradfab, I believe the below example will break. The first AP will replace everything from the first /** after TEST_STRING = " to the last */ after ThisWillProbablyDisappearToo.

    public const TEST_STRING = "/** @neighborhoods-buphalo:annotation-processor TestSimpleStringAnnotationProcessor */";

// This will probably disappear

/** @neighborhoods-buphalo:annotation-processor ThisWillProbablyDisappearToo */

Copy link
Contributor Author

Choose a reason for hiding this comment

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

because the incorrect example works with one AP in a template, but once you add a second AP, things break.

Huh, just re-read this, and that's very interesting. I'll see if I can replicate with some tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, @jakemalachowski

I've been able to validate this with tests. Created BUPH-92 | Single-Line Annotation Tags Don't Work Well With Others and #38 for us to address.

@jpmarcotte jpmarcotte merged commit a1a0cd8 into master Dec 9, 2019
@jpmarcotte jpmarcotte deleted the BUPH-21-ap-docs branch December 9, 2019 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants