java.lang.ClassFormatError: Invalid method Code length 65556 in class file

classic Classic list List threaded Threaded
7 messages Options
red
Reply | Threaded
Open this post in threaded view
|

java.lang.ClassFormatError: Invalid method Code length 65556 in class file

red
Hi,

We have a simple test for a groovy file, and after adding 5 more params to it, we are now getting this error.

What is Spock doing under the covers to generate that?  And is there a way to avoid it?

--
You received this message because you are subscribed to the Google Groups "Spock Framework - User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: java.lang.ClassFormatError: Invalid method Code length 65556 in class file

grzesuav


W dniu czwartek, 30 kwietnia 2015 15:13:36 UTC+2 użytkownik red napisał:
Hi,

We have a simple test for a groovy file, and after adding 5 more params to it, we are now getting this error.

What is Spock doing under the covers to generate that?  And is there a way to avoid it?

Have you @Unroll your parameterized test method ? 

AFAIK if you don't do this, all cases will be generated in one method, so it could be possible that it will be very large.


Cheers,

Grzesiek

--
You received this message because you are subscribed to the Google Groups "Spock Framework - User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: java.lang.ClassFormatError: Invalid method Code length 65556 in class file

Raffael Herzog
Am Mittwoch, 6. Mai 2015, 02.00:51 schrieb [hidden email]:
> Have you @Unroll your parameterized test method ?
>
> AFAIK if you don't do this, all cases will be generated in one method, so
> it could be possible that it will be very large.

If that is actually the case, I would seriously consider changing that.

Cheers,
   Raffi

--
You received this message because you are subscribed to the Google Groups "Spock Framework - User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.

signature.asc (836 bytes) Download Attachment
red
Reply | Threaded
Open this post in threaded view
|

Re: java.lang.ClassFormatError: Invalid method Code length 65556 in class file

red
Thanks for the suggestion...I tried @Unroll to no effect:

net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:237)
at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
at net.sf.cglib.proxy.Enhancer.createClass(Enhancer.java:317)
at org.spockframework.mock.runtime.ProxyBasedMockFactory$CglibMockFactory.createMock(ProxyBasedMockFactory.java:91)
at org.spockframework.mock.runtime.ProxyBasedMockFactory.create(ProxyBasedMockFactory.java:49)
at org.spockframework.mock.runtime.JavaMockFactory.create(JavaMockFactory.java:51)
at org.spockframework.mock.runtime.CompositeMockFactory.create(CompositeMockFactory.java:44)
at org.spockframework.lang.SpecInternals.createMock(SpecInternals.java:47)
at org.spockframework.lang.SpecInternals.createMockImpl(SpecInternals.java:282)
at org.spockframework.lang.SpecInternals.MockImpl(SpecInternals.java:99)
at com.package.MySpec.$spock_initializeFields(MySpec.groovy:28)
Caused by: java.lang.reflect.InvocationTargetException
at net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:384)
at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:219)
... 10 more
Caused by: java.lang.ClassFormatError: Invalid method Code length 67622 in class file com.package.MyClass$$EnhancerByCGLIB$$281952b3_4
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
... 12 more

On Wed, May 6, 2015 at 7:42 AM, Raffael Herzog <[hidden email]> wrote:
Am Mittwoch, 6. Mai 2015, 02.00:51 schrieb [hidden email]:
> Have you @Unroll your parameterized test method ?
>
> AFAIK if you don't do this, all cases will be generated in one method, so
> it could be possible that it will be very large.

If that is actually the case, I would seriously consider changing that.

Cheers,
   Raffi

--
You received this message because you are subscribed to the Google Groups "Spock Framework - User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Spock Framework - User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: java.lang.ClassFormatError: Invalid method Code length 65556 in class file

Peter Niederwieser
Administrator
In reply to this post by red
In 7 years of using Spock, I've never seen this error for a Spock test class, but I’ve seen it for plain Groovy classes a few times. Perhaps try with a different/later Groovy version.

On 30 Apr 2015, at 15:13, red <[hidden email]> wrote:

Hi,

We have a simple test for a groovy file, and after adding 5 more params to it, we are now getting this error.

What is Spock doing under the covers to generate that?  And is there a way to avoid it?

--
You received this message because you are subscribed to the Google Groups "Spock Framework - User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Spock Framework - User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.

signature.asc (859 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: java.lang.ClassFormatError: Invalid method Code length 65556 in class file

Peter Niederwieser
Administrator
In reply to this post by Raffael Herzog
It’s absolutely not the case. @Unroll only effects how tests are *reported*, nothing else.

> On 06 May 2015, at 13:42, Raffael Herzog <[hidden email]> wrote:
>
> Am Mittwoch, 6. Mai 2015, 02.00:51 schrieb [hidden email]:
>> Have you @Unroll your parameterized test method ?
>>
>> AFAIK if you don't do this, all cases will be generated in one method, so
>> it could be possible that it will be very large.
>
> If that is actually the case, I would seriously consider changing that.
>
> Cheers,
>   Raffi
>
> --
> You received this message because you are subscribed to the Google Groups "Spock Framework - User" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> To post to this group, send email to [hidden email].
> Visit this group at http://groups.google.com/group/spockframework.
> For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Spock Framework - User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.

signature.asc (859 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: java.lang.ClassFormatError: Invalid method Code length 65556 in class file

grzesuav


W dniu czwartek, 7 maja 2015 04:57:43 UTC+2 użytkownik Peter Niederwieser napisał:
It’s absolutely not the case. @Unroll only effects how tests are *reported*, nothing else.



Ok, apologies from my side,  I though that it is related how method is generated


@red 

Could you provide some example class which reproduces the bug if its possible ?


Regards,

Grzesiek

--
You received this message because you are subscribed to the Google Groups "Spock Framework - User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.