case ANNOTATION_TYPE :
case INTERFACE :
case CLASS :
case ENUM :
TypeElementImpl typeElementImpl = (TypeElementImpl) e;
Binding typeBinding = typeElementImpl._binding;
if (typeBinding instanceof SourceTypeBinding) {
SourceTypeBinding sourceTypeBinding = (SourceTypeBinding) typeBinding;
TypeDeclaration typeDeclaration = (TypeDeclaration) sourceTypeBinding.scope.referenceContext();
referenceContext = typeDeclaration;
elementAnnotations = typeDeclaration.annotations;
startPosition = typeDeclaration.sourceStart;
endPosition = typeDeclaration.sourceEnd;
}
break;
case PACKAGE :
// nothing to do: there is no reference context for a package
break;
case CONSTRUCTOR :
case METHOD :
ExecutableElementImpl executableElementImpl = (ExecutableElementImpl) e;
Binding binding = executableElementImpl._binding;
if (binding instanceof MethodBinding) {
MethodBinding methodBinding = (MethodBinding) binding;
AbstractMethodDeclaration sourceMethod = methodBinding.sourceMethod();
if (sourceMethod != null) {
referenceContext = sourceMethod;