Package org.eclipse.jdt.internal.compiler.ast

Examples of org.eclipse.jdt.internal.compiler.ast.Expression


      if (x.initializer != null) {
        newArray.initializers = new ArrayList();
        if (x.initializer.expressions != null) {
          for (int i = 0; i < x.initializer.expressions.length; i++) {
            Expression expression = x.initializer.expressions[i];
            newArray.initializers.add(dispProcessExpression(expression));
          }
        }
      } else {
        newArray.dims = new ArrayList();
        for (int i = 0; i < x.dimensions.length; i++) {
          Expression dimension = x.dimensions[i];
          // can be null if index expression was empty
          if (dimension == null) {
            newArray.dims.add(program.getLiteralAbsentArrayDimension());
          } else {
            newArray.dims.add(dispProcessExpression(dimension));
View Full Code Here


      JNewArray newArray = new JNewArray(program, info, type);

      newArray.initializers = new ArrayList();
      if (x.expressions != null) {
        for (int i = 0; i < x.expressions.length; i++) {
          Expression expression = x.expressions[i];
          newArray.initializers.add(dispProcessExpression(expression));
        }
      }

      return newArray;
View Full Code Here

    if (args.length != 1) {
      reportRebindProblem(site, "GWT.create() should take exactly one argument");
      return;
    }

    Expression arg = args[0];
    if (!(arg instanceof ClassLiteralAccess)) {
      reportRebindProblem(site,
          "Only class literals may be used as arguments to GWT.create()");
      return;
    }
View Full Code Here

    for (MemberValuePair mvp : annotation.memberValuePairs()) {
      // Method name
      String identifier = String.valueOf(mvp.name);

      // Value
      Expression expressionValue = mvp.value;
      TypeBinding expectedElementValueType = mvp.binding.returnType;
      Object elementValue = getAnnotationElementValue(logger,
          expectedElementValueType, expressionValue);
      if (elementValue == null) {
        return null;
View Full Code Here

    int arrayLength = initExpressions != null ? initExpressions.length : 0;

    Object array = Array.newInstance(leafComponentClass, arrayLength);
    boolean failed = false;
    for (int i = 0; i < arrayLength; ++i) {
      Expression arrayInitExp = initExpressions[i];
      Object value = getAnnotationElementValue(logger,
          arrayInitializer.binding.leafComponentType, arrayInitExp);
      if (value != null) {
        Array.set(array, i, value);
      } else {
View Full Code Here

    public boolean visit(FieldDeclaration fieldDeclaration, MethodScope scope) {
      try {
        FieldBinding b = fieldDeclaration.binding;
        SourceInfo info = makeSourceInfo(fieldDeclaration);
        JReferenceType enclosingType = (JReferenceType) typeMap.get(scope.enclosingSourceType());
        Expression initialization = fieldDeclaration.initialization;
        if (initialization != null
            && initialization instanceof AllocationExpression
            && ((AllocationExpression) initialization).enumConstant != null) {
          createEnumField(info, b, enclosingType);
        } else {
View Full Code Here

      for (Annotation a : annotations) {
        if (SuppressWarnings.class.getName().equals(
            CharOperation.toString(((ReferenceBinding) a.resolvedType).compoundName))) {
          for (MemberValuePair pair : a.memberValuePairs()) {
            if (String.valueOf(pair.name).equals("value")) {
              Expression valueExpr = pair.value;
              if (valueExpr instanceof StringLiteral) {
                // @SuppressWarnings("Foo")
                return Sets.create(((StringLiteral) valueExpr).constant.stringValue().toLowerCase(
                    Locale.ENGLISH));
              } else if (valueExpr instanceof ArrayInitializer) {
View Full Code Here

            CharOperation.toString(((ReferenceBinding) a.resolvedType).compoundName))) {
          continue;
        }

        // Sometimes it's a SingleMemberAnnotation, other times it's not
        Expression value = null;
        if (a instanceof SingleMemberAnnotation) {
          value = ((SingleMemberAnnotation) a).memberValue;
        } else {
          for (MemberValuePair pair : a.memberValuePairs()) {
            if ("value".equals(String.valueOf(pair.name))) {
              value = pair.value;
              break;
            }
          }
        }

        assert value != null;
        if (value instanceof ArrayInitializer) {
          for (Expression e : ((ArrayInitializer) value).expressions) {
            processArtificialRescue((Annotation) e);
          }
        } else if (value instanceof Annotation) {
          processArtificialRescue((Annotation) value);
        } else {
          throw new InternalCompilerException(
              "Unable to process annotation with value of type "
                  + value.getClass().getName());
        }

        return;
      }
    }
View Full Code Here

    for (MemberValuePair mvp : annotation.memberValuePairs()) {
      // Method name
      String identifier = String.valueOf(mvp.name);

      // Value
      Expression expressionValue = mvp.value;
      TypeBinding expectedElementValueType = mvp.binding.returnType;
      Object elementValue = getAnnotationElementValue(logger,
          expectedElementValueType, expressionValue);
      if (elementValue == null) {
        return null;
View Full Code Here

    int arrayLength = initExpressions != null ? initExpressions.length : 0;

    Object array = Array.newInstance(leafComponentClass, arrayLength);
    boolean failed = false;
    for (int i = 0; i < arrayLength; ++i) {
      Expression arrayInitExp = initExpressions[i];
      Object value = getAnnotationElementValue(logger,
          arrayInitializer.binding.leafComponentType, arrayInitExp);
      if (value != null) {
        Array.set(array, i, value);
      } else {
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.compiler.ast.Expression

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.