mark place in code as needed attention when ported to JDK9

This commit is contained in:
Alexey Kudravtsev
2017-05-16 14:13:52 +03:00
parent 0eb0ac4699
commit 8986aa6847
2 changed files with 33 additions and 1 deletions
@@ -28,6 +28,7 @@ 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.internal.ReviseWhenPortedToJDK;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.actionSystem.ex.CustomComponentAction;
import com.intellij.openapi.application.ApplicationManager;
@@ -121,7 +122,8 @@ public class QuickFixAction extends AnAction implements CustomComponentAction {
try {
Ref<CommonProblemDescriptor[]> descriptors = Ref.create();
Set<VirtualFile> readOnlyFiles = new THashSet<>();
if (!ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> ReadAction.run(() -> {
//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(() -> {
final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
indicator.setText("Checking problem descriptors...");
descriptors.set(tree.getSelectedDescriptors(true, readOnlyFiles, false, false));
@@ -0,0 +1,30 @@
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.internal;
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();
}