Examples of BcelWorld


Examples of org.aspectj.weaver.bcel.BcelWorld

      if (zos != null) {
        closeOutputStream(buildConfig.getOutputJar());
      }
      ret = !handler.hasErrors();
      if (getBcelWorld() != null) {
        BcelWorld bcelWorld = getBcelWorld();
        bcelWorld.reportTimers();
        bcelWorld.tidyUp();
      }
      if (getWeaver() != null) {
        getWeaver().tidyUp();
        // bug 59895, don't release reference to handler as may be needed by a nested call
        // handler = null;
View Full Code Here

Examples of org.aspectj.weaver.bcel.BcelWorld

  /** init only on initial batch compile? no file-specific options */
  private void initBcelWorld(IMessageHandler handler) throws IOException {
    List cp = buildConfig.getFullClasspath(); // pr145693
    // buildConfig.getBootclasspath();
    // cp.addAll(buildConfig.getClasspath());
    BcelWorld bcelWorld = new BcelWorld(cp, handler, null);
    bcelWorld.setBehaveInJava5Way(buildConfig.getBehaveInJava5Way());
    bcelWorld.setTiming(buildConfig.isTiming(), false);
    bcelWorld.setAddSerialVerUID(buildConfig.isAddSerialVerUID());
    bcelWorld.setXmlConfigured(buildConfig.isXmlConfigured());
    bcelWorld.setXmlFiles(buildConfig.getXmlFiles());
    bcelWorld.performExtraConfiguration(buildConfig.getXconfigurationInfo());
    bcelWorld.setTargetAspectjRuntimeLevel(buildConfig.getTargetAspectjRuntimeLevel());
    bcelWorld.setOptionalJoinpoints(buildConfig.getXJoinpoints());
    bcelWorld.setXnoInline(buildConfig.isXnoInline());
    bcelWorld.setXlazyTjp(buildConfig.isXlazyTjp());
    bcelWorld.setXHasMemberSupportEnabled(buildConfig.isXHasMemberEnabled());
    bcelWorld.setPinpointMode(buildConfig.isXdevPinpoint());
    bcelWorld.setErrorAndWarningThreshold(buildConfig.getOptions().errorThreshold, buildConfig.getOptions().warningThreshold);
    BcelWeaver bcelWeaver = new BcelWeaver(bcelWorld);
    bcelWeaver.setCustomMungerFactory(customMungerFactory);
    state.setWorld(bcelWorld);
    state.setWeaver(bcelWeaver);
    state.clearBinarySourceFiles();

    if (buildConfig.getLintMode().equals(AjBuildConfig.AJLINT_DEFAULT)) {
      bcelWorld.getLint().loadDefaultProperties();
    } else {
      bcelWorld.getLint().setAll(buildConfig.getLintMode());
    }
    if (buildConfig.getLintSpecFile() != null) {
      bcelWorld.getLint().setFromProperties(buildConfig.getLintSpecFile());
    }

    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

Examples of org.aspectj.weaver.bcel.BcelWorld

        zos.write(classFile.getBytes());
        zos.closeEntry();
      }

      private void addAspectName(String name, char[] fileContainingAspect) {
        BcelWorld world = getBcelWorld();
        ResolvedType type = world.resolve(name);
        // System.err.println("? writeAspectName() type=" + type);
        if (type.isAspect()) {
          if (state.getAspectNamesToFileNameMap() == null) {
            state.initializeAspectNamesToFileNameMap();
          }
View Full Code Here

Examples of org.aspectj.weaver.bcel.BcelWorld

   * Some AspectJ lint options need to be known about in the compiler. This is how we pass them over...
   *
   * @param forCompiler
   */
  private void populateCompilerOptionsFromLintSettings(org.aspectj.org.eclipse.jdt.internal.compiler.Compiler forCompiler) {
    BcelWorld world = this.state.getBcelWorld();
    IMessage.Kind swallowedExceptionKind = world.getLint().swallowedExceptionInCatchBlock.getKind();
    Map optionsMap = new HashMap();
    optionsMap.put(CompilerOptions.OPTION_ReportSwallowedExceptionInCatchBlock, swallowedExceptionKind == null ? "ignore"
        : swallowedExceptionKind.toString());
    forCompiler.options.set(optionsMap);
  }
View Full Code Here

Examples of org.aspectj.weaver.bcel.BcelWorld

    return new AjBuildNotifier(monitor, currentProject);
  }

  private void initWorldAndWeaver(AjCompilerOptions options) {
    cpManager = new EclipseClassPathManager(nameEnvironment);
    myBcelWorld = new BcelWorld(cpManager, new UnhandledMessageHandler(getProject()), null /* (xrefHandler) */);
    myBcelWorld.setBehaveInJava5Way(options.behaveInJava5Way);
    myBcelWorld.setTargetAspectjRuntimeLevel(options.targetAspectjRuntimeLevel);
    myBcelWorld.setXnoInline(options.xNoInline);
    myBcelWorld.setXlazyTjp(options.xLazyThisJoinPoint);
    myBcelWorld.setXHasMemberSupportEnabled(options.xHasMember);
 
View Full Code Here

Examples of org.aspectj.weaver.bcel.BcelWorld

    createMessageHandler();

    info("using classpath: " + classPath);
    info("using aspectpath: " + aspectPath);

    bcelWorld = new BcelWorld(classPath, messageHandler, null);
    bcelWorld.setXnoInline(false);
    bcelWorld.getLint().loadDefaultProperties();
    if (LangUtil.is15VMOrGreater()) {
      bcelWorld.setBehaveInJava5Way(true);
    }
View Full Code Here

Examples of org.aspectj.weaver.bcel.BcelWorld

  // return detector.isAspect();
  // }

  protected void ensureDelegateInitialized(String name, byte[] bytes) {
    if (delegateForCurrentClass == null) {
      BcelWorld world = (BcelWorld) weaver.getWorld();
      delegateForCurrentClass = world.addSourceObjectType(name, bytes, false);
    }
  }
View Full Code Here

Examples of org.aspectj.weaver.bcel.BcelWorld

  private final TypePattern typePattern;


  public AspectJTypeFilter(String typePatternExpression, ClassLoader classLoader) {
    this.world = new BcelWorld(classLoader, IMessageHandler.THROW, null);
    this.world.setBehaveInJava5Way(true);
    PatternParser patternParser = new PatternParser(typePatternExpression);
    TypePattern typePattern = patternParser.parseTypePattern();
    typePattern.resolve(this.world);
    IScope scope = new SimpleScope(this.world, new FormalBinding[0]);
View Full Code Here

Examples of org.aspectj.weaver.bcel.BcelWorld

    createMessageHandler();

    info("using classpath: " + classPath);
    info("using aspectpath: " + aspectPath);

    bcelWorld = new BcelWorld(classPath, messageHandler, null);
    bcelWorld.setXnoInline(false);
    bcelWorld.getLint().loadDefaultProperties();
    if (LangUtil.is15VMOrGreater()) {
      bcelWorld.setBehaveInJava5Way(true);
    }
View Full Code Here

Examples of org.aspectj.weaver.bcel.BcelWorld

  // return detector.isAspect();
  // }

  protected void ensureDelegateInitialized(String name, byte[] bytes) {
    if (delegateForCurrentClass == null) {
      BcelWorld world = (BcelWorld) weaver.getWorld();
      delegateForCurrentClass = world.addSourceObjectType(name, bytes, false);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.