Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
None
-
None
-
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$
=>
'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)