Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright MapStruct Authors.
*
* Licensed under the Apache License version 2.0, available at https://www.apache.org/licenses/LICENSE-2.0
*/
package org.mapstruct.intellij.bugs._235;

import org.jetbrains.annotations.NotNull;
import org.mapstruct.intellij.inspection.BaseInspectionTest;
import org.mapstruct.intellij.inspection.MapstructReferenceInspection;

/**
* @author Oliver Erhart
*/
public class EnumImplementingInterfaceTest extends BaseInspectionTest {

@Override
protected String getTestDataPath() {
return "testData/bugs/_235";
}

@NotNull
@Override
protected Class<MapstructReferenceInspection> getInspection() {
return MapstructReferenceInspection.class;
}

public void testEnumImplementingInterface() {
doTest();
}
}
38 changes: 38 additions & 0 deletions testData/bugs/_235/EnumImplementingInterface.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright MapStruct Authors.
*
* Licensed under the Apache License version 2.0, available at https://www.apache.org/licenses/LICENSE-2.0
*/

import org.mapstruct.Mapper;

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

@Mapper
abstract class MyMapper {

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
}

public abstract CheeseType map(OtherCheeseType cheese);
}