Return-Path: X-Original-To: apmail-tinkerpop-commits-archive@minotaur.apache.org Delivered-To: apmail-tinkerpop-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E2CDB18235 for ; Tue, 8 Mar 2016 19:37:09 +0000 (UTC) Received: (qmail 66485 invoked by uid 500); 8 Mar 2016 19:37:09 -0000 Delivered-To: apmail-tinkerpop-commits-archive@tinkerpop.apache.org Received: (qmail 66429 invoked by uid 500); 8 Mar 2016 19:37:09 -0000 Mailing-List: contact commits-help@tinkerpop.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@tinkerpop.incubator.apache.org Delivered-To: mailing list commits@tinkerpop.incubator.apache.org Received: (qmail 66412 invoked by uid 99); 8 Mar 2016 19:37:09 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Mar 2016 19:37:09 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 65DD51806C2 for ; Tue, 8 Mar 2016 19:37:09 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -3.549 X-Spam-Level: X-Spam-Status: No, score=-3.549 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.329] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id nWqNIxRhEM59 for ; Tue, 8 Mar 2016 19:37:07 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id 850F35FBF8 for ; Tue, 8 Mar 2016 19:37:06 +0000 (UTC) Received: (qmail 65501 invoked by uid 99); 8 Mar 2016 19:37:05 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Mar 2016 19:37:05 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id E042EE0362; Tue, 8 Mar 2016 19:37:04 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: spmallette@apache.org To: commits@tinkerpop.incubator.apache.org Date: Tue, 08 Mar 2016 19:37:23 -0000 Message-Id: <4a98ce301f0a42ca9f325bc1ed65afe2@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [20/50] incubator-tinkerpop git commit: With the bump to groovy 2.4.6 this class is no longer needed. With the bump to groovy 2.4.6 this class is no longer needed. Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/3447b02d Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/3447b02d Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/3447b02d Branch: refs/heads/TINKERPOP-1096 Commit: 3447b02dc2220161bd191b482e95ad709d6571e5 Parents: 73489b3 Author: Stephen Mallette Authored: Thu Feb 25 09:05:36 2016 -0500 Committer: Stephen Mallette Committed: Thu Feb 25 09:05:36 2016 -0500 ---------------------------------------------------------------------- .../jsr223/GremlinVariableAnalyzer.groovy | 104 ------------------- 1 file changed, 104 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3447b02d/gremlin-groovy/src/main/groovy/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinVariableAnalyzer.groovy ---------------------------------------------------------------------- diff --git a/gremlin-groovy/src/main/groovy/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinVariableAnalyzer.groovy b/gremlin-groovy/src/main/groovy/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinVariableAnalyzer.groovy deleted file mode 100644 index 1d1bcbe..0000000 --- a/gremlin-groovy/src/main/groovy/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinVariableAnalyzer.groovy +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tinkerpop.gremlin.groovy.jsr223 - -import org.codehaus.groovy.ast.DynamicVariable -import org.codehaus.groovy.ast.GroovyClassVisitor -import org.codehaus.groovy.ast.expr.VariableExpression -import org.codehaus.groovy.control.CompilationUnit -import org.codehaus.groovy.control.CompilerConfiguration -import org.codehaus.groovy.control.Phases -import org.codehaus.groovy.tools.shell.util.ScriptVariableAnalyzer - -import java.security.CodeSource - -/** - * An extension of Groovy's {@code VariableVisitor} that exposes the bound and unbound variables publicly. This - * class can likely be removed with the next update of Groovy (after 2.4.5) as the {code ScriptVariableAnalyzer} ends - * up exposing {@code getBoundVars() in such a way as to allow for the {@code ClassLoader} to be supplied. - */ -class GremlinVariableAnalyzer { - public static class GremlinVariableVisitor extends ScriptVariableAnalyzer.VariableVisitor { - String lastBound - - @Override - void visitVariableExpression(VariableExpression expression) { - if (!(expression.variable in ['args', 'context', 'this', 'super'])) { - if (expression.accessedVariable instanceof DynamicVariable) { - unbound << expression.variable - } else { - bound << expression.variable - lastBound = bound - } - } - super.visitVariableExpression(expression) - } - - @Override - public Set getBound() { - return super.getBound() - } - - @Override - public Set getUnbound() { - return super.getUnbound() - } - } - - public static class GremlinVisitorClassLoader extends GroovyClassLoader { - private final GroovyClassVisitor visitor - - public GremlinVisitorClassLoader(final GroovyClassVisitor visitor, ClassLoader parent) { - super(parent == null ? Thread.currentThread().getContextClassLoader() : parent) - this.visitor = visitor - } - - @Override - protected CompilationUnit createCompilationUnit(final CompilerConfiguration config, final CodeSource source) { - CompilationUnit cu = super.createCompilationUnit(config, source) - cu.addPhaseOperation(new ScriptVariableAnalyzer.VisitorSourceOperation(visitor), Phases.CLASS_GENERATION) - return cu - } - } - - public static BoundVars getBoundVars(final String scriptText, ClassLoader parent) { - assert scriptText != null - final GroovyClassVisitor visitor = new GremlinVariableVisitor() - new GremlinVisitorClassLoader(visitor, parent).parseClass(scriptText) - return new BoundVars(visitor.getLastBound(), visitor.getBound()) - } - - public static class BoundVars { - private String lastBound; - private Set bound; - - BoundVars(String lastBound, Set bound) { - this.lastBound = lastBound - this.bound = bound - } - - String getLastBound() { - return lastBound - } - - Set getBound() { - return bound - } - } -}