Skip to content

Fix ConfigurationBuilder addClassLoaders#288

Merged
ronmamo merged 2 commits intoronmamo:release/0913from
dariocutillas:dcut_fix_ConfigurationBuilder
Apr 26, 2020
Merged

Fix ConfigurationBuilder addClassLoaders#288
ronmamo merged 2 commits intoronmamo:release/0913from
dariocutillas:dcut_fix_ConfigurationBuilder

Conversation

@dariocutillas
Copy link
Copy Markdown
Contributor

The addClassLoaders(ClassLoader ... classloaders) was trying to concatenate ClassLoader.class to the stream of classloaders, and the toArray() method would fail given that ClassLoader.class is not of type ClassLoader.

Notice that I could not understand why there is interest in adding the ClassLoader.class so my solution was to remove it.

If what we are seeking is that the class loader of the ClassLoader is to be added, then probably we are missing a ClassLoader.class.getClassLoader(). But doing so would be inconsistent as the following would not produce same output:

ConfigurationBuilder configurationBuilder = new ConfigurationBuilder().addClassLoader( foo ).addClassLoader( bar );
ConfigurationBuilder configurationBuilder = new ConfigurationBuilder().addClassLoader( foo, bar );

In the second case, the ClassLoader.class would be ignored, because the ClassLoader[] classLoaders field of the ConfigurationBuilder is null and then classLoaders would simply match the passed { foo, bar } array.

@ronmamo ronmamo changed the base branch from master to release/0913 April 26, 2020 14:18
@ronmamo ronmamo merged commit 81eb4a3 into ronmamo:release/0913 Apr 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants