mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 13:02:30 +07:00
[java-intentions] More preview tests
GitOrigin-RevId: 4d6a5487576dbbc4aca9c89b067eec8218aff686
This commit is contained in:
committed by
intellij-monorepo-bot
parent
1361a10017
commit
49f4397ba0
@@ -3,6 +3,7 @@ package com.intellij.codeInsight.daemon.impl.quickfix;
|
||||
|
||||
import com.intellij.codeInsight.FileModificationService;
|
||||
import com.intellij.codeInsight.daemon.QuickFixBundle;
|
||||
import com.intellij.codeInsight.intention.FileModifier;
|
||||
import com.intellij.codeInsight.intention.impl.BaseIntentionAction;
|
||||
import com.intellij.codeInspection.LocalQuickFixOnPsiElement;
|
||||
import com.intellij.codeInspection.util.IntentionFamilyName;
|
||||
@@ -13,6 +14,7 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.codeStyle.JavaCodeStyleManager;
|
||||
import com.intellij.psi.util.JavaElementKind;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.util.ObjectUtils;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -37,6 +39,16 @@ public final class VariableArrayTypeFix extends LocalQuickFixOnPsiElement {
|
||||
: "fix.variable.type.family");
|
||||
}
|
||||
|
||||
private VariableArrayTypeFix(@NotNull PsiArrayInitializerExpression initializer,
|
||||
@NotNull PsiArrayType targetType,
|
||||
@IntentionName String name,
|
||||
@IntentionFamilyName String familyName) {
|
||||
super(initializer);
|
||||
myTargetType = targetType;
|
||||
myName = name;
|
||||
myFamilyName = familyName;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static VariableArrayTypeFix createFix(PsiArrayInitializerExpression initializer, @NotNull PsiType componentType) {
|
||||
PsiArrayType arrayType = new PsiArrayType(componentType);
|
||||
@@ -125,7 +137,15 @@ public final class VariableArrayTypeFix extends LocalQuickFixOnPsiElement {
|
||||
|
||||
@Override
|
||||
public boolean startInWriteAction() {
|
||||
return false;
|
||||
PsiFile file = myStartElement.getContainingFile();
|
||||
return file != null && !file.isPhysical(); // for preview
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable FileModifier getFileModifierForPreview(@NotNull PsiFile target) {
|
||||
PsiArrayInitializerExpression initializer = ObjectUtils.tryCast(getStartElement(), PsiArrayInitializerExpression.class);
|
||||
if (initializer == null) return null;
|
||||
return new VariableArrayTypeFix(PsiTreeUtil.findSameElementInCopy(initializer, target), myTargetType, myName, myFamilyName);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -138,6 +158,17 @@ public final class VariableArrayTypeFix extends LocalQuickFixOnPsiElement {
|
||||
*/
|
||||
final PsiNewExpression myNewExpression = getNewExpressionLocal(myInitializer);
|
||||
|
||||
if (!file.isPhysical()) {
|
||||
if (!myTargetType.equals(myVariable.getType()) && myVariable.getContainingFile().equals(file)) {
|
||||
fixVariableType(project, file, myVariable);
|
||||
}
|
||||
|
||||
if (myNewExpression != null) {
|
||||
fixArrayInitializer(myInitializer, myNewExpression);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (!FileModificationService.getInstance().prepareFileForWrite(myVariable.getContainingFile())) return;
|
||||
|
||||
if (! myTargetType.equals(myVariable.getType())) {
|
||||
|
||||
@@ -41,6 +41,13 @@ public class WrapExpressionFix implements IntentionAction {
|
||||
myMethodPresentation = getMethodPresentation(myExpression, myExpectedType, myPrimitiveExpected);
|
||||
}
|
||||
|
||||
private WrapExpressionFix(PsiExpression expression, PsiClassType expectedType, boolean primitiveExpected, String methodPresentation) {
|
||||
myExpression = expression;
|
||||
myExpectedType = expectedType;
|
||||
myPrimitiveExpected = primitiveExpected;
|
||||
myMethodPresentation = methodPresentation;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static PsiClassType getClassType(PsiType type, PsiElement place) {
|
||||
if (type instanceof PsiClassType) {
|
||||
@@ -195,6 +202,9 @@ public class WrapExpressionFix implements IntentionAction {
|
||||
|
||||
@Override
|
||||
public @Nullable FileModifier getFileModifierForPreview(@NotNull PsiFile target) {
|
||||
return new WrapExpressionFix(myExpectedType, PsiTreeUtil.findSameElementInCopy(myExpression, target));
|
||||
return new WrapExpressionFix(PsiTreeUtil.findSameElementInCopy(myExpression, target),
|
||||
myExpectedType,
|
||||
myPrimitiveExpected,
|
||||
myMethodPresentation);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.codeStyle.JavaCodeStyleManager;
|
||||
import com.intellij.psi.impl.light.LightRecordField;
|
||||
import com.intellij.psi.util.JavaElementKind;
|
||||
import com.intellij.psi.util.JavaPsiRecordUtil;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
@@ -168,6 +169,9 @@ public class VariableTypeFix extends LocalQuickFixAndIntentionActionOnPsiElement
|
||||
@Override
|
||||
public @NotNull IntentionPreviewInfo generatePreview(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) {
|
||||
PsiVariable variable = (PsiVariable)getStartElement();
|
||||
if (variable instanceof LightRecordField) {
|
||||
variable = ((LightRecordField)variable).getRecordComponent();
|
||||
}
|
||||
PsiFile containingFile = variable.getContainingFile();
|
||||
if (containingFile == file.getOriginalFile()) {
|
||||
PsiVariable varCopy = PsiTreeUtil.findSameElementInCopy(variable, file);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Unwrap '"blah"'" "true"
|
||||
// "Unwrap '"blah"'" "true-preview"
|
||||
class X {
|
||||
|
||||
@interface MyAnnotation {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Unwrap '"blah"'" "true"
|
||||
// "Unwrap '"blah"'" "true-preview"
|
||||
class X {
|
||||
@interface MyAnnotation {
|
||||
String value() default /*1*/ /*2*/ "blah";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Unwrap '"blah"'" "true"
|
||||
// "Unwrap '"blah"'" "true-preview"
|
||||
class X {
|
||||
|
||||
@interface MyAnnotation {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Unwrap '"blah"'" "true"
|
||||
// "Unwrap '"blah"'" "true-preview"
|
||||
class X {
|
||||
@interface MyAnnotation {
|
||||
String value() default {/*1*/"blah"/*2*/}<caret>;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Unwrap 'if' statement" "true"
|
||||
// "Unwrap 'if' statement" "true-preview"
|
||||
class X {
|
||||
boolean f(int[] a) {
|
||||
if (a.length == 0) return false;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Unwrap 'if' statement" "true"
|
||||
// "Unwrap 'if' statement" "true-preview"
|
||||
class X {
|
||||
void test(@org.jetbrains.annotations.NotNull String x) {
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Unwrap 'if' statement" "true"
|
||||
// "Unwrap 'if' statement" "true-preview"
|
||||
class X {
|
||||
StringBuilder str = new StringBuilder();
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Unwrap 'if' statement" "true"
|
||||
// "Unwrap 'if' statement" "true-preview"
|
||||
class X {
|
||||
void f() {
|
||||
<caret>{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Unwrap 'if' statement" "true"
|
||||
// "Unwrap 'if' statement" "true-preview"
|
||||
class X {
|
||||
void f(){
|
||||
while (true) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Unwrap 'do-while' statement (may change semantics)" "true"
|
||||
// "Unwrap 'do-while' statement (may change semantics)" "true-preview"
|
||||
import org.jetbrains.annotations.Contract;
|
||||
|
||||
class X {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Remove 'if' statement extracting side effects" "true"
|
||||
// "Remove 'if' statement extracting side effects" "true-preview"
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
class X {
|
||||
public String getRole(Object parent) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Unwrap 'if' statement" "true"
|
||||
// "Unwrap 'if' statement" "true-preview"
|
||||
class X {
|
||||
public String testUnwrap(String f) {
|
||||
switch (f) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Unwrap 'if' statement" "true"
|
||||
// "Unwrap 'if' statement" "true-preview"
|
||||
class X {
|
||||
public String testUnwrap(String f) {
|
||||
switch (f) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Remove 'if' statement" "true"
|
||||
// "Remove 'if' statement" "true-preview"
|
||||
class X {
|
||||
int m(String s) {
|
||||
for (int i = 0; i < 100; i++) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Remove 'if' statement" "true"
|
||||
// "Remove 'if' statement" "true-preview"
|
||||
class X {
|
||||
void test() {
|
||||
Object obj = "Hello from pattern matching";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Remove 'if' statement extracting side effects" "true"
|
||||
// "Remove 'if' statement extracting side effects" "true-preview"
|
||||
class X {
|
||||
void test() {
|
||||
Object obj = "Hello from pattern matching";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Remove 'if' statement extracting side effects" "true"
|
||||
// "Remove 'if' statement extracting side effects" "true-preview"
|
||||
class X {
|
||||
void test() {
|
||||
Object obj = "Hello from pattern matching";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Remove 'if' statement" "true"
|
||||
// "Remove 'if' statement" "true-preview"
|
||||
class X {
|
||||
int m(String s) {
|
||||
if (s.equals("abc")) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Unwrap 'if' statement" "true"
|
||||
// "Unwrap 'if' statement" "true-preview"
|
||||
class X {
|
||||
String m() {
|
||||
boolean field = true;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Remove 'while' statement extracting side effects" "true"
|
||||
// "Remove 'while' statement extracting side effects" "true-preview"
|
||||
import org.jetbrains.annotations.Contract;
|
||||
|
||||
class X {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Unwrap 'if' statement" "true"
|
||||
// "Unwrap 'if' statement" "true-preview"
|
||||
class X {
|
||||
boolean f(int[] a) {
|
||||
if (a.length == 0) return false;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Unwrap 'if' statement" "true"
|
||||
// "Unwrap 'if' statement" "true-preview"
|
||||
class X {
|
||||
void test(@org.jetbrains.annotations.NotNull String x) {
|
||||
if(x != <caret>null) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Unwrap 'if' statement" "true"
|
||||
// "Unwrap 'if' statement" "true-preview"
|
||||
class X {
|
||||
StringBuilder str = new StringBuilder();
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Unwrap 'if' statement" "true"
|
||||
// "Unwrap 'if' statement" "true-preview"
|
||||
class X {
|
||||
void f() {
|
||||
if (tru<caret>e) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Unwrap 'if' statement" "true"
|
||||
// "Unwrap 'if' statement" "true-preview"
|
||||
class X {
|
||||
void f(){
|
||||
while (true) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Unwrap 'do-while' statement (may change semantics)" "true"
|
||||
// "Unwrap 'do-while' statement (may change semantics)" "true-preview"
|
||||
import org.jetbrains.annotations.Contract;
|
||||
|
||||
class X {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Remove 'if' statement extracting side effects" "true"
|
||||
// "Remove 'if' statement extracting side effects" "true-preview"
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
class X {
|
||||
public String getRole(Object parent) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Unwrap 'if' statement" "true"
|
||||
// "Unwrap 'if' statement" "true-preview"
|
||||
class X {
|
||||
public String testUnwrap(String f) {
|
||||
switch (f) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Unwrap 'if' statement" "true"
|
||||
// "Unwrap 'if' statement" "true-preview"
|
||||
class X {
|
||||
public String testUnwrap(String f) {
|
||||
switch (f) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Remove 'if' statement" "true"
|
||||
// "Remove 'if' statement" "true-preview"
|
||||
class X {
|
||||
int m(String s) {
|
||||
for (int i = 0; i < 100; i++)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Remove 'if' statement" "true"
|
||||
// "Remove 'if' statement" "true-preview"
|
||||
class X {
|
||||
void test() {
|
||||
Object obj = "Hello from pattern matching";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Remove 'if' statement extracting side effects" "true"
|
||||
// "Remove 'if' statement extracting side effects" "true-preview"
|
||||
class X {
|
||||
void test() {
|
||||
Object obj = "Hello from pattern matching";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Remove 'if' statement extracting side effects" "true"
|
||||
// "Remove 'if' statement extracting side effects" "true-preview"
|
||||
class X {
|
||||
void test() {
|
||||
Object obj = "Hello from pattern matching";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Remove 'if' statement" "true"
|
||||
// "Remove 'if' statement" "true-preview"
|
||||
class X {
|
||||
int m(String s) {
|
||||
if (s.equals("abc"))
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Unwrap 'if' statement" "true"
|
||||
// "Unwrap 'if' statement" "true-preview"
|
||||
class X {
|
||||
String m() {
|
||||
boolean field = true;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Remove 'while' statement extracting side effects" "true"
|
||||
// "Remove 'while' statement extracting side effects" "true-preview"
|
||||
import org.jetbrains.annotations.Contract;
|
||||
|
||||
class X {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true"
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true-preview"
|
||||
import java.util.*;
|
||||
|
||||
public class Main {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true"
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true-preview"
|
||||
import java.util.*;
|
||||
|
||||
public class Collect {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true"
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true-preview"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true"
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true-preview"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true"
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true-preview"
|
||||
import java.util.*;
|
||||
|
||||
public class Collect {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true"
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true-preview"
|
||||
import java.util.*;
|
||||
|
||||
public class Collect {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true"
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true-preview"
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true"
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true-preview"
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true"
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true-preview"
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true"
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true-preview"
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true"
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true-preview"
|
||||
import java.util.*;
|
||||
|
||||
public class Collect {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'TestClass.test()' call" "true"
|
||||
// "Replace iteration with bulk 'TestClass.test()' call" "true-preview"
|
||||
package testpackage;
|
||||
|
||||
interface TestClass<T> {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'TestClass.test()' call" "true"
|
||||
// "Replace iteration with bulk 'TestClass.test()' call" "true-preview"
|
||||
package testpackage;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'TestClass.test()' call" "true"
|
||||
// "Replace iteration with bulk 'TestClass.test()' call" "true-preview"
|
||||
package testpackage;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'Map.putAll()' call" "true"
|
||||
// "Replace iteration with bulk 'Map.putAll()' call" "true-preview"
|
||||
import java.util.*;
|
||||
|
||||
class Main {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'Map.putAll()' call" "true"
|
||||
// "Replace iteration with bulk 'Map.putAll()' call" "true-preview"
|
||||
import java.util.*;
|
||||
|
||||
class Main {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'Map.putAll()' call" "true"
|
||||
// "Replace iteration with bulk 'Map.putAll()' call" "true-preview"
|
||||
import java.util.*;
|
||||
|
||||
class Main {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'Map.putAll()' call" "true"
|
||||
// "Replace iteration with bulk 'Map.putAll()' call" "true-preview"
|
||||
import java.util.*;
|
||||
|
||||
class Main {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'Map.putAll()' call" "true"
|
||||
// "Replace iteration with bulk 'Map.putAll()' call" "true-preview"
|
||||
import java.util.*;
|
||||
|
||||
class Main {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'Map.putAll()' call" "true"
|
||||
// "Replace iteration with bulk 'Map.putAll()' call" "true-preview"
|
||||
import java.util.*;
|
||||
|
||||
class Main {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'Map.putAll()' call" "true"
|
||||
// "Replace iteration with bulk 'Map.putAll()' call" "true-preview"
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'Map.putAll()' call" "true"
|
||||
// "Replace iteration with bulk 'Map.putAll()' call" "true-preview"
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true"
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true-preview"
|
||||
import java.util.*;
|
||||
|
||||
public class Main {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true"
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true-preview"
|
||||
import java.util.*;
|
||||
|
||||
public class Collect {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true"
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true-preview"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true"
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true-preview"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true"
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true-preview"
|
||||
import java.util.*;
|
||||
|
||||
public class Collect {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true"
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true-preview"
|
||||
import java.util.*;
|
||||
|
||||
public class Collect {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true"
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true-preview"
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true"
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true-preview"
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true"
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true-preview"
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true"
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true-preview"
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true"
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true-preview"
|
||||
import java.util.*;
|
||||
|
||||
public class Collect {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'TestClass.test()' call" "true"
|
||||
// "Replace iteration with bulk 'TestClass.test()' call" "true-preview"
|
||||
package testpackage;
|
||||
|
||||
interface TestClass<T> {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'TestClass.test()' call" "true"
|
||||
// "Replace iteration with bulk 'TestClass.test()' call" "true-preview"
|
||||
package testpackage;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'TestClass.test()' call" "true"
|
||||
// "Replace iteration with bulk 'TestClass.test()' call" "true-preview"
|
||||
package testpackage;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'Map.putAll()' call" "true"
|
||||
// "Replace iteration with bulk 'Map.putAll()' call" "true-preview"
|
||||
import java.util.*;
|
||||
|
||||
class Main {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'Map.putAll()' call" "true"
|
||||
// "Replace iteration with bulk 'Map.putAll()' call" "true-preview"
|
||||
import java.util.*;
|
||||
|
||||
class Main {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'Map.putAll()' call" "true"
|
||||
// "Replace iteration with bulk 'Map.putAll()' call" "true-preview"
|
||||
import java.util.*;
|
||||
|
||||
class Main {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'Map.putAll()' call" "true"
|
||||
// "Replace iteration with bulk 'Map.putAll()' call" "true-preview"
|
||||
import java.util.*;
|
||||
|
||||
class Main {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'Map.putAll()' call" "true"
|
||||
// "Replace iteration with bulk 'Map.putAll()' call" "true-preview"
|
||||
import java.util.*;
|
||||
|
||||
class Main {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'Map.putAll()' call" "true"
|
||||
// "Replace iteration with bulk 'Map.putAll()' call" "true-preview"
|
||||
import java.util.*;
|
||||
|
||||
class Main {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'Map.putAll()' call" "true"
|
||||
// "Replace iteration with bulk 'Map.putAll()' call" "true-preview"
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'Map.putAll()' call" "true"
|
||||
// "Replace iteration with bulk 'Map.putAll()' call" "true-preview"
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true"
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true-preview"
|
||||
import java.util.*;
|
||||
|
||||
public class Collect {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true"
|
||||
// "Replace iteration with bulk 'Collection.addAll()' call" "true-preview"
|
||||
import java.util.*;
|
||||
|
||||
public class Collect {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace 'var' with explicit type" "true"
|
||||
// "Replace 'var' with explicit type" "true-preview"
|
||||
final class Example {
|
||||
public static void main(String[] args) {
|
||||
for (String s : args) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace 'var' with explicit type" "true"
|
||||
// "Replace 'var' with explicit type" "true-preview"
|
||||
class Main {
|
||||
{
|
||||
String b = java.util.Arrays.asList("", "").get(0);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace 'var' with explicit type" "true"
|
||||
// "Replace 'var' with explicit type" "true-preview"
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
final class Example {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
// "Replace 'var' with explicit type" "true"
|
||||
// "Replace 'var' with explicit type" "true-preview"
|
||||
class Main {
|
||||
{
|
||||
List<Serializable> b = java.util.Arrays.asList("", 2);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace 'var' with explicit type" "true"
|
||||
// "Replace 'var' with explicit type" "true-preview"
|
||||
class Main {
|
||||
{
|
||||
int b = 0;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace 'var' with explicit type" "true"
|
||||
// "Replace 'var' with explicit type" "true-preview"
|
||||
import java.lang.annotation.*;
|
||||
class Main {
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace 'var' with explicit type" "true"
|
||||
// "Replace 'var' with explicit type" "true-preview"
|
||||
class Main {
|
||||
void m(java.util.List<? extends String> args){
|
||||
String s = args.get(0);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace 'var' with explicit type" "true"
|
||||
// "Replace 'var' with explicit type" "true-preview"
|
||||
final class Example {
|
||||
public static void main(String[] args) {
|
||||
for (v<caret>ar s : args) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace 'var' with explicit type" "true"
|
||||
// "Replace 'var' with explicit type" "true-preview"
|
||||
class Main {
|
||||
{
|
||||
<caret>var b = java.util.Arrays.asList("", "").get(0);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace 'var' with explicit type" "true"
|
||||
// "Replace 'var' with explicit type" "true-preview"
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
final class Example {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace 'var' with explicit type" "true"
|
||||
// "Replace 'var' with explicit type" "true-preview"
|
||||
class Main {
|
||||
{
|
||||
<caret>var b = 0;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace 'var' with explicit type" "true"
|
||||
// "Replace 'var' with explicit type" "true-preview"
|
||||
import java.lang.annotation.*;
|
||||
class Main {
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace 'var' with explicit type" "true"
|
||||
// "Replace 'var' with explicit type" "true-preview"
|
||||
class Main {
|
||||
void m(java.util.List<? extends String> args){
|
||||
<caret>var s = args.get(0);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Change variable 'test' type to 'int[][]'" "true"
|
||||
// "Change variable 'test' type to 'int[][]'" "true-preview"
|
||||
class A {
|
||||
void m() {
|
||||
final int[][] test = {new int<caret>[]{1}};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Change 'new Long[]' to 'new char[][]'" "true"
|
||||
// "Change 'new Long[]' to 'new char[][]'" "true-preview"
|
||||
class A {
|
||||
void m() {
|
||||
final char[][] test = new char[][]{<caret>{'a'}, {'1'}};
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user