Package org.aspectj.bridge

Examples of org.aspectj.bridge.Message


          hasAtAspectJAnnotation = hasAtAspectJAnnotation || handleAroundAnnotation(rvs, struct, preResolvedPointcut);
          // there can only be one RuntimeVisible bytecode attribute
          break;
        }
      } catch (ReturningFormalNotDeclaredInAdviceSignatureException e) {
        msgHandler.handleMessage(new Message(WeaverMessages.format(WeaverMessages.RETURNING_FORMAL_NOT_DECLARED_IN_ADVICE,
            e.getFormalName()), IMessage.ERROR, null, bMethod.getSourceLocation()));
      } catch (ThrownFormalNotDeclaredInAdviceSignatureException e) {
        msgHandler.handleMessage(new Message(WeaverMessages.format(WeaverMessages.THROWN_FORMAL_NOT_DECLARED_IN_ADVICE,
            e.getFormalName()), IMessage.ERROR, null, bMethod.getSourceLocation()));
      }
    }
    hasAtAspectJAnnotation = hasAtAspectJAnnotation || hasAtAspectJAnnotationMustReturnVoid;

    // semantic check - must be in an @Aspect [remove if previous block
    // bypassed in advance]
    if (hasAtAspectJAnnotation && !type.isAspect()) { // isAnnotationStyleAspect())
      // {
      msgHandler.handleMessage(new Message("Found @AspectJ annotations in a non @Aspect type '" + type.getName() + "'",
          IMessage.WARNING, null, type.getSourceLocation()));
      // go ahead
    }
    // semantic check - advice must be public
    if (hasAtAspectJAnnotation && !struct.method.isPublic()) {
      msgHandler.handleMessage(new Message("Found @AspectJ annotation on a non public advice '"
          + methodToString(struct.method) + "'", IMessage.ERROR, null, type.getSourceLocation()));
      // go ahead
    }

    // semantic check - advice must not be static
    if (hasAtAspectJAnnotation && struct.method.isStatic()) {
      msgHandler.handleMessage(MessageUtil.error("Advice cannot be declared static '" + methodToString(struct.method) + "'",
          type.getSourceLocation()));
      // new Message(
      // "Advice cannot be declared static '" +
      // methodToString(struct.method) + "'",
      // IMessage.ERROR,
      // null,
      // type.getSourceLocation()
      // )
      // );
      // go ahead
    }

    // semantic check for non around advice must return void
    if (hasAtAspectJAnnotationMustReturnVoid && !Type.VOID.equals(struct.method.getReturnType())) {
      msgHandler.handleMessage(new Message("Found @AspectJ annotation on a non around advice not returning void '"
          + methodToString(struct.method) + "'", IMessage.ERROR, null, type.getSourceLocation()));
      // go ahead
    }

    return struct.ajAttributes;
View Full Code Here


   * @param message
   * @param location
   */
  private static void reportError(String message, AjAttributeStruct location) {
    if (!location.handler.isIgnoring(IMessage.ERROR)) {
      location.handler.handleMessage(new Message(message, location.enclosingType.getSourceLocation(), true));
    }
  }
View Full Code Here

   * @param message
   * @param location
   */
  private static void reportWarning(String message, AjAttributeStruct location) {
    if (!location.handler.isIgnoring(IMessage.WARNING)) {
      location.handler.handleMessage(new Message(message, location.enclosingType.getSourceLocation(), false));
    }
  }
View Full Code Here

   * Error reporting
   *
   * @param message
   */
  private void reportError(String message) {
    world.getMessageHandler().handleMessage(new Message(message, IMessage.ERROR, null, null));
  }
View Full Code Here

    }

    String description = advice.getKind().toString();
    String advisedType = shadow.getEnclosingType().getName();
    String advisingType = advice.getConcreteAspect().getName();
    Message msg = null;
    if (advice.getKind().equals(AdviceKind.Softener)) {
      msg = WeaveMessage.constructWeavingMessage(WeaveMessage.WEAVEMESSAGE_SOFTENS, new String[] { advisedType,
          beautifyLocation(shadow.getSourceLocation()), advisingType, beautifyLocation(munger.getSourceLocation()) },
          advisedType, advisingType);
    } else {
View Full Code Here

    return bcelWeavingSupport;
  }

  @Override
  public void reportCheckerMatch(Checker checker, Shadow shadow) {
    IMessage iMessage = new Message(checker.getMessage(shadow), shadow.toString(), checker.isError() ? IMessage.ERROR
        : IMessage.WARNING, shadow.getSourceLocation(), null, new ISourceLocation[] { checker.getSourceLocation() }, true,
        0, -1, -1);

    getMessageHandler().handleMessage(iMessage);
View Full Code Here

    }
    return true;
  }

  public void error(BcelClassWeaver weaver, String text, ISourceLocation primaryLoc, ISourceLocation[] extraLocs) {
    IMessage msg = new Message(text, primaryLoc, true, extraLocs);
    weaver.getWorld().getMessageHandler().handleMessage(msg);
  }
View Full Code Here

          }
        }
        if (!isOK) {
          // the class does not implement this method, they needed to
          // supply a default impl class
          IMessage msg = new Message("@DeclareParents: No defaultImpl was specified but the type '" + gen.getName()
              + "' does not implement the method '" + stringifyMember(introduced) + "' defined on the interface '"
              + introduced.getDeclaringType() + "'", weaver.getLazyClassGen().getType().getSourceLocation(), true,
              new ISourceLocation[] { munger.getSourceLocation() });
          weaver.getWorld().getMessageHandler().handleMessage(msg);
          return false;
View Full Code Here

  protected FuzzyBoolean matchInternal(Shadow shadow) {
    ResolvedType enclosingType = shadow.getIWorld().resolve(shadow.getEnclosingType(), true);
    if (enclosingType.isMissing()) {
      // PTWIMPL ?? Add a proper message
      IMessage msg = new Message("Cant find type pertypewithin matching...", shadow.getSourceLocation(), true,
          new ISourceLocation[] { getSourceLocation() });
      shadow.getIWorld().getMessageHandler().handleMessage(msg);
    }

    // See pr106554 - we can't put advice calls in an interface when the
View Full Code Here

              previousIsClosure = false;
              getConcreteAspect()
                  .getWorld()
                  .getMessageHandler()
                  .handleMessage(
                      new Message("use of ProceedingJoinPoint is allowed only on around advice (" + "arg "
                          + i + " in " + toString() + ")", this.getSourceLocation(), true));
              // try to avoid verify error and pass in null
              il.append(InstructionConstants.ACONST_NULL);
            } else {
              if (previousIsClosure) {
                il.append(InstructionConstants.DUP);
              } else {
                previousIsClosure = true;
                il.append(closureInstantiation.copy());
              }
            }
          } else if ("Lorg/aspectj/lang/JoinPoint$StaticPart;".equals(getSignature().getParameterTypes()[i]
              .getSignature())) {
            previousIsClosure = false;
            if ((getExtraParameterFlags() & ThisJoinPointStaticPart) != 0) {
              shadow.getThisJoinPointStaticPartBcelVar().appendLoad(il, fact);
            }
          } else if ("Lorg/aspectj/lang/JoinPoint;".equals(getSignature().getParameterTypes()[i].getSignature())) {
            previousIsClosure = false;
            if ((getExtraParameterFlags() & ThisJoinPoint) != 0) {
              il.append(shadow.loadThisJoinPoint());
            }
          } else if ("Lorg/aspectj/lang/JoinPoint$EnclosingStaticPart;".equals(getSignature().getParameterTypes()[i]
              .getSignature())) {
            previousIsClosure = false;
            if ((getExtraParameterFlags() & ThisEnclosingJoinPointStaticPart) != 0) {
              shadow.getThisEnclosingJoinPointStaticPartBcelVar().appendLoad(il, fact);
            }
          } else if (hasExtraParameter()) {
            previousIsClosure = false;
            extraVar.appendLoadAndConvert(il, fact, getExtraParameterType().resolve(world));
          } else {
            previousIsClosure = false;
            getConcreteAspect()
                .getWorld()
                .getMessageHandler()
                .handleMessage(
                    new Message("use of ProceedingJoinPoint is allowed only on around advice (" + "arg " + i
                        + " in " + toString() + ")", this.getSourceLocation(), true));
            // try to avoid verify error and pass in null
            il.append(InstructionConstants.ACONST_NULL);
          }
        }
View Full Code Here

TOP

Related Classes of org.aspectj.bridge.Message

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.