diff options
author | Sravan Kumar Lakkimsetti | 2021-09-13 08:29:10 +0000 |
---|---|---|
committer | Jay Arthanareeswaran | 2021-09-28 08:52:21 +0000 |
commit | 4ed9e7693fd206946bf477eef96b73574bc465a3 (patch) | |
tree | 5c5cdef6feea3bbf5e1f7c49b28fc40895bfef29 | |
parent | 5f7bfaf735aad1c8c8f7f53029c979653faefd74 (diff) | |
download | eclipse.jdt.core-I20211002-0220.tar.gz eclipse.jdt.core-I20211002-0220.tar.xz eclipse.jdt.core-I20211002-0220.zip |
Bug 575503 - [16] NPE on F3 for Record constructorS4_22_0_M1I20211003-1800I20211002-1800I20211002-0220I20211001-1800I20210929-1800I20210929-0600I20210928-1800I20210928-0600
Change-Id: I97c9defeefaae0894531c4c6903137751ce966e0
Signed-off-by: Sravan Kumar Lakkimsetti <sravankumarl@in.ibm.com>
Reviewed-on: https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/185361
Reviewed-by: Manoj Palat [Away until Sep 27, 2021] <manpalat@in.ibm.com>
Tested-by: JDT Bot <jdt-bot@eclipse.org>
2 files changed, 32 insertions, 3 deletions
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeResolveTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeResolveTests.java index 317a2bcaa5..12ca893e3f 100644 --- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeResolveTests.java +++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeResolveTests.java @@ -127,7 +127,7 @@ public void setUpSuite() throws Exception { } static { // TESTS_NUMBERS = new int[] { 182, 183 }; -// TESTS_NAMES = new String[] { "test528818a" }; +// TESTS_NAMES = new String[] { "testBug575503" }; } public static Test suite() { return buildModelTestSuite(TypeResolveTests.class); @@ -1641,4 +1641,33 @@ public void testBug570314() throws Exception{ deleteProject("P"); } } +public void testBug575503() throws Exception{ + try { + createJava16Project("P", new String[] {"src"}); + String source = "package p;\n\n" + + "public class Ssss {\n" + + " public static void main(String[] args) {\n" + + " new Ssss.Entry(false, new int[0]);\n" + + " }\n" + + " record Entry(boolean isHidden, int... indexes) {\n" + + " Entry(int... indexes) {\n" + + " this(false, indexes);\n" + + " }\n" + + " }\n" + + "}\n"; + createFolder("/P/src/p"); + createFile("/P/src/p/Ssss.java", source); + waitForAutoBuild(); + + ICompilationUnit unit = getCompilationUnit("/P/src/p/Ssss.java"); + String select = "Ssss.Entry"; + IJavaElement[] elements = unit.codeSelect(source.indexOf(select), select.length()); + assertEquals("should not be empty", 1, elements.length); + IType type = (IType) elements[0]; + String signature= Signature.createTypeSignature(type.getFullyQualifiedName(), true); + assertEquals("incorrect type", "Lp.Ssss$Entry;", signature); + } finally { + deleteProject("P"); + } +} } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java index 6ff5658980..eca6e42792 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2020 IBM Corporation and others. + * Copyright (c) 2000, 2021 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -1081,7 +1081,7 @@ public final char[] signature() /* (ILjava/lang/Thread;)Ljava/lang/Object; */ { } } - if (this instanceof SyntheticMethodBinding) { + if ((this instanceof SyntheticMethodBinding) && (!this.declaringClass.isRecord())) { targetParameters = ((SyntheticMethodBinding)this).targetMethod.parameters; } } |