Package org.aspectj.weaver.bcel

Examples of org.aspectj.weaver.bcel.UnwovenClassFile


   
    public InterimCompilationResult(CompilationResult cr, List ucfList) {
      result = cr;
      unwovenClassFiles = new UnwovenClassFile[ucfList.size()];
    for (int i=0; i < ucfList.size(); i++) {
      UnwovenClassFile element = (UnwovenClassFile) ucfList.get(i);
      unwovenClassFiles[i] = element;
      AjClassFile ajcf = new AjClassFile(element.getClassName().replace('.', '/').toCharArray(),
                         element.getBytes());
      result.record(ajcf.fileName(),ajcf);
    }     
    }
View Full Code Here


      List addedOrModified = new ArrayList();
      addedOrModified.addAll(addedBinaryFiles);
      addedOrModified.addAll(getModifiedBinaryFiles());
      for (Iterator iter = addedOrModified.iterator(); iter.hasNext();) {
        AjBuildConfig.BinarySourceFile bsf = (AjBuildConfig.BinarySourceFile) iter.next();
        UnwovenClassFile ucf = createUnwovenClassFile(bsf);
        if (ucf == null) continue;
        List ucfs = new ArrayList();
        ucfs.add(ucf);
        addDependentsOf(ucf.getClassName());
        binarySourceFiles.put(bsf.binSrc.getPath(),ucfs);
        toWeave.put(bsf.binSrc.getPath(),ucfs);
      }
      deleteBinaryClassFiles();
    } else {
View Full Code Here

  private void removeAllResultsOfLastBuild() {
      // remove all binarySourceFiles, and all classesFromName...
      for (Iterator iter = binarySourceFiles.values().iterator(); iter.hasNext();) {
            List ucfs = (List) iter.next();
            for (Iterator iterator = ucfs.iterator(); iterator.hasNext();) {
                UnwovenClassFile ucf = (UnwovenClassFile) iterator.next();
                try {
                    ucf.deleteRealFile();
                } catch (IOException ex) { /* we did our best here */ }
            }
        }
      for (Iterator iterator = classesFromName.values().iterator(); iterator.hasNext();) {
            UnwovenClassFile ucf = (UnwovenClassFile) iterator.next();
            try {
                ucf.deleteRealFile();
            } catch (IOException ex) { /* we did our best here */
        }
      for (Iterator iter = resources.iterator(); iter.hasNext();) {
            String resource = (String) iter.next();
            new File(buildConfig.getOutputDir(),resource).delete();           
View Full Code Here

      //!!! might be okay to ignore
    }
  }
 
  private UnwovenClassFile createUnwovenClassFile(AjBuildConfig.BinarySourceFile bsf) {
    UnwovenClassFile ucf = null;
    try {
      ucf = weaver.addClassFile(bsf.binSrc, bsf.fromInPathDirectory, buildConfig.getOutputDir());
    } catch(IOException ex) {
      IMessage msg = new Message("can't read class file " + bsf.binSrc.getPath(),
                     new SourceLocation(bsf.binSrc,0),false);
View Full Code Here

    }

    InterimCompilationResult previous = (InterimCompilationResult) resultsFromFile.get(sourceFile);
    UnwovenClassFile[] unwovenClassFiles = result.unwovenClassFiles();
    for (int i = 0; i < unwovenClassFiles.length; i++) {
      UnwovenClassFile lastTimeRound = removeFromPreviousIfPresent(unwovenClassFiles[i],previous);
      recordClassFile(unwovenClassFiles[i],lastTimeRound);
      classesFromName.put(unwovenClassFiles[i].getClassName(),unwovenClassFiles[i]);
    }

    if (previous != null) {
View Full Code Here

 
  private UnwovenClassFile removeFromPreviousIfPresent(UnwovenClassFile cf, InterimCompilationResult previous) {
    if (previous == null) return null;
    UnwovenClassFile[] unwovenClassFiles = previous.unwovenClassFiles();
    for (int i = 0; i < unwovenClassFiles.length; i++) {
      UnwovenClassFile candidate = unwovenClassFiles[i];
      if ((candidate != null) && candidate.getFilename().equals(cf.getFilename())) {
        unwovenClassFiles[i] = null;
        return candidate;
      }
    }
    return null;
View Full Code Here

  public void cleanup() {
    baseEnvironment.cleanup();
  }

  private NameEnvironmentAnswer findType(String name) {
    UnwovenClassFile cf = (UnwovenClassFile)classesFromName.get(name);
    //System.err.println("find: " + name + " found: " + cf);
   
    if (cf == null) return null;

    try {
      //System.out.println("from cache: " + name);
      return new NameEnvironmentAnswer(
          new ClassFileReader(cf.getBytes(), cf.getFilename().toCharArray()),
          null /* no access restriction */);
    } catch (ClassFormatException e) {
      return null; //!!! seems to match FileSystem behavior
    }
  }
View Full Code Here

TOP

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

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.