mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-25 17:07:05 +07:00
Deprecated extension method syntax dropped
This commit is contained in:
+2
-3
@@ -1,10 +1,11 @@
|
||||
class Test {
|
||||
public static final BinaryOperator<Integer> rPlus = (x, y) -> x + y;
|
||||
|
||||
interface BinaryOperator<T> extends Combiner<T,T,T> {
|
||||
public T operate(T left, T right);
|
||||
|
||||
@Override
|
||||
T combine(T t1, T t2) default {
|
||||
default T combine(T t1, T t2) {
|
||||
return operate(t1, t2);
|
||||
}
|
||||
}
|
||||
@@ -13,5 +14,3 @@ class Test {
|
||||
V combine(T t, U u);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
interface I {
|
||||
void m1() <error descr="Deprecated extension method syntax">default</error> { }
|
||||
|
||||
default void m2() <error descr="Deprecated extension method syntax">default</error> { }
|
||||
|
||||
@SuppressWarnings("extensionSyntax")
|
||||
void m3() default { }
|
||||
}
|
||||
+8
-8
@@ -17,11 +17,11 @@
|
||||
class C {
|
||||
interface I {
|
||||
int i = 42;
|
||||
void m() default { }
|
||||
default void m() { }
|
||||
}
|
||||
|
||||
interface II extends I {
|
||||
void m() default {
|
||||
default void m() {
|
||||
I.super.m();
|
||||
<error descr="Unqualified super reference is not allowed in extension method">super.m</error>();
|
||||
|
||||
@@ -46,18 +46,18 @@ class C {
|
||||
}
|
||||
|
||||
class D {
|
||||
<error descr="Extension methods can only be used within an interface">void m()</error> default { }
|
||||
<error descr="Extension methods can only be used within an interface">default void m()</error> { }
|
||||
}
|
||||
|
||||
interface IllegalMods {
|
||||
<error descr="Static methods in interfaces should have a body">static void m1()</error>;
|
||||
<error descr="Illegal combination of modifiers: 'static' and 'default'">static</error> void m2() default { }
|
||||
void m1()<error descr="'{' or ';' expected"> </error>default<error descr="Identifier or type expected">;</error> <error descr="Not allowed in interface">{ }</error>
|
||||
|
||||
<error descr="Static methods in interfaces should have a body">static void m2()</error>;
|
||||
<error descr="Illegal combination of modifiers: 'static' and 'default'">static</error> <error descr="Illegal combination of modifiers: 'default' and 'static'">default</error> void m3() { }
|
||||
|
||||
<error descr="Illegal combination of modifiers: 'abstract' and 'default'">abstract</error> void m4() default { }
|
||||
<error descr="Illegal combination of modifiers: 'abstract' and 'default'">abstract</error> <error descr="Illegal combination of modifiers: 'default' and 'abstract'">default</error> void m5() { }
|
||||
<error descr="Illegal combination of modifiers: 'abstract' and 'default'">abstract</error> <error descr="Illegal combination of modifiers: 'default' and 'abstract'">default</error> void m4() { }
|
||||
|
||||
<error descr="Extension method should have a body">default void m6()</error>;
|
||||
<error descr="Extension method should have a body">default void m5()</error>;
|
||||
|
||||
<error descr="Modifier 'default' not allowed here">default</error> int i;
|
||||
<error descr="Modifier 'default' not allowed here">default</error> interface X { }
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
import java.util.*;
|
||||
|
||||
class MyTest2{
|
||||
class MyTest2 {
|
||||
{
|
||||
Comparator<? super String> comparator = String::compareToIgnoreCase;
|
||||
}
|
||||
@@ -16,5 +16,5 @@ interface Foo2<T> {
|
||||
void bar(T i, T j);
|
||||
}
|
||||
interface Bar2 {
|
||||
public void xxx(Bar2 p) default {}
|
||||
default void xxx(Bar2 p) { }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user