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

Eric Milles commented on GROOVY-11781:
--------------------------------------

> the proposed changes fix the 2nd test, but then the 3rd is failing

GroovyMockInterceptor#intercept needs to pass propertyMissing along. I just 
commented out the throw:
{code:java}
  public Object intercept(Object target, Method method, Object[] arguments, 
IResponseGenerator realMethodInvoker) {
    ...
    if (isMethod(method, "methodMissing", String.class, Object.class)) {
      throw new MissingMethodException((String)args[0], 
mockConfiguration.getType(), new Object[]{args[1]}, false);
    }
    /*if (isMethod(method, "propertyMissing", String.class)) {
      throw new MissingPropertyException((String)args[0], 
mockConfiguration.getType());
    }*/
    IMockMethod mockMethod = new StaticMockMethod(method, 
mockConfiguration.getExactType());
    IMockInvocation invocation = new MockInvocation(mockObject, mockMethod, 
asList(args), realMethodInvoker);
    IMockController controller = 
specification.getSpecificationContext().getMockController();
    return controller.handle(invocation);
  }
{code}

I don't know what other impact this has; you'll need to investigate further to 
understand why methodMissing and propertyMissing are not forwarded.

> static field access to outer class does not work properly anymore
> -----------------------------------------------------------------
>
>                 Key: GROOVY-11781
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11781
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 5.0.1
>            Reporter: Björn Kautler
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 5.0.2
>
>
> This is a regression in Groovy 5.
> Groovy 2.5, 3.0, and 4.0 it works fine.
> To reproduce:
>  * checkout my {{groovy5}} PR branch of 
> [https://github.com/spockframework/spock/pull/2213]
>  * go to 
> {{org.spockframework.smoke.mock.GroovyMockAbstractGlobalClass.AbstractClassA}}
>  * replace the three {{GroovyMockAbstractGlobalClass.NAME}} by just {{NAME}}
>  * execute {{./gradlew -Dvariant=5.0 -DjavaVersion=11 :spock-specs:test 
> --tests org.spockframework.smoke.mock.GroovyMockAbstractGlobalClass --info}}
> As a result you get an `IllegalArgumentException` with message `object is not 
> an instance of declaring class`.
> I'm not 100% sure whether this is a Groovy bug or Spock bug, but it works 
> fine up to and including Groovy 4.
> If this is not a Groovy bug but a Spock bug, I'd appreciate very much help in 
> how to resolve this on the Spock side.



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

Reply via email to