Skip to content

Commit 4d20a24

Browse files
committed
Addressed feedback on PR
1 parent 185be42 commit 4d20a24

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/GremlinGroovysh.groovy

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,8 @@ import org.apache.groovy.groovysh.ParseCode
2525
import org.apache.groovy.groovysh.Parser
2626
import org.apache.groovy.groovysh.Parsing
2727
import org.apache.groovy.groovysh.util.CommandArgumentParser
28-
import org.apache.groovy.groovysh.util.ScriptVariableAnalyzer
2928
import org.apache.tinkerpop.gremlin.console.commands.GremlinSetCommand
3029
import org.codehaus.groovy.control.CompilerConfiguration
31-
import org.codehaus.groovy.control.MultipleCompilationErrorsException
3230
import org.codehaus.groovy.control.customizers.ASTTransformationCustomizer
3331
import org.codehaus.groovy.tools.shell.IO
3432

@@ -43,7 +41,7 @@ class GremlinGroovysh extends Groovysh {
4341
private final static CompilerConfiguration compilerConfig = new CompilerConfiguration(CompilerConfiguration.DEFAULT) {{
4442
addCompilationCustomizers(new ASTTransformationCustomizer(ThreadInterrupt.class))
4543
}}
46-
private Parsing remoteParser = new RemoteParser()
44+
private Parsing remoteParser = new LocalSafeParser()
4745

4846
public GremlinGroovysh(final Mediator mediator, final IO io) {
4947
super(io, compilerConfig)

gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/RemoteParser.groovy renamed to gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/LocalSafeParser.groovy

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ import org.codehaus.groovy.control.messages.SyntaxErrorMessage
3131
* the Groovy compiler to try to compile the script and analyzes any compilation errors to determine if the script is
3232
* incomplete. It does not evaluate the script, which prevents local execution and potential local failure.
3333
*/
34-
class RemoteParser implements Parsing {
34+
class LocalSafeParser implements Parsing {
3535

3636
// Try to compile the script
37-
def config = new CompilerConfiguration()
37+
private final CompilerConfiguration config = new CompilerConfiguration()
3838

3939
// 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) {
4141
@Override
4242
public Class defineClass(String name, byte[] bytes) {
4343
// Skip writing to disk, just define the class in memory

gremlin-console/src/test/groovy/org/apache/tinkerpop/gremlin/console/RemoteParserTest.groovy renamed to gremlin-console/src/test/groovy/org/apache/tinkerpop/gremlin/console/LocalSafeParserTest.groovy

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,17 @@ import org.junit.Test
2525

2626
import static org.junit.Assert.assertEquals
2727
import static org.junit.Assert.assertNotNull
28-
import static org.junit.Assert.assertTrue
2928

3029
/**
31-
* Unit tests for {@link RemoteParser}.
30+
* Unit tests for {@link LocalSafeParser}.
3231
*/
33-
class RemoteParserTest {
32+
class LocalSafeParserTest {
3433

35-
private RemoteParser parser
34+
private LocalSafeParser parser
3635

3736
@Before
3837
void setUp() {
39-
parser = new RemoteParser()
38+
parser = new LocalSafeParser()
4039
}
4140

4241
@Test

0 commit comments

Comments
 (0)