mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
take correct parameter names from debug info for long/double parameters (IDEA-53195)
This commit is contained in:
@@ -598,6 +598,8 @@ public class ClsStubBuilder {
|
||||
private final int myIgnoreCount;
|
||||
private final int myParamCount;
|
||||
private final PsiParameterStubImpl[] myParamStubs;
|
||||
private int myUsedParamSize = 0;
|
||||
private int myUsedParamCount = 0;
|
||||
|
||||
private AnnotationParamCollectingVisitor(final StubElement owner, final PsiModifierListStub modList, int ignoreCount, int paramCount,
|
||||
PsiParameterStubImpl[] paramStubs) {
|
||||
@@ -609,11 +611,21 @@ public class ClsStubBuilder {
|
||||
|
||||
@Override
|
||||
public void visitLocalVariable(String name, String desc, String signature, Label start, Label end, int index) {
|
||||
if (index >= myIgnoreCount && index < myIgnoreCount + myParamCount) {
|
||||
PsiParameterStubImpl parameterStub = myParamStubs[index - myIgnoreCount];
|
||||
if (index >= myIgnoreCount) {
|
||||
// long and double variables increase the index by 2, not by 1
|
||||
int paramIndex = (index - myIgnoreCount == myUsedParamSize) ? myUsedParamCount : index - myIgnoreCount;
|
||||
if (paramIndex >= myParamCount) return;
|
||||
PsiParameterStubImpl parameterStub = myParamStubs[paramIndex];
|
||||
if (parameterStub != null) {
|
||||
parameterStub.setName(name);
|
||||
}
|
||||
myUsedParamCount = paramIndex+1;
|
||||
if ("D".equals(desc) || "J".equals(desc)) {
|
||||
myUsedParamSize += 2;
|
||||
}
|
||||
else {
|
||||
myUsedParamSize++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,22 @@
|
||||
PsiJavaFileStub []
|
||||
PsiClassStub[name=DoubleTest fqn=DoubleTest]
|
||||
PsiModifierListStub[mask=9]
|
||||
PsiTypeParameterListStub
|
||||
PsiRefListStub[EXTENDS_LIST:]
|
||||
PsiRefListStub[IMPLEMENTS_LIST:]
|
||||
PsiMethodStub[cons DoubleTest:void]
|
||||
PsiModifierListStub[mask=1]
|
||||
PsiTypeParameterListStub
|
||||
PsiParameterListStub
|
||||
PsiRefListStub[THROWS_LIST:]
|
||||
PsiMethodStub[foo:void]
|
||||
PsiModifierListStub[mask=4096]
|
||||
PsiTypeParameterListStub
|
||||
PsiParameterListStub
|
||||
PsiParameterStub[one:double]
|
||||
PsiModifierListStub[mask=0]
|
||||
PsiParameterStub[two:double]
|
||||
PsiModifierListStub[mask=0]
|
||||
PsiParameterStub[three:double]
|
||||
PsiModifierListStub[mask=0]
|
||||
PsiRefListStub[THROWS_LIST:]
|
||||
@@ -52,9 +52,17 @@ public class ClsBuilderTest extends LightIdeaTestCase {
|
||||
}
|
||||
|
||||
public void testTestSuite() throws Exception {
|
||||
final String clsFilePath = JavaTestUtil.getJavaTestDataPath() + "/psi/cls/stubBuilder/TestSuite.class";
|
||||
doTestFromTestData();
|
||||
}
|
||||
|
||||
public void testDoubleTest() throws Exception { // IDEA-53195
|
||||
doTestFromTestData();
|
||||
}
|
||||
|
||||
private void doTestFromTestData() throws ClsFormatException, IOException {
|
||||
final String clsFilePath = JavaTestUtil.getJavaTestDataPath() + "/psi/cls/stubBuilder/" + getTestName(false) + ".class";
|
||||
VirtualFile clsFile = LocalFileSystem.getInstance().findFileByPath(clsFilePath);
|
||||
doTest(clsFile, "TestSuite.txt");
|
||||
doTest(clsFile, getTestName(false) + ".txt");
|
||||
}
|
||||
|
||||
private void doTest(final String classname) throws IOException, ClsFormatException {
|
||||
|
||||
@@ -33,6 +33,9 @@ import org.jetbrains.annotations.NonNls;
|
||||
*/
|
||||
@SuppressWarnings({"HardCodedStringLiteral"})
|
||||
@NonNls public class LightIdeaTestCase extends LightPlatformTestCase {
|
||||
public LightIdeaTestCase() {
|
||||
IdeaTestCase.initPlatformPrefix();
|
||||
}
|
||||
|
||||
public static JavaPsiFacadeEx getJavaFacade() {
|
||||
return JavaPsiFacadeEx.getInstanceEx(ourProject);
|
||||
|
||||
Reference in New Issue
Block a user