Skip to content

Commit

Permalink
added test with anonymous class not implementing abstract methods
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenzoBettini committed Jan 3, 2024
1 parent fd8c3bc commit 365f1fa
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 365f1fa

Please sign in to comment.