[java-intentions] More preview tests

GitOrigin-RevId: 4d6a5487576dbbc4aca9c89b067eec8218aff686
This commit is contained in:
Tagir Valeev
2022-07-29 15:52:26 +02:00
committed by intellij-monorepo-bot
parent 1361a10017
commit 49f4397ba0
259 changed files with 323 additions and 256 deletions

View File

@@ -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())) {

View File

@@ -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);
}
}

View File

@@ -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);

View File

@@ -1,4 +1,4 @@
// "Unwrap '"blah"'" "true"
// "Unwrap '"blah"'" "true-preview"
class X {
@interface MyAnnotation {

View File

@@ -1,4 +1,4 @@
// "Unwrap '"blah"'" "true"
// "Unwrap '"blah"'" "true-preview"
class X {
@interface MyAnnotation {
String value() default /*1*/ /*2*/ "blah";

View File

@@ -1,4 +1,4 @@
// "Unwrap '"blah"'" "true"
// "Unwrap '"blah"'" "true-preview"
class X {
@interface MyAnnotation {

View File

@@ -1,4 +1,4 @@
// "Unwrap '"blah"'" "true"
// "Unwrap '"blah"'" "true-preview"
class X {
@interface MyAnnotation {
String value() default {/*1*/"blah"/*2*/}<caret>;

View File

@@ -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;

View File

@@ -1,4 +1,4 @@
// "Unwrap 'if' statement" "true"
// "Unwrap 'if' statement" "true-preview"
class X {
void test(@org.jetbrains.annotations.NotNull String x) {
{

View File

@@ -1,4 +1,4 @@
// "Unwrap 'if' statement" "true"
// "Unwrap 'if' statement" "true-preview"
class X {
StringBuilder str = new StringBuilder();

View File

@@ -1,4 +1,4 @@
// "Unwrap 'if' statement" "true"
// "Unwrap 'if' statement" "true-preview"
class X {
void f() {
<caret>{

View File

@@ -1,4 +1,4 @@
// "Unwrap 'if' statement" "true"
// "Unwrap 'if' statement" "true-preview"
class X {
void f(){
while (true) {

View File

@@ -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 {

View File

@@ -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) {

View File

@@ -1,4 +1,4 @@
// "Unwrap 'if' statement" "true"
// "Unwrap 'if' statement" "true-preview"
class X {
public String testUnwrap(String f) {
switch (f) {

View File

@@ -1,4 +1,4 @@
// "Unwrap 'if' statement" "true"
// "Unwrap 'if' statement" "true-preview"
class X {
public String testUnwrap(String f) {
switch (f) {

View File

@@ -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++) {

View File

@@ -1,4 +1,4 @@
// "Remove 'if' statement" "true"
// "Remove 'if' statement" "true-preview"
class X {
void test() {
Object obj = "Hello from pattern matching";

View File

@@ -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";

View File

@@ -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";

View File

@@ -1,4 +1,4 @@
// "Remove 'if' statement" "true"
// "Remove 'if' statement" "true-preview"
class X {
int m(String s) {
if (s.equals("abc")) {

View File

@@ -1,4 +1,4 @@
// "Unwrap 'if' statement" "true"
// "Unwrap 'if' statement" "true-preview"
class X {
String m() {
boolean field = true;

View File

@@ -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 {

View File

@@ -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;

View File

@@ -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) {

View File

@@ -1,4 +1,4 @@
// "Unwrap 'if' statement" "true"
// "Unwrap 'if' statement" "true-preview"
class X {
StringBuilder str = new StringBuilder();

View File

@@ -1,4 +1,4 @@
// "Unwrap 'if' statement" "true"
// "Unwrap 'if' statement" "true-preview"
class X {
void f() {
if (tru<caret>e) {

View File

@@ -1,4 +1,4 @@
// "Unwrap 'if' statement" "true"
// "Unwrap 'if' statement" "true-preview"
class X {
void f(){
while (true) {

View File

@@ -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 {

View File

@@ -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) {

View File

@@ -1,4 +1,4 @@
// "Unwrap 'if' statement" "true"
// "Unwrap 'if' statement" "true-preview"
class X {
public String testUnwrap(String f) {
switch (f) {

View File

@@ -1,4 +1,4 @@
// "Unwrap 'if' statement" "true"
// "Unwrap 'if' statement" "true-preview"
class X {
public String testUnwrap(String f) {
switch (f) {

View File

@@ -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++)

View File

@@ -1,4 +1,4 @@
// "Remove 'if' statement" "true"
// "Remove 'if' statement" "true-preview"
class X {
void test() {
Object obj = "Hello from pattern matching";

View File

@@ -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";

View File

@@ -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";

View File

@@ -1,4 +1,4 @@
// "Remove 'if' statement" "true"
// "Remove 'if' statement" "true-preview"
class X {
int m(String s) {
if (s.equals("abc"))

View File

@@ -1,4 +1,4 @@
// "Unwrap 'if' statement" "true"
// "Unwrap 'if' statement" "true-preview"
class X {
String m() {
boolean field = true;

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -1,4 +1,4 @@
// "Replace iteration with bulk 'Collection.addAll()' call" "true"
// "Replace iteration with bulk 'Collection.addAll()' call" "true-preview"
import java.util.*;

View File

@@ -1,4 +1,4 @@
// "Replace iteration with bulk 'Collection.addAll()' call" "true"
// "Replace iteration with bulk 'Collection.addAll()' call" "true-preview"
import java.util.*;

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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 {

View File

@@ -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> {

View File

@@ -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.*;

View File

@@ -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.*;

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -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;

View File

@@ -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;

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -1,4 +1,4 @@
// "Replace iteration with bulk 'Collection.addAll()' call" "true"
// "Replace iteration with bulk 'Collection.addAll()' call" "true-preview"
import java.util.*;

View File

@@ -1,4 +1,4 @@
// "Replace iteration with bulk 'Collection.addAll()' call" "true"
// "Replace iteration with bulk 'Collection.addAll()' call" "true-preview"
import java.util.*;

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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 {

View File

@@ -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> {

View File

@@ -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.*;

View File

@@ -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.*;

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -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;

View File

@@ -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;

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -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) {

View File

@@ -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);

View File

@@ -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 {

View File

@@ -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);

View File

@@ -1,4 +1,4 @@
// "Replace 'var' with explicit type" "true"
// "Replace 'var' with explicit type" "true-preview"
class Main {
{
int b = 0;

View File

@@ -1,4 +1,4 @@
// "Replace 'var' with explicit type" "true"
// "Replace 'var' with explicit type" "true-preview"
import java.lang.annotation.*;
class Main {
{

View File

@@ -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);

View File

@@ -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) {

View File

@@ -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);

View File

@@ -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 {

View File

@@ -1,4 +1,4 @@
// "Replace 'var' with explicit type" "true"
// "Replace 'var' with explicit type" "true-preview"
class Main {
{
<caret>var b = 0;

View File

@@ -1,4 +1,4 @@
// "Replace 'var' with explicit type" "true"
// "Replace 'var' with explicit type" "true-preview"
import java.lang.annotation.*;
class Main {
{

View File

@@ -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);

View File

@@ -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}};

View File

@@ -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