private boolean tryToUseSourceAsAWorkaround() {
    if (element.getKind() != ElementKind.METHOD) {
      // we don't bother with non-method attributes
      // (like factory builder, where attributes are parameters)
      return false;
    }

    CharSequence returnTypeString = SourceExtraction.getReturnTypeString((ExecutableElement) element);
    if (returnTypeString.length() == 0 && sourceExtractionCache != null) {
      try {
        SourceStructureGet sourceStructure = sourceExtractionCache.readCachedSourceGet();

        if (sourceStructure != null) {
          String accessorPath = computePath((ExecutableElement) element);
          returnTypeString = sourceStructure.getReturnType(accessorPath);
        }
      } catch (Error | RuntimeException bestEffortsMiserablyFailed) {
        return false;
      }
    }

    if (returnTypeString.length() == 0) {
      // no source could be extracted for some reason, workaround will not work
      return false;
    }

    Entry<String, List<String>> extractedTypes = SourceTypes.extract(returnTypeString);

    // forces source imports based resolution,
    // we should not rely that types would be fully qualified
    Entry<String, List<String>> resolvedTypes = resolveTypes(extractedTypes);

    this.rawTypeName = resolvedTypes.getKey();
    this.workaroundTypeParameters = resolvedTypes.getValue();
    this.workaroundTypeString = SourceTypes.stringify(resolvedTypes);

    // workaround may have successed, need to continue with whatever we have
    return true;
  }
Encapsulates routines and various hacks for get relevant strings for the raw types and type
parameters, while attempting to resolve unresolved types using source imports.
value-processor/src/org/immutables/value/processor/meta/TypeStringProvider.java