Java 1.5 gets attributes

Something that is new in 1.5, and could potentially be very cool is its support for metadata, which (based on a brief scan) looks a lot like .Net attributes, and possibly even more powerful. The java site has this to say:

Metadata

This language feature lets you avoid writing boilerplate code under many circumstances by enabling tools to generate it from annotations in the source code. This leads to a “declarative” programming style where the programmer says what should be done and tools emit the code to do it. Also it eliminates the need for maintaining “side files” that must be kept up to date with changes in source files. Instead the information can be maintained in the source file.
Refer to JSR 175.

Annotations are also used to implement the ‘override’ functionality of .Net, as this snippet from the JSR states:

This annotation type allows the programmer to declare his belief that a method
declaration overrides a superclass method:

@Overrides public boolean equals(Foo that) { … }

The compiler checks whether method actually overrides a superclass method,
and reports an error if it does not, nipping the problem in the bud.