예제 #1
0
  @Check
  public void checkMechanoidLibOnClasspath(Model m) {
    JvmType type = typeReferences.findDeclaredType(MechanoidPlugin.MECHANOID_LIB_CLASS, m);

    if (type == null) {
      error(
          "mechanoid.jar is required in your /libs folder or on the classpath",
          SqliteModelPackage.Literals.MODEL__PACKAGE_NAME,
          MechanoidIssueCodes.MISSING_MECHANOID_LIBS);
    }
  }
예제 #2
0
  protected JvmGenericType transform(XtendClass source, boolean prelinkingPhase) {
    JvmGenericType inferredJvmType = typesFactory.createJvmGenericType();
    source.eResource().getContents().add(inferredJvmType);
    associator.associatePrimary(source, inferredJvmType);
    inferredJvmType.setPackageName(source.getPackageName());
    inferredJvmType.setSimpleName(source.getName());
    inferredJvmType.setVisibility(JvmVisibility.PUBLIC);
    if (!prelinkingPhase) {
      JvmAnnotationType annotation =
          (JvmAnnotationType) typeReferences.findDeclaredType(SuppressWarnings.class, source);
      if (annotation != null) {
        JvmAnnotationReference suppressWarnings = typesFactory.createJvmAnnotationReference();
        suppressWarnings.setAnnotation(annotation);
        JvmStringAnnotationValue annotationValue = typesFactory.createJvmStringAnnotationValue();
        annotationValue.getValues().add("all");
        suppressWarnings.getValues().add(annotationValue);
        inferredJvmType.getAnnotations().add(suppressWarnings);
      }
      addDefaultConstructor(source, inferredJvmType);
      if (source.getExtends() == null) {
        JvmTypeReference typeRefToObject = typeReferences.getTypeForName(Object.class, source);
        if (typeRefToObject != null) inferredJvmType.getSuperTypes().add(typeRefToObject);
      } else {
        inferredJvmType.getSuperTypes().add(cloneWithProxies(source.getExtends()));
      }
      for (JvmTypeReference intf : source.getImplements()) {
        inferredJvmType.getSuperTypes().add(cloneWithProxies(intf));
      }
      copyAndFixTypeParameters(source.getTypeParameters(), inferredJvmType);
      for (XtendMember member : source.getMembers()) {
        if (member instanceof XtendField
            || (member instanceof XtendFunction && ((XtendFunction) member).getName() != null)
            || member instanceof XtendConstructor) {
          transform(member, inferredJvmType);
        }
      }
      appendSyntheticDispatchMethods(source, inferredJvmType);
      computeInferredReturnTypes(inferredJvmType);
      jvmTypesBuilder.translateAnnotationsTo(source.getAnnotations(), inferredJvmType);
      jvmTypesBuilder.setDocumentation(inferredJvmType, jvmTypesBuilder.getDocumentation(source));

      nameClashResolver.resolveNameClashes(inferredJvmType);
    }
    return inferredJvmType;
  }