You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by "dennis lucero (Jira)" <ji...@apache.org> on 2020/02/04 18:12:00 UTC

[jira] [Assigned] (NETBEANS-3791) Unclear use of Java hint: “Illegal Use of instanceOf operator”

     [ https://issues.apache.org/jira/browse/NETBEANS-3791?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

dennis lucero reassigned NETBEANS-3791:
---------------------------------------

    Assignee: Jan Lahoda

> Unclear use of Java hint: “Illegal Use of instanceOf operator”
> --------------------------------------------------------------
>
>                 Key: NETBEANS-3791
>                 URL: https://issues.apache.org/jira/browse/NETBEANS-3791
>             Project: NetBeans
>          Issue Type: Improvement
>          Components: java - Hints
>         Environment: JDK 8 project, NetBeans running on JDK 13
>            Reporter: dennis lucero
>            Assignee: Jan Lahoda
>            Priority: Minor
>              Labels: hints
>
> In an annotation processor similar to
> {code:java}
> @SupportedAnnotationTypes("org.example.MyAnnotation")
> public final class MyGenerator 
>         extends javax.annotation.processing.AbstractProcessor {
>     @Override
>     public boolean process(
>             final Set<? extends TypeElement> annotations,
>             final RoundEnvironment roundEnvironment) {
>         final Set<? extends Element> elements
>                 = roundEnvironment.getElementsAnnotatedWith(MyAnnotation.class);
>         for (final Element element : elements) {
>             PackageElement packageElement = null;
>             for (Element currentElement = typeElement;
>                     currentElement != null;
>                     currentElement = currentElement.getEnclosingElement()) {
>                 if (currentElement instanceof PackageElement) { // Illegal Use of instanceOf
>                     packageElement = (PackageElement) currentElement;
>                     break;
>                 }
> {code}
> I get the warning “Illegal Use of instanceOf operator” (in the line with the comment). It is unclear why this use would be illegal, as it works fine.
> The description of the hint in the options should clearly say why it’s illegal to use instanceOf or, if this warning is obsolete, the hint should be removed.
> (According to http://wiki.netbeans.org/Java_Hints, this hint is disabled by default.)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
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