lundi 15 juin 2020

IntelliJ/JDK 11: Cannot find symbol name() interface java.lang.annotation.Annotation

I have this simple code:

String tableName = MyEntity.class.getAnnotation( javax.persistence.Table.class ).name();

But IntelliJ underlines the fact that the method name() does not exist Cannot resolve method "name()".

I also get this error during the compilation:

Error:(29, 68) java: cannot find symbol
  symbol:   method name()
  location: interface java.lang.annotation.Annotation

I saw many example codes using this method, an example here: https://stackoverflow.com/a/1320890/6643803 What am I missing?

Thanks





Aucun commentaire:

Enregistrer un commentaire