fix OptimizeImportsHelper NPE in java stubs with DynamicReferences