jdk 6-compatible

This commit is contained in:
Alexey Kudravtsev
2017-05-17 14:40:26 +03:00
parent a16b875656
commit 18c3ec3078
2 changed files with 3 additions and 5 deletions
@@ -16,6 +16,7 @@
package com.intellij.codeInspection.ex;
import com.intellij.ReviseWhenPortedToJDK;
import com.intellij.codeInsight.FileModificationService;
import com.intellij.codeInspection.CommonProblemDescriptor;
import com.intellij.codeInspection.InspectionManager;
@@ -28,7 +29,6 @@ import com.intellij.codeInspection.ui.InspectionResultsView;
import com.intellij.codeInspection.ui.InspectionTree;
import com.intellij.icons.AllIcons;
import com.intellij.ide.DataManager;
import com.intellij.ReviseWhenPortedToJDK;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.actionSystem.ex.CustomComponentAction;
import com.intellij.openapi.application.ApplicationManager;
@@ -116,6 +116,7 @@ public class QuickFixAction extends AnAction implements CustomComponentAction {
}
@Override
@ReviseWhenPortedToJDK("9")
public void actionPerformed(final AnActionEvent e) {
final InspectionResultsView view = getInvoker(e);
final InspectionTree tree = view.getTree();
@@ -123,7 +124,7 @@ public class QuickFixAction extends AnAction implements CustomComponentAction {
Ref<CommonProblemDescriptor[]> descriptors = Ref.create();
Set<VirtualFile> readOnlyFiles = new THashSet<>();
//TODO revise when jdk9 arrives. Until then this redundant cast is a workaround to compile under jdk9 b169
if (!ProgressManager.getInstance().runProcessWithProgressSynchronously((@ReviseWhenPortedToJDK("9") Runnable)() -> ReadAction.run(() -> {
if (!ProgressManager.getInstance().runProcessWithProgressSynchronously((Runnable)() -> ReadAction.run(() -> {
final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
indicator.setText("Checking problem descriptors...");
descriptors.set(tree.getSelectedDescriptors(true, readOnlyFiles, false, false));
@@ -15,15 +15,12 @@
*/
package com.intellij;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Use to mark places in code which are hacks or workarounds which are supposed to be fixed or reworked in the new shiny JDK of the specified version
*/
@Target({ElementType.METHOD,ElementType.TYPE,ElementType.TYPE_USE,ElementType.ANNOTATION_TYPE,ElementType.CONSTRUCTOR,ElementType.FIELD,ElementType.PARAMETER,ElementType.LOCAL_VARIABLE,ElementType.PACKAGE,ElementType.TYPE_PARAMETER})
@Retention(RetentionPolicy.SOURCE)
public @interface ReviseWhenPortedToJDK {
String value(); // JDK major version