Closed
Description
Dave Syer opened SPR-17014 and commented
DefaultListableBeanFactory
has some nested types that are designed to protect the runtime against class not found errors when certain libraries are not on the classpath (in particular JSR330). Unfortunately, some static analysis tools cannot get past the fact that one of those inner classes implements an interface Provider
that is not available at runtime.
Here's a program that fails when javax.inject is not on the classpath:
public class Test {
public static void main(String[] args) throws Exception {
Class<?> clazz = Class.forName( "org.springframework.beans.factory.support.DefaultListableBeanFactory$DependencyObjectProvider");
System.out.println(clazz.getEnclosingClass());
}
}
It seems like a "feature" of the JDK, but I think we can easily work around it by extracting the private nested class into a package private one.
Affects: 5.0.7
Reference URL: oracle/graal#511
Issue Links:
- Initial GraalVM native images (Substrate VM) support [SPR-16991] #21529 Initial GraalVM native images (Substrate VM) support ("is depended on by")
Referenced from: commits b4fc794