Skip to content

Mapping enum that implements an interface leads to "Unmapped target property" warning #235

@xak2000

Description

@xak2000

The bug with "Unmapped target property" warning for enums was already fixed in #38 and #42.

However there is still a case when this bug happens.

public interface DbEnum<T> {
	T getDbValue();
}

@Mapper
public abstract class MyMapper {

	public enum CheeseType implements DbEnum<Integer> {
		BRIE(1),
		ROQUEFORT(2);

		private final Integer dbValue;

		CheeseType(Integer dbValue) {
			this.dbValue = dbValue;
		}

		@Override
		public Integer getDbValue() {
			return dbValue;
		}
	}

	public enum OtherCheeseType {
		BRIE,
		ROQUEFORT
	}

	// Here IDEA shows a warning: Unmapped target property: dbValue 
	public abstract CheeseType map(OtherCheeseType cheese);
}

IDEA shows an incorrect warning on the method map: Unmapped target property: dbValue.

If you remove implements DbEnum<Integer> the warning disappears.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions