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

Eric Milles edited comment on GROOVY-10521 at 8/22/22 7:35 PM:
---------------------------------------------------------------

I get your branch and run "gradlew :model-core:compileTestGroovy" but it does 
not fail.  If you are able to recreate, you can add this to your model-core's 
{{build.gradle.kts}}:
{code}
tasks.withType<GroovyCompile> {
    groovyOptions.setFork(false)
}
{code}

Then you can run with -Dorg.gradle.debug=true on your command line and attach 
to the build process on port 5005.  A breakpoint in 
{{ClassCompletionVerifier#checkNoAbstractMethodsNonabstractClass}} should give 
us a chance to see what the state of the compiler is when it issues the 
abstract method error.  I suspect the {{ProviderAssertions}} trait has a method 
with {{[Lorg.gradle.api.Task;}} style signature for the last parameter.  Or the 
test class didn't get an array created for the last parameter.  Hard to tell 
without a failing build.

*Update:* I did not see that ProviderAssertions already had a workaround on 
that branch.  Rolled that change back and the build fails as expected.


was (Author: emilles):
I get your branch and run "gradlew :model-core:compileTestGroovy" but it does 
not fail.  If you are able to recreate, you can add this to your model-core's 
{{build.gradle.kts}}:
{code}
tasks.withType<GroovyCompile> {
    groovyOptions.setFork(false)
}
{code}

Then you can run with -Dorg.gradle.debug=true on your command line and attach 
to the build process on port 5005.  A breakpoint in 
{{ClassCompletionVerifier#checkNoAbstractMethodsNonabstractClass}} should give 
us a chance to see what the state of the compiler is when it issues the 
abstract method error.  I suspect the {{ProviderAssertions}} trait has a method 
with {{[Lorg.gradle.api.Task;}} style signature for the last parameter.  Or the 
test class didn't get an array created for the last parameter.  Hard to tell 
without a failing build.

> Compiler complains about abstract method not implemented when implementing 
> trait
> --------------------------------------------------------------------------------
>
>                 Key: GROOVY-10521
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10521
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 4.0.1
>            Reporter: Lóránt Pintér
>            Assignee: Eric Milles
>            Priority: Major
>              Labels: traits
>
> I have a trait called 
> [ProviderAssertions|https://github.com/gradle/gradle/blob/c692f2a1d2baa03f975c443ddc746d885cf84ee2/subprojects/model-core/src/testFixtures/groovy/org/gradle/api/internal/provider/ProviderAssertions.groovy]
>  that is successfully implemented by a number of {{spock.lang.Specification}} 
> types. However, when compiling this class with Groovy 4.0.1-SNAPSHOT:
> It fails with the following error:
> {code}
> :model-core:compileTestGroovy FAILED  
> Note: Some input files use or override a deprecated API.      
> Note: Recompile with -Xlint:deprecation for details.  
> Note: 
> /Users/lptr/Workspace/gradle/gradle/subprojects/model-core/src/test/groovy/org/gradle/internal/instantiation/generator/AsmBackedClassGeneratorTest.java
>  uses unchecked or unsafe operations.    
> Note: Recompile with -Xlint:unchecked for details.    
> startup failed:       
> /Users/lptr/Workspace/gradle/gradle/subprojects/model-core/src/test/groovy/org/gradle/api/internal/provider/DefaultProviderFactoryTest.groovy:
>  27: Can't have an abstract method in a non-abstract class. The class 
> 'org.gradle.api.internal.provider.DefaultProviderFactoryTest' must be 
> declared abstract or the method 'void 
> assertHasProducer(org.gradle.api.internal.provider.ProviderInternal, 
> org.gradle.api.Task, org.gradle.api.Task[])' must be implemented.        
>  @ line 27, column 1. 
>    class DefaultProviderFactoryTest extends Specification implements 
> ProviderAssertions {     
>    ^  
> 1 error       
> {code}
> https://github.com/gradle/gradle/blob/c692f2a1d2baa03f975c443ddc746d885cf84ee2/subprojects/model-core/src/test/groovy/org/gradle/api/internal/provider/DefaultProviderFactoryTest.groovy#L27
> https://ge.gradle.org/s/mz3m6drw3kzog/console-log?task=:model-core:compileTestGroovy
> The same code works with Groovy 3.0.9, and it even compiled with Groovy 
> 4.0.0-beta-1.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to