Skip to content

Commit df30945

Browse files
author
emmanue1
committed
Fix syntax errors in decompiled sources
1 parent b199ffc commit df30945

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

src/main/java/org/jd/core/v1/service/converter/classfiletojavasyntax/model/localvariable/ObjectLocalVariable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public void typeOnRight(Map<String, BaseType> typeBounds, Type type) {
139139

140140
@Override
141141
public void typeOnLeft(Map<String, BaseType> typeBounds, Type type) {
142-
if (type != TYPE_UNDEFINED_OBJECT) {
142+
if ((type != TYPE_UNDEFINED_OBJECT) && !type.equals(TYPE_OBJECT)) {
143143
if (this.type == TYPE_UNDEFINED_OBJECT) {
144144
this.type = type;
145145
fireChangeEvent(typeBounds);

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -891,12 +891,14 @@ public void parse(BasicBlock basicBlock, Statements statements, DefaultStack<Exp
891891
break;
892892
case 198: // IFNULL
893893
expression1 = stack.pop();
894+
typeParametersToTypeArgumentsBinder.bindParameterTypesWithArgumentTypes(TYPE_OBJECT, expression1);
894895
stack.push(new BinaryOperatorExpression(lineNumber, TYPE_BOOLEAN, expression1, basicBlock.mustInverseCondition() ? "!=" : "==", new NullExpression(expression1.getLineNumber(), expression1.getType()), 9));
895896
offset += 2; // Skip branch offset
896897
checkStack(stack, code, offset);
897898
break;
898899
case 199: // IFNONNULL
899900
expression1 = stack.pop();
901+
typeParametersToTypeArgumentsBinder.bindParameterTypesWithArgumentTypes(TYPE_OBJECT, expression1);
900902
stack.push(new BinaryOperatorExpression(lineNumber, TYPE_BOOLEAN, expression1, basicBlock.mustInverseCondition() ? "==" : "!=", new NullExpression(expression1.getLineNumber(), expression1.getType()), 9));
901903
offset += 2; // Skip branch offset
902904
checkStack(stack, code, offset);

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import static org.jd.core.v1.model.javasyntax.declaration.Declaration.FLAG_STATIC;
2121
import static org.jd.core.v1.model.javasyntax.type.ObjectType.TYPE_OBJECT;
22+
import static org.jd.core.v1.model.javasyntax.type.ObjectType.TYPE_UNDEFINED_OBJECT;
2223

2324
public class TypeParametersToTypeArgumentsBinder {
2425
protected PopulateBindingsWithTypeParameterVisitor populateBindingsWithTypeParameterVisitor = new PopulateBindingsWithTypeParameterVisitor();
@@ -407,7 +408,7 @@ protected boolean eraseTypeArguments(Expression expression, BaseTypeParameter ty
407408
protected void populateBindingsWithTypeArgument(Map<String, TypeArgument> bindings, Map<String, BaseType> typeBounds, Type type, Expression expression) {
408409
Type t = getExpressionType(expression);
409410

410-
if (t != null) {
411+
if ((t != null) && (t != TYPE_UNDEFINED_OBJECT)) {
411412
populateBindingsWithTypeArgumentVisitor.init(contextualTypeBounds, bindings, typeBounds, t);
412413
type.accept(populateBindingsWithTypeArgumentVisitor);
413414
}

0 commit comments

Comments
 (0)