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/03 20:56:00 UTC
[jira] [Created] (NETBEANS-3791) Unclear use of Java hint: “Illegal Use of instanceOf operator”
dennis lucero created NETBEANS-3791:
---------------------------------------
Summary: 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
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.
--
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