diff options
Diffstat (limited to 'java/java-tests/testData/codeInsight')
44 files changed, 426 insertions, 11 deletions
diff --git a/java/java-tests/testData/codeInsight/completion/smartType/ConstructorRef-out.java b/java/java-tests/testData/codeInsight/completion/smartType/ConstructorRef-out.java new file mode 100644 index 000000000000..19decec183b0 --- /dev/null +++ b/java/java-tests/testData/codeInsight/completion/smartType/ConstructorRef-out.java @@ -0,0 +1,14 @@ +@FunctionalInterface +interface Foo9 { + Bar test(int p); +} + +class Bar { + public Bar(int p) {} +} + +class Test88 { + void foo(Foo9 foo) { + foo(Bar::new<caret>); + } +}
\ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/completion/smartType/ConstructorRef.java b/java/java-tests/testData/codeInsight/completion/smartType/ConstructorRef.java new file mode 100644 index 000000000000..7f7af003b377 --- /dev/null +++ b/java/java-tests/testData/codeInsight/completion/smartType/ConstructorRef.java @@ -0,0 +1,14 @@ +@FunctionalInterface +interface Foo9 { + Bar test(int p); +} + +class Bar { + public Bar(int p) {} +} + +class Test88 { + void foo(Foo9 foo) { + foo(Bar::<caret>); + } +}
\ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/completion/smartType/InLambdaPositionSameNames-out.java b/java/java-tests/testData/codeInsight/completion/smartType/InLambdaPositionSameNames-out.java new file mode 100644 index 000000000000..48157c4ded2a --- /dev/null +++ b/java/java-tests/testData/codeInsight/completion/smartType/InLambdaPositionSameNames-out.java @@ -0,0 +1,10 @@ +interface I<T> { + void m(T t, String s); +} + +class Test { + public static void main(String[] args) { + String s = ""; + I<String> i = (s1, s2) -> <caret> + } +}
\ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/completion/smartType/InLambdaPositionSameNames.java b/java/java-tests/testData/codeInsight/completion/smartType/InLambdaPositionSameNames.java new file mode 100644 index 000000000000..e7adb2ffb758 --- /dev/null +++ b/java/java-tests/testData/codeInsight/completion/smartType/InLambdaPositionSameNames.java @@ -0,0 +1,10 @@ +interface I<T> { + void m(T t, String s); +} + +class Test { + public static void main(String[] args) { + String s = ""; + I<String> i = <caret> + } +}
\ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/createSubclass/innerClassImplement/after/Test.java b/java/java-tests/testData/codeInsight/createSubclass/innerClassImplement/after/Test.java index 38024980a233..4c765169c38f 100644 --- a/java/java-tests/testData/codeInsight/createSubclass/innerClassImplement/after/Test.java +++ b/java/java-tests/testData/codeInsight/createSubclass/innerClassImplement/after/Test.java @@ -11,7 +11,7 @@ public class Test { @Override void bar() { - + } } }
\ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/AssignToFinal.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/AssignToFinal.java index 171b63a8f06f..de5212a4bf87 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/AssignToFinal.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/AssignToFinal.java @@ -90,5 +90,6 @@ class T1 { ++(<error descr="Variable 'i2' might not have been initialized">i2</error>); <error descr="Variable 'i3' might not have been initialized">i3</error> += 1; (i4) = 1; + (<error descr="Expression expected">)</error>++; } }
\ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/TypeCastInInstanceof.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/TypeCastInInstanceof.java new file mode 100644 index 000000000000..cbbffdf44291 --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/TypeCastInInstanceof.java @@ -0,0 +1,13 @@ +@SuppressWarnings({"UnusedDeclaration"}) +class C { + boolean foo(final ConfigurableField<String> nameField) { + return (Formatter<?>)nameField.getFormatter() instanceof DefaultFormatter; + } +} + +@SuppressWarnings({"UnusedDeclaration"}) +interface Formatter<V>{} +class DefaultFormatter implements Formatter<Object>{} +interface ConfigurableField<V> { + Formatter<V> getFormatter(); +} diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/annotations/dupMethods.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/annotations/dupMethods.java new file mode 100644 index 000000000000..94744fa9be03 --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/annotations/dupMethods.java @@ -0,0 +1,4 @@ +@interface Example { + <error descr="'myMethod()' is already defined in 'Example'">public String myMethod()</error>; + <error descr="'myMethod()' is already defined in 'Example'">public int myMethod()</error>; +}
\ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/annotations/privateInaccessibleConstant.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/annotations/privateInaccessibleConstant.java new file mode 100644 index 000000000000..435810d00b44 --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/annotations/privateInaccessibleConstant.java @@ -0,0 +1,8 @@ +@FooAnnotation(<error descr="'Foo.BAR' has private access in 'Foo'">Foo.BAR</error>) +class Foo { + private static final String BAR = "bar"; +} + +@interface FooAnnotation { + String value(); +}
\ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA55510.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA55510.java index 5776db03ae4b..2db53078fce5 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA55510.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA55510.java @@ -34,3 +34,20 @@ class Records { } } } +//--------------------------------------------- +class Parent<T extends Parent.NestedParent> +{ + protected static interface NestedParent + { + } +} + +class Test +{ + public final static class Child extends Parent<<error descr="NestedChild is not accessible in current context">Child.NestedChild</error>> + { + private static interface NestedChild extends NestedParent + { + } + } +}
\ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA78402.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA78402.java new file mode 100644 index 000000000000..ed8d259ab462 --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA78402.java @@ -0,0 +1,18 @@ +import java.util.Collection; +import java.util.List; + +class Reference<T> {} + +class Bug { + private static <T> void foo(List<T> x, Reference<String> y) { + System.out.println(x); + } + + private static <T> void foo(Collection<T> x, Reference<T> y) { + System.out.println(x); + } + + public static void bazz(List<String> bar) { + foo<error descr="Ambiguous method call: both 'Bug.foo(List<String>, Reference<String>)' and 'Bug.foo(Collection<String>, Reference<String>)' match">(bar, null)</error>; + } +}
\ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/IDEA78402.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/IDEA78402.java new file mode 100644 index 000000000000..ed8d259ab462 --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/IDEA78402.java @@ -0,0 +1,18 @@ +import java.util.Collection; +import java.util.List; + +class Reference<T> {} + +class Bug { + private static <T> void foo(List<T> x, Reference<String> y) { + System.out.println(x); + } + + private static <T> void foo(Collection<T> x, Reference<T> y) { + System.out.println(x); + } + + public static void bazz(List<String> bar) { + foo<error descr="Ambiguous method call: both 'Bug.foo(List<String>, Reference<String>)' and 'Bug.foo(Collection<String>, Reference<String>)' match">(bar, null)</error>; + } +}
\ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/graphInference/IDEA127928.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/graphInference/IDEA127928.java new file mode 100644 index 000000000000..d0c118198599 --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/graphInference/IDEA127928.java @@ -0,0 +1,21 @@ +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.Function; + +class CastLambdaParameter { + + void main(final Map<Integer, String> map) { + Set<Function<Object, String>> property2formatter = foo(bar((joint) -> map.get((Integer)joint))); + } + + public static <B> Set<B> foo(List<B> property2name) {return property2name != null ? null : null;} + public static <B> Set<B> foo(List<B>... property2name) {return property2name != null ? null : null;} + public static <B> Set<B> foo(Set<B> property2name) {return property2name != null ? null : null;} + + public static <TB> List<TB> bar(TB b) { + return null; + } + +} + diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/graphInference/OuterCallOverloads.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/graphInference/OuterCallOverloads.java new file mode 100644 index 000000000000..6506a7a48464 --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/graphInference/OuterCallOverloads.java @@ -0,0 +1,16 @@ +import java.util.List; +import java.util.Set; + +abstract class Overloadsss { + abstract <T> List<T> foo(List<T> l); + abstract <T> Set<T> foo(Set<T> s); + + abstract <K> List<K> bar(List<K> l); + abstract <K> List<K> bar1(List<K> l); + abstract <K> Set<K> bar1(Set<K> s); + + { + List<String> l = foo(bar (null)); + List<String> l1 = foo(bar1<error descr="Ambiguous method call: both 'Overloadsss.bar1(List<Object>)' and 'Overloadsss.bar1(Set<Object>)' match">(null)</error>); + } +} diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/interfaceMethods/AnnotationTypeExtensionsNotSupported.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/interfaceMethods/AnnotationTypeExtensionsNotSupported.java new file mode 100644 index 000000000000..258bf1132d5b --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/interfaceMethods/AnnotationTypeExtensionsNotSupported.java @@ -0,0 +1,9 @@ +@interface Example { + + public <error descr="Modifier 'static' not allowed here">static</error> String myMethod() { + return ""; + } + public <error descr="Modifier 'default' not allowed here">default</error> String myMethod1() { + return ""; + } +} diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA123951.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA123951.java new file mode 100644 index 000000000000..c5bdecf7c43e --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA123951.java @@ -0,0 +1,8 @@ + +import java.util.stream.Collectors; + +class Test { + { + Collectors.mapping(i -> 1, Collectors.summingInt(s -> s.intValue())); + } +}
\ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA124190.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA124190.java new file mode 100644 index 000000000000..9885b03ffaa9 --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA124190.java @@ -0,0 +1,12 @@ +import java.util.*; +import java.util.stream.Stream; + +class Test { + + void foo(final Stream<String> stream){ + stream.collect(ArrayList::new, ArrayList::add, ArrayList::addAll); + stream.collect(ArrayList<String>::new, ArrayList::add, ArrayList::addAll); + stream.collect(ArrayList::new, Collection::add, Collection::addAll); + } + +} diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA124424.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA124424.java new file mode 100644 index 000000000000..369804623026 --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA124424.java @@ -0,0 +1,12 @@ +import java.util.stream.Stream; + +import static java.util.stream.Collectors.toList; + +class Main { + void bar(final Stream<Object> objectStream) { + foo(objectStream.map(o -> "str").collect(toList())); + } + + void foo(Iterable<?> k){} + void foo(String s){} +} diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA124983.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA124983.java new file mode 100644 index 000000000000..2a92ebe2accf --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA124983.java @@ -0,0 +1,9 @@ + +import java.util.stream.IntStream; + +class Test { + private void foo(final IntStream range) { + range.mapToObj(i -> range.mapToObj(j -> 1)) + .flatMap(s -> s); + } +}
\ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA125674.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA125674.java new file mode 100644 index 000000000000..92d8de505e95 --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA125674.java @@ -0,0 +1,8 @@ +import java.util.stream.Collectors; +import java.util.stream.Stream; + +class Test { + void foo(final Stream<String> stream){ + stream.collect(Collectors.toMap(s -> s, s -> s, (a, b) -> a.length() > b. length() ? a : b)); + } +} diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA127124comment.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA127124comment.java new file mode 100644 index 000000000000..cb8442e59d12 --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA127124comment.java @@ -0,0 +1,30 @@ +import java.util.Collections; +import java.util.List; +import java.util.Optional; +import java.util.function.Function; +import java.util.stream.Collectors; + +class Test { + private static class Thing { + final String val; + public Thing(String val) { + this.val = val; + } + } + + public static Optional<List<String>> highlights() { + return Optional.of(Collections.singletonList(new Thing("Hello"))) + .map(l -> l + .stream() + .map(t -> t.val + " world!") + .collect(Collectors.toList())); + } + + public static Optional<List<String>> works() { + return Optional.of(Collections.singletonList(new Thing("Hello"))) + .map(l -> l + .stream() + .map(t -> t.val + " world!") + .collect(Collectors.toList())); + } +}
\ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA127275.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA127275.java new file mode 100644 index 000000000000..6b3a6123fa09 --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA127275.java @@ -0,0 +1,18 @@ +import java.util.List; +import java.util.Optional; +import java.util.function.Function; + +class Main { + { + List<Optional<Function<String, String>>> list = asList(of(Main::identity)); + } + + static <T> List<T> asList(T... a) { return null;} + + static <T> Optional<T> of(T value) { return null;} + + public static String identity(final String s) { + return s; + } + +}
\ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA127275_.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA127275_.java new file mode 100644 index 000000000000..c002468c1b91 --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA127275_.java @@ -0,0 +1,19 @@ +import java.util.List; +import java.util.Optional; +import java.util.function.Function; + +class Main { + { + List<Optional<Function<String, String>>> list = asList(of(Main::identity)); + } + + static <T> List<T> asList(T a) { return null;} + static <T> List<T> asList(Optional a) { return null;} + + static <T> Optional<T> of(T value) { return null;} + + public static String identity(final String s) { + return s; + } + +}
\ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA128534.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA128534.java new file mode 100644 index 000000000000..74b4322196b8 --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA128534.java @@ -0,0 +1,10 @@ +import java.util.Set; + +class Test { + + public static void foo(String[] args, final Set<Test> singleton) { + singleton.forEach(Test::m); + } + + public static void m(Test... others) {} +}
\ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA128712.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA128712.java new file mode 100644 index 000000000000..3a812195b86f --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA128712.java @@ -0,0 +1,19 @@ +import java.util.Collection; +import java.util.function.Function; +import java.util.stream.Stream; + +abstract class Foo { + { + map(Foo::bar); + map(a -> Foo.bar(a)); + } + + <R> Stream<R> map(Function<Class<?>, ? extends R> mapper) { + return null; + } + + + private static <T> Collection<T> bar(Class<T> baseClass) { + return null; + } +} diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/UnresolvedMethodReference.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/UnresolvedMethodReference.java new file mode 100644 index 000000000000..cee3a33a1230 --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/UnresolvedMethodReference.java @@ -0,0 +1,9 @@ +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; + +class Main { + public void test() { + Collections.sort(new ArrayList<>(), Comparator::<error descr="Cannot resolve method 'reversed'">reversed</error>); + } +}
\ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createInnerClassFromNew/afterTypeParamSetup.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createInnerClassFromNew/afterTypeParamSetup.java new file mode 100644 index 000000000000..9d516996894c --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createInnerClassFromNew/afterTypeParamSetup.java @@ -0,0 +1,11 @@ +// "Create Inner Class 'AInner'" "true" +class Test { + { + AInner aInner = new AInner<String>(42); + } + + private class AInner<T> { + public AInner(int i) { + } + } +}
\ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createInnerClassFromNew/afterTypeParamSetup1.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createInnerClassFromNew/afterTypeParamSetup1.java new file mode 100644 index 000000000000..aac015e28360 --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createInnerClassFromNew/afterTypeParamSetup1.java @@ -0,0 +1,11 @@ +// "Create Inner Class 'AInner'" "true" +class Test { + { + AInner aInner = new AInner<String, String>(42); + } + + private class AInner<T, T1> { + public AInner(int i) { + } + } +}
\ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createInnerClassFromNew/beforeTypeParamSetup.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createInnerClassFromNew/beforeTypeParamSetup.java new file mode 100644 index 000000000000..1d26d9d55357 --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createInnerClassFromNew/beforeTypeParamSetup.java @@ -0,0 +1,6 @@ +// "Create Inner Class 'AInner'" "true" +class Test { + { + AInner aInner = new AIn<caret>ner<String>(42); + } +}
\ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createInnerClassFromNew/beforeTypeParamSetup1.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createInnerClassFromNew/beforeTypeParamSetup1.java new file mode 100644 index 000000000000..bf0997aed99e --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createInnerClassFromNew/beforeTypeParamSetup1.java @@ -0,0 +1,6 @@ +// "Create Inner Class 'AInner'" "true" +class Test { + { + AInner aInner = new AIn<caret>ner<String, String>(42); + } +}
\ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/fixAll/after1.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/fixAll/after1.java index f90b3db33828..a144d82ac59c 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/fixAll/after1.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/fixAll/after1.java @@ -1,4 +1,4 @@ -// "Fix all 'Constant conditions & exceptions' problems" "true" +// "Fix all 'Constant conditions & exceptions' problems in file" "true" public class Test { void foo() { int k = 0; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/fixAll/after2.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/fixAll/after2.java index 877810ea9ade..a43c160b6d38 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/fixAll/after2.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/fixAll/after2.java @@ -1,4 +1,4 @@ -// "Fix all 'Constant conditions & exceptions' problems" "true" +// "Fix all 'Constant conditions & exceptions' problems in file" "true" public class Test { void foo1() { int k = 0; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/fixAll/afterAssertFalse.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/fixAll/afterAssertFalse.java index 5aba2e1bc320..b16797331be1 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/fixAll/afterAssertFalse.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/fixAll/afterAssertFalse.java @@ -1,4 +1,4 @@ -// "Fix all 'Constant conditions & exceptions' problems" "true" +// "Fix all 'Constant conditions & exceptions' problems in file" "true" public class Test { void foo2() { int k = 0; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/fixAll/afterAssertTrue.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/fixAll/afterAssertTrue.java index b251f0387f29..a5ded0b7ba07 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/fixAll/afterAssertTrue.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/fixAll/afterAssertTrue.java @@ -1,4 +1,4 @@ -// "Fix all 'Constant conditions & exceptions' problems" "true" +// "Fix all 'Constant conditions & exceptions' problems in file" "true" public class Test { void foo2() { int k = 0; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/fixAll/before1.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/fixAll/before1.java index b012f43a1c52..698897914e67 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/fixAll/before1.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/fixAll/before1.java @@ -1,4 +1,4 @@ -// "Fix all 'Constant conditions & exceptions' problems" "true" +// "Fix all 'Constant conditions & exceptions' problems in file" "true" public class Test { void foo() { int k = 0; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/fixAll/before2.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/fixAll/before2.java index e7d9398ae3e8..768ea463ff1c 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/fixAll/before2.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/fixAll/before2.java @@ -1,4 +1,4 @@ -// "Fix all 'Constant conditions & exceptions' problems" "true" +// "Fix all 'Constant conditions & exceptions' problems in file" "true" public class Test { void foo1() { int k = 0; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/fixAll/beforeAssertFalse.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/fixAll/beforeAssertFalse.java index 8ddc67b7ac1e..49786029f303 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/fixAll/beforeAssertFalse.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/fixAll/beforeAssertFalse.java @@ -1,4 +1,4 @@ -// "Fix all 'Constant conditions & exceptions' problems" "true" +// "Fix all 'Constant conditions & exceptions' problems in file" "true" public class Test { void foo2() { int k = 0; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/fixAll/beforeAssertTrue.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/fixAll/beforeAssertTrue.java index 98611528fce5..4aa5316be779 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/fixAll/beforeAssertTrue.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/fixAll/beforeAssertTrue.java @@ -1,4 +1,4 @@ -// "Fix all 'Constant conditions & exceptions' problems" "true" +// "Fix all 'Constant conditions & exceptions' problems in file" "true" public class Test { void foo2() { int k = 0; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/fixAllAnnotator/after1.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/fixAllAnnotator/after1.java index 1a0aba5d40ef..1297d5d7fac5 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/fixAllAnnotator/after1.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/fixAllAnnotator/after1.java @@ -1,4 +1,4 @@ -// "Fix all 'Annotator' problems" "true" +// "Fix all 'Annotator' problems in file" "true" public class Test { void fooF() { } diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/fixAllAnnotator/before1.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/fixAllAnnotator/before1.java index 8006731dbe32..8805559ebe8e 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/fixAllAnnotator/before1.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/fixAllAnnotator/before1.java @@ -1,4 +1,4 @@ -// "Fix all 'Annotator' problems" "true" +// "Fix all 'Annotator' problems in file" "true" public class Test { void f<caret>oo() { } diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/moveInitializerToConstructor/afterArrayInitializer.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/moveInitializerToConstructor/afterArrayInitializer.java new file mode 100644 index 000000000000..c063aef37715 --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/moveInitializerToConstructor/afterArrayInitializer.java @@ -0,0 +1,8 @@ +// "Move initializer to constructor" "true" +class X { + final String s; + + X() { + s = {}; + } +}
\ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/moveInitializerToConstructor/beforeArrayInitializer.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/moveInitializerToConstructor/beforeArrayInitializer.java new file mode 100644 index 000000000000..fdc8c7b3e22f --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/moveInitializerToConstructor/beforeArrayInitializer.java @@ -0,0 +1,7 @@ +// "Move initializer to constructor" "true" +class X { + final String <caret>s = {}; + + X() { + } +}
\ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/surroundWithTry/afterArrayInitializer.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/surroundWithTry/afterArrayInitializer.java new file mode 100644 index 000000000000..fda3c915e4da --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/surroundWithTry/afterArrayInitializer.java @@ -0,0 +1,22 @@ +// "Surround with try/catch" "true" +public class ExTest { + public static String maybeThrow(String data) throws Ex { + throw new Ex(data); + } + + { + String[] a = new String[0]; + try { + a = new String[]{maybeThrow("")}; + } catch (Ex ex) { + ex.printStackTrace(); + } + System.out.println(a); + } + + + private static class Ex extends Exception { + public Ex(String s) { + } + } +}
\ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/surroundWithTry/beforeArrayInitializer.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/surroundWithTry/beforeArrayInitializer.java new file mode 100644 index 000000000000..60e76c1781a3 --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/surroundWithTry/beforeArrayInitializer.java @@ -0,0 +1,17 @@ +// "Surround with try/catch" "true" +public class ExTest { + public static String maybeThrow(String data) throws Ex { + throw new Ex(data); + } + + { + String[] a = {mayb<caret>eThrow("")}; + System.out.println(a); + } + + + private static class Ex extends Exception { + public Ex(String s) { + } + } +}
\ No newline at end of file |