Allow cassandra to compile under java 8

patch by dbrosius reviewed by jmckenzie for cassandra-7028
This commit is contained in:
Dave Brosius 2014-04-15 20:36:16 -04:00
parent 2804ce9945
commit 4d0691759a
8 changed files with 53 additions and 8 deletions

View File

@ -4,6 +4,7 @@
* Remove CQL2 (CASSANDRA-5918)
* Add Thrift get_multi_slice call (CASSANDRA-6757)
* Optimize fetching multiple cells by name (CASSANDRA-6933)
* Allow compilation in java 8 (CASSANDRA-7208)
2.1.0-beta2

View File

@ -190,7 +190,7 @@
<target name="gen-cli-grammar" depends="check-gen-cli-grammar" unless="cliUpToDate">
<echo>Building Grammar ${build.src.java}/org/apache/cassandra/cli/Cli.g ....</echo>
<java classname="org.antlr.Tool"
classpath="${build.lib}/antlr-3.2.jar"
classpath="${build.dir.lib}/jars/antlr-3.5.2.jar;${build.lib}/antlr-runtime-3.5.2.jar;${build.lib}/stringtemplate-4.0.2.jar"
fork="true"
failonerror="true">
<arg value="${build.src.java}/org/apache/cassandra/cli/Cli.g" />
@ -211,7 +211,7 @@
<target name="gen-cql3-grammar" depends="check-gen-cql3-grammar" unless="cql3current">
<echo>Building Grammar ${build.src.java}/org/apache/cassandra/cql3/Cql.g ...</echo>
<java classname="org.antlr.Tool"
classpath="${build.lib}/antlr-3.2.jar"
classpath="${build.dir.lib}/jars/antlr-3.5.2.jar;${build.lib}/antlr-runtime-3.5.2.jar;${build.lib}/stringtemplate-4.0.2.jar"
fork="true"
failonerror="true">
<arg value="-Xconversiontimeout" />
@ -330,7 +330,9 @@
<dependency groupId="org.apache.commons" artifactId="commons-lang3" version="3.1"/>
<dependency groupId="org.apache.commons" artifactId="commons-math3" version="3.2"/>
<dependency groupId="com.googlecode.concurrentlinkedhashmap" artifactId="concurrentlinkedhashmap-lru" version="1.3"/>
<dependency groupId="org.antlr" artifactId="antlr" version="3.2"/>
<dependency groupId="org.antlr" artifactId="antlr" version="3.5.2"/>
<dependency groupId="org.antlr" artifactId="antlr-runtime" version="3.5.2"/>
<dependency groupId="org.antlr" artifactId="stringtemplate" version="4.0.2"/>
<dependency groupId="org.slf4j" artifactId="slf4j-api" version="1.7.2"/>
<dependency groupId="ch.qos.logback" artifactId="logback-core" version="1.1.12"/>
<dependency groupId="ch.qos.logback" artifactId="logback-classic" version="1.1.12"/>
@ -403,6 +405,7 @@
<dependency groupId="org.apache.hadoop" artifactId="hadoop-minicluster"/>
<dependency groupId="org.apache.pig" artifactId="pig"/>
<dependency groupId="com.google.code.findbugs" artifactId="jsr305"/>
<dependency groupId="org.antlr" artifactId="antlr"/>
<dependency groupId="com.datastax.cassandra" artifactId="cassandra-driver-core"/>
</artifact:pom>
@ -444,6 +447,8 @@
<dependency groupId="org.apache.commons" artifactId="commons-math3"/>
<dependency groupId="com.googlecode.concurrentlinkedhashmap" artifactId="concurrentlinkedhashmap-lru"/>
<dependency groupId="org.antlr" artifactId="antlr"/>
<dependency groupId="org.antlr" artifactId="antlr-runtime"/>
<dependency groupId="org.antlr" artifactId="stringtemplate" version="4.0.2"/>
<dependency groupId="org.slf4j" artifactId="slf4j-api"/>
<dependency groupId="org.codehaus.jackson" artifactId="jackson-core-asl"/>
<dependency groupId="org.codehaus.jackson" artifactId="jackson-mapper-asl"/>

Binary file not shown.

BIN
lib/antlr-runtime-3.5.2.jar Normal file

Binary file not shown.

View File

@ -0,0 +1,27 @@
Copyright (c) 2003-2006 Terence Parr
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Binary file not shown.

View File

@ -171,7 +171,7 @@ options {
{
super.nextToken();
if (tokens.size() == 0)
return Token.EOF_TOKEN;
return new CommonToken(Token.EOF);
return tokens.remove(0);
}
@ -900,7 +900,16 @@ term returns [Term.Raw term]
;
columnOperation[List<Pair<ColumnIdentifier, Operation.RawUpdate>> operations]
: key=cident '=' t=term ('+' c=cident )?
: key=cident columnOperationDifferentiator[operations, key]
;
columnOperationDifferentiator[List<Pair<ColumnIdentifier, Operation.RawUpdate>> operations, ColumnIdentifier key]
: '=' normalColumnOperation[operations, key]
| '[' k=term ']' specializedColumnOperation[operations, key, k]
;
normalColumnOperation[List<Pair<ColumnIdentifier, Operation.RawUpdate>> operations, ColumnIdentifier key]
: t=term ('+' c=cident )?
{
if (c == null)
{
@ -913,13 +922,13 @@ columnOperation[List<Pair<ColumnIdentifier, Operation.RawUpdate>> operations]
addRawUpdate(operations, key, new Operation.Prepend(t));
}
}
| key=cident '=' c=cident sig=('+' | '-') t=term
| c=cident sig=('+' | '-') t=term
{
if (!key.equals(c))
addRecognitionError("Only expressions of the form X = X " + $sig.text + "<value> are supported.");
addRawUpdate(operations, key, $sig.text.equals("+") ? new Operation.Addition(t) : new Operation.Substraction(t));
}
| key=cident '=' c=cident i=INTEGER
| c=cident i=INTEGER
{
// Note that this production *is* necessary because X = X - 3 will in fact be lexed as [ X, '=', X, INTEGER].
if (!key.equals(c))
@ -927,7 +936,10 @@ columnOperation[List<Pair<ColumnIdentifier, Operation.RawUpdate>> operations]
addRecognitionError("Only expressions of the form X = X " + ($i.text.charAt(0) == '-' ? '-' : '+') + " <value> are supported.");
addRawUpdate(operations, key, new Operation.Addition(Constants.Literal.integer($i.text)));
}
| key=cident '[' k=term ']' '=' t=term
;
specializedColumnOperation[List<Pair<ColumnIdentifier, Operation.RawUpdate>> operations, ColumnIdentifier key, Term.Raw k]
: '=' t=term
{
addRawUpdate(operations, key, new Operation.SetElement(k, t));
}