I'm writing a general purpose library (let's say junit or spring). I don't use any features of newer java versions. i want to put my library in maven central.
my question is: what -target
should i chose during compilation? if i chose 1.2 then everyone will be able to use my library, however i'm not sure if i loose some performance when running on recent jvm. what are best practises in such cases? i want to avoid deploying many versions in maven central, each for specific jvm
I think it should be fine to use the minimum Java version you need to compile your classes. So if your code compiles with Java 1.2 (which means you don't use any generics, enums, automatic resource management etc.) then feel free to compile it with Java 1.2.
I don't think there are huge performance blockers, altough newer javac versions might optimize code a bit better.