mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 15:27:45 +07:00
java: receiver parameter highlighting
This commit is contained in:
+2
-16
@@ -1,19 +1,3 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
@@ -47,6 +31,8 @@ class UnsupportedFeatures {
|
||||
}
|
||||
}
|
||||
|
||||
void f(<error descr="Receiver parameters are not supported at this language level">Object this</error>) { }
|
||||
|
||||
interface I {
|
||||
<error descr="Extension methods are not supported at this language level">default void m() { }</error>
|
||||
<error descr="Extension methods are not supported at this language level">static void m() { }</error>
|
||||
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@interface A { }
|
||||
|
||||
@Target(ElementType.TYPE_USE)
|
||||
@interface TA { }
|
||||
|
||||
class C {
|
||||
@Override
|
||||
public String toString(@TA C this) { return ""; }
|
||||
|
||||
@Override
|
||||
public boolean equals(@TA C this, @TA Object other) { return false; }
|
||||
|
||||
@interface Anno { String f(Anno this); }
|
||||
|
||||
void m0() {
|
||||
try (Object <error descr="Receivers are not allowed outside of method parameter list">this</error>) { }
|
||||
Runnable r = (C <error descr="Receivers are not allowed outside of method parameter list">C.this</error>) -> { };
|
||||
}
|
||||
|
||||
void m1a(<error descr="Modifier 'final' not allowed here">final</error> C this) { }
|
||||
void m1b(<error descr="'@A' not applicable to type use">@A</error> C this) { }
|
||||
|
||||
void m2(@TA Object other, @TA C <error descr="The receiver should be the first parameter">this</error>) { }
|
||||
|
||||
void m3a(@TA <error descr="The receiver type does not match the enclosing class type">Object</error> this) { }
|
||||
void m3b(@TA <error descr="The receiver type does not match the enclosing class type">int</error> this) { }
|
||||
|
||||
void m4a(C C.this) { }
|
||||
void m4b(C <error descr="The receiver name does not match the enclosing class type">C.X.this</error>) { }
|
||||
|
||||
static void sm1(@TA Object <error descr="The receiver cannot be used in a static context">this</error>) { }
|
||||
|
||||
C(C <error descr="The receiver cannot be used in a static context">this</error>) { }
|
||||
|
||||
static class X {
|
||||
X(X <error descr="The receiver cannot be used in a static context">this</error>) { }
|
||||
}
|
||||
|
||||
class B {
|
||||
B(C C.this) { }
|
||||
B(<error descr="The receiver type does not match the enclosing class type">B</error> C.this, int p) { }
|
||||
B(C <error descr="The receiver name does not match the enclosing class type">B.this</error>, long p) { }
|
||||
B(C <error descr="The receiver name does not match the enclosing class type">this</error>, float p) { }
|
||||
}
|
||||
}
|
||||
-15
@@ -130,19 +130,4 @@ class Outer {
|
||||
IntFunction<Super> f = Outer.<error descr="Annotations are not allowed here">@TA</error> This.super::getField;
|
||||
}
|
||||
}
|
||||
|
||||
//todo[r.sh]
|
||||
/*public String toString(@TA C this) { return ""; }
|
||||
|
||||
public boolean equals(@TA C this, @TA C other) { return false; }
|
||||
|
||||
C(@TA C this, boolean b) { }
|
||||
|
||||
class Outer {
|
||||
class Middle {
|
||||
class Inner {
|
||||
void innerMethod(@TA Outer.@TA Middle.@TA Inner this) { }
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user