File tree Expand file tree Collapse file tree 3 files changed +8
-11
lines changed
main/groovy/org/apache/tinkerpop/gremlin/console
test/groovy/org/apache/tinkerpop/gremlin/console Expand file tree Collapse file tree 3 files changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -25,10 +25,8 @@ import org.apache.groovy.groovysh.ParseCode
25
25
import org.apache.groovy.groovysh.Parser
26
26
import org.apache.groovy.groovysh.Parsing
27
27
import org.apache.groovy.groovysh.util.CommandArgumentParser
28
- import org.apache.groovy.groovysh.util.ScriptVariableAnalyzer
29
28
import org.apache.tinkerpop.gremlin.console.commands.GremlinSetCommand
30
29
import org.codehaus.groovy.control.CompilerConfiguration
31
- import org.codehaus.groovy.control.MultipleCompilationErrorsException
32
30
import org.codehaus.groovy.control.customizers.ASTTransformationCustomizer
33
31
import org.codehaus.groovy.tools.shell.IO
34
32
@@ -43,7 +41,7 @@ class GremlinGroovysh extends Groovysh {
43
41
private final static CompilerConfiguration compilerConfig = new CompilerConfiguration (CompilerConfiguration . DEFAULT ) {{
44
42
addCompilationCustomizers(new ASTTransformationCustomizer (ThreadInterrupt . class))
45
43
}}
46
- private Parsing remoteParser = new RemoteParser ()
44
+ private Parsing remoteParser = new LocalSafeParser ()
47
45
48
46
public GremlinGroovysh (final Mediator mediator , final IO io ) {
49
47
super (io, compilerConfig)
Original file line number Diff line number Diff line change @@ -31,13 +31,13 @@ import org.codehaus.groovy.control.messages.SyntaxErrorMessage
31
31
* the Groovy compiler to try to compile the script and analyzes any compilation errors to determine if the script is
32
32
* incomplete. It does not evaluate the script, which prevents local execution and potential local failure.
33
33
*/
34
- class RemoteParser implements Parsing {
34
+ class LocalSafeParser implements Parsing {
35
35
36
36
// Try to compile the script
37
- def config = new CompilerConfiguration ()
37
+ private final CompilerConfiguration config = new CompilerConfiguration ()
38
38
39
39
// Create a custom GroovyClassLoader that doesn't write class files
40
- def gcl = new GroovyClassLoader (this . class. classLoader, config) {
40
+ private final GroovyClassLoader gcl = new GroovyClassLoader (this . class. classLoader, config) {
41
41
@Override
42
42
public Class defineClass (String name , byte [] bytes ) {
43
43
// Skip writing to disk, just define the class in memory
Original file line number Diff line number Diff line change @@ -25,18 +25,17 @@ import org.junit.Test
25
25
26
26
import static org.junit.Assert.assertEquals
27
27
import static org.junit.Assert.assertNotNull
28
- import static org.junit.Assert.assertTrue
29
28
30
29
/**
31
- * Unit tests for {@link RemoteParser }.
30
+ * Unit tests for {@link LocalSafeParser }.
32
31
*/
33
- class RemoteParserTest {
32
+ class LocalSafeParserTest {
34
33
35
- private RemoteParser parser
34
+ private LocalSafeParser parser
36
35
37
36
@Before
38
37
void setUp () {
39
- parser = new RemoteParser ()
38
+ parser = new LocalSafeParser ()
40
39
}
41
40
42
41
@Test
You can’t perform that action at this time.
0 commit comments