Package org.aspectj.bridge

Examples of org.aspectj.bridge.IMessage


    } catch (InvalidInputException iie) {
      ISourceLocation location = null;
      if (buildConfig.getConfigFile() != null) {
        location = new SourceLocation(buildConfig.getConfigFile(), 0);
      }
      IMessage m = new Message(iie.getMessage(), IMessage.ERROR, null, location);
      handler.handleMessage(m);
    }
    return buildConfig;
  }
View Full Code Here


          ResolvedType t = resolvedMember.getReturnType().resolve(scope.getWorld());
          if (t.isEnum()) {
            // value must be an enum reference X.Y
            int pos = v.lastIndexOf(".");
            if (pos == -1) {
              IMessage m = MessageUtil.error(WeaverMessages
                  .format(WeaverMessages.INVALID_ANNOTATION_VALUE, v, "enum"), getSourceLocation());
              scope.getWorld().getMessageHandler().handleMessage(m);
            } else {
              String typename = v.substring(0, pos);
              ResolvedType rt = scope.lookupType(typename, this).resolve(scope.getWorld());
              v = rt.getSignature() + v.substring(pos + 1); // from 'Color.RED' to 'Lp/Color;RED'
              annotationValues.put(k, v);
            }
          } else if (t.isPrimitiveType()) {
            if (t.getSignature() == "I") {
              try {
                int value = Integer.parseInt(v);
                annotationValues.put(k, Integer.toString(value));
              } catch (NumberFormatException nfe) {
                IMessage m = MessageUtil.error(WeaverMessages.format(WeaverMessages.INVALID_ANNOTATION_VALUE, v,
                    "int"), getSourceLocation());
                scope.getWorld().getMessageHandler().handleMessage(m);
              }
            } else if (t.getSignature() == "F") {
              try {
                float value = Float.parseFloat(v);
                annotationValues.put(k, Float.toString(value));
              } catch (NumberFormatException nfe) {
                IMessage m = MessageUtil.error(WeaverMessages.format(WeaverMessages.INVALID_ANNOTATION_VALUE, v,
                    "float"), getSourceLocation());
                scope.getWorld().getMessageHandler().handleMessage(m);
              }

            } else if (t.getSignature() == "Z") {
              if (v.equalsIgnoreCase("true") || v.equalsIgnoreCase("false")) {
                // is it ok !
              } else {
                IMessage m = MessageUtil.error(WeaverMessages.format(WeaverMessages.INVALID_ANNOTATION_VALUE, v,
                    "boolean"), getSourceLocation());
                scope.getWorld().getMessageHandler().handleMessage(m);
              }
            } else if (t.getSignature() == "S") {
              try {
                short value = Short.parseShort(v);
                annotationValues.put(k, Short.toString(value));
              } catch (NumberFormatException nfe) {
                IMessage m = MessageUtil.error(WeaverMessages.format(WeaverMessages.INVALID_ANNOTATION_VALUE, v,
                    "short"), getSourceLocation());
                scope.getWorld().getMessageHandler().handleMessage(m);
              }
            } else if (t.getSignature() == "J") {
              try {
                long value = Long.parseLong(v);
                annotationValues.put(k, Long.toString(value));
              } catch (NumberFormatException nfe) {
                IMessage m = MessageUtil.error(WeaverMessages.format(WeaverMessages.INVALID_ANNOTATION_VALUE, v,
                    "long"), getSourceLocation());
                scope.getWorld().getMessageHandler().handleMessage(m);
              }
            } else if (t.getSignature() == "D") {
              try {
                double value = Double.parseDouble(v);
                annotationValues.put(k, Double.toString(value));
              } catch (NumberFormatException nfe) {
                IMessage m = MessageUtil.error(WeaverMessages.format(WeaverMessages.INVALID_ANNOTATION_VALUE, v,
                    "double"), getSourceLocation());
                scope.getWorld().getMessageHandler().handleMessage(m);
              }
            } else if (t.getSignature() == "B") {
              try {
                byte value = Byte.parseByte(v);
                annotationValues.put(k, Byte.toString(value));
              } catch (NumberFormatException nfe) {
                IMessage m = MessageUtil.error(WeaverMessages.format(WeaverMessages.INVALID_ANNOTATION_VALUE, v,
                    "byte"), getSourceLocation());
                scope.getWorld().getMessageHandler().handleMessage(m);
              }
            } else if (t.getSignature() == "C") {
              if (v.length() != 3) { // '?'
                IMessage m = MessageUtil.error(WeaverMessages.format(WeaverMessages.INVALID_ANNOTATION_VALUE, v,
                    "char"), getSourceLocation());
                scope.getWorld().getMessageHandler().handleMessage(m);
              } else {
                annotationValues.put(k, v.substring(1, 2));
              }
            } else {
              throw new RuntimeException("Not implemented for " + t);
            }
          } else if (t.equals(ResolvedType.JL_STRING)) {
            // nothing to do, it will be OK
          } else {
            throw new RuntimeException("Compiler limitation: annotation value support not implemented for type " + t);
          }
        }
      }
      if (!validKey) {
        IMessage m = MessageUtil.error(WeaverMessages.format(WeaverMessages.UNKNOWN_ANNOTATION_VALUE, annotationType, k),
            getSourceLocation());
        scope.getWorld().getMessageHandler().handleMessage(m);
      }
    }
  }
View Full Code Here

    this.typePattern = typePattern.resolveBindings(scope, bindings, false, false);
    resolved = true;
    if (typePattern instanceof ExactTypePattern) {
      ExactTypePattern et = (ExactTypePattern) typePattern;
      if (!et.getExactType().resolve(scope.getWorld()).isAnnotation()) {
        IMessage m = MessageUtil.error(WeaverMessages.format(WeaverMessages.REFERENCE_TO_NON_ANNOTATION_TYPE, et
            .getExactType().getName()), getSourceLocation());
        scope.getWorld().getMessageHandler().handleMessage(m);
        resolved = false;
      }
      ResolvedType annotationType = et.getExactType().resolve(scope.getWorld());
View Full Code Here

        // this is the output dir
        outputDir = buildConfig.getCompilationResultDestinationManager().getDefaultOutputLocation();
      }
      ucf = weaver.addClassFile(bsf.binSrc, bsf.fromInPathDirectory, outputDir);
    } catch (IOException ex) {
      IMessage msg = new Message("can't read class file " + bsf.binSrc.getPath(), new SourceLocation(bsf.binSrc, 0), false);
      buildManager.handler.handleMessage(msg);
    }
    return ucf;
  }
View Full Code Here

    boolean cellHasFocus) {
            String label = "<no message>";
            String detail = null;
            IMessage.Kind kind = IMessage.ERROR;
            if (value instanceof IMessage) {
        IMessage cm = (IMessage) value;
                label = cm.getMessage();
                if (LangUtil.isEmpty(label)) {
                    label = cm.getMessage();
                }
                kind = cm.getKind();
                Throwable thrown = cm.getThrown();
                if (null != thrown) {
                    detail = LangUtil.renderException(thrown);
                }
            } else if (null != value) {
                label = value.toString();
View Full Code Here

    return (ret.indexOf('.') == -1) ? ret : null;
  }

  protected void verifyIsAnnotationType(ResolvedType type, IScope scope) {
    if (!type.isAnnotation()) {
      IMessage m = MessageUtil.error(WeaverMessages.format(WeaverMessages.REFERENCE_TO_NON_ANNOTATION_TYPE, type.getName()),
          getSourceLocation());
      scope.getWorld().getMessageHandler().handleMessage(m);
      resolved = false;
    }
  }
View Full Code Here

    public void showError(String message) {
      ISourceLocation location = null;
      if (buildConfig.getConfigFile() != null) {
        location = new SourceLocation(buildConfig.getConfigFile(), 0);
      }
      IMessage errorMessage = new Message(CONFIG_MSG + message, IMessage.ERROR, null, location);
      handler.handleMessage(errorMessage);
      // MessageUtil.error(handler, CONFIG_MSG + message);
    }
View Full Code Here

    protected void showWarning(String message) {
      ISourceLocation location = null;
      if (buildConfig.getConfigFile() != null) {
        location = new SourceLocation(buildConfig.getConfigFile(), 0);
      }
      IMessage errorMessage = new Message(CONFIG_MSG + message, IMessage.WARNING, null, location);
      handler.handleMessage(errorMessage);
      // MessageUtil.warn(handler, message);
    }
View Full Code Here

    resolved = true;
    formalType = world.resolve(formalType);
    annotationType = world.resolve(annotationType);
    ResolvedType annoType = (ResolvedType) annotationType;
    if (!annoType.isAnnotation()) {
      IMessage m = MessageUtil.error(WeaverMessages.format(WeaverMessages.REFERENCE_TO_NON_ANNOTATION_TYPE, annoType
          .getName()), getSourceLocation());
      world.getMessageHandler().handleMessage(m);
      resolved = false;
    }
  }
View Full Code Here

        kind = IMessage.ERROR;
      } else {
        kind = IMessage.WARNING;
      }
    }
    IMessage msg = null;
    if (isLintMessage) {
      msg = new LintMessage(problem.getMessage(), extraDetails, world.getLint().fromKey(lintkey), kind, sourceLocation, null,
          seeAlsoLocations, declared, problem.getID(), problem.getSourceStart(), problem.getSourceEnd());
    } else {
      msg = new Message(problem.getMessage(), extraDetails, kind, sourceLocation, null, seeAlsoLocations, declared, problem
View Full Code Here

TOP

Related Classes of org.aspectj.bridge.IMessage

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.