diff --git a/org.eclipse.xtend.core.tests/src/org/eclipse/xtend/core/tests/validation/ValidationBug435020Test.xtend b/org.eclipse.xtend.core.tests/src/org/eclipse/xtend/core/tests/validation/ValidationBug435020Test.xtend index 71775e544be..198bc87de0c 100644 --- a/org.eclipse.xtend.core.tests/src/org/eclipse/xtend/core/tests/validation/ValidationBug435020Test.xtend +++ b/org.eclipse.xtend.core.tests/src/org/eclipse/xtend/core/tests/validation/ValidationBug435020Test.xtend @@ -42,7 +42,7 @@ class ValidationBug435020Test extends AbstractXtendTestCase { } @Test def void test_02() { - val c = parser.parse(''' + val source = ''' class Foo { def void foo() { new Object { @@ -50,12 +50,16 @@ class ValidationBug435020Test extends AbstractXtendTestCase { } } } - ''') - c.assertError(XtendPackage.Literals.XTEND_FIELD, IssueCodes.ANONYMOUS_CLASS_STATIC_FIELD) + ''' + val c = parser.parse(source) + c.assertError(XtendPackage.Literals.XTEND_FIELD, IssueCodes.ANONYMOUS_CLASS_STATIC_FIELD, + source.indexOf("static"), "static".length, + "A static field of an anonymous class must be final" + ) } @Test def void test_03() { - val c = parser.parse(''' + val source = ''' class Foo { def void foo() { new Object { @@ -63,12 +67,16 @@ class ValidationBug435020Test extends AbstractXtendTestCase { } } } - ''') - c.assertError(XtendPackage.Literals.XTEND_FIELD, IssueCodes.ANONYMOUS_CLASS_STATIC_FIELD) + ''' + val c = parser.parse(source) + c.assertError(XtendPackage.Literals.XTEND_FIELD, IssueCodes.ANONYMOUS_CLASS_STATIC_FIELD, + source.indexOf("Math.max(1, 2)"), "Math.max(1, 2)".length, + "must be initialized with a constant expression" + ) } @Test def void test_04() { - val c = parser.parse(''' + val source = ''' class Foo { def void foo() { new Object { @@ -77,8 +85,12 @@ class ValidationBug435020Test extends AbstractXtendTestCase { } } } - ''') - c.assertError(XtendPackage.Literals.XTEND_FUNCTION, IssueCodes.ANONYMOUS_CLASS_STATIC_METHOD) + ''' + val c = parser.parse(source) + c.assertError(XtendPackage.Literals.XTEND_FUNCTION, IssueCodes.ANONYMOUS_CLASS_STATIC_METHOD, + source.indexOf("static"), "static".length, + "A method of an anonymous class cannot be static" + ) } } \ No newline at end of file diff --git a/org.eclipse.xtend.core.tests/xtend-gen/org/eclipse/xtend/core/tests/validation/ValidationBug435020Test.java b/org.eclipse.xtend.core.tests/xtend-gen/org/eclipse/xtend/core/tests/validation/ValidationBug435020Test.java index daedd3de1cc..9051b87f11a 100644 --- a/org.eclipse.xtend.core.tests/xtend-gen/org/eclipse/xtend/core/tests/validation/ValidationBug435020Test.java +++ b/org.eclipse.xtend.core.tests/xtend-gen/org/eclipse/xtend/core/tests/validation/ValidationBug435020Test.java @@ -94,8 +94,11 @@ public void test_02() { _builder.newLine(); _builder.append("}"); _builder.newLine(); - final XtendFile c = this.parser.parse(_builder); - this.helper.assertError(c, XtendPackage.Literals.XTEND_FIELD, IssueCodes.ANONYMOUS_CLASS_STATIC_FIELD); + final String source = _builder.toString(); + final XtendFile c = this.parser.parse(source); + this.helper.assertError(c, XtendPackage.Literals.XTEND_FIELD, IssueCodes.ANONYMOUS_CLASS_STATIC_FIELD, + source.indexOf("static"), "static".length(), + "A static field of an anonymous class must be final"); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } @@ -124,8 +127,11 @@ public void test_03() { _builder.newLine(); _builder.append("}"); _builder.newLine(); - final XtendFile c = this.parser.parse(_builder); - this.helper.assertError(c, XtendPackage.Literals.XTEND_FIELD, IssueCodes.ANONYMOUS_CLASS_STATIC_FIELD); + final String source = _builder.toString(); + final XtendFile c = this.parser.parse(source); + this.helper.assertError(c, XtendPackage.Literals.XTEND_FIELD, IssueCodes.ANONYMOUS_CLASS_STATIC_FIELD, + source.indexOf("Math.max(1, 2)"), "Math.max(1, 2)".length(), + "must be initialized with a constant expression"); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } @@ -157,8 +163,11 @@ public void test_04() { _builder.newLine(); _builder.append("}"); _builder.newLine(); - final XtendFile c = this.parser.parse(_builder); - this.helper.assertError(c, XtendPackage.Literals.XTEND_FUNCTION, IssueCodes.ANONYMOUS_CLASS_STATIC_METHOD); + final String source = _builder.toString(); + final XtendFile c = this.parser.parse(source); + this.helper.assertError(c, XtendPackage.Literals.XTEND_FUNCTION, IssueCodes.ANONYMOUS_CLASS_STATIC_METHOD, + source.indexOf("static"), "static".length(), + "A method of an anonymous class cannot be static"); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); }