type name correction

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@69 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent 6ac08eb0b6
commit b596c66503
  1. 8
      jode/jode/expr/CheckCastOperator.java
  2. 9
      jode/jode/expr/InstanceOfOperator.java
  3. 7
      jode/jode/expr/NewOperator.java

@ -20,11 +20,10 @@
package jode; package jode;
public class CheckCastOperator extends SimpleOperator { public class CheckCastOperator extends SimpleOperator {
String typeString; Type castType;
public CheckCastOperator(Type type, String typeString) { public CheckCastOperator(Type type) {
super(type, 0, 1); super(type, 0, 1);
this.typeString = typeString;
/* The following is wrong. The operand must not /* The following is wrong. The operand must not
* be a super type of the given type, but any type * be a super type of the given type, but any type
* especially if type is an interface. * especially if type is an interface.
@ -36,6 +35,7 @@ public class CheckCastOperator extends SimpleOperator {
* *
* The forgiving solution: * The forgiving solution:
*/ */
castType = type;
operandTypes[0] = Type.tUnknown; operandTypes[0] = Type.tUnknown;
} }
@ -48,6 +48,6 @@ public class CheckCastOperator extends SimpleOperator {
} }
public String toString(String[] operands) { public String toString(String[] operands) {
return "(" + typeString + ")" + operands[0]; return "(" + castType.toString() + ")" + operands[0];
} }
} }

@ -20,9 +20,10 @@
package jode; package jode;
public class InstanceOfOperator extends SimpleOperator { public class InstanceOfOperator extends SimpleOperator {
String typeString;
public InstanceOfOperator(Type type, String typeString) { Type instanceType;
public InstanceOfOperator(Type type) {
super(Type.tBoolean, 0, 1); super(Type.tBoolean, 0, 1);
/* The following is wrong. The operand must not /* The following is wrong. The operand must not
* be a super type of the given type, but any type * be a super type of the given type, but any type
@ -35,8 +36,8 @@ public class InstanceOfOperator extends SimpleOperator {
* *
* The forgiving solution: * The forgiving solution:
*/ */
this.instanceType = type;
this.operandTypes[0] = Type.tUnknown; this.operandTypes[0] = Type.tUnknown;
this.typeString = typeString;
} }
public int getOperandCount() { public int getOperandCount() {
return 1; return 1;
@ -51,6 +52,6 @@ public class InstanceOfOperator extends SimpleOperator {
} }
public String toString(String[] operands) { public String toString(String[] operands) {
return operands[0] + " instanceof "+typeString; return operands[0] + " instanceof "+instanceType;
} }
} }

@ -20,11 +20,8 @@
package jode; package jode;
public class NewOperator extends NoArgOperator { public class NewOperator extends NoArgOperator {
String typeString; public NewOperator(Type type) {
public NewOperator(Type type, String typeString) {
super(type); super(type);
this.typeString = typeString;
} }
public int getPriority() { public int getPriority() {
@ -32,6 +29,6 @@ public class NewOperator extends NoArgOperator {
} }
public String toString(String[] operands) { public String toString(String[] operands) {
return "new "+typeString; return "new "+type.toString();
} }
} }

Loading…
Cancel
Save