本文整理汇总了Java中vk.core.api.CompileError类的典型用法代码示例。如果您正苦于以下问题:Java CompileError类的具体用法?Java CompileError怎么用?Java CompileError使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CompileError类属于vk.core.api包,在下文中一共展示了CompileError类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getCompileErrors
import vk.core.api.CompileError; //导入依赖的package包/类
/**
* Gets the last compiler errors for current mode
*
* @return collection of {@link CompileError}
*/
public Collection<CompileError> getCompileErrors() {
Collection<CompileError> compileErrors = new ArrayList<CompileError>();
switch (mode) {
case RED:
for (Test exerciseTest : exercise.getTests()) {
CompilationUnit testUnit = compiler.getCompilationUnitByName(exerciseTest.getName());
compileErrors.addAll(compilerResult.getCompilerErrorsForCompilationUnit(testUnit));
}
break;
case GREEN:
case BLUE:
for (Class exerciseClass : exercise.getClasses()) {
CompilationUnit classUnit = compiler.getCompilationUnitByName(exerciseClass.getName());
compileErrors.addAll(compilerResult.getCompilerErrorsForCompilationUnit(classUnit));
}
}
return compileErrors;
}
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-null,代码行数:25,代码来源:CompileService.java
示例2: getAllCompileErrors
import vk.core.api.CompileError; //导入依赖的package包/类
/**
* Gets all of the last compile errors
*
* @return collection of {@link CompileError}
*/
public Collection<CompileError> getAllCompileErrors() {
Collection<CompileError> compileErrors = new ArrayList<CompileError>();
for (Test exerciseTest : exercise.getTests()) {
CompilationUnit testUnit = compiler.getCompilationUnitByName(exerciseTest.getName());
compileErrors.addAll(compilerResult.getCompilerErrorsForCompilationUnit(testUnit));
}
for (Class exerciseClass : exercise.getClasses()) {
CompilationUnit classUnit = compiler.getCompilationUnitByName(exerciseClass.getName());
compileErrors.addAll(compilerResult.getCompilerErrorsForCompilationUnit(classUnit));
}
return compileErrors;
}
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-null,代码行数:21,代码来源:CompileService.java
示例3: setATDDTest
import vk.core.api.CompileError; //导入依赖的package包/类
public String[] setATDDTest(String pTest) {
CompilationUnit testATDD = new CompilationUnit("ATDD", pTest, true);
InternalCompiler compileTest = new InternalCompiler(new CompilationUnit[] {testATDD, aktuell.getCodeUnit()});
compileTest.compileAndRunTests();
if(!compileTest.getCompilerResult().hasCompileErrors()) {
aTDDTest = pTest;
aTDDTestUnit = new CompilationUnit("ATDD", aTDDTest, true);
return null;
}
Object[] errorObjects = compileTest.getCompilerResult().getCompilerErrorsForCompilationUnit(testATDD).toArray();
String[] errors = new String[errorObjects.length];
for(int i = 0; i < errors.length; i++) {
errors[i] = ((CompileError) errorObjects[i]).toString();
}
return errors;
}
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-amigos,代码行数:23,代码来源:LogikHandler.java
示例4: CompilerRun
import vk.core.api.CompileError; //导入依赖的package包/类
public JavaStringCompiler CompilerRun(String className, String classContent, boolean isTest) {
CompilationUnit unit = new CompilationUnit(className, classContent, isTest);
JavaStringCompiler compiler = CompilerFactory.getCompiler(unit);
compiler.compileAndRunTests();
CompilerResult compilerResult = compiler.getCompilerResult();
Collection<CompileError> errs = compilerResult.getCompilerErrorsForCompilationUnit(unit);
for (CompileError e : errs) {
System.out.println(e.getMessage());
System.out.println(e.getCodeLineContainingTheError());
}
System.out.println("End of errors");
return compiler;
}
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-two-finger-joe,代码行数:14,代码来源:Logic.java
示例5: handleErrors
import vk.core.api.CompileError; //导入依赖的package包/类
private String handleErrors(CompilerResult cpResult, CompilationUnit classToCompile) {
Collection<CompileError> errors = cpResult.getCompilerErrorsForCompilationUnit(classToCompile);
String compilerResults = "In class " + classToCompile.getClassName() + ":\n" + errors.size() + " Errors found!\n\n";
Iterator<CompileError> err = errors.iterator();
while(err.hasNext()) {
CompileError found = err.next();
compilerResults += "In line "+ found.getLineNumber() + "\n"
+ found.getCodeLineContainingTheError() + "\n"
+ found.getMessage() +"\n";
}
return compilerResults;
}
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-stack-overflow,代码行数:13,代码来源:CompileHandler.java
示例6: compile
import vk.core.api.CompileError; //导入依赖的package包/类
/**
* Gibt Compilierfehler (wenn vorhanden) auf die (programminterne) Konsole aus
*
* Wandelt übergebene Compilationunits mit {@link #getJSC(CompilationUnit[])} in JavaStringCompiler um,
* und gibt Compilierfehler mit {@link #print_errors_to_console(Collection)} auf der programminternen Konsole aus.
*/
public static void compile(CompilationUnit[] comp_uns){ //gibt fehlermeldungen, wenn vorhanden auf die console aus
JavaStringCompiler comp = getJSC(comp_uns);
CompilerResult comp_res = comp.getCompilerResult();
if(comp_res.hasCompileErrors()){
for(CompilationUnit cu: comp_uns){
Collection<CompileError> errors = comp_res.getCompilerErrorsForCompilationUnit(cu);
print_errors_to_console(errors);
}
} else console.set_textln("No Compilation errors");
}
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-team-1,代码行数:18,代码来源:Testing.java
示例7: print_errors_to_console
import vk.core.api.CompileError; //导入依赖的package包/类
/**
* Gibt übergebene CompileError-Liste auf die programminterne Konsole aus.
*/
private static void print_errors_to_console(Collection<CompileError> errors){ //gibt compileerrors auf console aus
console.set_textln("Compilation-Errors:");
for(CompileError error: errors){
console.set_text(error.getCodeLineContainingTheError());
console.set_textln(": "+error.getMessage());
}
console.set_textln("");
}
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-team-1,代码行数:12,代码来源:Testing.java
示例8: compile
import vk.core.api.CompileError; //导入依赖的package包/类
public static void compile(String code,String codeClassName, String tests, String testClassName){
test = new CompilationUnit(testClassName, tests, true);
program = new CompilationUnit(codeClassName, code, false);
// JavaStringCompiler compiler = CompilerFactory.getCompiler(test,program);
CompilationUnit[] cus = {test , program};
InternalCompiler compiler = new InternalCompiler(cus);
compiler.compileAndRunTests();
compilerResult = compiler.getCompilerResult();
if(compilerResult.hasCompileErrors()){
Collection<CompileError> codeError = compilerResult.getCompilerErrorsForCompilationUnit(program);
Collection<CompileError> testError = compilerResult.getCompilerErrorsForCompilationUnit(test);
int codeErrors = codeError.size();
int testErrors = testError.size();
CompileError[] codeErrorArray= new CompileError[codeErrors];
codeErrorArray = codeError.toArray(codeErrorArray);
for(int i= 0; i<codeErrors;i++){
Test_UI.compileOutput.setText(Test_UI.compileOutput.getText()+"\n In class"+ codeClassName+":");
Test_UI.compileOutput.setText(Test_UI.compileOutput.getText()+" \n"+codeErrorArray[i].getCodeLineContainingTheError());
Test_UI.compileOutput.setText(Test_UI.compileOutput.getText()+" \n"+codeErrorArray[i].toString());
System.out.println("In class"+ codeClassName+":");
System.out.println(codeErrorArray[i].getCodeLineContainingTheError());
System.out.println(codeErrorArray[i].toString());
}
CompileError[] testErrorArray= new CompileError[codeErrors];
testErrorArray = testError.toArray(testErrorArray);
for(int i= 0; i<testErrors;i++){
Test_UI.compileOutput.setText(Test_UI.compileOutput.getText()+" \n"+testErrorArray[i].getCodeLineContainingTheError());
Test_UI.compileOutput.setText(Test_UI.compileOutput.getText()+" \n"+testErrorArray[i].toString());
System.out.println(testErrorArray[i].getCodeLineContainingTheError());
System.out.println(testErrorArray[i].toString());
}
if(Test_UI.status.equals("writeTest"))
Test_UI.switchStatus(true);
}
}
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-proprawunderbar,代码行数:39,代码来源:Compile.java
示例9: formatCompileErrors
import vk.core.api.CompileError; //导入依赖的package包/类
/**
* This formats any compile errors.
* @param cr The CompilerResult of the uncompilable class.
* @param cu The CompilationUnit of the uncompilable class.
* @return A String that contains all the errors.
*/
private String formatCompileErrors(CompilerResult cr, CompilationUnit cu) {
StringBuilder output = new StringBuilder();
Collection<CompileError> errorList = cr.getCompilerErrorsForCompilationUnit(cu);
for (CompileError error : errorList) {
output.append(error.toString());
output.append("\n");
}
return output.toString();
}
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-nimmdochirgendeinennamen,代码行数:16,代码来源:TDDTCompiler.java
示例10: addAutocompile
import vk.core.api.CompileError; //导入依赖的package包/类
/**
* Auto compile on change
*/
private void addAutocompile() {
// Initialize observable list
compileErrors = FXCollections.observableArrayList();
// Mark compile errors, if they changed
compileErrors.addListener(new ListChangeListener<CompileError>() {
@Override
public void onChanged(Change<? extends CompileError> change) {
codeArea.markErrors(compileErrors);
}
});
// Auto compile on change
codeArea.textProperty().addListener((observable, oldValue, newValue) -> {
// Check if possible previous compile is finished (thread terminated)
if(compileThread == null || compileThread.getState() == Thread.State.TERMINATED) {
// Then compile and change errors
compileThread = new Thread(() -> {
Platform.runLater(() -> {
switch(mode) {
case RED:
exercise.getTests().get(0).setContent(codeArea.getText());
break;
case GREEN:
case BLUE:
exercise.getClasses().get(0).setContent(codeArea.getText());
break;
}
compileAndRunTests();
compileErrors.clear();
compileErrors.addAll(getCompileErrors());
showInformations();
});
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
System.out.println("Error while measuring time");
}
});
compileThread.start();
}
});
}
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-null,代码行数:52,代码来源:CompileService.java
示例11: tryCompileTest
import vk.core.api.CompileError; //导入依赖的package包/类
public String[] tryCompileTest(){
if(aktuell.getTestUnit() == null || aktuell.getCodeUnit() == null)
return new String[] {"nothing to compile"};
InternalCompiler compileTest = new InternalCompiler(new CompilationUnit[] {aktuell.getTestUnit(), aktuell.getCodeUnit()});
compileTest.compileAndRunTests();
if(!compileTest.getCompilerResult().hasCompileErrors()) {
return null;
}
Object[] errorObjects = compileTest.getCompilerResult().getCompilerErrorsForCompilationUnit(aktuell.getTestUnit()).toArray();
String[] errors = new String[errorObjects.length];
for(int i = 0; i < errors.length; i++) {
errors[i] = ((CompileError) errorObjects[i]).toString();
}
return errors; // Note that this will only return the messages of the compilation of the test
}
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-amigos,代码行数:23,代码来源:LogikHandler.java
示例12: tryCompileCode
import vk.core.api.CompileError; //导入依赖的package包/类
public String[] tryCompileCode(){
if(aktuell.getCodeUnit() == null || aktuell.getCode().isEmpty())
return new String[] {"nothing to compile"};
InternalCompiler compileTest = new InternalCompiler(new CompilationUnit[] {aktuell.getCodeUnit()});
compileTest.compileAndRunTests();
if(!compileTest.getCompilerResult().hasCompileErrors()) {
return null;
}
Object[] errorObjects = compileTest.getCompilerResult().getCompilerErrorsForCompilationUnit(aktuell.getCodeUnit()).toArray();
String[] errors = new String[errorObjects.length];
for(int i = 0; i < errors.length; i++) {
errors[i] = ((CompileError) errorObjects[i]).toString();
}
return errors;
}
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-amigos,代码行数:23,代码来源:LogikHandler.java
示例13: compile
import vk.core.api.CompileError; //导入依赖的package包/类
public void compile() {
// Compiliert das Programm NICHT imagin�r
Process processCompile = null;
try {
processCompile = Runtime.getRuntime().exec("javac " + codeFilePath);
} catch (IOException e1) {
e1.printStackTrace();
}
// Solange compiliert wird: WARTEN!
while (processCompile.isAlive()) {
}
// Liest Programm aus einer Datei
List<String> content;
try {
content = Files.readAllLines(codeFilePath);
} catch (IOException e) {
System.out.println("ERROR: File Path Not Found!");
return;
}
// Wandelt den Quellcode in einen String um
String contentS = "";
for (int i = 0; i < content.size(); i++) {
contentS = contentS + content.get(i);
}
// Erstellt eine CompilationUnit mit den vorangegangenen Daten
CompilationUnit unit = new CompilationUnit(info.getCodeFileName(), contentS, false);
CompilationUnit[] units = new CompilationUnit[1];
units[0] = unit;
InternalCompiler comp = new InternalCompiler(units);
// Compiliert das Programm imagin�r
comp.compileAndRunTests();
// Nimmt das Resultat des Compilierens entgegen
result = comp.getCompilerResult();
Collection<CompileError> error = result.getCompilerErrorsForCompilationUnit(units[0]);
CompileError[] array = new CompileError[error.size()];
error.toArray(array);
// Gibt Errors aus
for (int i = 0; i < array.length; i++) {
console.setText(console.getText() + array[i].toString() + "\n");
}
}
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-pwnyhof,代码行数:50,代码来源:Program.java
示例14: compile
import vk.core.api.CompileError; //导入依赖的package包/类
public void compile() {
// Compiliert das Programm NICHT imaginaer
Process processCompile = null;
try {
processCompile = Runtime.getRuntime().exec("javac " + codeFilePath);
} catch (IOException e1) {
e1.printStackTrace();
}
// Solange compiliert wird: WARTEN!
while (processCompile.isAlive()) {
}
// Liest Programm aus einer Datei
List<String> content;
try {
content = Files.readAllLines(codeFilePath);
} catch (IOException e) {
System.out.println("ERROR: File Path Not Found!");
return;
}
// Wandelt den Quellcode in einen String um
String contentS = "";
for (int i = 0; i < content.size(); i++) {
contentS = contentS + content.get(i);
}
// Erstellt eine CompilationUnit mit den vorangegangenen Daten
CompilationUnit unit = new CompilationUnit(info.getCodeFileName(), contentS, false);
CompilationUnit[] units = new CompilationUnit[1];
units[0] = unit;
InternalCompiler comp = new InternalCompiler(units);
// Compiliert das Programm imaginaer
comp.compileAndRunTests();
// Nimmt das Resultat des Compilierens entgegen
result = comp.getCompilerResult();
Collection<CompileError> error = result.getCompilerErrorsForCompilationUnit(units[0]);
CompileError[] array = new CompileError[error.size()];
error.toArray(array);
// Gibt Errors aus
for (int i = 0; i < array.length; i++) {
console.setText(console.getText() + array[i].toString() + "\n");
}
}
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-pwnyhof,代码行数:50,代码来源:Program.java
示例15: checkPhase
import vk.core.api.CompileError; //导入依赖的package包/类
/**
* Checks, if the given {@link Exercise} is valid, depending on the current {@link Phase}, and moves on or not to the next phase.
* Also manages the {@link TrackingManager} and the {@link BabystepsManager}
* @param exercise The current {@link Exercise}
* @param continuePhase whether or not to move on to the next {@link Phase}, if the {@link Exercise} is valid
* @return The {@link PhaseStatus} after the {@link Executor Execution}
*/
@Override
public PhaseStatus checkPhase(Exercise exercise, boolean continuePhase) {
ExecutionResult executionResult = new Executor().execute(exercise);
phaseStatus.setExecutionResult(executionResult);
trackingManager.track(exercise, phaseStatus);
if(phase == Phase.RED) {
boolean valid = true;
if(executionResult.getCompilerResult().hasCompileErrors()) {
loop:
for(CompilationResult cr : executionResult.getCompileErrors()) {
for(CompileError ce : cr.getCompileErrors()) {
if(!(ce.getMessage().contains("cannot find symbol") || ce.getMessage().contains("method"))) {
valid = false;
break loop;
}
}
}
}
else if(executionResult.getTestResult().getNumberOfFailedTests() != 1) {
valid = false;
}
if(valid) {
if(continuePhase) {
phase = Phase.GREEN;
babystepsManager.start(originalExercise.getBabyStepsCodeTime());
}
validExercise = exercise;
}
phaseStatus = new PhaseStatus(valid, executionResult, phase);
}
else {
if((!(executionResult.getCompilerResult().hasCompileErrors())) &&
(executionResult.getTestResult().getNumberOfFailedTests() == 0)) {
if(continuePhase) {
if(phase == Phase.GREEN) {
phase = Phase.REFACTOR;
babystepsManager.stop();
}
else {
phase = Phase.RED;
babystepsManager.start(originalExercise.getBabyStepsTestTime());
}
}
validExercise = exercise;
phaseStatus = new PhaseStatus(true, executionResult, phase);
}
else {
phaseStatus = new PhaseStatus(false, executionResult, phase);
}
}
bus.post(new ExecutionResultEvent(phaseStatus));
return phaseStatus;
}
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-team-2,代码行数:62,代码来源:PhaseManager.java
示例16: CompilationResult
import vk.core.api.CompileError; //导入依赖的package包/类
public CompilationResult(String className, List<CompileError> compileErrors) {
this.className = className;
this.compileErrors = compileErrors;
}
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-team-2,代码行数:5,代码来源:CompilationResult.java
示例17: getCompileErrors
import vk.core.api.CompileError; //导入依赖的package包/类
public List<CompileError> getCompileErrors() {
return compileErrors;
}
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-team-2,代码行数:4,代码来源:CompilationResult.java
示例18: getTestClassErrors
import vk.core.api.CompileError; //导入依赖的package包/类
/**
* Returns a Collection of Errors
*
* @return Errors of the test class
*/
public Collection<CompileError> getTestClassErrors() {
return compiler.getCompilerResult().getCompilerErrorsForCompilationUnit(testClass);
}
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-nosuchfieldexception,代码行数:9,代码来源:KataLiveCompiler.java
示例19: getCodeClassErrors
import vk.core.api.CompileError; //导入依赖的package包/类
/**
* Returns a Collection of Errors
*
* @return Errors of the code class
*/
public Collection<CompileError> getCodeClassErrors() {
return compiler.getCompilerResult().getCompilerErrorsForCompilationUnit(codeClass);
}
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-nosuchfieldexception,代码行数:9,代码来源:KataLiveCompiler.java
示例20: CompileErrorItem
import vk.core.api.CompileError; //导入依赖的package包/类
/**
* Constructs a compile error item
*
* @param compileError
* @param className
*/
public CompileErrorItem(CompileError compileError, String className) {
super("Compile error at " + compileError.getLineNumber() + ":" + compileError.getColumnNumber(), compileError.getMessage() + " (" + className + ")");
getStyleClass().add("compile-error-item");
}
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-null,代码行数:11,代码来源:CompileErrorItem.java
注:本文中的vk.core.api.CompileError类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论