Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Java Annotations Writing Your Own Annotation Adding Annotation Targets and Elements

Code like in the video not working in the challenge..

If you look at time index 04:01 of this video:

https://teamtreehouse.com/library/java-annotations/writing-your-own-annotation/finishing-the-annotation-targets-and-elements

..you see (what I think) was the code they were going for.


Here's the bad thing about this course (in general):

1.) There is NO TeamTreehouse Workspace for this course 2.) There is NO video transcript .srt files for the video 3.) The zip downloads are "chunk-ified" (split up and not as a single zip download for the course that has separate sub-folders for the different sections of the course).


So the zip you want ("Java Annotations S2V5.zip") is attached to this "Intro to Reflection" course page:

https://teamtreehouse.com/library/java-annotations/writing-your-own-annotation/introduction-to-reflection


The file inside the zip that you need is at path:

/src/com/teamtreehouse/docgen/doc.java

This will save some re-typing (copy/paste is your friend) to get

these three lines for task 1 of 2 of the challenge:

import java.lang.annotation.Target;

import java.lang.annotation.ElementType;

@Target({ElementType.TYPE,ElementType.METHOD})

However task 2 of 2 doesn't use directly use the lines from the video (or it's zipped code).

.

It took me hours of trial and error before I realized that the 'params()' wasn't needed:

  String username() default "";
  String[] hashtags() default {};

Hopefully this will save some people a lot of time if they get stuck...