Changes between Version 180 and Version 181 of j2p
- Timestamp:
- 01/10/25 11:12:27 (3 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
j2p
v180 v181 559 559 ||I get an error in python on an overloaded method ({{{@dispatch}}}), incorrect number of arguments.||{{{@dispatch}}} has a problem with Optional arguments. Try making the arguments {{{@NonNull}}} in java.|| 560 560 ||I get an {{{UnsupportedOperationException}}} inside javaparser LambdaExprContext||Javaparser seems to sometimes have trouble with resolving argument types inside lambda expressions. Try explicitly typing the left side of your lambda expression|| 561 ||I get mockito.invocation.InvocationError: You tried to stub a method '__len__' the object (<class 'mockito.mocking.mock.<locals>.Dummy'>) doesn't have.||Python typing around the built-in types (list, set) is messy. If you stub a java List/Set, it translates to mock(typing.List/typing.Set). And those types do not have {{{___len___}}} causing the error. 562 In these special cases you need to use mock(list)/mock(set). Try manual translation of these types.|| 561 ||I get {{{mockito.invocation.InvocationError: You tried to stub a method __len__ the object (<class 'mockito.mocking.mock.<locals>.Dummy'>) doesn't have.}}} ||Python typing around the built-in types (list, set, str, repr) is messy. If you stub a java List/Set, it translates to mock(typing.List/typing.Set). And those types do not have {{{___len___}}} causing the error. 562 In these special cases you need to use mock(list)/mock(set). Try manual translation of these types. 563 For example to mock {{{__repr__}}} you need {{{when2(myobj.__repr__).thenReturn("xx")}}}|| 563 564 ||I'm getting {{{TypeError: missing a required argument}}} at runtime on an overloaded mockito mock call||python mockito and plum dispatch don't work together||It is easiest to work around the overloading. Change one of the overloaded method names.|| 564 565 ||Mockito is complaining {{{AttributeError: 'Dummy' has no attribute 'xxx' configured}}}||python mockito does not automatically mock method calls and fields with null. You have to explicitly mock them||