@ Override public void endVisit ( VariableDeclarationFragment fragment ) { //TODO(malvania): Add field to elementReferenceMap when field detection is enabled and the // ElementUtil.getBinaryName() method doesn't break when called on a static block's // ExecutableElement. //String fieldID = stitchFieldIdentifier(fragment); //elementReferenceMap.putIfAbsent(fieldID, new FieldReferenceNode(fragment)); Element element = fragment . getVariableElement ( ) . getEnclosingElement ( ) ; if ( element instanceof TypeElement ) { TypeElement type = ( TypeElement ) element ; if ( ElementUtil . isPublic ( fragment . getVariableElement ( ) ) ) { ClassReferenceNode node = ( ClassReferenceNode ) elementReferenceMap . get ( stitchClassIdentifier ( type ) ) ; if ( node == null ) { node = new ClassReferenceNode ( type ) ; } node . containsPublicField = true ; elementReferenceMap . putIfAbsent ( stitchClassIdentifier ( type ) , node ) ; } } }
and resolve the type by its name using a resolve method in the parser environment .