Java generics in Xcode

Generics are a facility of generic programming that was added to the Java programming language in 2004 as part of J2SE 5.0. They allow “a type or method to operate on objects of various types while providing compile-time type safety.”

Well, if you start a new Java project with Apple Xcode and you try to use generics, compiler writes:

generics are not supported in -source 1.3

To solve this, you have to edit build.xml file:

Now, change source and target compatibility version like this:

source=”1.5″ target=”1.5″ 

If you want to make default changes for every next project, you need edit template file here:

/Developer/Library/Xcode/Project/Templates/Java/Java Tool/build.xml