Skip to content

Commit

Permalink
Fix tests expecting TextMergeViewer class only
Browse files Browse the repository at this point in the history
TextMergeViewer was expected by SaveableCompareEditorInputTest but more
specific implementation (subclass of it) - GenericEditorMergeViewer was
seen by the test after changes made to allow more specific viewer to
"win" in the compare editor for text content.

See eclipse-platform/eclipse.platform.ui#1747
See eclipse-platform#1277
  • Loading branch information
iloveeclipse authored and akurtakov committed Apr 4, 2024
1 parent 5919685 commit e2facf9
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
*******************************************************************************/
package org.eclipse.compare.tests;

import java.lang.reflect.*;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class ReflectionUtils {

Expand Down Expand Up @@ -48,7 +50,12 @@ public static Object callMethod(Object object, String name, Object... args)
public static Object getField(Object object, String name)
throws IllegalArgumentException, IllegalAccessException,
SecurityException, NoSuchFieldException {
Field field = object.getClass().getDeclaredField(name);
Field field;
try {
field = object.getClass().getDeclaredField(name);
} catch (NoSuchFieldException e) {
field = object.getClass().getSuperclass().getDeclaredField(name);
}
field.setAccessible(true);
Object ret = field.get(object);
return ret;
Expand Down

0 comments on commit e2facf9

Please sign in to comment.