Package org.aspectj.weaver.bcel

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


    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

  // 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

  }

 
  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

    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

   
    /** init only on initial batch compile? no file-specific options */
  private void initBcelWorld(IMessageHandler handler) throws IOException {
    List cp = buildConfig.getBootclasspath();
    cp.addAll(buildConfig.getClasspath());
    BcelWorld bcelWorld = new BcelWorld(cp, handler, null);
    bcelWorld.setBehaveInJava5Way(buildConfig.getBehaveInJava5Way());
    bcelWorld.setTargetAspectjRuntimeLevel(buildConfig.getTargetAspectjRuntimeLevel());
    bcelWorld.setXnoInline(buildConfig.isXnoInline());
    bcelWorld.setXlazyTjp(buildConfig.isXlazyTjp());
    bcelWorld.setXHasMemberSupportEnabled(buildConfig.isXHasMemberEnabled());
    bcelWorld.setPinpointMode(buildConfig.isXdevPinpoint());
    BcelWeaver bcelWeaver = new BcelWeaver(bcelWorld);
    state.setWorld(bcelWorld);
    state.setWeaver(bcelWeaver);
    state.binarySourceFiles = new HashMap();
   
    for (Iterator i = buildConfig.getAspectpath().iterator(); i.hasNext();) {
      File f = (File) i.next();
      bcelWeaver.addLibraryJarFile(f);
    }
   
//    String lintMode = buildConfig.getLintMode();
   
    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());
    }
   
    //??? incremental issues
    for (Iterator i = buildConfig.getInJars().iterator(); i.hasNext(); ) {
      File inJar = (File)i.next();
      List unwovenClasses = bcelWeaver.addJarFile(inJar, buildConfig.getOutputDir(),false);
      state.binarySourceFiles.put(inJar.getPath(), unwovenClasses);
    }
   
    for (Iterator i = buildConfig.getInpath().iterator(); i.hasNext(); ) {
      File inPathElement = (File)i.next();
      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 unwovenClasses = bcelWeaver.addJarFile(inPathElement,buildConfig.getOutputDir(),true);
        state.binarySourceFiles.put(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, buildConfig.getOutputDir());
          List ucfl = new ArrayList();
          ucfl.add(ucf);
          state.binarySourceFiles.put(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);
View Full Code Here

        zos.write(classFile.getBytes());
        zos.closeEntry();
      }
     
      private void addAspectName (String name) {
        BcelWorld world = getBcelWorld();
        ResolvedType type = world.resolve(name);
//        System.err.println("? writeAspectName() type=" + type);
        if (type.isAspect()) {
          aspectNames.add(name);
        }
      }
View Full Code Here

        List definitions = parseDefinitions(loader);
        if (!enabled) {
          return;
        }
       
        bcelWorld = new BcelWorld(
                loader, getMessageHandler(), new ICrossReferenceHandler() {
                    public void addCrossReference(ISourceLocation from, ISourceLocation to, IRelationship.Kind kind, boolean runtimeTest) {
                        ;// for tools only
                    }
                }
View Full Code Here

TOP

Related Classes of org.aspectj.weaver.bcel.BcelWorld

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.