You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by GitBox <gi...@apache.org> on 2019/05/27 05:58:00 UTC

[GitHub] [groovy] paulk-asert commented on a change in pull request #936: GROOVY-9127: check for subclass access to field for this prop expression

paulk-asert commented on a change in pull request #936: GROOVY-9127: check for subclass access to field for this prop expression
URL: https://github.com/apache/groovy/pull/936#discussion_r287654962
 
 

 ##########
 File path: src/test/groovy/bugs/Groovy9141.groovy
 ##########
 @@ -18,41 +18,39 @@
  */
 package groovy.bugs
 
-import gls.CompilableTestSupport
 import groovy.transform.CompileStatic
+import org.codehaus.groovy.control.CompilationFailedException
 import org.codehaus.groovy.control.CompilerConfiguration
-
-import static org.codehaus.groovy.control.ParserVersion.V_2
+import org.codehaus.groovy.control.ParserPluginFactory
 
 @CompileStatic
-final class Groovy9141 extends CompilableTestSupport {
-    private static final String METHOD_DEF = '''
-        abstract meth() {
-            println 42
-        }
-    '''
-
-    void testAbstractMethodWithBodyInScript() {
-        def err = shouldNotCompile METHOD_DEF
-        assert err =~ / You cannot define an abstract method\[meth\] in the script. Try removing the 'abstract' /
-    }
+final class Groovy9141 extends GroovyTestCase {
 
     void testAbstractMethodWithBodyInClass() {
-        def err = shouldNotCompile """
-            class Main {
-                $METHOD_DEF
+        def err = shouldFail(CompilationFailedException, '''\
+            abstract class Main {
 
 Review comment:
   Wouldn't it just be easier to add abstract in front of class on the one line and change the error message and leave the rest of the script as is?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services