CaptureTraverser (PsiElement targetClass, String name, boolean checkInheritance) { PsiClass fromClass = getPositionClass(); if (!(targetClass instanceof PsiClass) || fromClass == null) { throw evaluateException(JavaDebuggerBundle.message("evaluation.error.invalid.expression", name)); } try { CaptureTraverser traverser = CaptureTraverser.create((PsiClass)targetClass, fromClass, checkInheritance); if (!traverser.isValid() && !fromClass.equals(myContextPsiClass)) { // do not check twice traverser = CaptureTraverser.create((PsiClass)targetClass, myContextPsiClass, checkInheritance); } if (!traverser.isValid()) { LOG.warn("Unable create valid CaptureTraverser to access 'this'."); traverser = CaptureTraverser.direct(); } return traverser; } catch (Exception e) { throw new EvaluateRuntimeException(EvaluateExceptionUtil.createEvaluateException(e)); } }