mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 13:02:30 +07:00
[java] better error message when extends/implements list not allowed (IDEA-350501)
GitOrigin-RevId: 3eee3e73fe57a8dc7bf10b9b30956e02a36c89d8
This commit is contained in:
committed by
intellij-monorepo-bot
parent
0fc08dae0c
commit
afb2aef0a1
@@ -542,7 +542,7 @@ public final class HighlightClassUtil {
|
||||
if (isExtends) {
|
||||
String description = JavaErrorBundle.message(aClass.isRecord() ? "record.extends" : "extends.after.enum");
|
||||
HighlightInfo.Builder info =
|
||||
HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(list).descriptionAndTooltip(description);
|
||||
HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(list.getFirstChild()).descriptionAndTooltip(description);
|
||||
IntentionAction action = QuickFixFactory.getInstance().createDeleteFix(list);
|
||||
info.registerFix(action, null, null, null, null);
|
||||
return info;
|
||||
@@ -557,7 +557,7 @@ public final class HighlightClassUtil {
|
||||
if (isImplements) {
|
||||
String description = JavaErrorBundle.message("implements.after.interface");
|
||||
HighlightInfo.Builder result =
|
||||
HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(list).descriptionAndTooltip(description);
|
||||
HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(list.getFirstChild()).descriptionAndTooltip(description);
|
||||
PsiClassType[] referencedTypes = list.getReferencedTypes();
|
||||
if (referencedTypes.length > 0) {
|
||||
IntentionAction action = QuickFixFactory.getInstance().createChangeExtendsToImplementsFix(aClass, referencedTypes[0]);
|
||||
|
||||
@@ -102,8 +102,8 @@ unchecked.overriding.incompatible.return.type=Unchecked overriding: return type
|
||||
interface.expected=Interface expected here
|
||||
no.interface.expected=No interface expected here
|
||||
class.expected=Class name expected here
|
||||
implements.after.interface=No implements clause allowed for interface
|
||||
extends.after.enum=No extends clause allowed for enum
|
||||
implements.after.interface='implements' not allowed on interface
|
||||
extends.after.enum='extends' not allowed on enum
|
||||
permits.after.enum='permits' not allowed on enum
|
||||
class.must.be.abstract=Class ''{0}'' must either be declared abstract or implement abstract method ''{1}'' in ''{2}''
|
||||
enum.constant.must.implement.method=Enum constant ''{0}'' must implement abstract method ''{1}'' in ''{2}''
|
||||
@@ -493,7 +493,7 @@ lvti.selfReferenced=Cannot infer type for ''{0}'', it is used in its own variabl
|
||||
|
||||
record.no.header=Record has no header declared
|
||||
record.header.regular.class=Record header declared for non-record
|
||||
record.extends=No extends clause allowed for record
|
||||
record.extends='extends' not allowed on record
|
||||
record.component.vararg.not.last=Vararg record component must be the last in the list
|
||||
record.component.cstyle.declaration=C-style array declaration not allowed in record component
|
||||
record.component.restricted.name=Illegal record component name ''{0}''
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
interface i <error descr="No implements clause allowed for interface">implements Runnable</error> {}
|
||||
interface i <error descr="'implements' not allowed on interface">implements</error> Runnable {}
|
||||
|
||||
interface ii {}
|
||||
class cs extends <error descr="No interface expected here">ii</error> {}
|
||||
|
||||
@@ -8,7 +8,7 @@ record NoComponents() {}
|
||||
class ClassWithComponents<error descr="Record header declared for non-record">(int x)</error> {}
|
||||
class ClassWithComponents2<error descr="Record header declared for non-record">(int x, int y)</error> {}
|
||||
<error descr="Modifier 'abstract' not allowed here">abstract</error> record AbstractRecord() {}
|
||||
record ExtendsObject() <error descr="No extends clause allowed for record">extends Object</error> {}
|
||||
record ExtendsObject() <error descr="'extends' not allowed on record">extends</error> Object {}
|
||||
record PermitsObject() <error descr="'permits' not allowed on record">permits</error> Object {}
|
||||
class ExtendsRecord extends <error descr="Cannot inherit from final 'NoComponents'">NoComponents</error> {}
|
||||
abstract class ExtendsJLR extends <error descr="Classes cannot directly extend 'java.lang.Record'">Record</error> {}
|
||||
@@ -76,7 +76,7 @@ record CStyle(int a<error descr="C-style array declaration not allowed in record
|
||||
record CStyle2(int[] a<error descr="C-style array declaration not allowed in record component">[] []</error> ) {}
|
||||
record JavaStyle(int[] [] a) {}
|
||||
record SafeVarargComponent(<error descr="@SafeVarargs is not allowed on a record component">@SafeVarargs</error> int... component) {}
|
||||
record ExtendsRecordExplicitly() <error descr="No extends clause allowed for record">extends java.lang.Record</error> {}
|
||||
record ExtendsRecordExplicitly() <error descr="'extends' not allowed on record">extends</error> java.lang.Record {}
|
||||
|
||||
record AbstractMethod() {
|
||||
<error descr="Abstract method in non-abstract class">abstract</error> void f();
|
||||
|
||||
Reference in New Issue
Block a user