java.lang.VerifyError: incompatible argument to function

1,230 views
Skip to first unread message

Arun Thirupathi

unread,
Mar 16, 2017, 2:33:47 PM3/16/17
to google-guice
I am using Guice injection (version 4.0) for a personal project.

On one of my private methods (this method has nothing to do with Guice Injection, but consructor of this class uses Guice Injection) ,takes an argument of type com.amazonaws.AmazonWebServiceResult<ResponseMetadata> . The Caller passes in the object of type http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/dynamodbv2/model/QueryResult.html. It compiles fine, but during unit testing, it fails with an error


java.lang.VerifyError: (class: <className> , method: <methodName> signature: (L<Param1Class>;L<Param2Class>;Lcom/amazonaws/services/dynamodbv2/model/QueryResult;)Z) Incompatible argument to function
	at java.lang.Class.getDeclaredConstructors0(Native Method)
	at java.lang.Class.privateGetDeclaredConstructors(Class.java:2585)
	at java.lang.Class.getDeclaredConstructors(Class.java:1906)
	at com.google.inject.spi.InjectionPoint.forConstructorOf(InjectionPoint.java:245)
	at com.google.inject.internal.ConstructorBindingImpl.create(ConstructorBindingImpl.java:99)
	at com.google.inject.internal.InjectorImpl.createUninitializedBinding(InjectorImpl.java:658)
	at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:882)
	at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:805)
	at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:282)
	at com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:214)
	at com.google.inject.internal.InjectorImpl.getInternalFactory(InjectorImpl.java:890)
	at com.google.inject.internal.FactoryProxy.notify(FactoryProxy.java:46)
	at com.google.inject.internal.ProcessedBindingData.runCreationListeners(ProcessedBindingData.java:50)
	at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:134)
	at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:107)
	at com.google.inject.Guice.createInjector(Guice.java:96)
	at com.google.inject.Guice.createInjector(Guice.java:73)
	at com.google.inject.Guice.createInjector(Guice.java:62)

Is this a known Guice issue ?  

I tried moving this method to a new class (the new class does not have Guice Injection), tried adding one more intermediate method as pass through, but the error is still the same. But if the method parameter remains Result, if I extract the fields from the result and pass it down to another method it does not complain.

I was writing some generic code which could take in any result type and prints out the information like request id. I have added lots of duplication of code by defining one method per result type. Can someone please help me here ?

Thanks,
Arun.

Luke Sandberg

unread,
Mar 16, 2017, 2:59:50 PM3/16/17
to google-guice
That is a verification error thrown by the java reflection apis.  that implies that there is something wrong with the class file (and it just happens that guice is the first bit of code to notice).   Most likely your class file is simply corrupted

--
You received this message because you are subscribed to the Google Groups "google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-guice...@googlegroups.com.
To post to this group, send email to google...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-guice.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-guice/47241614-1812-4e4b-a9a3-058a4cca7a9a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Arun Thirupathi

unread,
Mar 16, 2017, 3:17:06 PM3/16/17
to google-guice
Is there any way to verify ? Also what is corrupted, the class I have or the amazon sdk jar ?

When I stop using the base class, it works well. Also other thing is I have 4 of these result types and I did a mix and match of the base class and it breaks if I have one of them. So it is hard for me to believe that class file is corrupted and this is not a Guice Issue.

I tried emptying the gradle cache, maven cache and rebuilding none of them works.

Thanks,
Arun. 

Luke Sandberg

unread,
Mar 16, 2017, 3:18:22 PM3/16/17
to google...@googlegroups.com
if you call 'getDeclaredConstructors()' on that class (instead of having guice do it), does it work?  that would rule out guice as the culprit

Arunachalam

unread,
Mar 16, 2017, 3:29:54 PM3/16/17
to google...@googlegroups.com
Note that tests are failing. My test uses Mockito and PowerMock a lot, so could that be an issue ?

Let me prepend the call with getDeclardConstructors before guice injection and see if any of them fails and update this thread.

Thanks,
Arun.

To unsubscribe from this group and stop receiving emails from it, send an email to google-guice+unsubscribe@googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "google-guice" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-guice/jsf0vJfmBro/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-guice+unsubscribe@googlegroups.com.

To post to this group, send email to google...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-guice.

Arunachalam

unread,
Mar 16, 2017, 4:22:44 PM3/16/17
to google...@googlegroups.com
Luke you are right. The reason I believe is this.


Thanks for the help.

Thanks,
Arun.
Reply all
Reply to author
Forward
0 new messages