Class AbstractXbaseCompiler

  • Direct Known Subclasses:
    TypeConvertingCompiler

    public abstract class AbstractXbaseCompiler
    extends java.lang.Object
    • Constructor Detail

      • AbstractXbaseCompiler

        public AbstractXbaseCompiler()
    • Method Detail

      • findKnownTopLevelType

        protected org.eclipse.xtext.common.types.JvmType findKnownTopLevelType​(java.lang.Class<?> rawType,
                                                                               org.eclipse.emf.common.notify.Notifier context)
      • findKnownType

        protected org.eclipse.xtext.common.types.JvmType findKnownType​(java.lang.Class<?> rawType,
                                                                       org.eclipse.emf.common.notify.Notifier context)
      • newTypeReferenceOwner

        protected ITypeReferenceOwner newTypeReferenceOwner​(org.eclipse.emf.ecore.EObject context)
      • toLightweight

        protected LightweightTypeReference toLightweight​(org.eclipse.xtext.common.types.JvmTypeReference reference,
                                                         org.eclipse.emf.ecore.EObject context)
      • generateCheckedExceptionHandling

        protected void generateCheckedExceptionHandling​(ITreeAppendable appendable)
      • canCompileToJavaExpression

        protected boolean canCompileToJavaExpression​(XExpression expression,
                                                     ITreeAppendable appendable)
      • internalCanCompileToJavaExpression

        protected boolean internalCanCompileToJavaExpression​(XExpression expression,
                                                             ITreeAppendable appendable)
        Parameters:
        expression - to be used by subtypes
        appendable - to be used by subtypes
      • compile

        public ITreeAppendable compile​(XExpression obj,
                                       ITreeAppendable parentAppendable,
                                       org.eclipse.xtext.common.types.JvmTypeReference expectedReturnType,
                                       java.util.Set<org.eclipse.xtext.common.types.JvmTypeReference> declaredExceptions)
      • hasJvmConstructorCall

        protected boolean hasJvmConstructorCall​(XExpression obj)
      • needsSneakyThrow

        protected boolean needsSneakyThrow​(XExpression obj,
                                           java.util.Collection<org.eclipse.xtext.common.types.JvmTypeReference> declaredExceptions)
      • hasUnhandledException

        protected boolean hasUnhandledException​(java.util.List<LightweightTypeReference> thrownExceptions,
                                                java.util.Collection<org.eclipse.xtext.common.types.JvmTypeReference> declaredExceptions)
      • isUnhandledException

        protected boolean isUnhandledException​(LightweightTypeReference thrownException,
                                               java.util.Collection<org.eclipse.xtext.common.types.JvmTypeReference> declaredExceptions)
      • isEarlyExit

        protected boolean isEarlyExit​(XExpression expr)
      • isPrimitiveVoid

        protected boolean isPrimitiveVoid​(org.eclipse.xtext.common.types.JvmTypeReference typeRef)
      • getType

        protected org.eclipse.xtext.common.types.JvmTypeReference getType​(XExpression expr)
      • getType

        protected org.eclipse.xtext.common.types.JvmTypeReference getType​(org.eclipse.xtext.common.types.JvmIdentifiableElement identifiable)
      • getLightweightType

        protected LightweightTypeReference getLightweightType​(org.eclipse.xtext.common.types.JvmIdentifiableElement identifiable)
      • getResolvedTypes

        protected IResolvedTypes getResolvedTypes​(org.eclipse.emf.ecore.EObject obj)
      • getExpectedType

        protected org.eclipse.xtext.common.types.JvmTypeReference getExpectedType​(XExpression expr)
      • isPrimitiveVoid

        protected boolean isPrimitiveVoid​(XExpression xExpression)
      • internalToJavaStatement

        protected final void internalToJavaStatement​(XExpression obj,
                                                     ITreeAppendable builder,
                                                     boolean isReferenced)
      • doInternalToJavaStatement

        protected void doInternalToJavaStatement​(XExpression obj,
                                                 ITreeAppendable builder,
                                                 boolean isReferenced)
      • _toJavaStatement

        public void _toJavaStatement​(XExpression func,
                                     ITreeAppendable b,
                                     boolean isReferenced)
        Parameters:
        b - the appendable, unused, but necessary for dispatching purpose
        isReferenced - unused, but necessary for dispatching purpose
      • _toJavaExpression

        public void _toJavaExpression​(XExpression func,
                                      ITreeAppendable b)
        Parameters:
        b - the appendable, unused, but necessary for dispatching purpose
      • serialize

        protected void serialize​(org.eclipse.xtext.common.types.JvmTypeReference type,
                                 org.eclipse.emf.ecore.EObject context,
                                 ITreeAppendable appendable)
      • serialize

        protected void serialize​(org.eclipse.xtext.common.types.JvmTypeReference type,
                                 org.eclipse.emf.ecore.EObject context,
                                 ITreeAppendable appendable,
                                 boolean withoutConstraints,
                                 boolean paramsToWildcard)
      • serialize

        protected void serialize​(org.eclipse.xtext.common.types.JvmTypeReference type,
                                 org.eclipse.emf.ecore.EObject context,
                                 ITreeAppendable appendable,
                                 boolean withoutConstraints,
                                 boolean paramsToWildcard,
                                 boolean paramsToObject,
                                 boolean allowPrimitives)
      • isReferenceToForeignTypeParameter

        protected boolean isReferenceToForeignTypeParameter​(org.eclipse.xtext.common.types.JvmTypeReference reference,
                                                            org.eclipse.emf.ecore.EObject context)
      • resolveMultiType

        protected org.eclipse.xtext.common.types.JvmTypeReference resolveMultiType​(org.eclipse.xtext.common.types.JvmTypeReference typeRef,
                                                                                   org.eclipse.emf.ecore.EObject context)
      • getVarName

        protected java.lang.String getVarName​(java.lang.Object ex,
                                              ITreeAppendable appendable)
      • getFavoriteVariableName

        protected java.lang.String getFavoriteVariableName​(org.eclipse.emf.ecore.EObject ex)
      • makeJavaIdentifier

        protected java.lang.String makeJavaIdentifier​(java.lang.String name)
      • getDefaultValueLiteral

        protected java.lang.String getDefaultValueLiteral​(XExpression expr)
      • isVariableDeclarationRequired

        protected boolean isVariableDeclarationRequired​(XExpression expr,
                                                        ITreeAppendable b,
                                                        boolean recursive)
        whether an expression needs to be declared in a statement If an expression has side effects this method must return true for it.
        Parameters:
        expr - the checked expression
        b - the appendable which represents the current compiler state
        recursive - determines if the siblings of the expression shall be investigated too to determine the is variable declaration required status
      • getReferenceName

        protected java.lang.String getReferenceName​(XExpression expr,
                                                    ITreeAppendable b)
        Returns:
        the variable name under which the result of the expression is stored. Returns null if the expression hasn't been assigned to a local variable before.