I suspect you are not using the version you think you are using at compile
time, this error message suggests that you are actually compiling with Java
9. See this email thread which has a bit more information about this issue:
http://mail-archives.apache.org/mod_mbox/lucene-dev/201503.mbox/%3C07c40
Hi,
I clone lucene 4.10.4 tag from github and use ant to build.
My ant and local jdk in mac info:
*Apache Ant(TM) version 1.9.9 compiled on February 2 2017*
*Trying the default build file: build.xml*
*Buildfile: /Users/yozhao/src/lucene-solr/lucene/core/build.xml*
*Detected Java version: 1.7 in: