Project: Eclipse_Platform_UI
Bug 11128 Access to a field in a particular super-type through IJavaObject
Reported: 2002-03-11 15:46:31 | Status: verified fixed

It is possible to cast an instance to a super type and query it for a field. This query should return the field from the super type. For the evaluation engine to support this, we need to be able to ask an IJavaObject for a field from a particular type in the hierarchy as follows: public IJavaFieldVariable getField(String name, String typeSignature) throws DebugException; An implementation of this API (in JDIObjectValue) is: public IJavaFieldVariable getField(String name, String typeSignature) throws DebugException { ReferenceType ref = getUnderlyingReferenceType(); try { Field field= null; Iterator fields= ref.allFields().iterator(); while (fields.hasNext()) { field = (Field)fields.next(); if (name.equals(field.name()) && typeSignature.equals(field.declaringType().signature())) { break; } } if (field != null) { return new JDIFieldVariable((JDIDebugTarget)getDebugTarget(), field, getUnderlyingObject()); } } catch (RuntimeException e) { targetRequestFailed(MessageFormat.format(JDIDebugModelMessages.getString("JDIObjectValue.exception_retrieving_field"), new String[]{e.toString()}), e); //$NON-NLS-1$ } // it is possible to return null return null; }

Files changed in fix:
bundles/org.eclipse.ui/Eclipse UI/org/eclipse/ui/internal/ReopenEditorMenu.java bundles/org.eclipse.ui/Eclipse UI/org/eclipse/ui/internal/WorkbenchActionBuilder.java