Skip to content

Commit

Permalink
Fix for #1403: grab resets the extension module (category class) cache
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-milles committed Oct 5, 2022
1 parent 4118605 commit 83535fa
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void testGrab() {
"}\n",

"Test.groovy",
"@Grab('joda-time:joda-time:2.10.13;transitive=false')\n" +
"@Grab('joda-time:joda-time:2.11.2;transitive=false')\n" +
"import org.joda.time.DateTime\n" +
"void printDate() {\n" +
" def now = new DateTime()\n" +
Expand Down Expand Up @@ -67,7 +67,7 @@ public void testGrabError() {

"Test.groovy",
"@Grapes([\n" +
" @Grab('joda-time:joda-time:2.10.13;transitive=false'),\n" +
" @Grab('joda-time:joda-time:2.11.2;transitive=false'),\n" +
" @Grab(group='org.aspectj', module='aspectjweaver', version='1.x')\n" +
"])\n" +
"class Test {\n" +
Expand Down Expand Up @@ -107,7 +107,7 @@ public void testGrabConfig() {

"Test.groovy",
"@GrabConfig(systemClassLoader=true)\n" +
"@Grab(group='mysql', module='mysql-connector-java', version='5.1.15', transitive=false)\n" +
"@Grab(group='mysql', module='mysql-connector-java', version='5.1.49', transitive=false)\n" +
"class Test {\n" +
"}\n",
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2021 the original author or authors.
* Copyright 2009-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -347,8 +347,10 @@ private GrapeAwareGroovyClassLoader(final IProject project, final ClassLoader pa

@Override
public void addURL(final URL url) {
this.grabbed = true;
super.addURL(url);
this.grabbed = true;
this.defaultCategories = null;
this.defaultStaticCategories = null;
}

/** {@code true} if any grabbing is done */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2021 the original author or authors.
* Copyright 2009-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -277,7 +277,7 @@ final class GroovyScriptLaunchShortcutTests extends GroovyEclipseTestSuite {
void testScriptLaunch13() {
def unit = addGroovySource('''\
|@GrabConfig(systemClassLoader=true)
|@Grab('mysql:mysql-connector-java:5.1.6')
|@Grab('mysql:mysql-connector-java:5.1.49')
|def xxx
|
|println "Why won't this run?"
Expand Down

0 comments on commit 83535fa

Please sign in to comment.