You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2016/08/04 06:45:32 UTC

groovy git commit: GROOVY-7899: Bump servlet-api version to 3.0.1

Repository: groovy
Updated Branches:
  refs/heads/master 286b36bbf -> 38b2ef551


GROOVY-7899: Bump servlet-api version to 3.0.1


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/38b2ef55
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/38b2ef55
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/38b2ef55

Branch: refs/heads/master
Commit: 38b2ef5516420d83c8d242b1a9434562fc068647
Parents: 286b36b
Author: paulk <pa...@asert.com.au>
Authored: Thu Aug 4 16:45:20 2016 +1000
Committer: paulk <pa...@asert.com.au>
Committed: Thu Aug 4 16:45:20 2016 +1000

----------------------------------------------------------------------
 src/spec/doc/grape.adoc                         | 34 ++++++++++++--------
 .../asm/sc/BugsStaticCompileTest.groovy         |  1 -
 subprojects/groovy-servlet/build.gradle         |  3 +-
 3 files changed, 23 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/38b2ef55/src/spec/doc/grape.adoc
----------------------------------------------------------------------
diff --git a/src/spec/doc/grape.adoc b/src/spec/doc/grape.adoc
index f9b5424..952aecc 100644
--- a/src/spec/doc/grape.adoc
+++ b/src/spec/doc/grape.adoc
@@ -200,8 +200,8 @@ annotated script element).
 [[Grape-MultipleGrapeAnnotations]]
 === Multiple Grape Annotations
 
-In order to use a Grape annotation multiple times on the same node you must use the
-`@Grapes` annotation, e.g.:
+In early versions of Groovy, if you wanted to use a Grab annotation multiple times
+on the same node you had to use the `@Grapes` annotation, e.g.:
 
 [source,groovy]
 ---------------------------------------------------------------------------------
@@ -213,12 +213,22 @@ class Example {
 }
 ---------------------------------------------------------------------------------
 
-Otherwise you\u2019ll encounter the following error:
+Otherwise you\u2019d encounter the following error:
 
 ------------------------------------------------------
 Cannot specify duplicate annotation on the same member
 ------------------------------------------------------
 
+But in recent versions, @Grapes is purely optional.
+
+Technical notes:
+
+* Originally, Groovy stored the Grab annotations for access at runtime
+and duplicates aren't allowed in the bytecode. In current versions, @Grab has only
+SOURCE retention, so the multiple occurrences aren't an issue.
+* Future versions of Grape may support using the Grapes annotation to
+provide a level of structuring, e.g. allowing a GrabExclude or GrabResolver
+annotation to apply to only a subset of the Grab annotations.
 
 [[Grape-Methodcall]]
 === Method call
@@ -370,9 +380,9 @@ Using Apache Commons Collections:
 [source,groovy]
 -----------------------------------------------------------------------------
 // create and use a primitive array list
+@Grab(group='commons-primitives', module='commons-primitives', version='1.0')
 import org.apache.commons.collections.primitives.ArrayIntList
 
-@Grab(group='commons-primitives', module='commons-primitives', version='1.0')
 def createEmptyInts() { new ArrayIntList() }
 
 def ints = createEmptyInts()
@@ -409,18 +419,16 @@ Launching a Jetty server to serve Groovy templates:
 
 [source,groovy]
 --------------------------------------------------------------------------------------------------
-@Grapes([
-    @Grab(group='org.eclipse.jetty.aggregate', module='jetty-server', version='8.1.7.v20120910'),
-    @Grab(group='org.eclipse.jetty.aggregate', module='jetty-servlet', version='8.1.7.v20120910'),
-    @Grab(group='javax.servlet', module='javax.servlet-api', version='3.0.1')])
-
+@Grab('org.eclipse.jetty.aggregate:jetty-server:8.1.19.v20160209')
+@Grab('org.eclipse.jetty.aggregate:jetty-servlet:8.1.19.v20160209')
+@Grab('javax.servlet:javax.servlet-api:3.0.1')
 import org.eclipse.jetty.server.Server
-import org.eclipse.jetty.servlet.*
-import groovy.servlet.*
+import org.eclipse.jetty.servlet.ServletContextHandler
+import groovy.servlet.TemplateServlet
 
 def runServer(duration) {
     def server = new Server(8080)
-    def context = new ServletContextHandler(server, "/", ServletContextHandler.SESSIONS);
+    def context = new ServletContextHandler(server, "/", ServletContextHandler.SESSIONS)
     context.resourceBase = "."
     context.addServlet(TemplateServlet, "*.gsp")
     server.start()
@@ -432,7 +440,7 @@ runServer(10000)
 --------------------------------------------------------------------------------------------------
 
 Grape will download Jetty and its dependencies on first launch of this
-script, and cache them. We\u2019re creating a new Jetty Server on port 8080,
+script, and cache them. We create a new Jetty Server on port 8080,
 then expose Groovy\u2019s TemplateServlet at the root of the context \u2014 Groovy
 comes with its own powerful template engine mechanism. We start the
 server and let it run for a certain duration. Each time someone will hit

http://git-wip-us.apache.org/repos/asf/groovy/blob/38b2ef55/src/test/org/codehaus/groovy/classgen/asm/sc/BugsStaticCompileTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/classgen/asm/sc/BugsStaticCompileTest.groovy b/src/test/org/codehaus/groovy/classgen/asm/sc/BugsStaticCompileTest.groovy
index 9a4491d..032f899 100644
--- a/src/test/org/codehaus/groovy/classgen/asm/sc/BugsStaticCompileTest.groovy
+++ b/src/test/org/codehaus/groovy/classgen/asm/sc/BugsStaticCompileTest.groovy
@@ -900,7 +900,6 @@ import groovy.transform.TypeCheckingMode
             import javax.servlet.ServletRegistration
 
             /**
-
              * author: Richard Vowles - http://gplus.to/RichardVowles
              */
             @CompileStatic

http://git-wip-us.apache.org/repos/asf/groovy/blob/38b2ef55/subprojects/groovy-servlet/build.gradle
----------------------------------------------------------------------
diff --git a/subprojects/groovy-servlet/build.gradle b/subprojects/groovy-servlet/build.gradle
index c89541a..3dce1cd 100644
--- a/subprojects/groovy-servlet/build.gradle
+++ b/subprojects/groovy-servlet/build.gradle
@@ -17,11 +17,12 @@
  *  under the License.
  */
 dependencies {
-    compile('javax.servlet:servlet-api:2.4') { dep ->
+    compile('javax.servlet:javax.servlet-api:3.0.1') { dep ->
         provided dep
     }
     compile('javax.servlet:jsp-api:2.0') { dep ->
         provided dep
+        exclude(group: 'javax.servlet', module: 'servlet-api')
     }
     compile rootProject
     testCompile "jmock:jmock:$jmockVersion"