groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pa...@apache.org
Subject [2/2] groovy git commit: GROOVY-7926: Method that returns void in a Trait with generics produces questionable byte code (tidy comments - closes #416)
Date Sun, 11 Sep 2016 22:22:19 GMT
GROOVY-7926: Method that returns void in a Trait with generics produces questionable byte code
(tidy comments - closes #416)


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

Branch: refs/heads/GROOVY_2_4_X
Commit: 96f1ea754092a5bc957623f9f97ad16dae123c5a
Parents: 50d4d1f
Author: paulk <paulk@asert.com.au>
Authored: Mon Sep 12 08:21:14 2016 +1000
Committer: paulk <paulk@asert.com.au>
Committed: Mon Sep 12 08:22:03 2016 +1000

----------------------------------------------------------------------
 .../transform/traitx/Groovy7926Bug.groovy       | 60 ++++++++++++--------
 1 file changed, 36 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/96f1ea75/src/test/org/codehaus/groovy/transform/traitx/Groovy7926Bug.groovy
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/transform/traitx/Groovy7926Bug.groovy b/src/test/org/codehaus/groovy/transform/traitx/Groovy7926Bug.groovy
index ee2d147..bb621ef 100644
--- a/src/test/org/codehaus/groovy/transform/traitx/Groovy7926Bug.groovy
+++ b/src/test/org/codehaus/groovy/transform/traitx/Groovy7926Bug.groovy
@@ -1,38 +1,50 @@
+/*
+ *  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.codehaus.groovy.transform.traitx
 
 import org.codehaus.groovy.classgen.asm.AbstractBytecodeTestCase
-import org.codehaus.groovy.classgen.asm.InstructionSequence
 
-/**
- * Created by graemerocher on 08/09/2016.
- */
 class Groovy7926Bug extends AbstractBytecodeTestCase {
 
     void testThatVoidTypesFromTraitsWithGenericsWork() {
-        assertScript('''
-trait MyTrait<D> {
-    void delete() {
-        // no-op
-        println "works"
-    }
-}
-class MyImpl implements MyTrait<MyImpl> {
-}
-new MyImpl().delete()
-return true
-''')
+        assertScript '''
+            trait MyTrait<D> {
+                void delete() {
+                    // no-op
+                    println "works"
+                }
+            }
+            class MyImpl implements MyTrait<MyImpl> { }
+            new MyImpl().delete()
+            return true
+        '''
     }
 
     void testThatVoidTypesAreNotUsedForVariableNamesInByteCode() {
         def byteCode = compile([method:"delete", classNamePattern:"MyImpl"],"""\
-trait MyTrait<D> {
-    void delete() {
-        // no-op
-        println "works"
-    }
-}
-class MyImpl implements MyTrait<MyImpl> {
-}
+            trait MyTrait<D> {
+                void delete() {
+                    // no-op
+                    println "works"
+                }
+            }
+            class MyImpl implements MyTrait<MyImpl> { }
         """)
 
         def instructions = byteCode.instructions


Mime
View raw message