Skip to content

Commit

Permalink
Fix for #1123: async content assist cannot load groovy.lang.GroovyObject
Browse files Browse the repository at this point in the history
evaluateExpression gets its ClassLoader from ProcessingUnit; in the
fork-join pool, the thread context loader is not good for Groovy
  • Loading branch information
eric-milles committed Jul 30, 2020
1 parent 8cb38ac commit da8a60c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,12 @@ public void setClassLoader(final GroovyClassLoader loader) {
// this method is invoked by code that does not have security permissions.
this.classLoader = loader != null ? loader : AccessController.doPrivileged(new PrivilegedAction<GroovyClassLoader>() {
public GroovyClassLoader run() {
/* GRECLIPSE edit -- async content assist cannot process DelegatesTo/ClosureParams
ClassLoader parent = Thread.currentThread().getContextClassLoader();
if (parent == null) parent = ProcessingUnit.class.getClassLoader();
*/
ClassLoader parent = this.getClass().getClassLoader();
// GRECLIPSE end
return new GroovyClassLoader(parent, getConfiguration());
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,12 @@ public void setClassLoader(final GroovyClassLoader loader) {
// this method is invoked by code that does not have security permissions.
this.classLoader = loader != null ? loader : AccessController.doPrivileged(new PrivilegedAction<GroovyClassLoader>() {
public GroovyClassLoader run() {
/* GRECLIPSE edit -- async content assist cannot process DelegatesTo/ClosureParams
ClassLoader parent = Thread.currentThread().getContextClassLoader();
if (parent == null) parent = ProcessingUnit.class.getClassLoader();
*/
ClassLoader parent = this.getClass().getClassLoader();
// GRECLIPSE end
return new GroovyClassLoader(parent, getConfiguration());
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,12 @@ public void setClassLoader(final GroovyClassLoader loader) {
// ClassLoaders should only be created inside a doPrivileged block in case
// this method is invoked by code that does not have security permissions.
this.classLoader = loader != null ? loader : AccessController.doPrivileged((PrivilegedAction<GroovyClassLoader>) () -> {
/* GRECLIPSE edit -- async content assist cannot process DelegatesTo/ClosureParams
ClassLoader parent = Thread.currentThread().getContextClassLoader();
if (parent == null) parent = ProcessingUnit.class.getClassLoader();
*/
ClassLoader parent = this.getClass().getClassLoader();
// GRECLIPSE end
return new GroovyClassLoader(parent, getConfiguration());
});
}
Expand Down

0 comments on commit da8a60c

Please sign in to comment.