groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (GROOVY-7416) Problem With CompileStatic And Interface Methods In Abstract Subclass
Date Sat, 04 Jul 2015 01:17:04 GMT

    [ https://issues.apache.org/jira/browse/GROOVY-7416?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14613545#comment-14613545
] 

ASF GitHub Bot commented on GROOVY-7416:
----------------------------------------

Github user paulk-asert closed the pull request at:

    https://github.com/apache/incubator-groovy/pull/23


> Problem With CompileStatic And Interface Methods In Abstract Subclass
> ---------------------------------------------------------------------
>
>                 Key: GROOVY-7416
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7416
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 2.4.3
>            Reporter: Jeff Scott Brown
>         Attachments: abstractcompilestatic.zip, abstractcompilestatic.zip
>
>
> The attached abstractcompilestatic.zip contains the following:
> {code:borderStyle=solid|title=src/main/groovy/demo/SomeInterface.groovy}
> package demo
> interface SomeInterface {
>     void someInterfaceMethod()
> }
> {code}
> {code:borderStyle=solid|title=src/main/groovy/demo/AbstractSuperClass.groovy}
> package demo
> abstract class AbstractSuperClass implements SomeInterface {}
> {code}
> {code:borderStyle=solid|title=src/main/groovy/demo/AbstractSubClass.groovy}
> package demo
> import groovy.transform.CompileStatic
> @CompileStatic
> abstract class AbstractSubClass extends AbstractSuperClass {
>     void someMethod() {
>         someInterfaceMethod()
>     }
> }
> {code}
> The code will not compile.
> {noformat}
>  $ ./gradlew clean compileGroovy
> :clean
> :compileJava UP-TO-DATE
> :compileGroovy
> startup failed:
> /Users/jeff/abstractcompilestatic/src/main/groovy/demo/AbstractSubClass.groovy: 9: [Static
type checking] - Cannot find matching method demo.AbstractSubClass#someInterfaceMethod().
Please check if the declared type is right and if the method exists.
>  @ line 9, column 9.
>            someInterfaceMethod()
>            ^
> 1 error
> :compileGroovy FAILED
> FAILURE: Build failed with an exception.
> * What went wrong:
> Execution failed for task ':compileGroovy'.
> > Compilation failed; see the compiler error output for details.
> * Try:
> Run with --stacktrace option to get the stack trace. Run with --info or --debug option
to get more log output.
> BUILD FAILED
> Total time: 4.045 secs
> {noformat}
> If the AbstractSubClass is modified to implement the interface as shown below the code
will compile:
> {code:borderStyle=solid|title=src/main/groovy/demo/AbstractSubClass.groovy}
> package demo
> import groovy.transform.CompileStatic
> @CompileStatic
> abstract class AbstractSubClass extends AbstractSuperClass implements SomeInterface {
>     void someMethod() {
>         someInterfaceMethod()
>     }
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message