Compare commits
2 Commits
2920dfe68f
...
LSP-Interf
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e1007cce30 | ||
|
|
4cfc070289 |
@@ -49,27 +49,27 @@ public class LanguageServerInterface {
|
|||||||
* Example: file:///c:/test/main.jav -> file:///c:/test/out/main.class
|
* Example: file:///c:/test/main.jav -> file:///c:/test/out/main.class
|
||||||
*
|
*
|
||||||
* @param pathAsString the URI of the File. See Example.
|
* @param pathAsString the URI of the File. See Example.
|
||||||
* @throws IOException
|
|
||||||
* @throws ClassNotFoundException
|
|
||||||
* @throws URISyntaxException
|
|
||||||
*/
|
*/
|
||||||
public LanguageServerTransferObject getResultSetAndAbstractSyntax(String pathAsString) throws IOException, ClassNotFoundException, URISyntaxException {
|
public LanguageServerTransferObject getResultSetAndAbstractSyntax(String pathAsString){
|
||||||
System.setOut(new PrintStream(OutputStream.nullOutputStream()));
|
System.setOut(new PrintStream(OutputStream.nullOutputStream()));
|
||||||
|
try {
|
||||||
|
var uri = new URI(pathAsString);
|
||||||
|
var path = Path.of(uri);
|
||||||
|
var file = path.toFile();
|
||||||
|
Files.createDirectories(path.getParent().resolve("out"));
|
||||||
|
var compiler = new JavaTXCompiler(List.of(file), List.of(path.getParent().toFile()), path.getParent().resolve("out").toFile());
|
||||||
|
|
||||||
var uri = new URI(pathAsString);
|
var parsedSource = compiler.sourceFiles.get(file);
|
||||||
var path = Path.of(uri);
|
var tiResults = compiler.typeInference(file);
|
||||||
var file = path.toFile();
|
|
||||||
Files.createDirectories(path.getParent().resolve("out"));
|
|
||||||
var compiler = new JavaTXCompiler(List.of(file), List.of(path.getParent().toFile()), path.getParent().resolve("out").toFile());
|
|
||||||
|
|
||||||
var parsedSource = compiler.sourceFiles.get(file);
|
Map<JavaClassName, byte[]> bytecode = compiler.generateBytecode(parsedSource, tiResults);
|
||||||
var tiResults = compiler.typeInference(file);
|
Files.createDirectories(path.getParent().resolve("out"));
|
||||||
|
compiler.writeClassFile(bytecode, path.getParent().resolve("out").toFile(), false);
|
||||||
|
|
||||||
Map<JavaClassName, byte[]> bytecode = compiler.generateBytecode(parsedSource, tiResults);
|
return new LanguageServerTransferObject(tiResults, parsedSource, "", compiler.getGeneratedGenerics());
|
||||||
Files.createDirectories(path.getParent().resolve("out"));
|
}catch (Exception e){
|
||||||
compiler.writeClassFile(bytecode, path.getParent().resolve("out").toFile(), false);
|
throw new RuntimeException(e.getMessage());
|
||||||
|
}
|
||||||
return new LanguageServerTransferObject(tiResults, parsedSource, "", compiler.getGeneratedGenerics());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user