You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by "Austin Stephens (JIRA)" <ji...@apache.org> on 2018/07/16 17:40:00 UTC

[jira] [Created] (NETBEANS-1050) Slay all of the warnings! (Root task)

Austin Stephens created NETBEANS-1050:
-----------------------------------------

             Summary: Slay all of the warnings! (Root task)
                 Key: NETBEANS-1050
                 URL: https://issues.apache.org/jira/browse/NETBEANS-1050
             Project: NetBeans
          Issue Type: Task
            Reporter: Austin Stephens


(It is recommended you read this with good humor, like Think Geek)

While building Netbeans, a number of warnings show up. We should fix that.

For the sake of organization, we should probably open a new task for each module. This will be the root/umbrella task. *The main project heads should take a look at this task and update it with official stuff.*

We should probably slay warnings in this order:
 # Warnings that don't require changes to other modules (like API changes). Examples would be changing raw types to non-raw types or something that would cause another module to not build after the warning has be properly dealt with.
 # Warnings that Do require changes to other modules (see previous entry for examples)
 # Those evil warnings that don't leave any links behind. Here are some examples:
{noformat}
warning: [options] bootstrap class path not set in conjunction with -source 1.7
/Volumes/Data/Code/<snip>/incubator-netbeans/nbbuild/build/public-package-jars/org-netbeans-api-annotations-common.jar(org/netbeans/api/annotations/common/NonNull.class): warning: Cannot find annotation method 'when()' in type 'Nonnull': class file for javax.annotation.Nonnull not found
warning: unknown enum constant When.ALWAYS
  reason: class file for javax.annotation.meta.When not found
/Volumes/Data/Code/<snip>/incubator-netbeans/nbbuild/build/public-package-jars/org-netbeans-api-annotations-common.jar(org/netbeans/api/annotations/common/NullAllowed.class): warning: Cannot find annotation method 'when()' in type 'Nonnull'
warning: unknown enum constant When.MAYBE
/Volumes/Data/Code/<snip>/incubator-netbeans/nbbuild/build/public-package-jars/org-netbeans-api-annotations-common.jar(org/netbeans/api/annotations/common/CheckForNull.class): warning: Cannot find annotation method 'when()' in type 'Nonnull'
warning: unknown enum constant When.MAYBE
warning: Supported source version 'RELEASE_6' from annotation processor 'org.netbeans.modules.openide.util.NbBundleProcessor' less than -source '1.7'
warning: No processor claimed any of these annotations: org.netbeans.api.annotations.common.NullAllowed,org.netbeans.api.annotations.common.CheckForNull,org.netbeans.api.annotations.common.NonNull{noformat}

 The following guide-lines should be followed while slaying warnings:
 * You shall make every effort to resolve the warning without suppressing it. This may involve one or more of the following (non-inclusive):
 ** Adding a new variable so assignments are not done to method parameters
 ** Adding a variable followed with an "assert var != null" to let the IDE know that it can't be null
 ** In the second pass, breaking APIs so raw types and such are not used if possible
 * You shall suppress the warning on the *smallest scope possible*. Why? Warnings exist for a reason. They are there to tell you that you did something wrong, unless that was your intention and you know what you are doing. That is what @SuppressWarnings is for. If (heaven forbid) you suppress all warnings in a class file, you may be (figuratively) slain, so DON'T!
 * The following (in my opinion) is a good way to suppress a warning on a line:

{code:java}
@SuppressWarning("unchecked")
Object shush = bar = (Foo<Bar>)foo;{code}

 * You may want to add dummy return values to some void methods to enable suppression via the above method.
 * If you do suppress a warning, and it is not obvious why it was suppressed, *document it*! Leave a comment that says why it was suppressed. The following is an example:

{code:java}
//the following is intentional
//the method is expected to return an constant array
@SuppressWarnings("OverridableMethodCallInConstructor")
List<Foo> shush = ImmutableList.copyOf(getSupportedTypes());{code}

I think that is all for now...



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists