Merge branch 'pr-1789'

This commit is contained in:
Juan Martín Sotuyo Dodero
2019-04-22 13:33:42 -03:00
2 changed files with 5 additions and 1 deletions

View File

@ -35,6 +35,8 @@ Being based on a proper Antlr grammar, CPD can:
### Fixed Issues
* all
* [#1788](https://github.com/pmd/pmd/issues/1788): \[cpd] \[core] Use better `ClassLoader` for `ServiceLoader` in `LanguageFactory`
* go
* [#1751](https://github.com/pmd/pmd/issues/1751): \[go] Parsing errors encountered with escaped backslash
* java
@ -60,6 +62,7 @@ Being based on a proper Antlr grammar, CPD can:
* [#1761](https://github.com/pmd/pmd/pull/1761): \[dart] \[cpd] Added CPD support for Dart - [Maikel Steneker](https://github.com/maikelsteneker)
* [#1776](https://github.com/pmd/pmd/pull/1776): \[java] Show more detailed message when can't resolve field type - [Andrey Fomin](https://github.com/andrey-fomin)
* [#1781](https://github.com/pmd/pmd/pull/1781): \[java] Location change in AssignmentToNonFinalStatic - [Maikel Steneker](https://github.com/maikelsteneker)
* [#1789](https://github.com/pmd/pmd/pull/1789): \[cpd] \[core] Use current classloader instead of Thread's classloader - [Andreas Schmid](https://github.com/aaschmid)
{% endtocmaker %}

View File

@ -33,7 +33,8 @@ public final class LanguageFactory {
private LanguageFactory() {
List<Language> languagesList = new ArrayList<>();
ServiceLoader<Language> languageLoader = ServiceLoader.load(Language.class);
// Use current class' classloader instead of the threads context classloader, see https://github.com/pmd/pmd/issues/1788
ServiceLoader<Language> languageLoader = ServiceLoader.load(Language.class, getClass().getClassLoader());
Iterator<Language> iterator = languageLoader.iterator();
while (iterator.hasNext()) {
try {