コード例 #1
0
  private void initPrimitives() {
    if (_primitives != null) return;
    AST ast = getCurrentDietAST();

    _primitives = new PrimitiveTypeImpl[8];
    // boolean
    ITypeBinding binding = ast.resolveWellKnownType(ITypeConstants.BOOLEAN);
    if (binding == null)
      throw new IllegalStateException("fail to locate " + ITypeConstants.BOOLEAN); // $NON-NLS-1$
    _primitives[BOOLEAN_INDEX] = new PrimitiveTypeImpl(binding);
    // byte
    binding = ast.resolveWellKnownType(ITypeConstants.BYTE);
    if (binding == null)
      throw new IllegalStateException("fail to locate " + ITypeConstants.BYTE); // $NON-NLS-1$
    _primitives[BYTE_INDEX] = new PrimitiveTypeImpl(binding);
    // char
    binding = ast.resolveWellKnownType(ITypeConstants.CHAR);
    if (binding == null)
      throw new IllegalStateException("fail to locate " + ITypeConstants.BYTE); // $NON-NLS-1$
    _primitives[CHAR_INDEX] = new PrimitiveTypeImpl(binding);
    // double
    binding = ast.resolveWellKnownType(ITypeConstants.DOUBLE);
    if (binding == null)
      throw new IllegalStateException("fail to locate " + ITypeConstants.BYTE); // $NON-NLS-1$
    _primitives[DOUBLE_INDEX] = new PrimitiveTypeImpl(binding);
    // float
    binding = ast.resolveWellKnownType(ITypeConstants.FLOAT);
    if (binding == null)
      throw new IllegalStateException("fail to locate " + ITypeConstants.BYTE); // $NON-NLS-1$
    _primitives[FLOAT_INDEX] = new PrimitiveTypeImpl(binding);
    // int
    binding = ast.resolveWellKnownType(ITypeConstants.INT);
    if (binding == null)
      throw new IllegalStateException("fail to locate " + ITypeConstants.BYTE); // $NON-NLS-1$
    _primitives[INT_INDEX] = new PrimitiveTypeImpl(binding);
    // long
    binding = ast.resolveWellKnownType(ITypeConstants.LONG);
    if (binding == null)
      throw new IllegalStateException("fail to locate " + ITypeConstants.BYTE); // $NON-NLS-1$
    _primitives[LONG_INDEX] = new PrimitiveTypeImpl(binding);
    // short
    binding = ast.resolveWellKnownType(ITypeConstants.SHORT);
    if (binding == null)
      throw new IllegalStateException("fail to locate " + ITypeConstants.BYTE); // $NON-NLS-1$
    _primitives[SHORT_INDEX] = new PrimitiveTypeImpl(binding);
    // void
    binding = ast.resolveWellKnownType(ITypeConstants.VOID);
    if (binding == null)
      throw new IllegalStateException("fail to locate " + ITypeConstants.BYTE); // $NON-NLS-1$
    _voidType = new VoidTypeImpl(binding);
  }
コード例 #2
0
 static {
   final AST ast = AST.newAST(AST.JLS3);
   EMPTY_AST_UNIT = ast.newCompilationUnit();
 }