mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java] remove unused field together with the javadoc (IDEA-293707)
GitOrigin-RevId: eefeda71df06e537d5a2d07119bb8724a70f5def
This commit is contained in:
committed by
intellij-monorepo-bot
parent
79aa35d1a0
commit
a263c47077
+4
-1
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInsight.daemon.impl.quickfix;
|
||||
|
||||
import com.intellij.psi.*;
|
||||
@@ -220,6 +220,9 @@ public final class RemoveUnusedVariableUtil {
|
||||
private static void deleteVariable(PsiVariable variable) {
|
||||
CommentTracker tracker = new CommentTracker();
|
||||
tracker.markUnchanged(variable.getInitializer()); // assume that initializer is used (e.g. inlined)
|
||||
if (variable instanceof PsiJavaDocumentedElement) {
|
||||
tracker.markUnchanged(((PsiJavaDocumentedElement)variable).getDocComment());
|
||||
}
|
||||
tracker.deleteAndRestoreComments(variable);
|
||||
}
|
||||
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Remove field 'k'" "true"
|
||||
import java.io.*;
|
||||
|
||||
class a {
|
||||
}
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Remove field 'k'" "true"
|
||||
import java.io.*;
|
||||
|
||||
class a {
|
||||
/**
|
||||
* Demo
|
||||
*/
|
||||
private int <caret>k;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user