mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
redundant cast: convert tests to light
This commit is contained in:
@@ -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){}
|
||||
}
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
</problems>
|
||||
-31
@@ -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){}
|
||||
}
|
||||
+1
-1
@@ -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/>
|
||||
-2
@@ -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 <code>s -> s.endsWith(".java")</code> to <code>I</code> 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
-1
@@ -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/>
|
||||
Reference in New Issue
Block a user