@Override public CtField<T> getFieldDeclaration() { if (declaringType == null) { return null; } CtType<?> type = declaringType.getTypeDeclaration(); if (type != null) { final CtField<T> ctField = (CtField<T>) type.getField(getSimpleName()); if (ctField == null && type instanceof CtEnum) { return ((CtEnum) type).getEnumValue(getSimpleName()); } return ctField; } return null; }