Coverage Report - com.sun.tools.javafx.main.JavafxJavaCompiler
 
Classes in this File Line Coverage Branch Coverage Complexity
JavafxJavaCompiler
94%
17/18
100%
2/2
0
 
 1  
 /*
 2  
  * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
 3  
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 4  
  *
 5  
  * This code is free software; you can redistribute it and/or modify it
 6  
  * under the terms of the GNU General Public License version 2 only, as
 7  
  * published by the Free Software Foundation.  Sun designates this
 8  
  * particular file as subject to the "Classpath" exception as provided
 9  
  * by Sun in the LICENSE file that accompanied this code.
 10  
  *
 11  
  * This code is distributed in the hope that it will be useful, but WITHOUT
 12  
  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 13  
  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 14  
  * version 2 for more details (a copy is included in the LICENSE file that
 15  
  * accompanied this code).
 16  
  *
 17  
  * You should have received a copy of the GNU General Public License version
 18  
  * 2 along with this work; if not, write to the Free Software Foundation,
 19  
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 20  
  *
 21  
  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
 22  
  * CA 95054 USA or visit www.sun.com if you need additional information or
 23  
  * have any questions.
 24  
  */
 25  
 
 26  
 package com.sun.tools.javafx.main;
 27  
 
 28  
 import com.sun.tools.javac.comp.AttrContext;
 29  
 import com.sun.tools.javac.comp.Env;
 30  
 import com.sun.tools.javac.main.*;
 31  
 import com.sun.tools.javac.tree.JCTree.JCClassDecl;
 32  
 import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
 33  
 import com.sun.tools.javac.util.*;
 34  
 import java.io.IOException;
 35  
 import javax.annotation.processing.Processor;
 36  
 import javax.tools.JavaFileObject;
 37  
 
 38  
 /**
 39  
  *
 40  
  * @author Robert
 41  
  */
 42  
 public class JavafxJavaCompiler extends JavaCompiler {
 43  
     /** The context key for the compiler. */
 44  12
     protected static final Context.Key<JavafxJavaCompiler> javafxJavaCompilerKey =
 45  
         new Context.Key<JavafxJavaCompiler>();
 46  
     
 47  
     List<JCCompilationUnit> modules; // Current compilation
 48  
 
 49  
     /** Get the JavaCompiler instance for this context. */
 50  
     public static JavafxJavaCompiler instance(Context context) {
 51  798
         JavafxJavaCompiler instance = context.get(javafxJavaCompilerKey);
 52  798
         if (instance == null)
 53  399
             instance = new JavafxJavaCompiler(context);
 54  798
         return instance;
 55  
     }
 56  
 
 57  
     protected JavafxJavaCompiler(Context context) {
 58  399
         super(context);
 59  399
     }
 60  
 
 61  
     @Override
 62  
     public void initProcessAnnotations(Iterable<? extends Processor> arg0) {
 63  
         // JavaFX Script doesn't support annotations
 64  379
     }
 65  
 
 66  
     public void backEnd(List<JCCompilationUnit> externalModules, ListBuffer<JavaFileObject> results) throws IOException {
 67  379
         modules = externalModules;
 68  379
         this.results = results;
 69  379
         compile(null, List.<String>nil(), null);
 70  379
         results = null;
 71  379
     }
 72  
     
 73  
     public Name.Table getNames() {
 74  0
         return names;
 75  
     }
 76  
     
 77  
     /**
 78  
      * Override of JavaCompiler.generate() to catch list of generated class files.
 79  
      * Do not call directly.
 80  
      */
 81  
     @Override
 82  
     public void generate(List<Pair<Env<AttrContext>, JCClassDecl>> list) {
 83  674
         generate(list, results);
 84  674
     }
 85  399
     ListBuffer<JavaFileObject> results = null;
 86  
 
 87  
     @Override
 88  
     public List<JCCompilationUnit> parseFiles(List<JavaFileObject> fileObjects) throws IOException {
 89  379
         return modules;
 90  
     }
 91  
 }