cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmcken...@apache.org
Subject [1/2] git commit: Allow cassandra to compile under java 8
Date Thu, 02 Oct 2014 18:05:58 GMT
Repository: cassandra
Updated Branches:
  refs/heads/trunk a479fe09b -> 9f4284aef


Allow cassandra to compile under java 8

patch by dbrosius reviewed by jmckenzie for cassandra-7028


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/2279d49e
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/2279d49e
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/2279d49e

Branch: refs/heads/trunk
Commit: 2279d49e96aa7cabf2702f239a8b6500c58a7bac
Parents: ca224b3
Author: Dave Brosius <dbrosius@mebigfatguy.com>
Authored: Thu Oct 2 12:47:08 2014 -0500
Committer: Joshua McKenzie <josh.mckenzie@datastax.com>
Committed: Thu Oct 2 12:47:08 2014 -0500

----------------------------------------------------------------------
 CHANGES.txt                                     |   1 +
 build.xml                                       |  13 ++++++---
 lib/antlr-3.2.jar                               | Bin 1928009 -> 0 bytes
 lib/antlr-runtime-3.5.2.jar                     | Bin 0 -> 167761 bytes
 lib/licenses/antlr-3.2.txt                      |  27 -------------------
 lib/licenses/antlr-runtime-3.5.2.txt            |  27 +++++++++++++++++++
 lib/licenses/stringtemplate-4.0.2.txt           |  27 +++++++++++++++++++
 lib/stringtemplate-4.0.2.jar                    | Bin 0 -> 226406 bytes
 src/java/org/apache/cassandra/cql/Cql.g         |   2 +-
 src/java/org/apache/cassandra/cql3/Cql.g        |  22 +++++++++++----
 .../apache/cassandra/cql3/CqlParserTest.java    |   7 ++---
 11 files changed, 86 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/2279d49e/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index e86ad5b..ac83b12 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.1.1
+ * Allow compilation in java 8 (CASSANDRA-7208)
  * Fix Assertion error on RangeTombstoneList diff (CASSANDRA-8013)
  * Release references to overlapping sstables during compaction (CASSANDRA-7819)
  * Send notification when opening compaction results early (CASSANDRA-8034)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/2279d49e/build.xml
----------------------------------------------------------------------
diff --git a/build.xml b/build.xml
index 5f2b568..957006a 100644
--- a/build.xml
+++ b/build.xml
@@ -194,7 +194,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">
          <jvmarg value="-Xmx512M" />
@@ -221,7 +221,7 @@
     <target name="gen-cql2-grammar" depends="check-gen-cql2-grammar" unless="cql2current">
       <echo>Building Grammar ${build.src.java}/org/apache/cassandra/cql/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">
          <jvmarg value="-Xmx512M" />
@@ -233,7 +233,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">
          <jvmarg value="-Xmx512M" />
@@ -356,7 +356,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.2"/>
           <dependency groupId="ch.qos.logback" artifactId="logback-classic" version="1.1.2"/>
@@ -443,6 +445,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"/>
 	<dependency groupId="net.ju-n.compile-command-annotations" artifactId="compile-command-annotations"/>
       </artifact:pom>
@@ -485,6 +488,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"/>

http://git-wip-us.apache.org/repos/asf/cassandra/blob/2279d49e/lib/antlr-3.2.jar
----------------------------------------------------------------------
diff --git a/lib/antlr-3.2.jar b/lib/antlr-3.2.jar
deleted file mode 100644
index fdd167d..0000000
Binary files a/lib/antlr-3.2.jar and /dev/null differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/2279d49e/lib/antlr-runtime-3.5.2.jar
----------------------------------------------------------------------
diff --git a/lib/antlr-runtime-3.5.2.jar b/lib/antlr-runtime-3.5.2.jar
new file mode 100644
index 0000000..d48e3e8
Binary files /dev/null and b/lib/antlr-runtime-3.5.2.jar differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/2279d49e/lib/licenses/antlr-3.2.txt
----------------------------------------------------------------------
diff --git a/lib/licenses/antlr-3.2.txt b/lib/licenses/antlr-3.2.txt
deleted file mode 100644
index 015a53d..0000000
--- a/lib/licenses/antlr-3.2.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-
-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.
-

http://git-wip-us.apache.org/repos/asf/cassandra/blob/2279d49e/lib/licenses/antlr-runtime-3.5.2.txt
----------------------------------------------------------------------
diff --git a/lib/licenses/antlr-runtime-3.5.2.txt b/lib/licenses/antlr-runtime-3.5.2.txt
new file mode 100644
index 0000000..015a53d
--- /dev/null
+++ b/lib/licenses/antlr-runtime-3.5.2.txt
@@ -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.
+

http://git-wip-us.apache.org/repos/asf/cassandra/blob/2279d49e/lib/licenses/stringtemplate-4.0.2.txt
----------------------------------------------------------------------
diff --git a/lib/licenses/stringtemplate-4.0.2.txt b/lib/licenses/stringtemplate-4.0.2.txt
new file mode 100644
index 0000000..015a53d
--- /dev/null
+++ b/lib/licenses/stringtemplate-4.0.2.txt
@@ -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.
+

http://git-wip-us.apache.org/repos/asf/cassandra/blob/2279d49e/lib/stringtemplate-4.0.2.jar
----------------------------------------------------------------------
diff --git a/lib/stringtemplate-4.0.2.jar b/lib/stringtemplate-4.0.2.jar
new file mode 100644
index 0000000..87d7faf
Binary files /dev/null and b/lib/stringtemplate-4.0.2.jar differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/2279d49e/src/java/org/apache/cassandra/cql/Cql.g
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/Cql.g b/src/java/org/apache/cassandra/cql/Cql.g
index 3c41f44..f76be27 100644
--- a/src/java/org/apache/cassandra/cql/Cql.g
+++ b/src/java/org/apache/cassandra/cql/Cql.g
@@ -86,7 +86,7 @@ options {
     public Token nextToken() {
         super.nextToken();
         if (tokens.size() == 0)
-            return Token.EOF_TOKEN;
+            return new CommonToken(Token.EOF);
         return tokens.remove(0);
     }
     

http://git-wip-us.apache.org/repos/asf/cassandra/blob/2279d49e/src/java/org/apache/cassandra/cql3/Cql.g
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/Cql.g b/src/java/org/apache/cassandra/cql3/Cql.g
index 9d54866..2c90c18 100644
--- a/src/java/org/apache/cassandra/cql3/Cql.g
+++ b/src/java/org/apache/cassandra/cql3/Cql.g
@@ -184,7 +184,7 @@ options {
     {
         super.nextToken();
         if (tokens.size() == 0)
-            return Token.EOF_TOKEN;
+            return new CommonToken(Token.EOF);
         return tokens.remove(0);
     }
 
@@ -936,7 +936,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)
           {
@@ -949,13 +958,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))
@@ -963,7 +972,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));
       }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/2279d49e/test/unit/org/apache/cassandra/cql3/CqlParserTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/CqlParserTest.java b/test/unit/org/apache/cassandra/cql3/CqlParserTest.java
index d122eb5..84509e8 100644
--- a/test/unit/org/apache/cassandra/cql3/CqlParserTest.java
+++ b/test/unit/org/apache/cassandra/cql3/CqlParserTest.java
@@ -46,8 +46,9 @@ public class CqlParserTest
 
         parser.query();
 
-        assertEquals(1, firstCounter.count);
-        assertEquals(1, secondCounter.count);
+        // ANTLR 3.5 reports 2 errors in the sentence above (missing FROM and missing EOF).
+        assertTrue(firstCounter.count > 0);
+        assertTrue(secondCounter.count > 0);
     }
 
     @Test
@@ -67,7 +68,7 @@ public class CqlParserTest
 
         parser.query();
 
-        assertEquals(1, firstCounter.count);
+        assertTrue(firstCounter.count > 0);
         assertEquals(0, secondCounter.count);
     }
 


Mime
View raw message