zacharymorn commented on pull request #2052:
URL: https://github.com/apache/lucene-solr/pull/2052#issuecomment-748427066


   Wow thanks everyone for the great suggestions and ideas! Really appreciate 
them! Didn't quite anticipate we would go so deep into looking at java compiler 
when picking up this issue LOL!
   
   I pushed a commit that went with the recommended class / enum lookup 
approach, and it is working with JDK 12 (Yay!). I did not use final static 
constant for the flag though as it can only be initialized statically (I 
think), and thus we can't throw checked IOException if the class or the enum is 
not available (or has to wrap it inside `ExceptionInInitializerError`). Could 
you please take a look and let me know if there's any concern?
   
   ----
   
   >  IMHO, instead of adding @SuppressWarnings, you should also review the 
Gradle config, if there are some -Xlintoptions enabled that cause this.
   
   I tried this with the vanilla program and plain javac command, and it seems 
like without any -Xlint options the warning message will still be emitted if 
there's a different version passed into "--release" flag
   
   ```
   % export 
JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-12.jdk/Contents/Home
   % javac --version
   javac 12.0.2
   % javac src/com/company/Main.java --release 11                               
         
   src/com/company/Main.java:19: warning: ExtendedOpenOption is internal 
proprietary API and may be removed in a future release
                                                   StandardOpenOption.READ, 
com.sun.nio.file.ExtendedOpenOption.DIRECT);
                                                                                
            ^
   1 warning
   % export 
JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home
   % javac --version
   javac 11.0.9
   % javac src/com/company/Main.java --release 11  
   ```
   
   > You can try to ask on JDK's compiler-dev mailing list
   > I can only recommend to call out to OpenJDK mailing list, how to disable 
the warning. 
   
   I'm also thinking whether I should just create a Jira ticket for them, so 
that I can include it in the java doc for this change for future reference? 
   
   > Sources for the JDK are also available - I sometimes hack and recompile a 
custom distro and this proves the simplest of all solutions (even if it seems 
daunting at first).
   
   It does sound daunting! :D  I'm interested in knowing how / where this is 
emitted in JDK source though also so will find time to check it out!
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to