Search in sources :

Example 61 with Procedure0

use of org.eclipse.xtext.xbase.lib.Procedures.Procedure0 in project xtext-xtend by eclipse.

the class Bug464136Processor method doTransform.

@Override
public void doTransform(final MutableClassDeclaration annotatedClass, @Extension final TransformationContext context) {
    final Procedure0 _function = () -> {
        throw new LinkageError("Just a test :-/");
    };
    context.validateLater(_function);
}
Also used : Procedure0(org.eclipse.xtext.xbase.lib.Procedures.Procedure0)

Example 62 with Procedure0

use of org.eclipse.xtext.xbase.lib.Procedures.Procedure0 in project xtext-xtend by eclipse.

the class CheckMutableClassDeclarationProcessor method doTransform.

@Override
public void doTransform(final MutableClassDeclaration annotatedClass, @Extension final TransformationContext context) {
    final Procedure0 _function = () -> {
        annotatedClass.setImplementedInterfaces(null);
    };
    MutableAssert.<IllegalArgumentException>assertThrowable(IllegalArgumentException.class, "superIntefaces cannot be null", _function);
    final Procedure0 _function_1 = () -> {
        annotatedClass.setImplementedInterfaces(Collections.<TypeReference>unmodifiableList(CollectionLiterals.<TypeReference>newArrayList((TypeReference) null)));
    };
    MutableAssert.<IllegalArgumentException>assertThrowable(IllegalArgumentException.class, "superIntefaces cannot contain null", _function_1);
    annotatedClass.setImplementedInterfaces(CollectionLiterals.<TypeReference>emptyList());
    final Procedure1<String> _function_2 = (String identifier) -> {
        annotatedClass.addTypeParameter(identifier).remove();
    };
    MutableAssert.assertValidJavaIdentifier("name", _function_2);
    final Procedure0 _function_3 = () -> {
        annotatedClass.addTypeParameter("T", ((TypeReference[]) null));
    };
    MutableAssert.<IllegalArgumentException>assertThrowable(IllegalArgumentException.class, "upperBounds cannot be null", _function_3);
    final Procedure0 _function_4 = () -> {
        annotatedClass.addTypeParameter("T", new TypeReference[] { null });
    };
    MutableAssert.<IllegalArgumentException>assertThrowable(IllegalArgumentException.class, "upperBounds cannot contain null", _function_4);
    final MutableTypeParameterDeclaration typeParameter = annotatedClass.addTypeParameter("T");
    final Procedure1<String> _function_5 = (String identifier) -> {
        typeParameter.setSimpleName(identifier);
    };
    MutableAssert.assertValidJavaIdentifier("name", _function_5);
    final Procedure0 _function_6 = () -> {
        typeParameter.setUpperBounds(null);
    };
    MutableAssert.<IllegalArgumentException>assertThrowable(IllegalArgumentException.class, "upperBounds cannot be null", _function_6);
    final Procedure0 _function_7 = () -> {
        typeParameter.setUpperBounds(Collections.<TypeReference>unmodifiableList(CollectionLiterals.<TypeReference>newArrayList((TypeReference) null)));
    };
    MutableAssert.<IllegalArgumentException>assertThrowable(IllegalArgumentException.class, "upperBounds cannot contain null", _function_7);
    typeParameter.setUpperBounds(CollectionLiterals.<TypeReference>emptyList());
    final Procedure0 _function_8 = () -> {
        annotatedClass.setSimpleName(null);
    };
    MutableAssert.<UnsupportedOperationException>assertThrowable(UnsupportedOperationException.class, "The type cannot be renamed.", _function_8);
    final Procedure1<String> _function_9 = (String identifier) -> {
        final Procedure1<MutableFieldDeclaration> _function_10 = (MutableFieldDeclaration it) -> {
            it.setType(context.newTypeReference(String.class));
        };
        annotatedClass.addField(identifier, _function_10).remove();
    };
    MutableAssert.assertValidJavaIdentifier("name", _function_9);
    final Procedure0 _function_10 = () -> {
        annotatedClass.addField("foo", null);
    };
    MutableAssert.<IllegalArgumentException>assertThrowable(IllegalArgumentException.class, "initializer cannot be null", _function_10);
    final Procedure1<String> _function_11 = (String identifier) -> {
        final Procedure1<MutableMethodDeclaration> _function_12 = (MutableMethodDeclaration it) -> {
        };
        annotatedClass.addMethod(identifier, _function_12).remove();
    };
    MutableAssert.assertValidJavaIdentifier("name", _function_11);
    final Procedure0 _function_12 = () -> {
        annotatedClass.addMethod("foo", null);
    };
    MutableAssert.<IllegalArgumentException>assertThrowable(IllegalArgumentException.class, "initializer cannot be null", _function_12);
    final Procedure0 _function_13 = () -> {
        annotatedClass.addConstructor(null);
    };
    MutableAssert.<IllegalArgumentException>assertThrowable(IllegalArgumentException.class, "initializer cannot be null", _function_13);
    final Procedure1<MutableMethodDeclaration> _function_14 = (MutableMethodDeclaration it) -> {
    };
    final MutableMethodDeclaration method = annotatedClass.addMethod("foo", _function_14);
    annotatedClass.findDeclaredMethod(null);
    annotatedClass.findDeclaredMethod("foo");
    final Procedure0 _function_15 = () -> {
        annotatedClass.findDeclaredMethod("foo", ((TypeReference[]) null));
    };
    MutableAssert.<IllegalArgumentException>assertThrowable(IllegalArgumentException.class, "parameterTypes cannot be null", _function_15);
    final Procedure0 _function_16 = () -> {
        annotatedClass.findDeclaredMethod("foo", new TypeReference[] { null });
    };
    MutableAssert.<IllegalArgumentException>assertThrowable(IllegalArgumentException.class, "parameterTypes cannot contain null", _function_16);
    annotatedClass.findDeclaredMethod("foo", ((TypeReference[]) Conversions.unwrapArray(CollectionLiterals.<TypeReference>emptyList(), TypeReference.class)));
    method.remove();
    final Procedure0 _function_17 = () -> {
        annotatedClass.findDeclaredConstructor(((TypeReference[]) null));
    };
    MutableAssert.<IllegalArgumentException>assertThrowable(IllegalArgumentException.class, "parameterTypes cannot be null", _function_17);
    final Procedure0 _function_18 = () -> {
        annotatedClass.findDeclaredConstructor(new TypeReference[] { null });
    };
    MutableAssert.<IllegalArgumentException>assertThrowable(IllegalArgumentException.class, "parameterTypes cannot contain null", _function_18);
    annotatedClass.findDeclaredConstructor(((TypeReference[]) Conversions.unwrapArray(CollectionLiterals.<TypeReference>emptyList(), TypeReference.class)));
}
Also used : Procedure0(org.eclipse.xtext.xbase.lib.Procedures.Procedure0) MutableFieldDeclaration(org.eclipse.xtend.lib.macro.declaration.MutableFieldDeclaration) Procedure1(org.eclipse.xtext.xbase.lib.Procedures.Procedure1) MutableMethodDeclaration(org.eclipse.xtend.lib.macro.declaration.MutableMethodDeclaration) TypeReference(org.eclipse.xtend.lib.macro.declaration.TypeReference) MutableTypeParameterDeclaration(org.eclipse.xtend.lib.macro.declaration.MutableTypeParameterDeclaration)

Example 63 with Procedure0

use of org.eclipse.xtext.xbase.lib.Procedures.Procedure0 in project xtext-xtend by eclipse.

the class XtendEditorChangingClasspathTest method assertAddLibsToClasspath.

public void assertAddLibsToClasspath(final IJavaProject project) {
    final Procedure0 _function = () -> {
        this._xtendLibClasspathAdder.addLibsToClasspath(project, null);
    };
    Assert.assertNotNull(this.waitForCoarseGrainedEvent(_function));
}
Also used : Procedure0(org.eclipse.xtext.xbase.lib.Procedures.Procedure0)

Aggregations

Procedure0 (org.eclipse.xtext.xbase.lib.Procedures.Procedure0)63 Test (org.junit.Test)52 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)51 AbstractQueuedBuildDataTest (org.eclipse.xtend.ide.tests.builder.AbstractQueuedBuildDataTest)50 ITextEditor (org.eclipse.ui.texteditor.ITextEditor)5 Function1 (org.eclipse.xtext.xbase.lib.Functions.Function1)5 TypeReference (org.eclipse.xtend.lib.macro.declaration.TypeReference)4 Procedure1 (org.eclipse.xtext.xbase.lib.Procedures.Procedure1)4 IFile (org.eclipse.core.resources.IFile)2 MutableFieldDeclaration (org.eclipse.xtend.lib.macro.declaration.MutableFieldDeclaration)2 MutableInterfaceDeclaration (org.eclipse.xtend.lib.macro.declaration.MutableInterfaceDeclaration)2 MutableMethodDeclaration (org.eclipse.xtend.lib.macro.declaration.MutableMethodDeclaration)2 MutableTypeParameterDeclaration (org.eclipse.xtend.lib.macro.declaration.MutableTypeParameterDeclaration)2 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 URI (org.eclipse.emf.common.util.URI)1 Resource (org.eclipse.emf.ecore.resource.Resource)1 ResourceSet (org.eclipse.emf.ecore.resource.ResourceSet)1 IJavaProject (org.eclipse.jdt.core.IJavaProject)1 AnnotationReference (org.eclipse.xtend.lib.macro.declaration.AnnotationReference)1 MutableEnumerationTypeDeclaration (org.eclipse.xtend.lib.macro.declaration.MutableEnumerationTypeDeclaration)1