List of usage examples for org.eclipse.jdt.internal.compiler.ast TypeReference baseTypeReference
public static final TypeReference baseTypeReference(int baseType, int dim, Annotation[][] dimAnnotations)
From source file:org.eclipse.objectteams.otdt.internal.core.compiler.ast.FieldAccessSpec.java
License:Open Source License
/** * @param name/* ww w .j ava2 s . c om*/ * @param type may be null if creating a field access spec short * @param nameSourcePositions (s<<32+e encoded) * @param calloutModifier either TokenNameset or TokenNameget */ public FieldAccessSpec(char[] name, TypeReference type, long nameSourcePositions, int calloutModifier) { super(name, nameSourcePositions); this.calloutModifier = calloutModifier; if (calloutModifier == TerminalTokens.TokenNameset && type != null) { // prepare the argument of a setter with signature for parameter mapping // (name is identical to field name) this.arguments = new Argument[] { new Argument(name, nameSourcePositions, type, 0) }; this.returnType = TypeReference.baseTypeReference(TypeIds.T_void, 0, null); this.returnType.sourceStart = this.sourceStart; this.returnType.sourceEnd = this.sourceEnd; } else { this.returnType = type; } }
From source file:org.eclipse.objectteams.otdt.internal.core.compiler.ast.PotentialTranslationExpression.java
License:Open Source License
/** * Check whether rawType is already compatible perhaps using basic type conversion * @param scope/*from w w w . j av a 2 s. c o m*/ * @param rawType * @return the compatible type */ protected TypeBinding compatibleType(BlockScope scope, TypeBinding rawType) { // save and reset flags: Config oldConfig = Config.createOrResetConfig(this); try { if (areTypesCompatible(rawType, this.expectedType)) { if (!Config.requireTypeAdjustment()) { // TODO (SH) is conversion of arrays of base type allowed? TypeBinding resultType = this.resolvedType; // default if (this.resolvedType.isBaseType()) { if (TypeBinding.notEquals(rawType, this.expectedType)) { this.rawExpression = this.expression; this.rawExpression.computeConversion(scope, rawType, rawType); // null conversion. this.expression = new CastExpression(this.expression, TypeReference.baseTypeReference(this.expectedType.id, 0, null)); this.expression.constant = Constant.NotAConstant; ((CastExpression) this.expression).checkCastTypesCompatibility(scope, this.expectedType, rawType, this.expression); this.operator = "(convert to " + new String(this.expectedType.readableName()) + ")"; //$NON-NLS-1$ //$NON-NLS-2$ resultType = this.expectedType; } } if (BaseTypeBinding.isWidening(this.expectedType.id, rawType.id) && this.expression.constant != Constant.NotAConstant) this.expression.computeConversion(scope, this.expectedType, rawType); return resultType; } } } finally { // restore on any exit: Config.removeOrRestore(oldConfig, this); } return null; }
From source file:org.eclipse.objectteams.otdt.internal.core.compiler.ast.RoleInitializationMethod.java
License:Open Source License
/** * @param compilationResult//from w w w .j a va2 s .co m */ public RoleInitializationMethod(CompilationResult compilationResult) { super(compilationResult); this.returnType = TypeReference.baseTypeReference(TypeIds.T_void, 0, null); this.selector = INIT_METHOD_NAME; this.bits |= ASTNode.NeedFreeReturn; this.isGenerated = true; // set private to disable overriding along extends: // (each constructor calls the corresponding init fields, // which must stay within the constructor's class). this.modifiers = ClassFileConstants.AccPrivate; }
From source file:org.eclipse.objectteams.otdt.internal.core.compiler.ast.TypeContainerMethod.java
License:Open Source License
/** * @param compilationResult/*from w ww.jav a 2 s . co m*/ * @param localType the type to wrap */ public TypeContainerMethod(CompilationResult compilationResult, TypeDeclaration localType) { super(compilationResult); setStatements(new Statement[] { localType }); this.selector = SELECTOR; this.isGenerated = true; this.returnType = TypeReference.baseTypeReference(TypeIds.T_void, 0, null); }