Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-3601

Error when using Jackpot to add @SuppressWarning annotation

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • java - Hints
    • None

    Description

      Me and Tomáš Hůrka were trying to write a rule to add @SuppressWarnings annotation to all class from a project:

      'SuppressWarnings in all classes':
      $mods$ class $name extends $extends$ implements $implements$

      { $members$; }
      =>
      'Do it!':
      @SuppressWarnings("all") $mods$ class $name extends $extends$ implements $implements$ { $members$; }

      ;;

      this is the error that gets generated when the "Do It!" action is invoked:

      java.lang.ClassCastException: com.sun.tools.javac.tree.JCTree$JCCompilationUnit cannot be cast to com.sun.source.tree.ClassTree
      at org.netbeans.spi.java.hints.JavaFixUtilities$JavaFixRealImpl.performRewrite(JavaFixUtilities.java:525)
      at org.netbeans.spi.java.hints.JavaFix$1.process(JavaFix.java:171)
      at org.netbeans.modules.java.hints.spiimpl.JavaFixImpl$1.run(JavaFixImpl.java:80)
      at org.netbeans.modules.java.hints.spiimpl.JavaFixImpl$1.run(JavaFixImpl.java:74)
      at org.netbeans.api.java.source.JavaSource$1.run(JavaSource.java:673)
      at org.netbeans.api.java.source.JavaSource$1.run(JavaSource.java:663)
      at org.netbeans.api.java.source.JavaSource$MultiTask.run(JavaSource.java:502)
      at org.netbeans.modules.parsing.impl.TaskProcessor.callUserTask(TaskProcessor.java:586)

      Attachments

        Activity

          People

            jlahoda Jan Lahoda
            jtulach Jaroslav Tulach
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: