|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.rice.cs.javalanglevels.LanguageLevelConverter
public class LanguageLevelConverter
An instance of this class converts a language level file to a .java file of the same name by first visiting the file to error-check it, and then by augmenting the file. This class is tested at the top level in the AdvancedLevelTest, ElementaryLevelTest, and IntermediateLevelTest.
| Field Summary | |
|---|---|
static Log |
_log
|
static Hashtable<SymbolData,LanguageLevelVisitor> |
_newSDs
Stores all the SymbolDatas (and corresponding visitors) created as in course of conversion. |
static int |
INPUT_BUFFER_SIZE
|
static int |
LINE_NUM_MAPPINGS_PER_LINE
Number of line number mappings (from dj* to java) per line. |
static Options |
OPT
|
static Symboltable |
symbolTable
Hashtable for a shared symbolTable. |
| Constructor Summary | |
|---|---|
LanguageLevelConverter()
|
|
| Method Summary | |
|---|---|
static SymbolData |
_classFile2SymbolData(String qualifiedClassName)
Defines library classes assuming they are available to the PathClassLoader. |
static SymbolData |
_classFile2SymbolData(String qualifiedClassName,
String programRoot)
Uses the ASM class reader to read the class file corresponding to the class in the specified directory, and uses the information from ASM to build a SymbolData corresponding to the class. |
static SymbolData |
_getPrimitiveSymbolData(String className)
Checks to see if the provided class name is the name of a primative type, and if so, returns the corresponding SymbolData. |
Pair<LinkedList<JExprParseException>,LinkedList<Pair<String,JExpressionIF>>> |
convert(File[] files,
Options options)
Parse, Visit, Type Check, and Convert any language level files in the array of files. |
Pair<LinkedList<JExprParseException>,LinkedList<Pair<String,JExpressionIF>>> |
convert(File[] files,
Options options,
Map<File,Set<String>> sourceToTopLevelClassMap)
Parse, visit, type check, and convert any language level files (and unconverted LL files they reference) in files/ |
static SymbolData |
getSymbolDataForClassFile(String className,
String programRoot)
Resolves a reference to a class embedded in a class file. |
static boolean |
isAdvancedFile(File f)
If a file name ends with .dj2, it is an Advanced File, which is a legacy notion. |
static boolean |
isElementaryFile(File f)
If a file name ends with .dj0, it is an Elementary File |
static boolean |
isFullJavaFile(File f)
If a file name ends with .dj, it is a Functional Java File |
static boolean |
isFunctionalJavaFile(File f)
If a file name ends with .dj, it is a Functional Java File |
static boolean |
isIntermediateFile(File f)
If a file name ends with .dj1, it is an Intermediate File |
static void |
loadSymbolTable()
Ensures that the symbol table contains essential symbols. |
static void |
main(String[] args)
Do a conversion from the command line, to allow quick testing |
static boolean |
versionIs15(JavaVersion version)
|
static boolean |
versionSupportsAutoboxing(JavaVersion version)
Only certain versions of the java compiler support autoboxing |
static boolean |
versionSupportsForEach(JavaVersion version)
Only 1.5 supports for each |
static boolean |
versionSupportsGenerics(JavaVersion version)
Only certain versions of the java compiler support generics |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final Log _log
public static final Symboltable symbolTable
public static Options OPT
public static final int INPUT_BUFFER_SIZE
public static final int LINE_NUM_MAPPINGS_PER_LINE
public static final Hashtable<SymbolData,LanguageLevelVisitor> _newSDs
| Constructor Detail |
|---|
public LanguageLevelConverter()
| Method Detail |
|---|
public static void loadSymbolTable()
public static SymbolData _classFile2SymbolData(String qualifiedClassName)
public static SymbolData _classFile2SymbolData(String qualifiedClassName,
String programRoot)
qualifiedClassName - The fully qualified class name of the class we are looking upprogramRoot - The directory where the class is located.
public static SymbolData getSymbolDataForClassFile(String className,
String programRoot)
public static SymbolData _getPrimitiveSymbolData(String className)
public Pair<LinkedList<JExprParseException>,LinkedList<Pair<String,JExpressionIF>>> convert(File[] files,
Options options)
public Pair<LinkedList<JExprParseException>,LinkedList<Pair<String,JExpressionIF>>> convert(File[] files,
Options options,
Map<File,Set<String>> sourceToTopLevelClassMap)
files - The array of files to process.sourceToTopLevelClassMap - A map from source files to names of top-level classes created from that source file;
it is initially empty and subsequently filled out by this methodpublic static boolean isElementaryFile(File f)
public static boolean isIntermediateFile(File f)
public static boolean isAdvancedFile(File f)
public static boolean isFunctionalJavaFile(File f)
public static boolean isFullJavaFile(File f)
public static boolean versionSupportsAutoboxing(JavaVersion version)
public static boolean versionSupportsGenerics(JavaVersion version)
public static boolean versionSupportsForEach(JavaVersion version)
public static boolean versionIs15(JavaVersion version)
public static void main(String[] args)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||