class FieldAccessContext extends AbstractJavaParserContext<FieldAccessExpr> {

    private static final String ARRAY_LENGTH_FIELD_NAME = "length";

    public FieldAccessContext(FieldAccessExpr wrappedNode, TypeSolver typeSolver) {
        super(wrappedNode, typeSolver);
    }

    @Override
    public SymbolReference<? extends ResolvedValueDeclaration> solveSymbol(String name) {
        if (wrappedNode.getName().toString().equals(name)) {
            if (wrappedNode.getScope() instanceof ThisExpr) {
                ResolvedType typeOfThis = JavaParserFacade.get(typeSolver).getTypeOfThisIn(wrappedNode);
                if(typeOfThis.asReferenceType().getTypeDeclaration().isPresent()) {
                    return new SymbolSolver(typeSolver).solveSymbolInType(
                            typeOfThis.asReferenceType().getTypeDeclaration().get(),
                            name
                    );
                }
            }
        }
        return JavaParserFactory.getContext(demandParentNode(wrappedNode), typeSolver).solveSymbol(name);
    }

    @Override
    public SymbolReference<ResolvedTypeDeclaration> solveType(String name, List<ResolvedType> typeArguments) {
        return JavaParserFactory.getContext(demandParentNode(wrappedNode), typeSolver).solveType(name, typeArguments);
    }

    @Override
    public SymbolReference<ResolvedMethodDeclaration> solveMethod(String name, List<ResolvedType> parameterTypes, boolean staticOnly) {
        return JavaParserFactory.getContext(demandParentNode(wrappedNode), typeSolver).solveMethod(name, parameterTypes, false);
    }

    @Override
    public Optional<Value> solveSymbolAsValue(String name) {
        Expression scope = wrappedNode.getScope();
        if (wrappedNode.getName().toString().equals(name)) {
            ResolvedType typeOfScope = JavaParserFacade.get(typeSolver).getType(scope);
            if (typeOfScope.isArray() && ARRAY_LENGTH_FIELD_NAME.equals(name)) {
                return Optional.of(new Value(ResolvedPrimitiveType.INT, ARRAY_LENGTH_FIELD_NAME));
            }
            if (typeOfScope.isReferenceType()) {
                return solveSymbolAsValue(name, typeOfScope.asReferenceType());
            }
                    if (typeOfScope.isConstraint()) {
                return solveSymbolAsValue(name, typeOfScope.asConstraintType().getBound().asReferenceType());
            }
            return Optional.empty();
        }
        return solveSymbolAsValueInParentContext(name);
    }

    /*
     * Try to resolve the name parameter as a field of the reference type
     */
    private Optional<Value> solveSymbolAsValue(String name, ResolvedReferenceType type) {<FILL_FUNCTION_BODY>}

    public SymbolReference<ResolvedValueDeclaration> solveField(String name) {
        Collection<ResolvedReferenceTypeDeclaration> rrtds = findTypeDeclarations(Optional.of(wrappedNode.getScope()));
        for (ResolvedReferenceTypeDeclaration rrtd : rrtds) {
            if (rrtd.isEnum()) {
                Optional<ResolvedEnumConstantDeclaration> enumConstant = rrtd.asEnum().getEnumConstants().stream().filter(c -> c.getName().equals(name)).findFirst();
                if (enumConstant.isPresent()) {
                    return SymbolReference.solved(enumConstant.get());
                }
            }
            try {
                return SymbolReference.solved(rrtd.getField(wrappedNode.getName().getId()));
            } catch (Throwable t) {
            }
        }
        return SymbolReference.unsolved();
    }
}

        Optional<ResolvedReferenceTypeDeclaration> optionalTypeDeclaration = type.getTypeDeclaration();
        if (optionalTypeDeclaration.isPresent()) {
            ResolvedReferenceTypeDeclaration typeDeclaration = optionalTypeDeclaration.get();
            if (typeDeclaration.isEnum()) {
                ResolvedEnumDeclaration enumDeclaration = (ResolvedEnumDeclaration) typeDeclaration;
                if (enumDeclaration.hasEnumConstant(name)) {
                    return Optional.of(new Value(enumDeclaration.getEnumConstant(name).getType(), name));
                }
            }
        }
        Optional<ResolvedType> typeUsage = type.getFieldType(name);
        return typeUsage.map(resolvedType -> new Value(resolvedType, name));
    
<methods>public void <init>(com.github.javaparser.ast.expr.FieldAccessExpr, com.github.javaparser.resolution.TypeSolver) ,public boolean equals(java.lang.Object) ,public final Optional<com.github.javaparser.resolution.Context> getParent() ,public com.github.javaparser.ast.expr.FieldAccessExpr getWrappedNode() ,public int hashCode() ,public Optional<com.github.javaparser.resolution.MethodUsage> solveMethodAsUsage(java.lang.String, List<com.github.javaparser.resolution.types.ResolvedType>) ,public SymbolReference<? extends com.github.javaparser.resolution.declarations.ResolvedValueDeclaration> solveSymbolInParentContext(java.lang.String) ,public static SymbolReference<com.github.javaparser.resolution.declarations.ResolvedValueDeclaration> solveWith(com.github.javaparser.resolution.SymbolDeclarator, java.lang.String) <variables>protected com.github.javaparser.resolution.TypeSolver typeSolver,protected com.github.javaparser.ast.expr.FieldAccessExpr wrappedNode