Thread overview
overriding methods
Apr 05, 2016
stunaep
Apr 05, 2016
Adam D. Ruppe
Apr 05, 2016
stunaep
Apr 05, 2016
Adam D. Ruppe
Apr 05, 2016
Ali Çehreli
Apr 05, 2016
pineapple
April 05, 2016
I get a deprecation warning with @Override, but I was unable to find the proper way to do it.
Am I meant to add override before the method like this?
>override public void startThread(Thread t, int pri) {
>    ...
>}
Am I meant to wrap the entire method in override { } like this?
> override {
>    public void startThread(Thread t, int pri) {
>        ...
>    }
> }

Both of them compile, so I'm wondering which to use. Is override {} supposed to be for adding multiple methods inside to avoid writing override before each method, or is putting override in front of the method without brackets just wrong?

April 05, 2016
On Tuesday, 5 April 2016 at 18:38:43 UTC, stunaep wrote:
> I get a deprecation warning with @Override, but I was unable to find the proper way to do it.

What error message exactly are you getting and on what code?

Both styles you put there should work equally well.
April 05, 2016
On Tuesday, 5 April 2016 at 18:42:33 UTC, Adam D. Ruppe wrote:
> On Tuesday, 5 April 2016 at 18:38:43 UTC, stunaep wrote:
>> I get a deprecation warning with @Override, but I was unable to find the proper way to do it.
>
> What error message exactly are you getting and on what code?
>
> Both styles you put there should work equally well.

I had no error on the examples I posted, only when using @Override previously. It just says to use override attribute instead of @Override

source\game\client.d(8,20): Deprecation: implicitly overriding base class method game.GameWindow.startThread with game.client.Client.startThread deprecated; add 'override' attribute
source\game\client.d(7,3): Error: undefined identifier 'Override'
April 05, 2016
On Tuesday, 5 April 2016 at 18:54:39 UTC, stunaep wrote:
> I had no error on the examples I posted, only when using @Override previously. It just says to use override attribute instead of @Override
>
> source\game\client.d(8,20): Deprecation: implicitly overriding base class method game.GameWindow.startThread with game.client.Client.startThread deprecated; add 'override' attribute
> source\game\client.d(7,3): Error: undefined identifier 'Override'

Yeah, that just means use the override keyword on the method. There is no @Override thing, it is a plain lowercase keyword.
April 05, 2016
On 04/05/2016 11:54 AM, stunaep wrote:

> when using @Override previously. It just says to use override
> attribute instead of @Override

> source\game\client.d(7,3): Error: undefined identifier 'Override'

Note that it doesn't say _instead of Override_. Override is an undefined symbol in your code. @Override is user defined attribute (UDA) syntax. The programmer is responsible for defining the semantics of user defined attributes.

Ali

April 05, 2016
On Tuesday, 5 April 2016 at 18:54:39 UTC, stunaep wrote:
> I had no error on the examples I posted, only when using @Override previously. It just says to use override attribute instead of @Override

Unlike in Java, D's override indicator doesn't look like an annotation, it's just a keyword placed before a method along the same lines as "static" or "public" or "protected".