Laxystem
02/20/2025, 1:25 PMCharSequence
s?Laxystem
02/20/2025, 1:27 PMhho
02/20/2025, 2:18 PMCharSequence
s?
Of course not. A String is a CharSequence, but not every CharSequence is a String.Laxystem
02/20/2025, 2:21 PMString
is a `CharSequence`: I should be able to have my override accept more than required.hho
02/20/2025, 2:26 PMRobert Williams
02/20/2025, 2:48 PMclass Foo {
public void doThing(String s) { }
}
class Bar extends Foo {
@Override
public void doThing(CharSequence s) { }
}
error: method does not override or implement a method from a supertype
Laxystem
02/20/2025, 2:51 PMFoo.doThing
abstract, there's no error.Laxystem
02/20/2025, 2:51 PMLaxystem
02/20/2025, 2:51 PMRobert Williams
02/20/2025, 2:57 PMerror: Bar is not abstract and does not override abstract method doThing(String) in Foo
What Java/ JVM version are you using?Laxystem
02/20/2025, 2:57 PMRobert Williams
02/20/2025, 3:00 PMLaxystem
02/20/2025, 3:00 PMephemient
02/20/2025, 3:59 PMLaxystem
02/20/2025, 4:03 PMpublic interface Test {
void test(String x);
public class Impl implements Test {
@Override
public void test(CharSequence x) {
}
}
}
Produces no error for me.ephemient
02/20/2025, 4:13 PMLaxystem
02/20/2025, 4:13 PMVampire
02/20/2025, 5:27 PMLaxystem
02/20/2025, 6:06 PMLaxystem
02/20/2025, 6:06 PMephemient
02/20/2025, 6:15 PMVampire
02/20/2025, 6:17 PM@Vampire nope, syntax highlighting did workBasic syntax highlighting or full IntelliSense?
Laxystem
02/20/2025, 6:17 PMLaxystem
02/20/2025, 6:17 PMVampire
02/20/2025, 6:18 PMLaxystem
02/20/2025, 6:18 PMephemient
02/20/2025, 6:37 PMephemient
02/20/2025, 6:38 PMephemient
02/20/2025, 6:39 PMLaxystem
02/20/2025, 9:20 PMLaxystem
02/20/2025, 9:20 PMLaxystem
02/20/2025, 9:21 PMLaxystem
02/20/2025, 9:21 PMephemient
02/21/2025, 3:13 AMLaxystem
02/22/2025, 11:15 AMephemient
02/22/2025, 11:16 AMLaxystem
02/22/2025, 11:17 AMephemient
02/22/2025, 11:17 AMLaxystem
02/22/2025, 11:18 AM