IDEA-172877 Provide a quick-fix on 'Not a statement' error message

This commit is contained in:
Tagir Valeev
2017-06-07 15:25:52 +07:00
parent d41b212fca
commit 535c113dba
12 changed files with 200 additions and 1 deletions

View File

@@ -0,0 +1,9 @@
// "Extract side effects" "true"
import java.util.concurrent.atomic.AtomicInteger;
public class Main {
public void test(AtomicInteger i) {
i.incrementAndGet();
i.incrementAndGet();
}
}

View File

@@ -0,0 +1,10 @@
// "Convert to 'if' statement" "true"
import java.io.File;
public class Main {
public void test(File f) {
if (!f.isDirectory()) {
f.mkdirs();
}
}
}

View File

@@ -0,0 +1,8 @@
// "Extract side effect" "true"
import java.util.concurrent.atomic.AtomicInteger;
public class Main {
public void test(AtomicInteger i) {
i.incrementAndGet();
}
}

View File

@@ -0,0 +1,8 @@
// "Extract side effects" "true"
import java.util.concurrent.atomic.AtomicInteger;
public class Main {
public void test(AtomicInteger i) {
i.incrementAndGet() <caret>+ i.incrementAndGet();
}
}

View File

@@ -0,0 +1,8 @@
// "Convert to 'if' statement" "true"
import java.io.File;
public class Main {
public void test(File f) {
f.isDirectory() |<caret>| f.mkdirs();
}
}

View File

@@ -0,0 +1,8 @@
// "Extract side effect" "true"
import java.util.concurrent.atomic.AtomicInteger;
public class Main {
public void test(AtomicInteger i) {
i.incrementAndGet() <caret>+ 2;
}
}

View File

@@ -0,0 +1,27 @@
/*
* 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.java.codeInsight.daemon.quickFix;
import com.intellij.codeInsight.daemon.quickFix.LightQuickFixParameterizedTestCase;
public class ExtractSideEffectsTest extends LightQuickFixParameterizedTestCase {
public void test() throws Exception { doAllTests(); }
@Override
protected String getBasePath() {
return "/codeInsight/daemonCodeAnalyzer/quickFix/extractSideEffects";
}
}