use of org.checkerframework.common.wholeprograminference.scenelib.ASceneWrapper in project checker-framework by typetools.
the class WholeProgramInferenceScenesStorage method writeResultsToFile.
@Override
public void writeResultsToFile(WholeProgramInference.OutputFormat outputFormat, BaseTypeChecker checker) {
if (outputFormat == OutputFormat.AJAVA) {
throw new BugInCF("WholeProgramInferenceScenes used with format " + outputFormat);
}
for (String file : modifiedScenes) {
ASceneWrapper scene = scenes.get(file);
prepareSceneForWriting(scene.getAScene());
}
writeScenes(outputFormat, checker);
}
use of org.checkerframework.common.wholeprograminference.scenelib.ASceneWrapper in project checker-framework by typetools.
the class WholeProgramInferenceScenesStorage method getClassAnnos.
/**
* Get the annotations for a class.
*
* @param className the name of the class, in binary form
* @param file the path to the file that represents the class
* @param classSymbol optionally, the ClassSymbol representing the class
* @return the annotations for the class
*/
private AClass getClassAnnos(@BinaryName String className, String file, @Nullable ClassSymbol classSymbol) {
// Possibly reads .jaif file to obtain a Scene.
ASceneWrapper scene = getScene(file);
AClass aClass = scene.getAScene().classes.getVivify(className);
scene.updateSymbolInformation(aClass, classSymbol);
return aClass;
}
use of org.checkerframework.common.wholeprograminference.scenelib.ASceneWrapper in project checker-framework by typetools.
the class WholeProgramInferenceScenesStorage method getScene.
/**
* Reads a Scene from the given .jaif file, or returns an empty Scene if the file does not exist.
*
* @param jaifPath the .jaif file
* @return the Scene read from the file, or an empty Scene if the file does not exist
*/
private ASceneWrapper getScene(String jaifPath) {
AScene scene;
if (!scenes.containsKey(jaifPath)) {
File jaifFile = new File(jaifPath);
scene = new AScene();
if (jaifFile.exists()) {
try {
IndexFileParser.parseFile(jaifPath, scene);
} catch (IOException e) {
throw new UserError("Problem while reading %s: %s", jaifPath, e.getMessage());
}
}
ASceneWrapper wrapper = new ASceneWrapper(scene);
scenes.put(jaifPath, wrapper);
return wrapper;
} else {
return scenes.get(jaifPath);
}
}
use of org.checkerframework.common.wholeprograminference.scenelib.ASceneWrapper in project checker-framework by typetools.
the class WholeProgramInferenceScenesStorage method getAClass.
/**
* Returns the scene-lib representation of the given className in the scene identified by the
* given jaifPath.
*
* @param className the name of the class to get, in binary form
* @param jaifPath the path to the jaif file that would represent that class (must end in ".jaif")
* @param classSymbol optionally, the ClassSymbol representing the class. Used to set the symbol
* information stored on an AClass.
* @return a version of the scene-lib representation of the class, augmented with symbol
* information if {@code classSymbol} was non-null
*/
protected AClass getAClass(@BinaryName String className, String jaifPath, @Nullable ClassSymbol classSymbol) {
// Possibly reads .jaif file to obtain a Scene.
ASceneWrapper scene = getScene(jaifPath);
AClass aClass = scene.getAScene().classes.getVivify(className);
scene.updateSymbolInformation(aClass, classSymbol);
return aClass;
}
Aggregations