Skip to content

Commit 42dfaa1

Browse files
author
jossonsmith
committed
Merge with trunks for fixing bug of incorrect ignoring super method
1 parent 6b8af47 commit 42dfaa1

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/net/sf/j2s/core/astvisitors/ASTScriptVisitor.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.eclipse.jdt.core.dom.EnumConstantDeclaration;
2525
import org.eclipse.jdt.core.dom.EnumDeclaration;
2626
import org.eclipse.jdt.core.dom.Expression;
27+
import org.eclipse.jdt.core.dom.ExpressionStatement;
2728
import org.eclipse.jdt.core.dom.FieldAccess;
2829
import org.eclipse.jdt.core.dom.FieldDeclaration;
2930
import org.eclipse.jdt.core.dom.IBinding;
@@ -55,7 +56,6 @@
5556
import org.eclipse.jdt.core.dom.TypeDeclarationStatement;
5657
import org.eclipse.jdt.core.dom.TypeLiteral;
5758
import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
58-
import org.eclipse.jdt.core.dom.PrimitiveType.Code;
5959

6060
public class ASTScriptVisitor extends ASTKeywordParser {
6161

@@ -1370,6 +1370,17 @@ public boolean visit(MethodDeclaration node) {
13701370
argsList = superRet.arguments();
13711371
}
13721372
}
1373+
} else if (statement instanceof ExpressionStatement) {
1374+
ExpressionStatement sttmt = (ExpressionStatement) statement;
1375+
Expression exp = sttmt.getExpression();
1376+
if (exp instanceof SuperMethodInvocation) {
1377+
SuperMethodInvocation superRet = (SuperMethodInvocation) exp;
1378+
if (superRet.getName().toString().equals(node.getName().toString())) {
1379+
// same method name
1380+
needToCheckArgs = true;
1381+
argsList = superRet.arguments();
1382+
}
1383+
}
13731384
} else if (statement instanceof SuperConstructorInvocation) {
13741385
SuperConstructorInvocation superConstructor = (SuperConstructorInvocation) statement;
13751386
needToCheckArgs = true;
@@ -1394,6 +1405,9 @@ public boolean visit(MethodDeclaration node) {
13941405
isOnlySuper = false;
13951406
break;
13961407
}
1408+
} else {
1409+
isOnlySuper = false;
1410+
break;
13971411
}
13981412
}
13991413
if (isOnlySuper) {

0 commit comments

Comments
 (0)