@@ -162,6 +162,7 @@ public static WhereUsedElement create(CompilationInfo compiler, TreePath tree, b
162162 return create (compiler , tree , null , inTest , inPlatform , inDependency , inImport );
163163 }
164164
165+ @ SuppressWarnings ({"NestedAssignment" , "AssignmentToMethodParameter" })
165166 public static WhereUsedElement create (CompilationInfo compiler , TreePath tree , JavaWhereUsedFilters .ReadWrite access , boolean inTest , boolean inPlatform , boolean inDependency , AtomicBoolean inImport ) {
166167 CompilationUnitTree unit = tree .getCompilationUnit ();
167168 CharSequence content = compiler .getSnapshot ().getText ();
@@ -195,9 +196,7 @@ public static WhereUsedElement create(CompilationInfo compiler, TreePath tree, J
195196 if (TreeUtilities .CLASS_TREE_KINDS .contains (t .getKind ())) {
196197 int [] pos = treeUtils .findNameSpan ((ClassTree )t );
197198 if (pos == null ) {
198- Tree tr = tree .getParentPath ().getLeaf ();
199- if (tr instanceof NewClassTree ) {
200- NewClassTree newClass = (NewClassTree ) tr ;
199+ if (tree .getParentPath ().getLeaf () instanceof NewClassTree newClass ) {
201200 start = (int ) sp .getStartPosition (unit , newClass .getIdentifier ());
202201 end = (int ) sp .getEndPosition (unit , newClass .getIdentifier ());
203202 } else {
@@ -207,7 +206,7 @@ public static WhereUsedElement create(CompilationInfo compiler, TreePath tree, J
207206 start = end = (int ) sp .getStartPosition (unit , t );
208207 }
209208 // #213723 hotfix, happens for enum values
210- if (start < 0 ) {
209+ if (start < 0 || end < 0 ) {
211210 TreePath parentPath = tree .getParentPath ();
212211 if (parentPath != null && (parentPath = parentPath .getParentPath ()) != null
213212 && parentPath .getLeaf ().getKind () == Tree .Kind .VARIABLE ) {
0 commit comments