From 365f1fa4489ada3ce337f109de74ad14623fe7da Mon Sep 17 00:00:00 2001 From: Lorenzo Bettini Date: Sat, 30 Dec 2023 11:05:04 +0100 Subject: [PATCH] added test with anonymous class not implementing abstract methods --- .../core/tests/validation/OverrideValidationTest.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/org.eclipse.xtend.core.tests/src/org/eclipse/xtend/core/tests/validation/OverrideValidationTest.java b/org.eclipse.xtend.core.tests/src/org/eclipse/xtend/core/tests/validation/OverrideValidationTest.java index 9598e14e999..d9658b73199 100644 --- a/org.eclipse.xtend.core.tests/src/org/eclipse/xtend/core/tests/validation/OverrideValidationTest.java +++ b/org.eclipse.xtend.core.tests/src/org/eclipse/xtend/core/tests/validation/OverrideValidationTest.java @@ -966,6 +966,14 @@ public void testClassMustBeAbstract_06() throws Exception { "The anonymous subclass of Runnable does not implement run()"); } + @Test public void testAnonymousClassMustBeAbstract_1() throws Exception { + var source = "class Foo { val foo = new Runnable() { int i; } }"; + XtendClass xtendClass = clazz(source); + helper.assertError(xtendClass, ANONYMOUS_CLASS, ANONYMOUS_CLASS_MISSING_MEMBERS, + source.indexOf("new Runnable()"), "new Runnable()".length(), + "The anonymous subclass of Runnable does not implement run()"); + } + @Test public void testAnonymousClassIncompatibleSignature_0() throws Exception { XtendClass xtendClass = clazz("class Foo { val foo = new Runnable() { override run(int x) {} } }"); helper.assertError(xtendClass, XTEND_FUNCTION, OBSOLETE_OVERRIDE);