redundant cast: convert tests to light

This commit is contained in:
Anna.Kozlova
2016-10-04 18:45:14 +02:00
parent 031f71c5b3
commit 1cf1300ab1
15 changed files with 44 additions and 68 deletions
@@ -1,2 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<problems/>
@@ -0,0 +1,16 @@
class Test {
interface I {
}
interface Bar extends I {
int compare(String o1, String o2);
}
{
I bar2 = (Bar) (o1, o2) -> 0;
g((Bar) (o1, o2) -> 0);
((Bar) (o1, o2) -> 0).getClass();
}
void g(I i){}
}
@@ -1,3 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<problems>
</problems>
@@ -1,31 +0,0 @@
/*
* Copyright 2000-2012 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.
*/
public class Test {
interface I {
}
interface Bar extends I {
int compare(String o1, String o2);
}
{
I bar2 = (Bar) (o1, o2) -> 0;
g((Bar) (o1, o2) -> 0);
((Bar) (o1, o2) -> 0).getClass();
}
void g(I i){}
}
@@ -3,7 +3,7 @@ import java.util.Iterator;
class IterableMain {
public static void main(final String... args) {
for (final String s : (Iterable<String>) XIterator::new) {}
for (final String s : (Iterable<String>) <error descr="'XIterator' is abstract; cannot be instantiated">XIterator::new</error>) {}
}
public static interface XIterator extends Iterator<String> {}
@@ -1,2 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<problems/>
@@ -1,2 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<problems/>
@@ -0,0 +1,10 @@
class Test {
interface I {
boolean foo(String s);
}
{
((I)s -> s.endsWith(".java")).getClass();
I i = (<warning descr="Casting 's -> s.endsWith(\".java\")' to 'I' is redundant">I</warning>)s -> s.endsWith(".java");
}
}
@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<problems>
<problem>
<file>Test.java</file>
<line>7</line>
<description>Casting &lt;code&gt;s -&gt; s.endsWith(&quot;.java&quot;)&lt;/code&gt; to &lt;code&gt;I&lt;/code&gt; is redundant</description>
</problem>
</problems>
@@ -1,10 +0,0 @@
class Test {
interface I {
boolean foo(String s);
}
{
((I)s -> s.endsWith(".java")).getClass();
I i = (I)s -> s.endsWith(".java");
}
}
@@ -1,6 +1,6 @@
class Test {
{
((Bar) Test::length)._("");
((Bar) Test::length)._("");
}
public static Integer length(String s) {
@@ -1,2 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<problems/>