Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipse-dev] New unused method/type/ctor/field diagnostics from Java compiler.

eclipse-dev-bounces@xxxxxxxxxxx wrote on 26/02/2009 02:34:15:

> It seems more than a little presumptive to just have this enabled
> when you can't fairly estimate how much source will suddenly be
> flagged as erroneous.  Is there any way to disable this diagnostic?


1. Either on a project specific basis or on a workspace basis,
you can configure the nature of diagnostic to be:

    - IGNORED altogether,
    - a WARNING, (the default setting)
    - an ERROR.

Look under Preferences + Java + Compiler + Errors/Warnings + Unnecessary code +
                        Unused local/private member.

2. You can always annotate an entity and suppress warnings about it. For example, in the
code below:

public class Boo {
        private void goo() {}
        private void zoo(int a) {}

the compiler will warn about zoo() being unused and will NOT complain
about goo() being unused.

3. These warnings are not new. They have existed for a long time, the recent
behavior change being that they are being emitted in more contexts than we used
to previously. As the OP noted, the compiler has begun warning about an inner
private class's methods/fields/types being unused.


Back to the top