Skip to content

Commit

Permalink
Fix CRLF
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-bor committed Nov 9, 2023
1 parent 4790cdf commit 081d86b
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main/java/io/beanmapper/utils/CanonicalClassName.java
Original file line number Diff line number Diff line change
@@ -1 +1 @@
package io.beanmapper.utils;public class CanonicalClassName { public static String determineCanonicalClassName(Class<?> clazz) { return clazz.getCanonicalName() == null ? fallbackWhenCanonicalNameIsNull(clazz) : clazz.getCanonicalName(); } // See bug 190, https://github.com/42BV/beanmapper/issues/190 // When an enum has abstract methods, calling getCanonicalName() on its class will return a null value. // This fallback method will allow for the expected canonical name value to be returned. getCanonicalName // must no longer be called directly. private static String fallbackWhenCanonicalNameIsNull(Class<?> clazz) { return clazz.getSuperclass().getCanonicalName(); }}
package io.beanmapper.utils;public class CanonicalClassName { public static String determineCanonicalClassName(Class<?> clazz) { return clazz.getCanonicalName() == null ? fallbackWhenCanonicalNameIsNull(clazz) : clazz.getCanonicalName(); } // See bug 190, https://github.com/42BV/beanmapper/issues/190 // When an enum has abstract methods, calling getCanonicalName() on its class will return a null value. // This fallback method will allow for the expected canonical name value to be returned. getCanonicalName // must no longer be called directly. private static String fallbackWhenCanonicalNameIsNull(Class<?> clazz) { return clazz.getSuperclass().getCanonicalName(); }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.beanmapper.testmodel.enums;

public class ComplexEnumResult {

public String name;
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
package io.beanmapper.testmodel.enums;public enum WithAbstractMethod { ONE_VALUE() { @Override public void someAbstractMethod() {} }; public abstract void someAbstractMethod(); public String getName() { return name(); }}
package io.beanmapper.testmodel.enums;public enum WithAbstractMethod { ONE_VALUE() { @Override public void someAbstractMethod() { } }; public abstract void someAbstractMethod(); public String getName() { return name(); }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
package io.beanmapper.utils;import io.beanmapper.testmodel.enums.Day;import io.beanmapper.testmodel.enums.WithAbstractMethod;import org.junit.jupiter.api.Test;import static org.junit.jupiter.api.Assertions.assertEquals;public class CanonicalClassNameTest { @Test public void determineCanonicalClassNameOfOrdinaryEnum() { assertEquals("io.beanmapper.testmodel.enums.Day", CanonicalClassName.determineCanonicalClassName(Day.MONDAY.getClass())); } @Test public void determineCanonicalClassNameOfEnumWithAbstractMethod() { assertEquals("io.beanmapper.testmodel.enums.WithAbstractMethod", CanonicalClassName.determineCanonicalClassName(WithAbstractMethod.ONE_VALUE.getClass())); }}
package io.beanmapper.utils;import io.beanmapper.testmodel.enums.Day;import io.beanmapper.testmodel.enums.WithAbstractMethod;import org.junit.jupiter.api.Test;import static org.junit.jupiter.api.Assertions.assertEquals;public class CanonicalClassNameTest { @Test public void determineCanonicalClassNameOfOrdinaryEnum() { assertEquals("io.beanmapper.testmodel.enums.Day", CanonicalClassName.determineCanonicalClassName(Day.MONDAY.getClass())); } @Test public void determineCanonicalClassNameOfEnumWithAbstractMethod() { assertEquals("io.beanmapper.testmodel.enums.WithAbstractMethod", CanonicalClassName.determineCanonicalClassName(WithAbstractMethod.ONE_VALUE.getClass())); }}
Expand Down

0 comments on commit 081d86b

Please sign in to comment.