IAE: Cannot attach undefined variable TLeft under 16b30
See original GitHub issueCaused by this test: https://github.com/ReactiveX/RxJava/blob/3.x/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableGroupJoinTest.java#L701-L718
io.reactivex.rxjava3.internal.operators.flowable.FlowableGroupJoinTest > leftRightState FAILED
org.mockito.exceptions.base.MockitoException:
Mockito cannot mock this class: interface io.reactivex.rxjava3.internal.operators.flowable.FlowableGroupJoin$JoinSupport.
Mockito can only mock non-private & non-final classes.
If you're not sure why you're getting this error, please report to the mailing list.
Java : 16
JVM vendor name : Oracle Corporation
JVM vendor version : 16-ea+30-2130
JVM name : OpenJDK 64-Bit Server VM
JVM version : 16-ea+30-2130
JVM info : mixed mode, sharing
OS name : Linux
OS version : 5.4.0-1032-azure
Underlying exception : java.lang.IllegalArgumentException: Cannot attach undefined variable: TLeft
at io.reactivex.rxjava3.internal.operators.flowable.FlowableGroupJoinTest.leftRightState(FlowableGroupJoinTest.java:703)
Caused by:
java.lang.IllegalArgumentException: Cannot attach undefined variable: TLeft
at net.bytebuddy.dynamic.Transformer$ForMethod$TransformedMethod$AttachmentVisitor.onTypeVariable(Transformer.java:592)
at net.bytebuddy.dynamic.Transformer$ForMethod$TransformedMethod$AttachmentVisitor.onTypeVariable(Transformer.java:580)
at net.bytebuddy.description.type.TypeDescription$Generic$OfTypeVariable$Symbolic.accept(TypeDescription.java:5938)
at net.bytebuddy.description.type.TypeDescription$Generic$Visitor$Substitutor.onParameterizedType(TypeDescription.java:1850)
at net.bytebuddy.description.type.TypeDescription$Generic$Visitor$Substitutor$WithoutTypeSubstitution.onParameterizedType(TypeDescription.java:1894)
at net.bytebuddy.description.type.TypeDescription$Generic$OfParameterizedType.accept(TypeDescription.java:5149)
at net.bytebuddy.description.type.TypeDescription$Generic$Visitor$Substitutor.onParameterizedType(TypeDescription.java:1855)
at net.bytebuddy.description.type.TypeDescription$Generic$Visitor$Substitutor$WithoutTypeSubstitution.onParameterizedType(TypeDescription.java:1894)
at net.bytebuddy.description.type.TypeDescription$Generic$OfParameterizedType.accept(TypeDescription.java:5149)
at net.bytebuddy.dynamic.Transformer$ForMethod$TransformedMethod.getReceiverType(Transformer.java:458)
at net.bytebuddy.implementation.attribute.MethodAttributeAppender$ForInstrumentedMethod$2.appendReceiver(MethodAttributeAppender.java:177)
at net.bytebuddy.implementation.attribute.MethodAttributeAppender$ForInstrumentedMethod.apply(MethodAttributeAppender.java:215)
at net.bytebuddy.implementation.attribute.MethodAttributeAppender$Compound.apply(MethodAttributeAppender.java:484)
at net.bytebuddy.dynamic.scaffold.TypeWriter$MethodPool$Record$ForDefinedMethod$WithBody.applyAttributes(TypeWriter.java:701)
at net.bytebuddy.dynamic.scaffold.TypeWriter$MethodPool$Record$ForDefinedMethod$WithBody.applyBody(TypeWriter.java:691)
at net.bytebuddy.dynamic.scaffold.TypeWriter$MethodPool$Record$ForDefinedMethod.apply(TypeWriter.java:600)
at net.bytebuddy.dynamic.scaffold.TypeWriter$Default$ForCreation.create(TypeWriter.java:5751)
at net.bytebuddy.dynamic.scaffold.TypeWriter$Default.make(TypeWriter.java:2166)
at net.bytebuddy.dynamic.scaffold.subclass.SubclassDynamicTypeBuilder.make(SubclassDynamicTypeBuilder.java:232)
at net.bytebuddy.dynamic.scaffold.subclass.SubclassDynamicTypeBuilder.make(SubclassDynamicTypeBuilder.java:204)
at net.bytebuddy.dynamic.DynamicType$Builder$AbstractBase.make(DynamicType.java:3659)
at net.bytebuddy.dynamic.DynamicType$Builder$AbstractBase$Delegator.make(DynamicType.java:3897)
at org.mockito.internal.creation.bytebuddy.SubclassBytecodeGenerator.mockClass(SubclassBytecodeGenerator.java:199)
at org.mockito.internal.creation.bytebuddy.TypeCachingBytecodeGenerator$1.call(TypeCachingBytecodeGenerator.java:46)
at org.mockito.internal.creation.bytebuddy.TypeCachingBytecodeGenerator$1.call(TypeCachingBytecodeGenerator.java:43)
at net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:153)
at net.bytebuddy.TypeCache$WithInlineExpunction.findOrInsert(TypeCache.java:366)
at net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:175)
at net.bytebuddy.TypeCache$WithInlineExpunction.findOrInsert(TypeCache.java:377)
at org.mockito.internal.creation.bytebuddy.TypeCachingBytecodeGenerator.mockClass(TypeCachingBytecodeGenerator.java:36)
at org.mockito.internal.creation.bytebuddy.SubclassByteBuddyMockMaker.createMockType(SubclassByteBuddyMockMaker.java:77)
at org.mockito.internal.creation.bytebuddy.SubclassByteBuddyMockMaker.createMock(SubclassByteBuddyMockMaker.java:43)
at org.mockito.internal.creation.bytebuddy.ByteBuddyMockMaker.createMock(ByteBuddyMockMaker.java:29)
at org.mockito.internal.util.MockUtil.createMock(MockUtil.java:53)
at org.mockito.internal.MockitoCore.mock(MockitoCore.java:61)
at org.mockito.Mockito.mock(Mockito.java:1949)
at org.mockito.Mockito.mock(Mockito.java:1860)
... 1 more
Related: #983
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
ByteBuddy: java.lang.IllegalArgumentException: Cannot ...
You have found a bug in Byte Buddy. I have resolved this issue (formerly incorrect in release 1.6.14) in Byte Buddy 1.4.17.
Read more >MAGAZINE-SEPT-2018.compressed.pdf - Vanik
2002) to attach any property mentioned in application with permission of special court. These properties can be attached provisionally ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This is the result of a recent change in OpenJDK. As a matter of fact, I am involved in the change but I am wondering if we overlooked another scenario. The reflection API considers the outer class of a static member (in your case an interface) to be parameterized. As a result, the variable TLeft suddenly exists in the scope of the interface which is does not. (javac also forbids to consider the outer class as parameterized as a receiver of a method of the static member.)
Personally, I believe that the changes behavior of the reflection API is incorrect here, but I will check back with the person at Oracle who implemented the change if this is an oversight. The receiver type feature is much more complicated then it seems at first sight, unfortunately, so thanks for getting this back to us!
Confirmed fixed in 16b34 and 17b7. Thank you!