public static StringWrapper javaTranslateTypeSpecHelper(StandardObject typeSpec, boolean functionP) {
    { Surrogate finalType = null;
      String typeName = "";

      { Surrogate testValue000 = Stella_Object.safePrimaryType(typeSpec);

        if (Surrogate.subtypeOfParametricTypeSpecifierP(testValue000)) {
          { ParametricTypeSpecifier typeSpec000 = ((ParametricTypeSpecifier)(typeSpec));

            if (StandardObject.arrayTypeSpecifierP(typeSpec000)) {
              return (ParametricTypeSpecifier.javaTranslateArrayType(typeSpec000));
            }
            else {
              return (StandardObject.javaTranslateTypeSpec(typeSpec000.specifierBaseType));
            }
          }
        }
        else if (Surrogate.subtypeOfSurrogateP(testValue000)) {
          { Surrogate typeSpec000 = ((Surrogate)(typeSpec));

            if (((StringWrapper)(KeyValueList.dynamicSlotValue(((Stella_Class)(typeSpec000.surrogateValue)).dynamicSlots, Stella.SYM_STELLA_CLASS_JAVA_NATIVE_TYPE, Stella.NULL_STRING_WRAPPER))).wrapperValue != null) {
              return (StringWrapper.wrapString(((Stella_Class)(typeSpec000.surrogateValue)).javaNativeType()));
            }
            else {
              finalType = ((Stella_Class)(typeSpec000.surrogateValue)).classType;
              typeName = StringWrapper.javaTranslateClassNamestring(StringWrapper.wrapString(finalType.symbolName)).wrapperValue;
              if (!Module.omitJavaPackagePrefixP(finalType.homeModule(), finalType.symbolName)) {
                return (StringWrapper.wrapString(Module.javaPackagePrefix(finalType.homeModule(), ".") + typeName));
              }
              else if (functionP &&
                  Stella_Class.classNameConflictsWithSlotNameP(((Stella_Class)(Stella.$CURRENT_JAVA_OUTPUT_CLASS$.get())), typeName)) {
                return (StringWrapper.wrapString(Module.javaPackagePrefix(finalType.homeModule(), ".") + typeName));
              }
              else {
                return (StringWrapper.wrapString(typeName));
              }
            }
          }
        }
        else {
          { OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

            stream000.nativeStream.print("`" + testValue000 + "' is not a valid case option");
            throw ((StellaException)(StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace()));
          }
        }
      }
    }
  }