Skip to content

Commit 10adb37

Browse files
author
emmanue1
committed
Fix bug on local variable declarations
1 parent 225e4d6 commit 10adb37

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main/java/org/jd/core/v1/service/converter/classfiletojavasyntax/util/LocalVariableMaker.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2008-2019 Emmanuel Dupuy.
2+
* Copyright (c) 2008, 2019 Emmanuel Dupuy.
33
* This project is distributed under the GPLv3 license.
44
* This is a Copyleft license that gives the user the right to use,
55
* copy and modify the code freely for non-commercial purposes.
@@ -182,9 +182,11 @@ protected void initLocalVariablesFromAttributes(Method method) {
182182
AttributeLocalVariableTable localVariableTable = code.getAttribute("LocalVariableTable");
183183

184184
if (localVariableTable != null) {
185+
boolean staticFlag = (method.getAccessFlags() & FLAG_STATIC) != 0;
186+
185187
for (org.jd.core.v1.model.classfile.attribute.LocalVariable localVariable : localVariableTable.getLocalVariableTable()) {
186188
int index = localVariable.getIndex();
187-
int startPc = (index==0) ? 0 : localVariable.getStartPc();
189+
int startPc = (!staticFlag && index==0) ? 0 : localVariable.getStartPc();
188190
String descriptor = localVariable.getDescriptor();
189191
String name = localVariable.getName();
190192
AbstractLocalVariable lv;

0 commit comments

Comments
 (0)