You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import com.example.b.Contact;
import javax.annotation.processing.Generated;
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2024-09-03T09:05:41+0200",
comments = "version: 1.6.0, compiler: javac, environment: Java 21.0.2 (BellSoft)"
)
public class ContactMapperImpl extends ContactMapper {
@Override
public com.example.a.Contact map(Contact contact) {
if ( contact == null ) {
return null;
}
com.example.a.Contact.ContactBuilder contact1 = com.example.a.Contact.builder();
contact1.nameInA( contact.getNameInB() );
afterMapping( contact1, contact );
// here is the error. contact1.build() will generate a com.example.a.Contact. Due to the import of
// com.example.b.Contact the class Contact is from package b.
Contact contact1Result = contact1.build();
afterMapping( contact1Result, contact );
return contact1Result;
}
}
Expected behavior
Same behavior as in 1.5.5 (AfterMapping method only for the Builder type is called)
Actual behavior
Both AfterMapping methods are called and code does not compile
Steps to reproduce the problem
The generated code does not compile if I have the following configuration.
If the class names of the source and target class are the same but the classes reside in a different package, the generated code will not compile.
With this mapper
The generated code will be something like...
MapStruct Version
MapStruct 1.6.0