Package org.aspectj.bridge

Examples of org.aspectj.bridge.Message


              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


  }

  public void message(IMessage.Kind kind, IHasPosition location, String message) {
    // System.out.println("message: " + message + " loc: " +
    // makeSourceLocation(location));
    getMessageHandler().handleMessage(new Message(message, kind, null, makeSourceLocation(location)));

  }
View Full Code Here

          }
        }
        if (!itdMatch) {
          IMessage message = null;
          if (isDeclareAtField) {
            message = new Message("The field '" + declA.getSignaturePattern().toString() + "' does not exist",
                declA.getSourceLocation(), true);
          } else {
            message = new Message("The method '" + declA.getSignaturePattern().toString() + "' does not exist",
                declA.getSourceLocation(), true);
          }
          world.getMessageHandler().handleMessage(message);
        }
      }
View Full Code Here

  private boolean openOutputStream(File outJar) {
    try {
      OutputStream os = FileUtil.makeOutputStream(buildConfig.getOutputJar());
      zos = new JarOutputStream(os, getWeaver().getManifest(true));
    } catch (IOException ex) {
      IMessage message = new Message("Unable to open outjar " + outJar.getPath() + "(" + ex.getMessage() + ")",
          new SourceLocation(outJar, 0), true);
      handler.handleMessage(message);
      return false;
    }
    return true;
View Full Code Here

          buildConfig.getCompilationResultDestinationManager().reportFileRemove(outJar.getPath(),
              CompilationResultDestinationManager.FILETYPE_OUTJAR);
        }
      }
    } catch (IOException ex) {
      IMessage message = new Message("Unable to write outjar " + outJar.getPath() + "(" + ex.getMessage() + ")",
          new SourceLocation(outJar, 0), true);
      handler.handleMessage(message);
    }
  }
View Full Code Here

   * @param srcloc the src of the directory entry, for use when creating a warning message
   * @throws IOException if something goes wrong creating the new zip entry
   */
  private void writeDirectory(String directory, File srcloc) throws IOException {
    if (state.hasResource(directory)) {
      IMessage msg = new Message("duplicate resource: '" + directory + "'", IMessage.WARNING, null, new SourceLocation(
          srcloc, 0));
      handler.handleMessage(msg);
      return;
    }
    if (zos != null) {
View Full Code Here

    // Nothing to do if not writing to a zip file
  }

  private void writeResource(String filename, byte[] content, File srcLocation) throws IOException {
    if (state.hasResource(filename)) {
      IMessage msg = new Message("duplicate resource: '" + filename + "'", IMessage.WARNING, null, new SourceLocation(
          srcLocation, 0));
      handler.handleMessage(msg);
      return;
    }
    if (filename.equals(buildConfig.getOutxmlName())) {
      ignoreOutxml = true;
      IMessage msg = new Message("-outxml/-outxmlfile option ignored because resource already exists: '" + filename + "'",
          IMessage.WARNING, null, new SourceLocation(srcLocation, 0));
      handler.handleMessage(msg);
    }
    if (zos != null) {
      ZipEntry newEntry = new ZipEntry(filename); // ??? get compression scheme right
      zos.putNextEntry(newEntry);
      zos.write(content);
      zos.closeEntry();
    } else {
      File destDir = buildConfig.getOutputDir();
      if (buildConfig.getCompilationResultDestinationManager() != null) {
        destDir = buildConfig.getCompilationResultDestinationManager().getOutputLocationForResource(srcLocation);
      }
      try {
        File outputLocation = new File(destDir, filename);
        OutputStream fos = FileUtil.makeOutputStream(outputLocation);
        fos.write(content);
        fos.close();
        if (buildConfig.getCompilationResultDestinationManager() != null) {
          buildConfig.getCompilationResultDestinationManager().reportFileWrite(outputLocation.getPath(),
              CompilationResultDestinationManager.FILETYPE_RESOURCE);
        }
      } catch (FileNotFoundException fnfe) {
        IMessage msg = new Message("unable to copy resource to output folder: '" + filename + "' - reason: "
            + fnfe.getMessage(), IMessage.ERROR, null, new SourceLocation(srcLocation, 0));
        handler.handleMessage(msg);
      }
    }
    state.recordResource(filename, srcLocation);
View Full Code Here

    }

    for (Iterator i = buildConfig.getAspectpath().iterator(); i.hasNext();) {
      File f = (File) i.next();
      if (!f.exists()) {
        IMessage message = new Message("invalid aspectpath entry: " + f.getName(), null, true);
        handler.handleMessage(message);
      } else {
        bcelWeaver.addLibraryJarFile(f);
      }
    }

    // String lintMode = buildConfig.getLintMode();

    File outputDir = buildConfig.getOutputDir();
    if (outputDir == null && buildConfig.getCompilationResultDestinationManager() != null) {
      // send all output from injars and inpath to the default output location
      // (will also later send the manifest there too)
      outputDir = buildConfig.getCompilationResultDestinationManager().getDefaultOutputLocation();
    }
    // ??? incremental issues
    for (File inJar : buildConfig.getInJars()) {
      List<UnwovenClassFile> unwovenClasses = bcelWeaver.addJarFile(inJar, outputDir, false);
      state.recordBinarySource(inJar.getPath(), unwovenClasses);
    }

    for (File inPathElement : buildConfig.getInpath()) {
      if (!inPathElement.isDirectory()) {
        // its a jar file on the inpath
        // the weaver method can actually handle dirs, but we don't call it, see next block
        List<UnwovenClassFile> unwovenClasses = bcelWeaver.addJarFile(inPathElement, outputDir, true);
        state.recordBinarySource(inPathElement.getPath(), unwovenClasses);
      } else {
        // add each class file in an in-dir individually, this gives us the best error reporting
        // (they are like 'source' files then), and enables a cleaner incremental treatment of
        // class file changes in indirs.
        File[] binSrcs = FileUtil.listFiles(inPathElement, binarySourceFilter);
        for (int j = 0; j < binSrcs.length; j++) {
          UnwovenClassFile ucf = bcelWeaver.addClassFile(binSrcs[j], inPathElement, outputDir);
          List<UnwovenClassFile> ucfl = new ArrayList<UnwovenClassFile>();
          ucfl.add(ucf);
          state.recordBinarySource(binSrcs[j].getPath(), ucfl);
        }
      }
    }

    bcelWeaver.setReweavableMode(buildConfig.isXNotReweavable());

    // check for org.aspectj.runtime.JoinPoint
    ResolvedType joinPoint = bcelWorld.resolve("org.aspectj.lang.JoinPoint");
    if (joinPoint.isMissing()) {
      IMessage message = new Message(
          "classpath error: unable to find org.aspectj.lang.JoinPoint (check that aspectjrt.jar is in your classpath)",
          null, true);
      handler.handleMessage(message);
    }
  }
View Full Code Here

    compiler.options.produceReferenceInfo = true; // TODO turn off when not needed

    try {
      compiler.compile(getCompilationUnits(filenames));
    } catch (OperationCanceledException oce) {
      handler.handleMessage(new Message("build cancelled:" + oce.getMessage(), IMessage.WARNING, null, null));
    }
    // cleanup
    org.aspectj.ajdt.internal.compiler.CompilerAdapter.setCompilerAdapterFactory(null);
    AnonymousClassPublisher.aspectOf().setAnonymousClassCreationListener(null);
    environment.cleanup();
View Full Code Here

        try {
          BufferedOutputStream os = FileUtil.makeOutputStream(new File(outFile));
          os.write(classFile.getBytes());
          os.close();
        } catch (FileNotFoundException fnfe) {
          IMessage msg = new Message("unable to write out class file: '" + filename + "' - reason: " + fnfe.getMessage(),
              IMessage.ERROR, null, new SourceLocation(new File(outFile), 0));
          handler.handleMessage(msg);
        }

        if (buildConfig.getCompilationResultDestinationManager() != 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.