File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
src/main/java/org/mockito/internal/creation/bytebuddy Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -91,7 +91,8 @@ public InlineBytecodeGenerator(
91
91
new ByteBuddy ()
92
92
.with (TypeValidation .DISABLED )
93
93
.with (Implementation .Context .Disabled .Factory .INSTANCE )
94
- .with (MethodGraph .Compiler .ForDeclaredMethods .INSTANCE );
94
+ .with (MethodGraph .Compiler .ForDeclaredMethods .INSTANCE )
95
+ .ignore (isSynthetic ().and (not (isConstructor ())).or (isDefaultFinalizer ()));
95
96
mocked = new WeakConcurrentSet <>(WeakConcurrentSet .Cleaner .INLINE );
96
97
flatMocked = new WeakConcurrentSet <>(WeakConcurrentSet .Cleaner .INLINE );
97
98
String identifier = RandomString .make ();
Original file line number Diff line number Diff line change @@ -397,13 +397,14 @@ public MethodVisitor wrap(
397
397
.getDeclaredMethods ()
398
398
.filter (isConstructor ().and (not (isPrivate ())));
399
399
int arguments = Integer .MAX_VALUE ;
400
- boolean visible = false ;
400
+ boolean packagePrivate = true ;
401
401
MethodDescription .InDefinedShape current = null ;
402
402
for (MethodDescription .InDefinedShape constructor : constructors ) {
403
403
if (constructor .getParameters ().size () < arguments
404
- && (!visible || constructor .isPackagePrivate ())) {
404
+ && (packagePrivate || !constructor .isPackagePrivate ())) {
405
+ arguments = constructor .getParameters ().size ();
406
+ packagePrivate = constructor .isPackagePrivate ();
405
407
current = constructor ;
406
- visible = constructor .isPackagePrivate ();
407
408
}
408
409
}
409
410
if (current != null ) {
You can’t perform that action at this time.
0 commit comments