JavaPsiRecordUtil: isCanonicalConstructor fixed for record w/o components; testdata fixed (IDEA-CR-56742)

GitOrigin-RevId: a179e7ddf958f6f7c76e72187a0044d2da6cc936
This commit is contained in:
Tagir Valeev
2019-12-18 12:02:04 +00:00
committed by intellij-monorepo-bot
parent cc61ddeaf4
commit 14c82dcf4f
2 changed files with 2 additions and 2 deletions
@@ -59,7 +59,7 @@ public class JavaPsiRecordUtil {
* @return true if given method is a canonical (non-compact) constructor for a record class
*/
public static boolean isCanonicalConstructor(@NotNull PsiMethod method) {
if (!method.isConstructor()) return false;
if (!method.isConstructor() || isCompactConstructor(method)) return false;
PsiClass aClass = method.getContainingClass();
if (aClass == null || !aClass.isRecord()) return false;
return hasCanonicalSignature(method, aClass.getRecordComponents());
@@ -12,7 +12,7 @@ record Throws(int x) {
public Throws<error descr="Identifier expected"> </error><error descr="Unexpected token">throws</error> <error descr="Invalid method declaration; return type required">Throwable</error> {}
}
record Generic() {
public <error descr="Canonical constructor cannot have type parameters"><T></error> Generic() {}
public <error descr="Compact constructor cannot have type parameters"><T></error> Generic {}
}
record Delegate(int x) {
public Delegate {