uschindler commented on pull request #2052: URL: https://github.com/apache/lucene-solr/pull/2052#issuecomment-748465633
Hi, I implemented the approach and also cleaned up the lookup code to not require unchecked casts. I also made the code safer for exceptions, you only catched ClassNotFound, but actually there can more go wrong! - Cast the class after forName() to OpenOption. Then the stream knows what everything is and we can bail out soon. - catch all Exceptions, as there can happy many: ClassNotFound, ClassCast (if it's not an OpenOption), NullPointerException (if it's not an enum). In static initializers we should not risk any of this. It's just not supported if ANYTHING goes wrong. - BASTA 👍 I also added an assume to the test, so it won't run without that open option. I also changed the Exception to UnsupportedOperationException, as this is what the Javadocs say in the class description. This is also in line with "operating system does not support it" behaviour of JDK, which throws UOE in the open method. There's one TODO: If we change to Java module system, we may need to add an import to the unsupported module. ---------------------------------------------------------------- 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