private JExpression unbox(JExpression original, int implicitConversion) { int typeId = implicitConversion & TypeIds.COMPILE_TYPE_MASK; ClassScope scope = curClass.scope; BaseTypeBinding primitiveType = (BaseTypeBinding) TypeBinding.wellKnownType(scope, typeId); ReferenceBinding boxType = (ReferenceBinding) scope.boxing(primitiveType); char[] selector = CharOperation.concat(primitiveType.simpleName, VALUE); MethodBinding valueMethod = boxType.getExactMethod(selector, NO_TYPES, scope.compilationUnitScope()); assert valueMethod != null; JMethod unboxMethod = typeMap.get(valueMethod); JMethodCall call = new JMethodCall(original.getSourceInfo(), original, unboxMethod); return call; }
private JExpression box(JExpression original, int implicitConversion) { int typeId = (implicitConversion & TypeIds.IMPLICIT_CONVERSION_MASK) >> 4; ClassScope scope = curClass.scope; BaseTypeBinding primitiveType = (BaseTypeBinding) TypeBinding.wellKnownType(scope, typeId); ReferenceBinding boxType = (ReferenceBinding) scope.boxing(primitiveType); MethodBinding valueOfMethod = boxType.getExactMethod(VALUE_OF, new TypeBinding[]{primitiveType}, scope .compilationUnitScope()); assert valueOfMethod != null; // Add a cast to the correct primitive type if needed. JType targetPrimitiveType = typeMap.get(primitiveType); if (original.getType() != targetPrimitiveType) { original = new JCastOperation(original.getSourceInfo(), targetPrimitiveType, original); } JMethod boxMethod = typeMap.get(valueOfMethod); JMethodCall call = new JMethodCall(original.getSourceInfo(), null, boxMethod); call.addArg(original); return call; }
TypeBinding resultType = TypeBinding.wellKnownType(scope, result & 0x0000F); if (checkCastCompatibility()) { if (originalLhsType.id != T_JavaLangString && resultType.id != T_JavaLangString) { this.lhs.computeConversion(scope, TypeBinding.wellKnownType(scope, (result >>> 16) & 0x0000F), originalLhsType); this.expression.computeConversion(scope, TypeBinding.wellKnownType(scope, (result >>> 8) & 0x0000F), originalExpressionType); this.preAssignImplicitConversion = (unboxedLhs ? BOXING : 0) | (lhsID << 4) | (result & 0x0000F); if (unboxedLhs) scope.problemReporter().autoboxing(this, lhsType, originalLhsType);
TypeBinding resultType = TypeBinding.wellKnownType(scope, result & 0x0000F); if (checkCastCompatibility()) { if (originalLhsType.id != T_JavaLangString && resultType.id != T_JavaLangString) { this.lhs.computeConversion(scope, TypeBinding.wellKnownType(scope, (result >>> 16) & 0x0000F), originalLhsType); this.expression.computeConversion(scope, TypeBinding.wellKnownType(scope, (result >>> 8) & 0x0000F), originalExpressionType); this.preAssignImplicitConversion = (unboxedLhs ? BOXING : 0) | (lhsID << 4) | (result & 0x0000F); if (unboxedLhs) scope.problemReporter().autoboxing(this, lhsType, originalLhsType);
TypeBinding resultType = TypeBinding.wellKnownType(scope, result & 0x0000F); if (checkCastCompatibility()) { if (originalLhsType.id != T_JavaLangString && resultType.id != T_JavaLangString) { this.lhs.computeConversion(scope, TypeBinding.wellKnownType(scope, (result >>> 16) & 0x0000F), originalLhsType); this.expression.computeConversion(scope, TypeBinding.wellKnownType(scope, (result >>> 8) & 0x0000F), originalExpressionType); this.preAssignImplicitConversion = (unboxedLhs ? BOXING : 0) | (lhsID << 4) | (result & 0x0000F); if (unboxedLhs) scope.problemReporter().autoboxing(this, lhsType, originalLhsType);
TypeBinding resultType = TypeBinding.wellKnownType(scope, result & 0x0000F); if (checkCastCompatibility()) { if (originalLhsType.id != T_JavaLangString && resultType.id != T_JavaLangString) { this.lhs.computeConversion(scope, TypeBinding.wellKnownType(scope, (result >>> 16) & 0x0000F), originalLhsType); this.expression.computeConversion(scope, TypeBinding.wellKnownType(scope, (result >>> 8) & 0x0000F), originalExpressionType); this.preAssignImplicitConversion = (unboxedLhs ? BOXING : 0) | (lhsID << 4) | (result & 0x0000F); if (unboxedLhs) scope.problemReporter().autoboxing(this, lhsType, originalLhsType);
TypeBinding resultType = TypeBinding.wellKnownType(scope, result & 0x0000F); if (checkCastCompatibility()) { if (originalLhsType.id != T_JavaLangString && resultType.id != T_JavaLangString) { this.lhs.computeConversion(scope, TypeBinding.wellKnownType(scope, (result >>> 16) & 0x0000F), originalLhsType); this.expression.computeConversion(scope, TypeBinding.wellKnownType(scope, (result >>> 8) & 0x0000F), originalExpressionType); this.preAssignImplicitConversion = (unboxedLhs ? BOXING : 0) | (lhsID << 4) | (result & 0x0000F); if (unboxedLhs) scope.problemReporter().autoboxing(this, lhsType, originalLhsType);
TypeBinding resultType = TypeBinding.wellKnownType(scope, result & 0x0000F); if (checkCastCompatibility()) { if (originalLhsType.id != T_JavaLangString && resultType.id != T_JavaLangString) { this.lhs.computeConversion(scope, TypeBinding.wellKnownType(scope, (result >>> 16) & 0x0000F), originalLhsType); this.expression.computeConversion(scope, TypeBinding.wellKnownType(scope, (result >>> 8) & 0x0000F), originalExpressionType); this.preAssignImplicitConversion = (unboxedLhs ? BOXING : 0) | (lhsID << 4) | (result & 0x0000F); if (unboxedLhs) scope.problemReporter().autoboxing(this, lhsType, originalLhsType);
TypeBinding resultType = TypeBinding.wellKnownType(scope, result & 0x0000F); if (checkCastCompatibility()) { if (originalLhsType.id != T_JavaLangString && resultType.id != T_JavaLangString) { this.lhs.computeConversion(scope, TypeBinding.wellKnownType(scope, (result >>> 16) & 0x0000F), originalLhsType); this.expression.computeConversion(scope, TypeBinding.wellKnownType(scope, (result >>> 8) & 0x0000F), originalExpressionType); this.preAssignImplicitConversion = (unboxedLhs ? BOXING : 0) | (lhsID << 4) | (result & 0x0000F); if (unboxedLhs) scope.problemReporter().autoboxing(this, lhsType, originalLhsType);
TypeBinding resultType = TypeBinding.wellKnownType(scope, result & 0x0000F); if (checkCastCompatibility()) { if (originalLhsType.id != T_JavaLangString && resultType.id != T_JavaLangString) { this.lhs.computeConversion(scope, TypeBinding.wellKnownType(scope, (result >>> 16) & 0x0000F), originalLhsType); this.expression.computeConversion(scope, TypeBinding.wellKnownType(scope, (result >>> 8) & 0x0000F), originalExpressionType); this.preAssignImplicitConversion = (unboxedLhs ? BOXING : 0) | (lhsID << 4) | (result & 0x0000F); if (unboxedLhs) scope.problemReporter().autoboxing(this, lhsType, originalLhsType);
TypeBinding resultType = TypeBinding.wellKnownType(scope, result & 0x0000F); if (checkCastCompatibility()) { if (originalLhsType.id != T_JavaLangString && resultType.id != T_JavaLangString) { this.lhs.computeConversion(scope, TypeBinding.wellKnownType(scope, (result >>> 16) & 0x0000F), originalLhsType); this.expression.computeConversion(scope, TypeBinding.wellKnownType(scope, (result >>> 8) & 0x0000F), originalExpressionType); this.preAssignImplicitConversion = (unboxedLhs ? BOXING : 0) | (lhsID << 4) | (result & 0x0000F); if (unboxedLhs) scope.problemReporter().autoboxing(this, lhsType, originalLhsType);
TypeBinding resultType = TypeBinding.wellKnownType(scope, result & 0x0000F); if (checkCastCompatibility()) { if (originalLhsType.id != T_JavaLangString && resultType.id != T_JavaLangString) { this.lhs.computeConversion(scope, TypeBinding.wellKnownType(scope, (result >>> 16) & 0x0000F), originalLhsType); this.expression.computeConversion(scope, TypeBinding.wellKnownType(scope, (result >>> 8) & 0x0000F), originalExpressionType); this.preAssignImplicitConversion = (unboxedLhs ? BOXING : 0) | (lhsID << 4) | (result & 0x0000F); if (unboxedLhs) scope.problemReporter().autoboxing(this, lhsType, originalLhsType);
TypeBinding resultType = TypeBinding.wellKnownType(scope, result & 0x0000F); if (checkCastCompatibility()) { if (originalLhsType.id != T_JavaLangString && resultType.id != T_JavaLangString) { this.lhs.computeConversion(scope, TypeBinding.wellKnownType(scope, (result >>> 16) & 0x0000F), originalLhsType); this.expression.computeConversion(scope, TypeBinding.wellKnownType(scope, (result >>> 8) & 0x0000F), originalExpressionType); this.preAssignImplicitConversion = (unboxedLhs ? BOXING : 0) | (lhsID << 4) | (result & 0x0000F); if (unboxedLhs) scope.problemReporter().autoboxing(this, lhsType, originalLhsType);
this.expression.computeConversion(scope, TypeBinding.wellKnownType(scope, (operatorSignature >>> 16) & 0x0000F), expressionType); this.bits |= operatorSignature & 0xF; switch (operatorSignature & 0xF) { // only switch on possible result type.....
this.expression.computeConversion(scope, TypeBinding.wellKnownType(scope, (operatorSignature >>> 16) & 0x0000F), expressionType); this.bits |= operatorSignature & 0xF; switch (operatorSignature & 0xF) { // only switch on possible result type.....
this.expression.computeConversion(scope, TypeBinding.wellKnownType(scope, (operatorSignature >>> 16) & 0x0000F), expressionType); this.bits |= operatorSignature & 0xF; switch (operatorSignature & 0xF) { // only switch on possible result type.....
this.expression.computeConversion(scope, TypeBinding.wellKnownType(scope, (operatorSignature >>> 16) & 0x0000F), expressionType); this.bits |= operatorSignature & 0xF; switch (operatorSignature & 0xF) { // only switch on possible result type.....
int operatorSignature = OperatorExpression.OperatorSignatures[operator][(leftTypeID << 4) + rightTypeID]; this.left.computeConversion(scope, TypeBinding.wellKnownType(scope, (operatorSignature >>> 16) & 0x0000F), leftType); this.right.computeConversion(scope, TypeBinding.wellKnownType(scope, (operatorSignature >>> 8) & 0x0000F), rightType); this.bits |= operatorSignature & 0xF; switch (operatorSignature & 0xF) { // record the current ReturnTypeID
this.expression.computeConversion(scope, TypeBinding.wellKnownType(scope, (operatorSignature >>> 16) & 0x0000F), expressionType); this.bits |= operatorSignature & 0xF; switch (operatorSignature & 0xF) { // only switch on possible result type.....
this.expression.computeConversion(scope, TypeBinding.wellKnownType(scope, (operatorSignature >>> 16) & 0x0000F), expressionType); this.bits |= operatorSignature & 0xF; switch (operatorSignature & 0xF) { // only switch on possible result type.....