Skip to content

Commit

Permalink
test for INCOMPATIBLE_RETURN_TYPE
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenzoBettini committed Feb 8, 2024
1 parent 643587e commit a709a53
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,14 @@ public void testWildcardSuperType() throws Exception {
validationHelper.assertNoErrors(model);
}

@Test public void testOverrideIncompatbileReturnType() throws Exception {
var source = "class Foo extends test.SuperTypeClass { def Integer stringMethod() {null} }";
var model = parse(source);
validationHelper.assertError(model, MY_METHOD, INCOMPATIBLE_RETURN_TYPE,
source.indexOf("Integer"), "Integer".length(),
"incompatible", "stringMethod");
}

@Test public void testOverrideHides() throws Exception {
var source = "class Foo extends test.SuperTypeClass { def private void foo() {} }";
var model = parse(source);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,7 @@ public abstract class SuperTypeClass {
public void foo() {
}

public String stringMethod() {
return null;
}
}

0 comments on commit a709a53

Please sign in to comment.