Skip to content

Commit cd3674f

Browse files
committed
This check isn't really helpful for anything
1 parent 2a2fdcc commit cd3674f

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

rewrite-core/src/main/java/org/openrewrite/style/StyleHelper.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,6 @@ protected List<FieldAccessor> computeValue(Class<?> styleClass) {
9191
*/
9292
public static <T> T merge(T left, T right) {
9393
Class<?> styleClass = left.getClass();
94-
if (right.getClass() != styleClass) {
95-
throw new RuntimeException(left.getClass().getName() + " and " + right.getClass().getName() + " should match exactly.");
96-
}
9794
for (FieldAccessor accessor : FIELD_ACCESSORS.get(styleClass)) {
9895
try {
9996
Object rightValue = accessor.getGetter().invoke(right);
@@ -118,6 +115,7 @@ public static <T> T merge(T left, T right) {
118115
return left;
119116
}
120117

118+
@SuppressWarnings("unused")
121119
public static <T extends SourceFile> T addStyleMarker(T t, List<NamedStyles> styles) {
122120
if (!styles.isEmpty()) {
123121
Set<NamedStyles> newNamedStyles = new HashSet<>(styles);
@@ -170,6 +168,7 @@ public static <S extends Style, T extends SourceFile> S getStyle(Class<S> styleC
170168
public static <S extends Style> @Nullable S getStyle(Class<S> styleClass, List<NamedStyles> styles) {
171169
S style = NamedStyles.merge(styleClass, styles);
172170
if (style != null) {
171+
//noinspection unchecked
173172
return (S) style.applyDefaults();
174173
}
175174
return null;

0 commit comments

Comments
 (0)