1

in Java, I want to know if there is a way to get the jdk version where a class have been added, I want a function that outputs "14" when I put in argument the RecordComponent class (java.lang.reflect.RecordComponent).
ArrayList outputs "7" etc

Is there a way to make something like this ?

1 Answer 1

1

The information is stored in the @since tag in the javadoc of the class.

To get this information for a specific class you could use the package jdk.javadoc.doclet

2
  • Okay but I have to do this in runtime, not with a command in a terminal, is there a way to do this so ?
    – Ayfri
    Commented May 12, 2020 at 6:56
  • As explained in: stackoverflow.com/a/15312267/5948314 The class does not contain comments. This makes it very difficult to acces them runtime. The easiest solution is probably to scrape the javadoc
    – scramados
    Commented May 12, 2020 at 8:11

Not the answer you're looking for? Browse other questions tagged or ask your own question.