From 2f7b31025488a0bbad9254203c1846e54fb9ab37 Mon Sep 17 00:00:00 2001 From: Lucas <89882946+notbad3500@users.noreply.github.com> Date: Thu, 4 Jul 2024 16:49:14 +0200 Subject: [PATCH] refactoring, readme --- .gitignore | 6 +- readme.md | 38 +- src/main/java/main/Main.java | 28 +- ...penLogger.java => MiniCompilerLogger.java} | 10 +- src/test/Makefile | 12 +- src/test/java/main/E2EReflectionsTest.java | 1250 ++++++++--------- src/test/java/main/EndToEndTester.java | 2 - 7 files changed, 683 insertions(+), 663 deletions(-) rename src/main/java/main/{RaupenLogger.java => MiniCompilerLogger.java} (96%) diff --git a/.gitignore b/.gitignore index cb648af..5d19a24 100644 --- a/.gitignore +++ b/.gitignore @@ -77,10 +77,10 @@ fabric.properties .idea/caches/build_file_checksums.ser /target -src/main/resources/logs/RaupenLog.log +src/main/resources/logs/miniCompilerLog.log src/main/resources/output/CompilerInput.class src/test/resources/output/javac/CompilerInput$Test.class src/test/resources/output/javac/CompilerInput.class -src/test/resources/output/raupenpiler/CompilerInput.class -src/test/resources/output/raupenpiler/CompilerInput$Test.class +src/test/resources/output/miniCompiler/CompilerInput.class +src/test/resources/output/miniCompiler/CompilerInput$Test.class .idea/inspectionProfiles/Project_Default.xml diff --git a/readme.md b/readme.md index fc72bb8..8d2f771 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,6 @@ # "Nicht Haskel 2.0" Java Compiler -Realisation of a subset of the Java Standard Compiler in the course Compiler Construction of the 4th semester Computer Science at the Duale Hochschule Suttgart (Horb). +Realisation of a subset of the Java Standard Compiler in the course Compiler Construction of the 4th semester Computer Science at the Duale Hochschule Stuttgart (Horb). This project aims to provide a simplified version of the Java compiler, focusing on key language features and demonstrating the principles of compiler construction. @@ -62,7 +62,39 @@ test/ ## How to run the compiler +### Possibilities +### 1. Start miniCompiler using make: +Make needs to be installed +```bash +cd .\src\test\ ; make clean compile-miniCompiler +``` -## Download +### 2. Start miniCompiler using jar: +If you do not have the .jar, download it [here](https://gitea.hb.dhbw-stuttgart.de/i22005/NichtHaskell2.0/src/branch/Endabgabe/src) or compile it using mvn package or make first +``` +java.exe -DgenJar=bool -DgenClass=bool -jar path_to_jar\jarName.jar 'path_to_input_file.java' 'path_to_output_directory' +``` -```bash \ No newline at end of file +Example (jar needs to be in the target directory) +```bash + java.exe -DgenJar=true -DgenClass=true -jar .\target\JavaCompiler-1.0-jar-with-dependencies.jar 'src/main/resources/input/CompilerInput.java' 'src/main/resources/output' +``` + +- set DgenJar true, to generate the jar, false for no jar + +``` + DgenJar=true +``` + +- set DgenClass true, to generate class files, false for no class files + +``` + DgenClass=true + ``` + +## How to run tests + +```bash +mvn test +``` +Or start them manually in your IDE \ No newline at end of file diff --git a/src/main/java/main/Main.java b/src/main/java/main/Main.java index 5f1395b..a596fae 100644 --- a/src/main/java/main/Main.java +++ b/src/main/java/main/Main.java @@ -17,10 +17,10 @@ import java.util.Optional; /** - * Start Raupenpiler using make: + * Start miniCompiler using make: *

cd .\src\test\ - *

make clean compile-raupenpiler - *

Start Raupenpiler using jar: + *

make clean compile-miniCompiler + *

Start miniCompiler using jar: *

java.exe -DgenJar=true_OR_false -DgenClass=true_OR_false -jar path_to_jar\JavaCompiler-1.0-jar-with-dependencies.jar 'path_to_input_file.java' 'path_to_output_directory' *

Example (jar needs to be in the target directory, compile with make or mvn package first): * java.exe -DgenJar=true -DgenClass=true -jar .\target\JavaCompiler-1.0-jar-with-dependencies.jar 'src/main/resources/input/CompilerInput.java' 'src/main/resources/output' @@ -40,16 +40,6 @@ public class Main { System.err.println("Error reading the file: " + e.getMessage()); } } - /* !!! Else Branch (main ohne args starten) ist nicht zur Verwendung vorgesehen, immer mit args starten !!! - else { - try { - CharStream codeCharStream = CharStreams.fromPath(Paths.get("src/main/resources/input/CompilerInput.java")); - compileFile(codeCharStream); - } catch (IOException e) { - System.err.println("Error reading the file: " + e.getMessage()); - } - } - */ } /** @@ -66,7 +56,7 @@ public class Main { */ static void compileFile(CharStream inputCharStream, String outputDirectoryPath) { // Initialize the logger - new RaupenLogger(); + new MiniCompilerLogger(); /* ------------------------- Scanner -> tokens ------------------------- */ // Use the SimpleJavaLexer to tokenize the input CharStream @@ -74,27 +64,27 @@ public class Main { CommonTokenStream tokenStream = new CommonTokenStream(lexer); tokenStream.fill(); // Log the tokens - RaupenLogger.logScanner(tokenStream); + MiniCompilerLogger.logScanner(tokenStream); /*------------------------- Parser -> Parsetree -------------------------*/ // Use the SimpleJavaParser to parse the tokens and generate a ParseTree SimpleJavaParser parser = new SimpleJavaParser(tokenStream); ParseTree parseTree = parser.program(); // parse the input // Log the ParseTree - RaupenLogger.logParser(parseTree, parser); + MiniCompilerLogger.logParser(parseTree, parser); /*------------------------- AST builder -> AST -------------------------*/ // Use the ASTBuilder to visit the ParseTree and generate an Abstract Syntax Tree (AST) ASTBuilder astBuilder = new ASTBuilder(); ASTNode abstractSyntaxTree = astBuilder.visit(parseTree); // Log the AST - RaupenLogger.logAST(abstractSyntaxTree); + MiniCompilerLogger.logAST(abstractSyntaxTree); /*------------------------- Semantic Analyzer -> typed AST -------------------------*/ // Use the SemanticAnalyzer to generate a typed AST ASTNode typedAst = SemanticAnalyzer.generateTast(abstractSyntaxTree); // Log the typed AST - RaupenLogger.logSemanticAnalyzer(typedAst); + MiniCompilerLogger.logSemanticAnalyzer(typedAst); if(SemanticAnalyzer.errors.isEmpty()){ /*------------------------- Bytecode Generator -> Bytecode -------------------------*/ @@ -107,7 +97,7 @@ public class Main { assert typedAst != null; byteCodeGenerator.visit((ProgramNode) typedAst); // Log the bytecode generation - RaupenLogger.logBytecodeGenerator(); + MiniCompilerLogger.logBytecodeGenerator(); } else { for(Exception exception : SemanticAnalyzer.errors){ exception.printStackTrace(); diff --git a/src/main/java/main/RaupenLogger.java b/src/main/java/main/MiniCompilerLogger.java similarity index 96% rename from src/main/java/main/RaupenLogger.java rename to src/main/java/main/MiniCompilerLogger.java index 90bc7e2..f2314a1 100644 --- a/src/main/java/main/RaupenLogger.java +++ b/src/main/java/main/MiniCompilerLogger.java @@ -29,11 +29,11 @@ import java.util.logging.*; * consoleHandler.setLevel(Level.OFF); * fileHandler.setLevel(Level.ALL); */ -public class RaupenLogger { +public class MiniCompilerLogger { - static Logger logger = Logger.getLogger("RaupenLogs"); + static Logger logger = Logger.getLogger("miniCompilerLogs"); - public RaupenLogger() { + public MiniCompilerLogger() { // ------------------------- Logging ------------------------- logger.setLevel(Level.ALL); logger.getParent().getHandlers()[0].setLevel(Level.ALL); @@ -66,7 +66,7 @@ public class RaupenLogger { logger.addHandler(consoleHandler); // Configure file handler - Handler fileHandler = new FileHandler("src/main/resources/logs/RaupenLog.log"); + Handler fileHandler = new FileHandler("src/main/resources/logs/miniCompiler.log"); // Toggle file logging on/off fileHandler.setLevel(Level.ALL); fileHandler.setFormatter(new CustomFormatter()); @@ -117,7 +117,7 @@ public class RaupenLogger { public static void logBytecodeGenerator() { // Printing the bytecode logger.info("-------------------- Bytecode Generator -> Bytecode --------------------"); - logger.info("Bytecode generated"); + logger.info("Bytecode generated without errors."); logger.info("\n"); } diff --git a/src/test/Makefile b/src/test/Makefile index 54c905d..1fc9648 100644 --- a/src/test/Makefile +++ b/src/test/Makefile @@ -2,17 +2,17 @@ ### IntelliJs play buttons do not work. Run in "src/test" folder with "make" command to run all ### Or run only parts with "make compile-javac", "make clean" etc. -all: compile-javac compile-raupenpiler +all: compile-javac compile-miniCompiler compile-javac: javac -d .\resources\output\javac .\resources\input\CompilerInput.java -compile-raupenpiler: +compile-miniCompiler: cd ../.. ; mvn -DskipTests install cd ../.. ; mvn exec:java -DgenJar=true -DgenClass=true -Dexec.mainClass="main.Main" -Dexec.args="'src/main/resources/input/CompilerInput.java' 'src/main/resources/output'" - # cp ../main/resources/output/CompilerInput.class .java/resources/output/raupenpiler + # cp ../main/resources/output/CompilerInput.class .java/resources/output/miniCompiler -test-raupenpiler: +test-miniCompiler: # move the compiled class to the test/main folder mv ../main/resources/output/CompilerInput.class .java/main/ # compile the test class @@ -28,8 +28,8 @@ clean: rm -f ../main/resources/output/*.jar # clean resources output folders rm -f ./resources/output/javac/*.class - rm -f ./resources/output/raupenpiler/*.class - rm -f ./resources/output/raupenpiler/*.jar + rm -f ./resources/output/miniCompiler/*.class + rm -f ./resources/output/miniCompiler/*.jar # clean logs rm -f ../main/resources/logs/* # clean test/java/main folders from .class files for End-to-End tests diff --git a/src/test/java/main/E2EReflectionsTest.java b/src/test/java/main/E2EReflectionsTest.java index 78d479d..28c95ed 100644 --- a/src/test/java/main/E2EReflectionsTest.java +++ b/src/test/java/main/E2EReflectionsTest.java @@ -22,8 +22,8 @@ public class E2EReflectionsTest { public void CharTest() { final String FILE_NAME = "Char"; try { - // compile with raupenpiler - Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/raupenpiler"}); + // compile with miniCompiler + Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/miniCompiler"}); // Get the system Java compiler JavaCompiler javac = ToolProvider.getSystemJavaCompiler(); // Assert that the compiler is available @@ -37,28 +37,28 @@ public class E2EReflectionsTest { ClassLoader javacClassLoader = new java.net.URLClassLoader(new java.net.URL[]{javacClassPath.toUri().toURL()}); Class javacLoadedClass = javacClassLoader.loadClass(FILE_NAME); - // Load the raupenpiler class - Path raupenpilerClassPath = Paths.get("src/test/resources/output/raupenpiler"); - ClassLoader raupenpilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{raupenpilerClassPath.toUri().toURL()}); - Class raupenpilerLoadedClass = raupenpilerClassLoader.loadClass(FILE_NAME); + // Load the miniCompiler class + Path miniCompilerClassPath = Paths.get("src/test/resources/output/miniCompiler"); + ClassLoader miniCompilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{miniCompilerClassPath.toUri().toURL()}); + Class miniCompilerLoadedClass = miniCompilerClassLoader.loadClass(FILE_NAME); // Class Name assertEquals(FILE_NAME, javacLoadedClass.getName()); - assertEquals(FILE_NAME, raupenpilerLoadedClass.getName()); + assertEquals(FILE_NAME, miniCompilerLoadedClass.getName()); // Constructors Constructor[] javacConstructors = javacLoadedClass.getDeclaredConstructors(); - Constructor[] raupenpilerConstructors = raupenpilerLoadedClass.getDeclaredConstructors(); + Constructor[] miniCompilerConstructors = miniCompilerLoadedClass.getDeclaredConstructors(); - assertEquals(javacConstructors.length, raupenpilerConstructors.length); + assertEquals(javacConstructors.length, miniCompilerConstructors.length); for(Constructor c : javacConstructors) { - for(Constructor raupenpilerConstructor : raupenpilerConstructors) { - assertEquals(c.getParameterCount(), raupenpilerConstructor.getParameterCount()); - if (c.getParameterCount() == raupenpilerConstructor.getParameterCount()) { - assertEquals(c.getName(), raupenpilerConstructor.getName()); + for(Constructor miniCompilerConstructor : miniCompilerConstructors) { + assertEquals(c.getParameterCount(), miniCompilerConstructor.getParameterCount()); + if (c.getParameterCount() == miniCompilerConstructor.getParameterCount()) { + assertEquals(c.getName(), miniCompilerConstructor.getName()); } } } @@ -66,29 +66,29 @@ public class E2EReflectionsTest { // Methods Method[] javacMethods = javacLoadedClass.getDeclaredMethods(); - Method[] raupenpilerMethods = raupenpilerLoadedClass.getDeclaredMethods(); + Method[] miniCompilerMethods = miniCompilerLoadedClass.getDeclaredMethods(); - assertEquals(javacMethods.length, raupenpilerMethods.length); + assertEquals(javacMethods.length, miniCompilerMethods.length); for (int i = 0; i < javacMethods.length; i++) { - assertEquals(javacMethods[i].getName(), raupenpilerMethods[i].getName()); - assertEquals(javacMethods[i].getReturnType(), raupenpilerMethods[i].getReturnType()); - assertEquals(javacMethods[i].getParameterCount(), raupenpilerMethods[i].getParameterCount()); - // assertEquals(javacMethods[i].getModifiers(), raupenpilerMethods[i].getModifiers()); + assertEquals(javacMethods[i].getName(), miniCompilerMethods[i].getName()); + assertEquals(javacMethods[i].getReturnType(), miniCompilerMethods[i].getReturnType()); + assertEquals(javacMethods[i].getParameterCount(), miniCompilerMethods[i].getParameterCount()); + // assertEquals(javacMethods[i].getModifiers(), miniCompilerMethods[i].getModifiers()); } // Fields Field[] javacLoadedClassDeclaredFields = javacLoadedClass.getDeclaredFields(); - Field[] raupenpilerLoadedClassDeclaredFields = raupenpilerLoadedClass.getDeclaredFields(); + Field[] miniCompilerLoadedClassDeclaredFields = miniCompilerLoadedClass.getDeclaredFields(); - assertEquals(javacLoadedClassDeclaredFields.length, raupenpilerLoadedClassDeclaredFields.length); + assertEquals(javacLoadedClassDeclaredFields.length, miniCompilerLoadedClassDeclaredFields.length); for (Field field : javacLoadedClassDeclaredFields) { - for (Field raupenpilerField : raupenpilerLoadedClassDeclaredFields) { - if (field.getName().equals(raupenpilerField.getName())) { - assertEquals(field.getType(), raupenpilerField.getType()); - // assertEquals(field.getModifiers(), raupenpilerField.getModifiers()); + for (Field miniCompilerField : miniCompilerLoadedClassDeclaredFields) { + if (field.getName().equals(miniCompilerField.getName())) { + assertEquals(field.getType(), miniCompilerField.getType()); + // assertEquals(field.getModifiers(), miniCompilerField.getModifiers()); } } } @@ -104,8 +104,8 @@ public class E2EReflectionsTest { public void CommentsTest() { final String FILE_NAME = "Comments"; try { - // compile with raupenpiler - Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/raupenpiler"}); + // compile with miniCompiler + Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/miniCompiler"}); // Get the system Java compiler JavaCompiler javac = ToolProvider.getSystemJavaCompiler(); // Assert that the compiler is available @@ -119,28 +119,28 @@ public class E2EReflectionsTest { ClassLoader javacClassLoader = new java.net.URLClassLoader(new java.net.URL[]{javacClassPath.toUri().toURL()}); Class javacLoadedClass = javacClassLoader.loadClass(FILE_NAME); - // Load the raupenpiler class - Path raupenpilerClassPath = Paths.get("src/test/resources/output/raupenpiler"); - ClassLoader raupenpilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{raupenpilerClassPath.toUri().toURL()}); - Class raupenpilerLoadedClass = raupenpilerClassLoader.loadClass(FILE_NAME); + // Load the miniCompiler class + Path miniCompilerClassPath = Paths.get("src/test/resources/output/miniCompiler"); + ClassLoader miniCompilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{miniCompilerClassPath.toUri().toURL()}); + Class miniCompilerLoadedClass = miniCompilerClassLoader.loadClass(FILE_NAME); // Class Name assertEquals(FILE_NAME, javacLoadedClass.getName()); - assertEquals(FILE_NAME, raupenpilerLoadedClass.getName()); + assertEquals(FILE_NAME, miniCompilerLoadedClass.getName()); // Constructors Constructor[] javacConstructors = javacLoadedClass.getDeclaredConstructors(); - Constructor[] raupenpilerConstructors = raupenpilerLoadedClass.getDeclaredConstructors(); + Constructor[] miniCompilerConstructors = miniCompilerLoadedClass.getDeclaredConstructors(); - assertEquals(javacConstructors.length, raupenpilerConstructors.length); + assertEquals(javacConstructors.length, miniCompilerConstructors.length); for(Constructor c : javacConstructors) { - for(Constructor raupenpilerConstructor : raupenpilerConstructors) { - assertEquals(c.getParameterCount(), raupenpilerConstructor.getParameterCount()); - if (c.getParameterCount() == raupenpilerConstructor.getParameterCount()) { - assertEquals(c.getName(), raupenpilerConstructor.getName()); + for(Constructor miniCompilerConstructor : miniCompilerConstructors) { + assertEquals(c.getParameterCount(), miniCompilerConstructor.getParameterCount()); + if (c.getParameterCount() == miniCompilerConstructor.getParameterCount()) { + assertEquals(c.getName(), miniCompilerConstructor.getName()); } } } @@ -148,29 +148,29 @@ public class E2EReflectionsTest { // Methods Method[] javacMethods = javacLoadedClass.getDeclaredMethods(); - Method[] raupenpilerMethods = raupenpilerLoadedClass.getDeclaredMethods(); + Method[] miniCompilerMethods = miniCompilerLoadedClass.getDeclaredMethods(); - assertEquals(javacMethods.length, raupenpilerMethods.length); + assertEquals(javacMethods.length, miniCompilerMethods.length); for (int i = 0; i < javacMethods.length; i++) { - assertEquals(javacMethods[i].getName(), raupenpilerMethods[i].getName()); - assertEquals(javacMethods[i].getReturnType(), raupenpilerMethods[i].getReturnType()); - assertEquals(javacMethods[i].getParameterCount(), raupenpilerMethods[i].getParameterCount()); - // assertEquals(javacMethods[i].getModifiers(), raupenpilerMethods[i].getModifiers()); + assertEquals(javacMethods[i].getName(), miniCompilerMethods[i].getName()); + assertEquals(javacMethods[i].getReturnType(), miniCompilerMethods[i].getReturnType()); + assertEquals(javacMethods[i].getParameterCount(), miniCompilerMethods[i].getParameterCount()); + // assertEquals(javacMethods[i].getModifiers(), miniCompilerMethods[i].getModifiers()); } // Fields Field[] javacLoadedClassDeclaredFields = javacLoadedClass.getDeclaredFields(); - Field[] raupenpilerLoadedClassDeclaredFields = raupenpilerLoadedClass.getDeclaredFields(); + Field[] miniCompilerLoadedClassDeclaredFields = miniCompilerLoadedClass.getDeclaredFields(); - assertEquals(javacLoadedClassDeclaredFields.length, raupenpilerLoadedClassDeclaredFields.length); + assertEquals(javacLoadedClassDeclaredFields.length, miniCompilerLoadedClassDeclaredFields.length); for (Field field : javacLoadedClassDeclaredFields) { - for (Field raupenpilerField : raupenpilerLoadedClassDeclaredFields) { - if (field.getName().equals(raupenpilerField.getName())) { - assertEquals(field.getType(), raupenpilerField.getType()); - // assertEquals(field.getModifiers(), raupenpilerField.getModifiers()); + for (Field miniCompilerField : miniCompilerLoadedClassDeclaredFields) { + if (field.getName().equals(miniCompilerField.getName())) { + assertEquals(field.getType(), miniCompilerField.getType()); + // assertEquals(field.getModifiers(), miniCompilerField.getModifiers()); } } } @@ -186,8 +186,8 @@ public class E2EReflectionsTest { public void ConstructorMethodCallTest() { final String FILE_NAME = "ConstructorMethodCall"; try { - // compile with raupenpiler - Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/raupenpiler"}); + // compile with miniCompiler + Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/miniCompiler"}); // Get the system Java compiler JavaCompiler javac = ToolProvider.getSystemJavaCompiler(); // Assert that the compiler is available @@ -201,28 +201,28 @@ public class E2EReflectionsTest { ClassLoader javacClassLoader = new java.net.URLClassLoader(new java.net.URL[]{javacClassPath.toUri().toURL()}); Class javacLoadedClass = javacClassLoader.loadClass(FILE_NAME); - // Load the raupenpiler class - Path raupenpilerClassPath = Paths.get("src/test/resources/output/raupenpiler"); - ClassLoader raupenpilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{raupenpilerClassPath.toUri().toURL()}); - Class raupenpilerLoadedClass = raupenpilerClassLoader.loadClass(FILE_NAME); + // Load the miniCompiler class + Path miniCompilerClassPath = Paths.get("src/test/resources/output/miniCompiler"); + ClassLoader miniCompilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{miniCompilerClassPath.toUri().toURL()}); + Class miniCompilerLoadedClass = miniCompilerClassLoader.loadClass(FILE_NAME); // Class Name assertEquals(FILE_NAME, javacLoadedClass.getName()); - assertEquals(FILE_NAME, raupenpilerLoadedClass.getName()); + assertEquals(FILE_NAME, miniCompilerLoadedClass.getName()); // Constructors Constructor[] javacConstructors = javacLoadedClass.getDeclaredConstructors(); - Constructor[] raupenpilerConstructors = raupenpilerLoadedClass.getDeclaredConstructors(); + Constructor[] miniCompilerConstructors = miniCompilerLoadedClass.getDeclaredConstructors(); - assertEquals(javacConstructors.length, raupenpilerConstructors.length); + assertEquals(javacConstructors.length, miniCompilerConstructors.length); for(Constructor c : javacConstructors) { - for(Constructor raupenpilerConstructor : raupenpilerConstructors) { - assertEquals(c.getParameterCount(), raupenpilerConstructor.getParameterCount()); - if (c.getParameterCount() == raupenpilerConstructor.getParameterCount()) { - assertEquals(c.getName(), raupenpilerConstructor.getName()); + for(Constructor miniCompilerConstructor : miniCompilerConstructors) { + assertEquals(c.getParameterCount(), miniCompilerConstructor.getParameterCount()); + if (c.getParameterCount() == miniCompilerConstructor.getParameterCount()) { + assertEquals(c.getName(), miniCompilerConstructor.getName()); } } } @@ -230,29 +230,29 @@ public class E2EReflectionsTest { // Methods Method[] javacMethods = javacLoadedClass.getDeclaredMethods(); - Method[] raupenpilerMethods = raupenpilerLoadedClass.getDeclaredMethods(); + Method[] miniCompilerMethods = miniCompilerLoadedClass.getDeclaredMethods(); - assertEquals(javacMethods.length, raupenpilerMethods.length); + assertEquals(javacMethods.length, miniCompilerMethods.length); for (int i = 0; i < javacMethods.length; i++) { - assertEquals(javacMethods[i].getName(), raupenpilerMethods[i].getName()); - assertEquals(javacMethods[i].getReturnType(), raupenpilerMethods[i].getReturnType()); - assertEquals(javacMethods[i].getParameterCount(), raupenpilerMethods[i].getParameterCount()); - // assertEquals(javacMethods[i].getModifiers(), raupenpilerMethods[i].getModifiers()); + assertEquals(javacMethods[i].getName(), miniCompilerMethods[i].getName()); + assertEquals(javacMethods[i].getReturnType(), miniCompilerMethods[i].getReturnType()); + assertEquals(javacMethods[i].getParameterCount(), miniCompilerMethods[i].getParameterCount()); + // assertEquals(javacMethods[i].getModifiers(), miniCompilerMethods[i].getModifiers()); } // Fields Field[] javacLoadedClassDeclaredFields = javacLoadedClass.getDeclaredFields(); - Field[] raupenpilerLoadedClassDeclaredFields = raupenpilerLoadedClass.getDeclaredFields(); + Field[] miniCompilerLoadedClassDeclaredFields = miniCompilerLoadedClass.getDeclaredFields(); - assertEquals(javacLoadedClassDeclaredFields.length, raupenpilerLoadedClassDeclaredFields.length); + assertEquals(javacLoadedClassDeclaredFields.length, miniCompilerLoadedClassDeclaredFields.length); for (Field field : javacLoadedClassDeclaredFields) { - for (Field raupenpilerField : raupenpilerLoadedClassDeclaredFields) { - if (field.getName().equals(raupenpilerField.getName())) { - assertEquals(field.getType(), raupenpilerField.getType()); - // assertEquals(field.getModifiers(), raupenpilerField.getModifiers()); + for (Field miniCompilerField : miniCompilerLoadedClassDeclaredFields) { + if (field.getName().equals(miniCompilerField.getName())) { + assertEquals(field.getType(), miniCompilerField.getType()); + // assertEquals(field.getModifiers(), miniCompilerField.getModifiers()); } } } @@ -268,8 +268,8 @@ public class E2EReflectionsTest { public void ConstructorMethodCallParametersTest() { final String FILE_NAME = "ConstructorMethodCallParameters"; try { - // compile with raupenpiler - Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/raupenpiler"}); + // compile with miniCompiler + Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/miniCompiler"}); // Get the system Java compiler JavaCompiler javac = ToolProvider.getSystemJavaCompiler(); // Assert that the compiler is available @@ -283,28 +283,28 @@ public class E2EReflectionsTest { ClassLoader javacClassLoader = new java.net.URLClassLoader(new java.net.URL[]{javacClassPath.toUri().toURL()}); Class javacLoadedClass = javacClassLoader.loadClass(FILE_NAME); - // Load the raupenpiler class - Path raupenpilerClassPath = Paths.get("src/test/resources/output/raupenpiler"); - ClassLoader raupenpilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{raupenpilerClassPath.toUri().toURL()}); - Class raupenpilerLoadedClass = raupenpilerClassLoader.loadClass(FILE_NAME); + // Load the miniCompiler class + Path miniCompilerClassPath = Paths.get("src/test/resources/output/miniCompiler"); + ClassLoader miniCompilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{miniCompilerClassPath.toUri().toURL()}); + Class miniCompilerLoadedClass = miniCompilerClassLoader.loadClass(FILE_NAME); // Class Name assertEquals(FILE_NAME, javacLoadedClass.getName()); - assertEquals(FILE_NAME, raupenpilerLoadedClass.getName()); + assertEquals(FILE_NAME, miniCompilerLoadedClass.getName()); // Constructors Constructor[] javacConstructors = javacLoadedClass.getDeclaredConstructors(); - Constructor[] raupenpilerConstructors = raupenpilerLoadedClass.getDeclaredConstructors(); + Constructor[] miniCompilerConstructors = miniCompilerLoadedClass.getDeclaredConstructors(); - assertEquals(javacConstructors.length, raupenpilerConstructors.length); + assertEquals(javacConstructors.length, miniCompilerConstructors.length); for(Constructor c : javacConstructors) { - for(Constructor raupenpilerConstructor : raupenpilerConstructors) { - assertEquals(c.getParameterCount(), raupenpilerConstructor.getParameterCount()); - if (c.getParameterCount() == raupenpilerConstructor.getParameterCount()) { - assertEquals(c.getName(), raupenpilerConstructor.getName()); + for(Constructor miniCompilerConstructor : miniCompilerConstructors) { + assertEquals(c.getParameterCount(), miniCompilerConstructor.getParameterCount()); + if (c.getParameterCount() == miniCompilerConstructor.getParameterCount()) { + assertEquals(c.getName(), miniCompilerConstructor.getName()); } } } @@ -312,29 +312,29 @@ public class E2EReflectionsTest { // Methods Method[] javacMethods = javacLoadedClass.getDeclaredMethods(); - Method[] raupenpilerMethods = raupenpilerLoadedClass.getDeclaredMethods(); + Method[] miniCompilerMethods = miniCompilerLoadedClass.getDeclaredMethods(); - assertEquals(javacMethods.length, raupenpilerMethods.length); + assertEquals(javacMethods.length, miniCompilerMethods.length); for (int i = 0; i < javacMethods.length; i++) { - assertEquals(javacMethods[i].getName(), raupenpilerMethods[i].getName()); - assertEquals(javacMethods[i].getReturnType(), raupenpilerMethods[i].getReturnType()); - assertEquals(javacMethods[i].getParameterCount(), raupenpilerMethods[i].getParameterCount()); - // assertEquals(javacMethods[i].getModifiers(), raupenpilerMethods[i].getModifiers()); + assertEquals(javacMethods[i].getName(), miniCompilerMethods[i].getName()); + assertEquals(javacMethods[i].getReturnType(), miniCompilerMethods[i].getReturnType()); + assertEquals(javacMethods[i].getParameterCount(), miniCompilerMethods[i].getParameterCount()); + // assertEquals(javacMethods[i].getModifiers(), miniCompilerMethods[i].getModifiers()); } // Fields Field[] javacLoadedClassDeclaredFields = javacLoadedClass.getDeclaredFields(); - Field[] raupenpilerLoadedClassDeclaredFields = raupenpilerLoadedClass.getDeclaredFields(); + Field[] miniCompilerLoadedClassDeclaredFields = miniCompilerLoadedClass.getDeclaredFields(); - assertEquals(javacLoadedClassDeclaredFields.length, raupenpilerLoadedClassDeclaredFields.length); + assertEquals(javacLoadedClassDeclaredFields.length, miniCompilerLoadedClassDeclaredFields.length); for (Field field : javacLoadedClassDeclaredFields) { - for (Field raupenpilerField : raupenpilerLoadedClassDeclaredFields) { - if (field.getName().equals(raupenpilerField.getName())) { - assertEquals(field.getType(), raupenpilerField.getType()); - // assertEquals(field.getModifiers(), raupenpilerField.getModifiers()); + for (Field miniCompilerField : miniCompilerLoadedClassDeclaredFields) { + if (field.getName().equals(miniCompilerField.getName())) { + assertEquals(field.getType(), miniCompilerField.getType()); + // assertEquals(field.getModifiers(), miniCompilerField.getModifiers()); } } } @@ -350,8 +350,8 @@ public class E2EReflectionsTest { public void ConstructorParameterTest() { final String FILE_NAME = "ConstructorParameter"; try { - // compile with raupenpiler - Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/raupenpiler"}); + // compile with miniCompiler + Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/miniCompiler"}); // Get the system Java compiler JavaCompiler javac = ToolProvider.getSystemJavaCompiler(); // Assert that the compiler is available @@ -365,28 +365,28 @@ public class E2EReflectionsTest { ClassLoader javacClassLoader = new java.net.URLClassLoader(new java.net.URL[]{javacClassPath.toUri().toURL()}); Class javacLoadedClass = javacClassLoader.loadClass(FILE_NAME); - // Load the raupenpiler class - Path raupenpilerClassPath = Paths.get("src/test/resources/output/raupenpiler"); - ClassLoader raupenpilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{raupenpilerClassPath.toUri().toURL()}); - Class raupenpilerLoadedClass = raupenpilerClassLoader.loadClass(FILE_NAME); + // Load the miniCompiler class + Path miniCompilerClassPath = Paths.get("src/test/resources/output/miniCompiler"); + ClassLoader miniCompilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{miniCompilerClassPath.toUri().toURL()}); + Class miniCompilerLoadedClass = miniCompilerClassLoader.loadClass(FILE_NAME); // Class Name assertEquals(FILE_NAME, javacLoadedClass.getName()); - assertEquals(FILE_NAME, raupenpilerLoadedClass.getName()); + assertEquals(FILE_NAME, miniCompilerLoadedClass.getName()); // Constructors Constructor[] javacConstructors = javacLoadedClass.getDeclaredConstructors(); - Constructor[] raupenpilerConstructors = raupenpilerLoadedClass.getDeclaredConstructors(); + Constructor[] miniCompilerConstructors = miniCompilerLoadedClass.getDeclaredConstructors(); - assertEquals(javacConstructors.length, raupenpilerConstructors.length); + assertEquals(javacConstructors.length, miniCompilerConstructors.length); for(Constructor c : javacConstructors) { - for(Constructor raupenpilerConstructor : raupenpilerConstructors) { - assertEquals(c.getParameterCount(), raupenpilerConstructor.getParameterCount()); - if (c.getParameterCount() == raupenpilerConstructor.getParameterCount()) { - assertEquals(c.getName(), raupenpilerConstructor.getName()); + for(Constructor miniCompilerConstructor : miniCompilerConstructors) { + assertEquals(c.getParameterCount(), miniCompilerConstructor.getParameterCount()); + if (c.getParameterCount() == miniCompilerConstructor.getParameterCount()) { + assertEquals(c.getName(), miniCompilerConstructor.getName()); } } } @@ -394,29 +394,29 @@ public class E2EReflectionsTest { // Methods Method[] javacMethods = javacLoadedClass.getDeclaredMethods(); - Method[] raupenpilerMethods = raupenpilerLoadedClass.getDeclaredMethods(); + Method[] miniCompilerMethods = miniCompilerLoadedClass.getDeclaredMethods(); - assertEquals(javacMethods.length, raupenpilerMethods.length); + assertEquals(javacMethods.length, miniCompilerMethods.length); for (int i = 0; i < javacMethods.length; i++) { - assertEquals(javacMethods[i].getName(), raupenpilerMethods[i].getName()); - assertEquals(javacMethods[i].getReturnType(), raupenpilerMethods[i].getReturnType()); - assertEquals(javacMethods[i].getParameterCount(), raupenpilerMethods[i].getParameterCount()); - // assertEquals(javacMethods[i].getModifiers(), raupenpilerMethods[i].getModifiers()); + assertEquals(javacMethods[i].getName(), miniCompilerMethods[i].getName()); + assertEquals(javacMethods[i].getReturnType(), miniCompilerMethods[i].getReturnType()); + assertEquals(javacMethods[i].getParameterCount(), miniCompilerMethods[i].getParameterCount()); + // assertEquals(javacMethods[i].getModifiers(), miniCompilerMethods[i].getModifiers()); } // Fields Field[] javacLoadedClassDeclaredFields = javacLoadedClass.getDeclaredFields(); - Field[] raupenpilerLoadedClassDeclaredFields = raupenpilerLoadedClass.getDeclaredFields(); + Field[] miniCompilerLoadedClassDeclaredFields = miniCompilerLoadedClass.getDeclaredFields(); - assertEquals(javacLoadedClassDeclaredFields.length, raupenpilerLoadedClassDeclaredFields.length); + assertEquals(javacLoadedClassDeclaredFields.length, miniCompilerLoadedClassDeclaredFields.length); for (Field field : javacLoadedClassDeclaredFields) { - for (Field raupenpilerField : raupenpilerLoadedClassDeclaredFields) { - if (field.getName().equals(raupenpilerField.getName())) { - assertEquals(field.getType(), raupenpilerField.getType()); - // assertEquals(field.getModifiers(), raupenpilerField.getModifiers()); + for (Field miniCompilerField : miniCompilerLoadedClassDeclaredFields) { + if (field.getName().equals(miniCompilerField.getName())) { + assertEquals(field.getType(), miniCompilerField.getType()); + // assertEquals(field.getModifiers(), miniCompilerField.getModifiers()); } } } @@ -432,8 +432,8 @@ public class E2EReflectionsTest { public void ConstructorThisDotTest() { final String FILE_NAME = "ConstructorThisDot"; try { - // compile with raupenpiler - Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/raupenpiler"}); + // compile with miniCompiler + Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/miniCompiler"}); // Get the system Java compiler JavaCompiler javac = ToolProvider.getSystemJavaCompiler(); // Assert that the compiler is available @@ -447,28 +447,28 @@ public class E2EReflectionsTest { ClassLoader javacClassLoader = new java.net.URLClassLoader(new java.net.URL[]{javacClassPath.toUri().toURL()}); Class javacLoadedClass = javacClassLoader.loadClass(FILE_NAME); - // Load the raupenpiler class - Path raupenpilerClassPath = Paths.get("src/test/resources/output/raupenpiler"); - ClassLoader raupenpilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{raupenpilerClassPath.toUri().toURL()}); - Class raupenpilerLoadedClass = raupenpilerClassLoader.loadClass(FILE_NAME); + // Load the miniCompiler class + Path miniCompilerClassPath = Paths.get("src/test/resources/output/miniCompiler"); + ClassLoader miniCompilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{miniCompilerClassPath.toUri().toURL()}); + Class miniCompilerLoadedClass = miniCompilerClassLoader.loadClass(FILE_NAME); // Class Name assertEquals(FILE_NAME, javacLoadedClass.getName()); - assertEquals(FILE_NAME, raupenpilerLoadedClass.getName()); + assertEquals(FILE_NAME, miniCompilerLoadedClass.getName()); // Constructors Constructor[] javacConstructors = javacLoadedClass.getDeclaredConstructors(); - Constructor[] raupenpilerConstructors = raupenpilerLoadedClass.getDeclaredConstructors(); + Constructor[] miniCompilerConstructors = miniCompilerLoadedClass.getDeclaredConstructors(); - assertEquals(javacConstructors.length, raupenpilerConstructors.length); + assertEquals(javacConstructors.length, miniCompilerConstructors.length); for(Constructor c : javacConstructors) { - for(Constructor raupenpilerConstructor : raupenpilerConstructors) { - assertEquals(c.getParameterCount(), raupenpilerConstructor.getParameterCount()); - if (c.getParameterCount() == raupenpilerConstructor.getParameterCount()) { - assertEquals(c.getName(), raupenpilerConstructor.getName()); + for(Constructor miniCompilerConstructor : miniCompilerConstructors) { + assertEquals(c.getParameterCount(), miniCompilerConstructor.getParameterCount()); + if (c.getParameterCount() == miniCompilerConstructor.getParameterCount()) { + assertEquals(c.getName(), miniCompilerConstructor.getName()); } } } @@ -476,29 +476,29 @@ public class E2EReflectionsTest { // Methods Method[] javacMethods = javacLoadedClass.getDeclaredMethods(); - Method[] raupenpilerMethods = raupenpilerLoadedClass.getDeclaredMethods(); + Method[] miniCompilerMethods = miniCompilerLoadedClass.getDeclaredMethods(); - assertEquals(javacMethods.length, raupenpilerMethods.length); + assertEquals(javacMethods.length, miniCompilerMethods.length); for (int i = 0; i < javacMethods.length; i++) { - assertEquals(javacMethods[i].getName(), raupenpilerMethods[i].getName()); - assertEquals(javacMethods[i].getReturnType(), raupenpilerMethods[i].getReturnType()); - assertEquals(javacMethods[i].getParameterCount(), raupenpilerMethods[i].getParameterCount()); - // assertEquals(javacMethods[i].getModifiers(), raupenpilerMethods[i].getModifiers()); + assertEquals(javacMethods[i].getName(), miniCompilerMethods[i].getName()); + assertEquals(javacMethods[i].getReturnType(), miniCompilerMethods[i].getReturnType()); + assertEquals(javacMethods[i].getParameterCount(), miniCompilerMethods[i].getParameterCount()); + // assertEquals(javacMethods[i].getModifiers(), miniCompilerMethods[i].getModifiers()); } // Fields Field[] javacLoadedClassDeclaredFields = javacLoadedClass.getDeclaredFields(); - Field[] raupenpilerLoadedClassDeclaredFields = raupenpilerLoadedClass.getDeclaredFields(); + Field[] miniCompilerLoadedClassDeclaredFields = miniCompilerLoadedClass.getDeclaredFields(); - assertEquals(javacLoadedClassDeclaredFields.length, raupenpilerLoadedClassDeclaredFields.length); + assertEquals(javacLoadedClassDeclaredFields.length, miniCompilerLoadedClassDeclaredFields.length); for (Field field : javacLoadedClassDeclaredFields) { - for (Field raupenpilerField : raupenpilerLoadedClassDeclaredFields) { - if (field.getName().equals(raupenpilerField.getName())) { - assertEquals(field.getType(), raupenpilerField.getType()); - // assertEquals(field.getModifiers(), raupenpilerField.getModifiers()); + for (Field miniCompilerField : miniCompilerLoadedClassDeclaredFields) { + if (field.getName().equals(miniCompilerField.getName())) { + assertEquals(field.getType(), miniCompilerField.getType()); + // assertEquals(field.getModifiers(), miniCompilerField.getModifiers()); } } } @@ -514,8 +514,8 @@ public class E2EReflectionsTest { public void DoWhileTest() { final String FILE_NAME = "DoWhile"; try { - // compile with raupenpiler - Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/raupenpiler"}); + // compile with miniCompiler + Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/miniCompiler"}); // Get the system Java compiler JavaCompiler javac = ToolProvider.getSystemJavaCompiler(); // Assert that the compiler is available @@ -529,28 +529,28 @@ public class E2EReflectionsTest { ClassLoader javacClassLoader = new java.net.URLClassLoader(new java.net.URL[]{javacClassPath.toUri().toURL()}); Class javacLoadedClass = javacClassLoader.loadClass(FILE_NAME); - // Load the raupenpiler class - Path raupenpilerClassPath = Paths.get("src/test/resources/output/raupenpiler"); - ClassLoader raupenpilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{raupenpilerClassPath.toUri().toURL()}); - Class raupenpilerLoadedClass = raupenpilerClassLoader.loadClass(FILE_NAME); + // Load the miniCompiler class + Path miniCompilerClassPath = Paths.get("src/test/resources/output/miniCompiler"); + ClassLoader miniCompilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{miniCompilerClassPath.toUri().toURL()}); + Class miniCompilerLoadedClass = miniCompilerClassLoader.loadClass(FILE_NAME); // Class Name assertEquals(FILE_NAME, javacLoadedClass.getName()); - assertEquals(FILE_NAME, raupenpilerLoadedClass.getName()); + assertEquals(FILE_NAME, miniCompilerLoadedClass.getName()); // Constructors Constructor[] javacConstructors = javacLoadedClass.getDeclaredConstructors(); - Constructor[] raupenpilerConstructors = raupenpilerLoadedClass.getDeclaredConstructors(); + Constructor[] miniCompilerConstructors = miniCompilerLoadedClass.getDeclaredConstructors(); - assertEquals(javacConstructors.length, raupenpilerConstructors.length); + assertEquals(javacConstructors.length, miniCompilerConstructors.length); for(Constructor c : javacConstructors) { - for(Constructor raupenpilerConstructor : raupenpilerConstructors) { - assertEquals(c.getParameterCount(), raupenpilerConstructor.getParameterCount()); - if (c.getParameterCount() == raupenpilerConstructor.getParameterCount()) { - assertEquals(c.getName(), raupenpilerConstructor.getName()); + for(Constructor miniCompilerConstructor : miniCompilerConstructors) { + assertEquals(c.getParameterCount(), miniCompilerConstructor.getParameterCount()); + if (c.getParameterCount() == miniCompilerConstructor.getParameterCount()) { + assertEquals(c.getName(), miniCompilerConstructor.getName()); } } } @@ -558,29 +558,29 @@ public class E2EReflectionsTest { // Methods Method[] javacMethods = javacLoadedClass.getDeclaredMethods(); - Method[] raupenpilerMethods = raupenpilerLoadedClass.getDeclaredMethods(); + Method[] miniCompilerMethods = miniCompilerLoadedClass.getDeclaredMethods(); - assertEquals(javacMethods.length, raupenpilerMethods.length); + assertEquals(javacMethods.length, miniCompilerMethods.length); for (int i = 0; i < javacMethods.length; i++) { - assertEquals(javacMethods[i].getName(), raupenpilerMethods[i].getName()); - assertEquals(javacMethods[i].getReturnType(), raupenpilerMethods[i].getReturnType()); - assertEquals(javacMethods[i].getParameterCount(), raupenpilerMethods[i].getParameterCount()); - // assertEquals(javacMethods[i].getModifiers(), raupenpilerMethods[i].getModifiers()); + assertEquals(javacMethods[i].getName(), miniCompilerMethods[i].getName()); + assertEquals(javacMethods[i].getReturnType(), miniCompilerMethods[i].getReturnType()); + assertEquals(javacMethods[i].getParameterCount(), miniCompilerMethods[i].getParameterCount()); + // assertEquals(javacMethods[i].getModifiers(), miniCompilerMethods[i].getModifiers()); } // Fields Field[] javacLoadedClassDeclaredFields = javacLoadedClass.getDeclaredFields(); - Field[] raupenpilerLoadedClassDeclaredFields = raupenpilerLoadedClass.getDeclaredFields(); + Field[] miniCompilerLoadedClassDeclaredFields = miniCompilerLoadedClass.getDeclaredFields(); - assertEquals(javacLoadedClassDeclaredFields.length, raupenpilerLoadedClassDeclaredFields.length); + assertEquals(javacLoadedClassDeclaredFields.length, miniCompilerLoadedClassDeclaredFields.length); for (Field field : javacLoadedClassDeclaredFields) { - for (Field raupenpilerField : raupenpilerLoadedClassDeclaredFields) { - if (field.getName().equals(raupenpilerField.getName())) { - assertEquals(field.getType(), raupenpilerField.getType()); - // assertEquals(field.getModifiers(), raupenpilerField.getModifiers()); + for (Field miniCompilerField : miniCompilerLoadedClassDeclaredFields) { + if (field.getName().equals(miniCompilerField.getName())) { + assertEquals(field.getType(), miniCompilerField.getType()); + // assertEquals(field.getModifiers(), miniCompilerField.getModifiers()); } } } @@ -596,8 +596,8 @@ public class E2EReflectionsTest { public void EmptyClassTest() { final String FILE_NAME = "EmptyClass"; try { - // compile with raupenpiler - Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/raupenpiler"}); + // compile with miniCompiler + Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/miniCompiler"}); // Get the system Java compiler JavaCompiler javac = ToolProvider.getSystemJavaCompiler(); // Assert that the compiler is available @@ -611,28 +611,28 @@ public class E2EReflectionsTest { ClassLoader javacClassLoader = new java.net.URLClassLoader(new java.net.URL[]{javacClassPath.toUri().toURL()}); Class javacLoadedClass = javacClassLoader.loadClass(FILE_NAME); - // Load the raupenpiler class - Path raupenpilerClassPath = Paths.get("src/test/resources/output/raupenpiler"); - ClassLoader raupenpilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{raupenpilerClassPath.toUri().toURL()}); - Class raupenpilerLoadedClass = raupenpilerClassLoader.loadClass(FILE_NAME); + // Load the miniCompiler class + Path miniCompilerClassPath = Paths.get("src/test/resources/output/miniCompiler"); + ClassLoader miniCompilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{miniCompilerClassPath.toUri().toURL()}); + Class miniCompilerLoadedClass = miniCompilerClassLoader.loadClass(FILE_NAME); // Class Name assertEquals(FILE_NAME, javacLoadedClass.getName()); - assertEquals(FILE_NAME, raupenpilerLoadedClass.getName()); + assertEquals(FILE_NAME, miniCompilerLoadedClass.getName()); // Constructors Constructor[] javacConstructors = javacLoadedClass.getDeclaredConstructors(); - Constructor[] raupenpilerConstructors = raupenpilerLoadedClass.getDeclaredConstructors(); + Constructor[] miniCompilerConstructors = miniCompilerLoadedClass.getDeclaredConstructors(); - assertEquals(javacConstructors.length, raupenpilerConstructors.length); + assertEquals(javacConstructors.length, miniCompilerConstructors.length); for(Constructor c : javacConstructors) { - for(Constructor raupenpilerConstructor : raupenpilerConstructors) { - assertEquals(c.getParameterCount(), raupenpilerConstructor.getParameterCount()); - if (c.getParameterCount() == raupenpilerConstructor.getParameterCount()) { - assertEquals(c.getName(), raupenpilerConstructor.getName()); + for(Constructor miniCompilerConstructor : miniCompilerConstructors) { + assertEquals(c.getParameterCount(), miniCompilerConstructor.getParameterCount()); + if (c.getParameterCount() == miniCompilerConstructor.getParameterCount()) { + assertEquals(c.getName(), miniCompilerConstructor.getName()); } } } @@ -640,29 +640,29 @@ public class E2EReflectionsTest { // Methods Method[] javacMethods = javacLoadedClass.getDeclaredMethods(); - Method[] raupenpilerMethods = raupenpilerLoadedClass.getDeclaredMethods(); + Method[] miniCompilerMethods = miniCompilerLoadedClass.getDeclaredMethods(); - assertEquals(javacMethods.length, raupenpilerMethods.length); + assertEquals(javacMethods.length, miniCompilerMethods.length); for (int i = 0; i < javacMethods.length; i++) { - assertEquals(javacMethods[i].getName(), raupenpilerMethods[i].getName()); - assertEquals(javacMethods[i].getReturnType(), raupenpilerMethods[i].getReturnType()); - assertEquals(javacMethods[i].getParameterCount(), raupenpilerMethods[i].getParameterCount()); - // assertEquals(javacMethods[i].getModifiers(), raupenpilerMethods[i].getModifiers()); + assertEquals(javacMethods[i].getName(), miniCompilerMethods[i].getName()); + assertEquals(javacMethods[i].getReturnType(), miniCompilerMethods[i].getReturnType()); + assertEquals(javacMethods[i].getParameterCount(), miniCompilerMethods[i].getParameterCount()); + // assertEquals(javacMethods[i].getModifiers(), miniCompilerMethods[i].getModifiers()); } // Fields Field[] javacLoadedClassDeclaredFields = javacLoadedClass.getDeclaredFields(); - Field[] raupenpilerLoadedClassDeclaredFields = raupenpilerLoadedClass.getDeclaredFields(); + Field[] miniCompilerLoadedClassDeclaredFields = miniCompilerLoadedClass.getDeclaredFields(); - assertEquals(javacLoadedClassDeclaredFields.length, raupenpilerLoadedClassDeclaredFields.length); + assertEquals(javacLoadedClassDeclaredFields.length, miniCompilerLoadedClassDeclaredFields.length); for (Field field : javacLoadedClassDeclaredFields) { - for (Field raupenpilerField : raupenpilerLoadedClassDeclaredFields) { - if (field.getName().equals(raupenpilerField.getName())) { - assertEquals(field.getType(), raupenpilerField.getType()); - // assertEquals(field.getModifiers(), raupenpilerField.getModifiers()); + for (Field miniCompilerField : miniCompilerLoadedClassDeclaredFields) { + if (field.getName().equals(miniCompilerField.getName())) { + assertEquals(field.getType(), miniCompilerField.getType()); + // assertEquals(field.getModifiers(), miniCompilerField.getModifiers()); } } } @@ -678,8 +678,8 @@ public class E2EReflectionsTest { public void EmptyClassWithConstructorTest() { final String FILE_NAME = "EmptyClassWithConstructor"; try { - // compile with raupenpiler - Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/raupenpiler"}); + // compile with miniCompiler + Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/miniCompiler"}); // Get the system Java compiler JavaCompiler javac = ToolProvider.getSystemJavaCompiler(); // Assert that the compiler is available @@ -693,28 +693,28 @@ public class E2EReflectionsTest { ClassLoader javacClassLoader = new java.net.URLClassLoader(new java.net.URL[]{javacClassPath.toUri().toURL()}); Class javacLoadedClass = javacClassLoader.loadClass(FILE_NAME); - // Load the raupenpiler class - Path raupenpilerClassPath = Paths.get("src/test/resources/output/raupenpiler"); - ClassLoader raupenpilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{raupenpilerClassPath.toUri().toURL()}); - Class raupenpilerLoadedClass = raupenpilerClassLoader.loadClass(FILE_NAME); + // Load the miniCompiler class + Path miniCompilerClassPath = Paths.get("src/test/resources/output/miniCompiler"); + ClassLoader miniCompilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{miniCompilerClassPath.toUri().toURL()}); + Class miniCompilerLoadedClass = miniCompilerClassLoader.loadClass(FILE_NAME); // Class Name assertEquals(FILE_NAME, javacLoadedClass.getName()); - assertEquals(FILE_NAME, raupenpilerLoadedClass.getName()); + assertEquals(FILE_NAME, miniCompilerLoadedClass.getName()); // Constructors Constructor[] javacConstructors = javacLoadedClass.getDeclaredConstructors(); - Constructor[] raupenpilerConstructors = raupenpilerLoadedClass.getDeclaredConstructors(); + Constructor[] miniCompilerConstructors = miniCompilerLoadedClass.getDeclaredConstructors(); - assertEquals(javacConstructors.length, raupenpilerConstructors.length); + assertEquals(javacConstructors.length, miniCompilerConstructors.length); for(Constructor c : javacConstructors) { - for(Constructor raupenpilerConstructor : raupenpilerConstructors) { - assertEquals(c.getParameterCount(), raupenpilerConstructor.getParameterCount()); - if (c.getParameterCount() == raupenpilerConstructor.getParameterCount()) { - assertEquals(c.getName(), raupenpilerConstructor.getName()); + for(Constructor miniCompilerConstructor : miniCompilerConstructors) { + assertEquals(c.getParameterCount(), miniCompilerConstructor.getParameterCount()); + if (c.getParameterCount() == miniCompilerConstructor.getParameterCount()) { + assertEquals(c.getName(), miniCompilerConstructor.getName()); } } } @@ -722,29 +722,29 @@ public class E2EReflectionsTest { // Methods Method[] javacMethods = javacLoadedClass.getDeclaredMethods(); - Method[] raupenpilerMethods = raupenpilerLoadedClass.getDeclaredMethods(); + Method[] miniCompilerMethods = miniCompilerLoadedClass.getDeclaredMethods(); - assertEquals(javacMethods.length, raupenpilerMethods.length); + assertEquals(javacMethods.length, miniCompilerMethods.length); for (int i = 0; i < javacMethods.length; i++) { - assertEquals(javacMethods[i].getName(), raupenpilerMethods[i].getName()); - assertEquals(javacMethods[i].getReturnType(), raupenpilerMethods[i].getReturnType()); - assertEquals(javacMethods[i].getParameterCount(), raupenpilerMethods[i].getParameterCount()); - // assertEquals(javacMethods[i].getModifiers(), raupenpilerMethods[i].getModifiers()); + assertEquals(javacMethods[i].getName(), miniCompilerMethods[i].getName()); + assertEquals(javacMethods[i].getReturnType(), miniCompilerMethods[i].getReturnType()); + assertEquals(javacMethods[i].getParameterCount(), miniCompilerMethods[i].getParameterCount()); + // assertEquals(javacMethods[i].getModifiers(), miniCompilerMethods[i].getModifiers()); } // Fields Field[] javacLoadedClassDeclaredFields = javacLoadedClass.getDeclaredFields(); - Field[] raupenpilerLoadedClassDeclaredFields = raupenpilerLoadedClass.getDeclaredFields(); + Field[] miniCompilerLoadedClassDeclaredFields = miniCompilerLoadedClass.getDeclaredFields(); - assertEquals(javacLoadedClassDeclaredFields.length, raupenpilerLoadedClassDeclaredFields.length); + assertEquals(javacLoadedClassDeclaredFields.length, miniCompilerLoadedClassDeclaredFields.length); for (Field field : javacLoadedClassDeclaredFields) { - for (Field raupenpilerField : raupenpilerLoadedClassDeclaredFields) { - if (field.getName().equals(raupenpilerField.getName())) { - assertEquals(field.getType(), raupenpilerField.getType()); - // assertEquals(field.getModifiers(), raupenpilerField.getModifiers()); + for (Field miniCompilerField : miniCompilerLoadedClassDeclaredFields) { + if (field.getName().equals(miniCompilerField.getName())) { + assertEquals(field.getType(), miniCompilerField.getType()); + // assertEquals(field.getModifiers(), miniCompilerField.getModifiers()); } } } @@ -760,8 +760,8 @@ public class E2EReflectionsTest { public void FieldTest() { final String FILE_NAME = "Field"; try { - // compile with raupenpiler - Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/raupenpiler"}); + // compile with miniCompiler + Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/miniCompiler"}); // Get the system Java compiler JavaCompiler javac = ToolProvider.getSystemJavaCompiler(); // Assert that the compiler is available @@ -775,28 +775,28 @@ public class E2EReflectionsTest { ClassLoader javacClassLoader = new java.net.URLClassLoader(new java.net.URL[]{javacClassPath.toUri().toURL()}); Class javacLoadedClass = javacClassLoader.loadClass(FILE_NAME); - // Load the raupenpiler class - Path raupenpilerClassPath = Paths.get("src/test/resources/output/raupenpiler"); - ClassLoader raupenpilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{raupenpilerClassPath.toUri().toURL()}); - Class raupenpilerLoadedClass = raupenpilerClassLoader.loadClass(FILE_NAME); + // Load the miniCompiler class + Path miniCompilerClassPath = Paths.get("src/test/resources/output/miniCompiler"); + ClassLoader miniCompilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{miniCompilerClassPath.toUri().toURL()}); + Class miniCompilerLoadedClass = miniCompilerClassLoader.loadClass(FILE_NAME); // Class Name assertEquals(FILE_NAME, javacLoadedClass.getName()); - assertEquals(FILE_NAME, raupenpilerLoadedClass.getName()); + assertEquals(FILE_NAME, miniCompilerLoadedClass.getName()); // Constructors Constructor[] javacConstructors = javacLoadedClass.getDeclaredConstructors(); - Constructor[] raupenpilerConstructors = raupenpilerLoadedClass.getDeclaredConstructors(); + Constructor[] miniCompilerConstructors = miniCompilerLoadedClass.getDeclaredConstructors(); - assertEquals(javacConstructors.length, raupenpilerConstructors.length); + assertEquals(javacConstructors.length, miniCompilerConstructors.length); for(Constructor c : javacConstructors) { - for(Constructor raupenpilerConstructor : raupenpilerConstructors) { - assertEquals(c.getParameterCount(), raupenpilerConstructor.getParameterCount()); - if (c.getParameterCount() == raupenpilerConstructor.getParameterCount()) { - assertEquals(c.getName(), raupenpilerConstructor.getName()); + for(Constructor miniCompilerConstructor : miniCompilerConstructors) { + assertEquals(c.getParameterCount(), miniCompilerConstructor.getParameterCount()); + if (c.getParameterCount() == miniCompilerConstructor.getParameterCount()) { + assertEquals(c.getName(), miniCompilerConstructor.getName()); } } } @@ -804,29 +804,29 @@ public class E2EReflectionsTest { // Methods Method[] javacMethods = javacLoadedClass.getDeclaredMethods(); - Method[] raupenpilerMethods = raupenpilerLoadedClass.getDeclaredMethods(); + Method[] miniCompilerMethods = miniCompilerLoadedClass.getDeclaredMethods(); - assertEquals(javacMethods.length, raupenpilerMethods.length); + assertEquals(javacMethods.length, miniCompilerMethods.length); for (int i = 0; i < javacMethods.length; i++) { - assertEquals(javacMethods[i].getName(), raupenpilerMethods[i].getName()); - assertEquals(javacMethods[i].getReturnType(), raupenpilerMethods[i].getReturnType()); - assertEquals(javacMethods[i].getParameterCount(), raupenpilerMethods[i].getParameterCount()); - // assertEquals(javacMethods[i].getModifiers(), raupenpilerMethods[i].getModifiers()); + assertEquals(javacMethods[i].getName(), miniCompilerMethods[i].getName()); + assertEquals(javacMethods[i].getReturnType(), miniCompilerMethods[i].getReturnType()); + assertEquals(javacMethods[i].getParameterCount(), miniCompilerMethods[i].getParameterCount()); + // assertEquals(javacMethods[i].getModifiers(), miniCompilerMethods[i].getModifiers()); } // Fields Field[] javacLoadedClassDeclaredFields = javacLoadedClass.getDeclaredFields(); - Field[] raupenpilerLoadedClassDeclaredFields = raupenpilerLoadedClass.getDeclaredFields(); + Field[] miniCompilerLoadedClassDeclaredFields = miniCompilerLoadedClass.getDeclaredFields(); - assertEquals(javacLoadedClassDeclaredFields.length, raupenpilerLoadedClassDeclaredFields.length); + assertEquals(javacLoadedClassDeclaredFields.length, miniCompilerLoadedClassDeclaredFields.length); for (Field field : javacLoadedClassDeclaredFields) { - for (Field raupenpilerField : raupenpilerLoadedClassDeclaredFields) { - if (field.getName().equals(raupenpilerField.getName())) { - assertEquals(field.getType(), raupenpilerField.getType()); - // assertEquals(field.getModifiers(), raupenpilerField.getModifiers()); + for (Field miniCompilerField : miniCompilerLoadedClassDeclaredFields) { + if (field.getName().equals(miniCompilerField.getName())) { + assertEquals(field.getType(), miniCompilerField.getType()); + // assertEquals(field.getModifiers(), miniCompilerField.getModifiers()); } } } @@ -842,8 +842,8 @@ public class E2EReflectionsTest { public void FieldWithAccessModifierTest() { final String FILE_NAME = "FieldWithAccessModifier"; try { - // compile with raupenpiler - Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/raupenpiler"}); + // compile with miniCompiler + Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/miniCompiler"}); // Get the system Java compiler JavaCompiler javac = ToolProvider.getSystemJavaCompiler(); // Assert that the compiler is available @@ -857,28 +857,28 @@ public class E2EReflectionsTest { ClassLoader javacClassLoader = new java.net.URLClassLoader(new java.net.URL[]{javacClassPath.toUri().toURL()}); Class javacLoadedClass = javacClassLoader.loadClass(FILE_NAME); - // Load the raupenpiler class - Path raupenpilerClassPath = Paths.get("src/test/resources/output/raupenpiler"); - ClassLoader raupenpilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{raupenpilerClassPath.toUri().toURL()}); - Class raupenpilerLoadedClass = raupenpilerClassLoader.loadClass(FILE_NAME); + // Load the miniCompiler class + Path miniCompilerClassPath = Paths.get("src/test/resources/output/miniCompiler"); + ClassLoader miniCompilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{miniCompilerClassPath.toUri().toURL()}); + Class miniCompilerLoadedClass = miniCompilerClassLoader.loadClass(FILE_NAME); // Class Name assertEquals(FILE_NAME, javacLoadedClass.getName()); - assertEquals(FILE_NAME, raupenpilerLoadedClass.getName()); + assertEquals(FILE_NAME, miniCompilerLoadedClass.getName()); // Constructors Constructor[] javacConstructors = javacLoadedClass.getDeclaredConstructors(); - Constructor[] raupenpilerConstructors = raupenpilerLoadedClass.getDeclaredConstructors(); + Constructor[] miniCompilerConstructors = miniCompilerLoadedClass.getDeclaredConstructors(); - assertEquals(javacConstructors.length, raupenpilerConstructors.length); + assertEquals(javacConstructors.length, miniCompilerConstructors.length); for(Constructor c : javacConstructors) { - for(Constructor raupenpilerConstructor : raupenpilerConstructors) { - assertEquals(c.getParameterCount(), raupenpilerConstructor.getParameterCount()); - if (c.getParameterCount() == raupenpilerConstructor.getParameterCount()) { - assertEquals(c.getName(), raupenpilerConstructor.getName()); + for(Constructor miniCompilerConstructor : miniCompilerConstructors) { + assertEquals(c.getParameterCount(), miniCompilerConstructor.getParameterCount()); + if (c.getParameterCount() == miniCompilerConstructor.getParameterCount()) { + assertEquals(c.getName(), miniCompilerConstructor.getName()); } } } @@ -886,29 +886,29 @@ public class E2EReflectionsTest { // Methods Method[] javacMethods = javacLoadedClass.getDeclaredMethods(); - Method[] raupenpilerMethods = raupenpilerLoadedClass.getDeclaredMethods(); + Method[] miniCompilerMethods = miniCompilerLoadedClass.getDeclaredMethods(); - assertEquals(javacMethods.length, raupenpilerMethods.length); + assertEquals(javacMethods.length, miniCompilerMethods.length); for (int i = 0; i < javacMethods.length; i++) { - assertEquals(javacMethods[i].getName(), raupenpilerMethods[i].getName()); - assertEquals(javacMethods[i].getReturnType(), raupenpilerMethods[i].getReturnType()); - assertEquals(javacMethods[i].getParameterCount(), raupenpilerMethods[i].getParameterCount()); - // assertEquals(javacMethods[i].getModifiers(), raupenpilerMethods[i].getModifiers()); + assertEquals(javacMethods[i].getName(), miniCompilerMethods[i].getName()); + assertEquals(javacMethods[i].getReturnType(), miniCompilerMethods[i].getReturnType()); + assertEquals(javacMethods[i].getParameterCount(), miniCompilerMethods[i].getParameterCount()); + // assertEquals(javacMethods[i].getModifiers(), miniCompilerMethods[i].getModifiers()); } // Fields Field[] javacLoadedClassDeclaredFields = javacLoadedClass.getDeclaredFields(); - Field[] raupenpilerLoadedClassDeclaredFields = raupenpilerLoadedClass.getDeclaredFields(); + Field[] miniCompilerLoadedClassDeclaredFields = miniCompilerLoadedClass.getDeclaredFields(); - assertEquals(javacLoadedClassDeclaredFields.length, raupenpilerLoadedClassDeclaredFields.length); + assertEquals(javacLoadedClassDeclaredFields.length, miniCompilerLoadedClassDeclaredFields.length); for (Field field : javacLoadedClassDeclaredFields) { - for (Field raupenpilerField : raupenpilerLoadedClassDeclaredFields) { - if (field.getName().equals(raupenpilerField.getName())) { - assertEquals(field.getType(), raupenpilerField.getType()); - // assertEquals(field.getModifiers(), raupenpilerField.getModifiers()); + for (Field miniCompilerField : miniCompilerLoadedClassDeclaredFields) { + if (field.getName().equals(miniCompilerField.getName())) { + assertEquals(field.getType(), miniCompilerField.getType()); + // assertEquals(field.getModifiers(), miniCompilerField.getModifiers()); } } } @@ -924,8 +924,8 @@ public class E2EReflectionsTest { public void ForTest() { final String FILE_NAME = "For"; try { - // compile with raupenpiler - Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/raupenpiler"}); + // compile with miniCompiler + Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/miniCompiler"}); // Get the system Java compiler JavaCompiler javac = ToolProvider.getSystemJavaCompiler(); // Assert that the compiler is available @@ -939,28 +939,28 @@ public class E2EReflectionsTest { ClassLoader javacClassLoader = new java.net.URLClassLoader(new java.net.URL[]{javacClassPath.toUri().toURL()}); Class javacLoadedClass = javacClassLoader.loadClass(FILE_NAME); - // Load the raupenpiler class - Path raupenpilerClassPath = Paths.get("src/test/resources/output/raupenpiler"); - ClassLoader raupenpilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{raupenpilerClassPath.toUri().toURL()}); - Class raupenpilerLoadedClass = raupenpilerClassLoader.loadClass(FILE_NAME); + // Load the miniCompiler class + Path miniCompilerClassPath = Paths.get("src/test/resources/output/miniCompiler"); + ClassLoader miniCompilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{miniCompilerClassPath.toUri().toURL()}); + Class miniCompilerLoadedClass = miniCompilerClassLoader.loadClass(FILE_NAME); // Class Name assertEquals(FILE_NAME, javacLoadedClass.getName()); - assertEquals(FILE_NAME, raupenpilerLoadedClass.getName()); + assertEquals(FILE_NAME, miniCompilerLoadedClass.getName()); // Constructors Constructor[] javacConstructors = javacLoadedClass.getDeclaredConstructors(); - Constructor[] raupenpilerConstructors = raupenpilerLoadedClass.getDeclaredConstructors(); + Constructor[] miniCompilerConstructors = miniCompilerLoadedClass.getDeclaredConstructors(); - assertEquals(javacConstructors.length, raupenpilerConstructors.length); + assertEquals(javacConstructors.length, miniCompilerConstructors.length); for(Constructor c : javacConstructors) { - for(Constructor raupenpilerConstructor : raupenpilerConstructors) { - assertEquals(c.getParameterCount(), raupenpilerConstructor.getParameterCount()); - if (c.getParameterCount() == raupenpilerConstructor.getParameterCount()) { - assertEquals(c.getName(), raupenpilerConstructor.getName()); + for(Constructor miniCompilerConstructor : miniCompilerConstructors) { + assertEquals(c.getParameterCount(), miniCompilerConstructor.getParameterCount()); + if (c.getParameterCount() == miniCompilerConstructor.getParameterCount()) { + assertEquals(c.getName(), miniCompilerConstructor.getName()); } } } @@ -968,29 +968,29 @@ public class E2EReflectionsTest { // Methods Method[] javacMethods = javacLoadedClass.getDeclaredMethods(); - Method[] raupenpilerMethods = raupenpilerLoadedClass.getDeclaredMethods(); + Method[] miniCompilerMethods = miniCompilerLoadedClass.getDeclaredMethods(); - assertEquals(javacMethods.length, raupenpilerMethods.length); + assertEquals(javacMethods.length, miniCompilerMethods.length); for (int i = 0; i < javacMethods.length; i++) { - assertEquals(javacMethods[i].getName(), raupenpilerMethods[i].getName()); - assertEquals(javacMethods[i].getReturnType(), raupenpilerMethods[i].getReturnType()); - assertEquals(javacMethods[i].getParameterCount(), raupenpilerMethods[i].getParameterCount()); - // assertEquals(javacMethods[i].getModifiers(), raupenpilerMethods[i].getModifiers()); + assertEquals(javacMethods[i].getName(), miniCompilerMethods[i].getName()); + assertEquals(javacMethods[i].getReturnType(), miniCompilerMethods[i].getReturnType()); + assertEquals(javacMethods[i].getParameterCount(), miniCompilerMethods[i].getParameterCount()); + // assertEquals(javacMethods[i].getModifiers(), miniCompilerMethods[i].getModifiers()); } // Fields Field[] javacLoadedClassDeclaredFields = javacLoadedClass.getDeclaredFields(); - Field[] raupenpilerLoadedClassDeclaredFields = raupenpilerLoadedClass.getDeclaredFields(); + Field[] miniCompilerLoadedClassDeclaredFields = miniCompilerLoadedClass.getDeclaredFields(); - assertEquals(javacLoadedClassDeclaredFields.length, raupenpilerLoadedClassDeclaredFields.length); + assertEquals(javacLoadedClassDeclaredFields.length, miniCompilerLoadedClassDeclaredFields.length); for (Field field : javacLoadedClassDeclaredFields) { - for (Field raupenpilerField : raupenpilerLoadedClassDeclaredFields) { - if (field.getName().equals(raupenpilerField.getName())) { - assertEquals(field.getType(), raupenpilerField.getType()); - // assertEquals(field.getModifiers(), raupenpilerField.getModifiers()); + for (Field miniCompilerField : miniCompilerLoadedClassDeclaredFields) { + if (field.getName().equals(miniCompilerField.getName())) { + assertEquals(field.getType(), miniCompilerField.getType()); + // assertEquals(field.getModifiers(), miniCompilerField.getModifiers()); } } } @@ -1007,8 +1007,8 @@ public class E2EReflectionsTest { public void IfTest() { final String FILE_NAME = "If"; try { - // compile with raupenpiler - Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/raupenpiler"}); + // compile with miniCompiler + Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/miniCompiler"}); // Get the system Java compiler JavaCompiler javac = ToolProvider.getSystemJavaCompiler(); // Assert that the compiler is available @@ -1022,28 +1022,28 @@ public class E2EReflectionsTest { ClassLoader javacClassLoader = new java.net.URLClassLoader(new java.net.URL[]{javacClassPath.toUri().toURL()}); Class javacLoadedClass = javacClassLoader.loadClass(FILE_NAME); - // Load the raupenpiler class - Path raupenpilerClassPath = Paths.get("src/test/resources/output/raupenpiler"); - ClassLoader raupenpilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{raupenpilerClassPath.toUri().toURL()}); - Class raupenpilerLoadedClass = raupenpilerClassLoader.loadClass(FILE_NAME); + // Load the miniCompiler class + Path miniCompilerClassPath = Paths.get("src/test/resources/output/miniCompiler"); + ClassLoader miniCompilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{miniCompilerClassPath.toUri().toURL()}); + Class miniCompilerLoadedClass = miniCompilerClassLoader.loadClass(FILE_NAME); // Class Name assertEquals(FILE_NAME, javacLoadedClass.getName()); - assertEquals(FILE_NAME, raupenpilerLoadedClass.getName()); + assertEquals(FILE_NAME, miniCompilerLoadedClass.getName()); // Constructors Constructor[] javacConstructors = javacLoadedClass.getDeclaredConstructors(); - Constructor[] raupenpilerConstructors = raupenpilerLoadedClass.getDeclaredConstructors(); + Constructor[] miniCompilerConstructors = miniCompilerLoadedClass.getDeclaredConstructors(); - assertEquals(javacConstructors.length, raupenpilerConstructors.length); + assertEquals(javacConstructors.length, miniCompilerConstructors.length); for(Constructor c : javacConstructors) { - for(Constructor raupenpilerConstructor : raupenpilerConstructors) { - assertEquals(c.getParameterCount(), raupenpilerConstructor.getParameterCount()); - if (c.getParameterCount() == raupenpilerConstructor.getParameterCount()) { - assertEquals(c.getName(), raupenpilerConstructor.getName()); + for(Constructor miniCompilerConstructor : miniCompilerConstructors) { + assertEquals(c.getParameterCount(), miniCompilerConstructor.getParameterCount()); + if (c.getParameterCount() == miniCompilerConstructor.getParameterCount()) { + assertEquals(c.getName(), miniCompilerConstructor.getName()); } } } @@ -1051,29 +1051,29 @@ public class E2EReflectionsTest { // Methods Method[] javacMethods = javacLoadedClass.getDeclaredMethods(); - Method[] raupenpilerMethods = raupenpilerLoadedClass.getDeclaredMethods(); + Method[] miniCompilerMethods = miniCompilerLoadedClass.getDeclaredMethods(); - assertEquals(javacMethods.length, raupenpilerMethods.length); + assertEquals(javacMethods.length, miniCompilerMethods.length); for (int i = 0; i < javacMethods.length; i++) { - assertEquals(javacMethods[i].getName(), raupenpilerMethods[i].getName()); - assertEquals(javacMethods[i].getReturnType(), raupenpilerMethods[i].getReturnType()); - assertEquals(javacMethods[i].getParameterCount(), raupenpilerMethods[i].getParameterCount()); - // assertEquals(javacMethods[i].getModifiers(), raupenpilerMethods[i].getModifiers()); + assertEquals(javacMethods[i].getName(), miniCompilerMethods[i].getName()); + assertEquals(javacMethods[i].getReturnType(), miniCompilerMethods[i].getReturnType()); + assertEquals(javacMethods[i].getParameterCount(), miniCompilerMethods[i].getParameterCount()); + // assertEquals(javacMethods[i].getModifiers(), miniCompilerMethods[i].getModifiers()); } // Fields Field[] javacLoadedClassDeclaredFields = javacLoadedClass.getDeclaredFields(); - Field[] raupenpilerLoadedClassDeclaredFields = raupenpilerLoadedClass.getDeclaredFields(); + Field[] miniCompilerLoadedClassDeclaredFields = miniCompilerLoadedClass.getDeclaredFields(); - assertEquals(javacLoadedClassDeclaredFields.length, raupenpilerLoadedClassDeclaredFields.length); + assertEquals(javacLoadedClassDeclaredFields.length, miniCompilerLoadedClassDeclaredFields.length); for (Field field : javacLoadedClassDeclaredFields) { - for (Field raupenpilerField : raupenpilerLoadedClassDeclaredFields) { - if (field.getName().equals(raupenpilerField.getName())) { - assertEquals(field.getType(), raupenpilerField.getType()); - // assertEquals(field.getModifiers(), raupenpilerField.getModifiers()); + for (Field miniCompilerField : miniCompilerLoadedClassDeclaredFields) { + if (field.getName().equals(miniCompilerField.getName())) { + assertEquals(field.getType(), miniCompilerField.getType()); + // assertEquals(field.getModifiers(), miniCompilerField.getModifiers()); } } } @@ -1088,8 +1088,8 @@ public class E2EReflectionsTest { public void IfElseTest() { final String FILE_NAME = "IfElse"; try { - // compile with raupenpiler - Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/raupenpiler"}); + // compile with miniCompiler + Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/miniCompiler"}); // Get the system Java compiler JavaCompiler javac = ToolProvider.getSystemJavaCompiler(); // Assert that the compiler is available @@ -1103,28 +1103,28 @@ public class E2EReflectionsTest { ClassLoader javacClassLoader = new java.net.URLClassLoader(new java.net.URL[]{javacClassPath.toUri().toURL()}); Class javacLoadedClass = javacClassLoader.loadClass(FILE_NAME); - // Load the raupenpiler class - Path raupenpilerClassPath = Paths.get("src/test/resources/output/raupenpiler"); - ClassLoader raupenpilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{raupenpilerClassPath.toUri().toURL()}); - Class raupenpilerLoadedClass = raupenpilerClassLoader.loadClass(FILE_NAME); + // Load the miniCompiler class + Path miniCompilerClassPath = Paths.get("src/test/resources/output/miniCompiler"); + ClassLoader miniCompilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{miniCompilerClassPath.toUri().toURL()}); + Class miniCompilerLoadedClass = miniCompilerClassLoader.loadClass(FILE_NAME); // Class Name assertEquals(FILE_NAME, javacLoadedClass.getName()); - assertEquals(FILE_NAME, raupenpilerLoadedClass.getName()); + assertEquals(FILE_NAME, miniCompilerLoadedClass.getName()); // Constructors Constructor[] javacConstructors = javacLoadedClass.getDeclaredConstructors(); - Constructor[] raupenpilerConstructors = raupenpilerLoadedClass.getDeclaredConstructors(); + Constructor[] miniCompilerConstructors = miniCompilerLoadedClass.getDeclaredConstructors(); - assertEquals(javacConstructors.length, raupenpilerConstructors.length); + assertEquals(javacConstructors.length, miniCompilerConstructors.length); for(Constructor c : javacConstructors) { - for(Constructor raupenpilerConstructor : raupenpilerConstructors) { - assertEquals(c.getParameterCount(), raupenpilerConstructor.getParameterCount()); - if (c.getParameterCount() == raupenpilerConstructor.getParameterCount()) { - assertEquals(c.getName(), raupenpilerConstructor.getName()); + for(Constructor miniCompilerConstructor : miniCompilerConstructors) { + assertEquals(c.getParameterCount(), miniCompilerConstructor.getParameterCount()); + if (c.getParameterCount() == miniCompilerConstructor.getParameterCount()) { + assertEquals(c.getName(), miniCompilerConstructor.getName()); } } } @@ -1132,29 +1132,29 @@ public class E2EReflectionsTest { // Methods Method[] javacMethods = javacLoadedClass.getDeclaredMethods(); - Method[] raupenpilerMethods = raupenpilerLoadedClass.getDeclaredMethods(); + Method[] miniCompilerMethods = miniCompilerLoadedClass.getDeclaredMethods(); - assertEquals(javacMethods.length, raupenpilerMethods.length); + assertEquals(javacMethods.length, miniCompilerMethods.length); for (int i = 0; i < javacMethods.length; i++) { - assertEquals(javacMethods[i].getName(), raupenpilerMethods[i].getName()); - assertEquals(javacMethods[i].getReturnType(), raupenpilerMethods[i].getReturnType()); - assertEquals(javacMethods[i].getParameterCount(), raupenpilerMethods[i].getParameterCount()); - // assertEquals(javacMethods[i].getModifiers(), raupenpilerMethods[i].getModifiers()); + assertEquals(javacMethods[i].getName(), miniCompilerMethods[i].getName()); + assertEquals(javacMethods[i].getReturnType(), miniCompilerMethods[i].getReturnType()); + assertEquals(javacMethods[i].getParameterCount(), miniCompilerMethods[i].getParameterCount()); + // assertEquals(javacMethods[i].getModifiers(), miniCompilerMethods[i].getModifiers()); } // Fields Field[] javacLoadedClassDeclaredFields = javacLoadedClass.getDeclaredFields(); - Field[] raupenpilerLoadedClassDeclaredFields = raupenpilerLoadedClass.getDeclaredFields(); + Field[] miniCompilerLoadedClassDeclaredFields = miniCompilerLoadedClass.getDeclaredFields(); - assertEquals(javacLoadedClassDeclaredFields.length, raupenpilerLoadedClassDeclaredFields.length); + assertEquals(javacLoadedClassDeclaredFields.length, miniCompilerLoadedClassDeclaredFields.length); for (Field field : javacLoadedClassDeclaredFields) { - for (Field raupenpilerField : raupenpilerLoadedClassDeclaredFields) { - if (field.getName().equals(raupenpilerField.getName())) { - assertEquals(field.getType(), raupenpilerField.getType()); - // assertEquals(field.getModifiers(), raupenpilerField.getModifiers()); + for (Field miniCompilerField : miniCompilerLoadedClassDeclaredFields) { + if (field.getName().equals(miniCompilerField.getName())) { + assertEquals(field.getType(), miniCompilerField.getType()); + // assertEquals(field.getModifiers(), miniCompilerField.getModifiers()); } } } @@ -1169,8 +1169,8 @@ public class E2EReflectionsTest { public void IfElseIfElseTest() { final String FILE_NAME = "IfElseIfElse"; try { - // compile with raupenpiler - Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/raupenpiler"}); + // compile with miniCompiler + Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/miniCompiler"}); // Get the system Java compiler JavaCompiler javac = ToolProvider.getSystemJavaCompiler(); // Assert that the compiler is available @@ -1184,28 +1184,28 @@ public class E2EReflectionsTest { ClassLoader javacClassLoader = new java.net.URLClassLoader(new java.net.URL[]{javacClassPath.toUri().toURL()}); Class javacLoadedClass = javacClassLoader.loadClass(FILE_NAME); - // Load the raupenpiler class - Path raupenpilerClassPath = Paths.get("src/test/resources/output/raupenpiler"); - ClassLoader raupenpilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{raupenpilerClassPath.toUri().toURL()}); - Class raupenpilerLoadedClass = raupenpilerClassLoader.loadClass(FILE_NAME); + // Load the miniCompiler class + Path miniCompilerClassPath = Paths.get("src/test/resources/output/miniCompiler"); + ClassLoader miniCompilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{miniCompilerClassPath.toUri().toURL()}); + Class miniCompilerLoadedClass = miniCompilerClassLoader.loadClass(FILE_NAME); // Class Name assertEquals(FILE_NAME, javacLoadedClass.getName()); - assertEquals(FILE_NAME, raupenpilerLoadedClass.getName()); + assertEquals(FILE_NAME, miniCompilerLoadedClass.getName()); // Constructors Constructor[] javacConstructors = javacLoadedClass.getDeclaredConstructors(); - Constructor[] raupenpilerConstructors = raupenpilerLoadedClass.getDeclaredConstructors(); + Constructor[] miniCompilerConstructors = miniCompilerLoadedClass.getDeclaredConstructors(); - assertEquals(javacConstructors.length, raupenpilerConstructors.length); + assertEquals(javacConstructors.length, miniCompilerConstructors.length); for(Constructor c : javacConstructors) { - for(Constructor raupenpilerConstructor : raupenpilerConstructors) { - assertEquals(c.getParameterCount(), raupenpilerConstructor.getParameterCount()); - if (c.getParameterCount() == raupenpilerConstructor.getParameterCount()) { - assertEquals(c.getName(), raupenpilerConstructor.getName()); + for(Constructor miniCompilerConstructor : miniCompilerConstructors) { + assertEquals(c.getParameterCount(), miniCompilerConstructor.getParameterCount()); + if (c.getParameterCount() == miniCompilerConstructor.getParameterCount()) { + assertEquals(c.getName(), miniCompilerConstructor.getName()); } } } @@ -1213,29 +1213,29 @@ public class E2EReflectionsTest { // Methods Method[] javacMethods = javacLoadedClass.getDeclaredMethods(); - Method[] raupenpilerMethods = raupenpilerLoadedClass.getDeclaredMethods(); + Method[] miniCompilerMethods = miniCompilerLoadedClass.getDeclaredMethods(); - assertEquals(javacMethods.length, raupenpilerMethods.length); + assertEquals(javacMethods.length, miniCompilerMethods.length); for (int i = 0; i < javacMethods.length; i++) { - assertEquals(javacMethods[i].getName(), raupenpilerMethods[i].getName()); - assertEquals(javacMethods[i].getReturnType(), raupenpilerMethods[i].getReturnType()); - assertEquals(javacMethods[i].getParameterCount(), raupenpilerMethods[i].getParameterCount()); - // assertEquals(javacMethods[i].getModifiers(), raupenpilerMethods[i].getModifiers()); + assertEquals(javacMethods[i].getName(), miniCompilerMethods[i].getName()); + assertEquals(javacMethods[i].getReturnType(), miniCompilerMethods[i].getReturnType()); + assertEquals(javacMethods[i].getParameterCount(), miniCompilerMethods[i].getParameterCount()); + // assertEquals(javacMethods[i].getModifiers(), miniCompilerMethods[i].getModifiers()); } // Fields Field[] javacLoadedClassDeclaredFields = javacLoadedClass.getDeclaredFields(); - Field[] raupenpilerLoadedClassDeclaredFields = raupenpilerLoadedClass.getDeclaredFields(); + Field[] miniCompilerLoadedClassDeclaredFields = miniCompilerLoadedClass.getDeclaredFields(); - assertEquals(javacLoadedClassDeclaredFields.length, raupenpilerLoadedClassDeclaredFields.length); + assertEquals(javacLoadedClassDeclaredFields.length, miniCompilerLoadedClassDeclaredFields.length); for (Field field : javacLoadedClassDeclaredFields) { - for (Field raupenpilerField : raupenpilerLoadedClassDeclaredFields) { - if (field.getName().equals(raupenpilerField.getName())) { - assertEquals(field.getType(), raupenpilerField.getType()); - // assertEquals(field.getModifiers(), raupenpilerField.getModifiers()); + for (Field miniCompilerField : miniCompilerLoadedClassDeclaredFields) { + if (field.getName().equals(miniCompilerField.getName())) { + assertEquals(field.getType(), miniCompilerField.getType()); + // assertEquals(field.getModifiers(), miniCompilerField.getModifiers()); } } } @@ -1250,8 +1250,8 @@ public class E2EReflectionsTest { public void IncrementTest() { final String FILE_NAME = "Increment"; try { - // compile with raupenpiler - Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/raupenpiler"}); + // compile with miniCompiler + Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/miniCompiler"}); // Get the system Java compiler JavaCompiler javac = ToolProvider.getSystemJavaCompiler(); // Assert that the compiler is available @@ -1265,28 +1265,28 @@ public class E2EReflectionsTest { ClassLoader javacClassLoader = new java.net.URLClassLoader(new java.net.URL[]{javacClassPath.toUri().toURL()}); Class javacLoadedClass = javacClassLoader.loadClass(FILE_NAME); - // Load the raupenpiler class - Path raupenpilerClassPath = Paths.get("src/test/resources/output/raupenpiler"); - ClassLoader raupenpilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{raupenpilerClassPath.toUri().toURL()}); - Class raupenpilerLoadedClass = raupenpilerClassLoader.loadClass(FILE_NAME); + // Load the miniCompiler class + Path miniCompilerClassPath = Paths.get("src/test/resources/output/miniCompiler"); + ClassLoader miniCompilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{miniCompilerClassPath.toUri().toURL()}); + Class miniCompilerLoadedClass = miniCompilerClassLoader.loadClass(FILE_NAME); // Class Name assertEquals(FILE_NAME, javacLoadedClass.getName()); - assertEquals(FILE_NAME, raupenpilerLoadedClass.getName()); + assertEquals(FILE_NAME, miniCompilerLoadedClass.getName()); // Constructors Constructor[] javacConstructors = javacLoadedClass.getDeclaredConstructors(); - Constructor[] raupenpilerConstructors = raupenpilerLoadedClass.getDeclaredConstructors(); + Constructor[] miniCompilerConstructors = miniCompilerLoadedClass.getDeclaredConstructors(); - assertEquals(javacConstructors.length, raupenpilerConstructors.length); + assertEquals(javacConstructors.length, miniCompilerConstructors.length); for(Constructor c : javacConstructors) { - for(Constructor raupenpilerConstructor : raupenpilerConstructors) { - assertEquals(c.getParameterCount(), raupenpilerConstructor.getParameterCount()); - if (c.getParameterCount() == raupenpilerConstructor.getParameterCount()) { - assertEquals(c.getName(), raupenpilerConstructor.getName()); + for(Constructor miniCompilerConstructor : miniCompilerConstructors) { + assertEquals(c.getParameterCount(), miniCompilerConstructor.getParameterCount()); + if (c.getParameterCount() == miniCompilerConstructor.getParameterCount()) { + assertEquals(c.getName(), miniCompilerConstructor.getName()); } } } @@ -1294,29 +1294,29 @@ public class E2EReflectionsTest { // Methods Method[] javacMethods = javacLoadedClass.getDeclaredMethods(); - Method[] raupenpilerMethods = raupenpilerLoadedClass.getDeclaredMethods(); + Method[] miniCompilerMethods = miniCompilerLoadedClass.getDeclaredMethods(); - assertEquals(javacMethods.length, raupenpilerMethods.length); + assertEquals(javacMethods.length, miniCompilerMethods.length); for (int i = 0; i < javacMethods.length; i++) { - assertEquals(javacMethods[i].getName(), raupenpilerMethods[i].getName()); - assertEquals(javacMethods[i].getReturnType(), raupenpilerMethods[i].getReturnType()); - assertEquals(javacMethods[i].getParameterCount(), raupenpilerMethods[i].getParameterCount()); - // assertEquals(javacMethods[i].getModifiers(), raupenpilerMethods[i].getModifiers()); + assertEquals(javacMethods[i].getName(), miniCompilerMethods[i].getName()); + assertEquals(javacMethods[i].getReturnType(), miniCompilerMethods[i].getReturnType()); + assertEquals(javacMethods[i].getParameterCount(), miniCompilerMethods[i].getParameterCount()); + // assertEquals(javacMethods[i].getModifiers(), miniCompilerMethods[i].getModifiers()); } // Fields Field[] javacLoadedClassDeclaredFields = javacLoadedClass.getDeclaredFields(); - Field[] raupenpilerLoadedClassDeclaredFields = raupenpilerLoadedClass.getDeclaredFields(); + Field[] miniCompilerLoadedClassDeclaredFields = miniCompilerLoadedClass.getDeclaredFields(); - assertEquals(javacLoadedClassDeclaredFields.length, raupenpilerLoadedClassDeclaredFields.length); + assertEquals(javacLoadedClassDeclaredFields.length, miniCompilerLoadedClassDeclaredFields.length); for (Field field : javacLoadedClassDeclaredFields) { - for (Field raupenpilerField : raupenpilerLoadedClassDeclaredFields) { - if (field.getName().equals(raupenpilerField.getName())) { - assertEquals(field.getType(), raupenpilerField.getType()); - // assertEquals(field.getModifiers(), raupenpilerField.getModifiers()); + for (Field miniCompilerField : miniCompilerLoadedClassDeclaredFields) { + if (field.getName().equals(miniCompilerField.getName())) { + assertEquals(field.getType(), miniCompilerField.getType()); + // assertEquals(field.getModifiers(), miniCompilerField.getModifiers()); } } } @@ -1331,8 +1331,8 @@ public class E2EReflectionsTest { public void MainMethodTest() { final String FILE_NAME = "MainMethod"; try { - // compile with raupenpiler - Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/raupenpiler"}); + // compile with miniCompiler + Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/miniCompiler"}); // Get the system Java compiler JavaCompiler javac = ToolProvider.getSystemJavaCompiler(); // Assert that the compiler is available @@ -1346,28 +1346,28 @@ public class E2EReflectionsTest { ClassLoader javacClassLoader = new java.net.URLClassLoader(new java.net.URL[]{javacClassPath.toUri().toURL()}); Class javacLoadedClass = javacClassLoader.loadClass(FILE_NAME); - // Load the raupenpiler class - Path raupenpilerClassPath = Paths.get("src/test/resources/output/raupenpiler"); - ClassLoader raupenpilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{raupenpilerClassPath.toUri().toURL()}); - Class raupenpilerLoadedClass = raupenpilerClassLoader.loadClass(FILE_NAME); + // Load the miniCompiler class + Path miniCompilerClassPath = Paths.get("src/test/resources/output/miniCompiler"); + ClassLoader miniCompilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{miniCompilerClassPath.toUri().toURL()}); + Class miniCompilerLoadedClass = miniCompilerClassLoader.loadClass(FILE_NAME); // Class Name assertEquals(FILE_NAME, javacLoadedClass.getName()); - assertEquals(FILE_NAME, raupenpilerLoadedClass.getName()); + assertEquals(FILE_NAME, miniCompilerLoadedClass.getName()); // Constructors Constructor[] javacConstructors = javacLoadedClass.getDeclaredConstructors(); - Constructor[] raupenpilerConstructors = raupenpilerLoadedClass.getDeclaredConstructors(); + Constructor[] miniCompilerConstructors = miniCompilerLoadedClass.getDeclaredConstructors(); - assertEquals(javacConstructors.length, raupenpilerConstructors.length); + assertEquals(javacConstructors.length, miniCompilerConstructors.length); for(Constructor c : javacConstructors) { - for(Constructor raupenpilerConstructor : raupenpilerConstructors) { - assertEquals(c.getParameterCount(), raupenpilerConstructor.getParameterCount()); - if (c.getParameterCount() == raupenpilerConstructor.getParameterCount()) { - assertEquals(c.getName(), raupenpilerConstructor.getName()); + for(Constructor miniCompilerConstructor : miniCompilerConstructors) { + assertEquals(c.getParameterCount(), miniCompilerConstructor.getParameterCount()); + if (c.getParameterCount() == miniCompilerConstructor.getParameterCount()) { + assertEquals(c.getName(), miniCompilerConstructor.getName()); } } } @@ -1375,29 +1375,29 @@ public class E2EReflectionsTest { // Methods Method[] javacMethods = javacLoadedClass.getDeclaredMethods(); - Method[] raupenpilerMethods = raupenpilerLoadedClass.getDeclaredMethods(); + Method[] miniCompilerMethods = miniCompilerLoadedClass.getDeclaredMethods(); - assertEquals(javacMethods.length, raupenpilerMethods.length); + assertEquals(javacMethods.length, miniCompilerMethods.length); for (int i = 0; i < javacMethods.length; i++) { - assertEquals(javacMethods[i].getName(), raupenpilerMethods[i].getName()); - assertEquals(javacMethods[i].getReturnType(), raupenpilerMethods[i].getReturnType()); - assertEquals(javacMethods[i].getParameterCount(), raupenpilerMethods[i].getParameterCount()); - // assertEquals(javacMethods[i].getModifiers(), raupenpilerMethods[i].getModifiers()); + assertEquals(javacMethods[i].getName(), miniCompilerMethods[i].getName()); + assertEquals(javacMethods[i].getReturnType(), miniCompilerMethods[i].getReturnType()); + assertEquals(javacMethods[i].getParameterCount(), miniCompilerMethods[i].getParameterCount()); + // assertEquals(javacMethods[i].getModifiers(), miniCompilerMethods[i].getModifiers()); } // Fields Field[] javacLoadedClassDeclaredFields = javacLoadedClass.getDeclaredFields(); - Field[] raupenpilerLoadedClassDeclaredFields = raupenpilerLoadedClass.getDeclaredFields(); + Field[] miniCompilerLoadedClassDeclaredFields = miniCompilerLoadedClass.getDeclaredFields(); - assertEquals(javacLoadedClassDeclaredFields.length, raupenpilerLoadedClassDeclaredFields.length); + assertEquals(javacLoadedClassDeclaredFields.length, miniCompilerLoadedClassDeclaredFields.length); for (Field field : javacLoadedClassDeclaredFields) { - for (Field raupenpilerField : raupenpilerLoadedClassDeclaredFields) { - if (field.getName().equals(raupenpilerField.getName())) { - assertEquals(field.getType(), raupenpilerField.getType()); - // assertEquals(field.getModifiers(), raupenpilerField.getModifiers()); + for (Field miniCompilerField : miniCompilerLoadedClassDeclaredFields) { + if (field.getName().equals(miniCompilerField.getName())) { + assertEquals(field.getType(), miniCompilerField.getType()); + // assertEquals(field.getModifiers(), miniCompilerField.getModifiers()); } } } @@ -1412,8 +1412,8 @@ public class E2EReflectionsTest { public void MultipleClassesTest() { final String FILE_NAME = "MultipleClasses"; try { - // compile with raupenpiler - Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/raupenpiler"}); + // compile with miniCompiler + Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/miniCompiler"}); // Get the system Java compiler JavaCompiler javac = ToolProvider.getSystemJavaCompiler(); // Assert that the compiler is available @@ -1427,28 +1427,28 @@ public class E2EReflectionsTest { ClassLoader javacClassLoader = new java.net.URLClassLoader(new java.net.URL[]{javacClassPath.toUri().toURL()}); Class javacLoadedClass = javacClassLoader.loadClass(FILE_NAME); - // Load the raupenpiler class - Path raupenpilerClassPath = Paths.get("src/test/resources/output/raupenpiler"); - ClassLoader raupenpilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{raupenpilerClassPath.toUri().toURL()}); - Class raupenpilerLoadedClass = raupenpilerClassLoader.loadClass(FILE_NAME); + // Load the miniCompiler class + Path miniCompilerClassPath = Paths.get("src/test/resources/output/miniCompiler"); + ClassLoader miniCompilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{miniCompilerClassPath.toUri().toURL()}); + Class miniCompilerLoadedClass = miniCompilerClassLoader.loadClass(FILE_NAME); // Class Name assertEquals(FILE_NAME, javacLoadedClass.getName()); - assertEquals(FILE_NAME, raupenpilerLoadedClass.getName()); + assertEquals(FILE_NAME, miniCompilerLoadedClass.getName()); // Constructors Constructor[] javacConstructors = javacLoadedClass.getDeclaredConstructors(); - Constructor[] raupenpilerConstructors = raupenpilerLoadedClass.getDeclaredConstructors(); + Constructor[] miniCompilerConstructors = miniCompilerLoadedClass.getDeclaredConstructors(); - assertEquals(javacConstructors.length, raupenpilerConstructors.length); + assertEquals(javacConstructors.length, miniCompilerConstructors.length); for(Constructor c : javacConstructors) { - for(Constructor raupenpilerConstructor : raupenpilerConstructors) { - assertEquals(c.getParameterCount(), raupenpilerConstructor.getParameterCount()); - if (c.getParameterCount() == raupenpilerConstructor.getParameterCount()) { - assertEquals(c.getName(), raupenpilerConstructor.getName()); + for(Constructor miniCompilerConstructor : miniCompilerConstructors) { + assertEquals(c.getParameterCount(), miniCompilerConstructor.getParameterCount()); + if (c.getParameterCount() == miniCompilerConstructor.getParameterCount()) { + assertEquals(c.getName(), miniCompilerConstructor.getName()); } } } @@ -1456,29 +1456,29 @@ public class E2EReflectionsTest { // Methods Method[] javacMethods = javacLoadedClass.getDeclaredMethods(); - Method[] raupenpilerMethods = raupenpilerLoadedClass.getDeclaredMethods(); + Method[] miniCompilerMethods = miniCompilerLoadedClass.getDeclaredMethods(); - assertEquals(javacMethods.length, raupenpilerMethods.length); + assertEquals(javacMethods.length, miniCompilerMethods.length); for (int i = 0; i < javacMethods.length; i++) { - assertEquals(javacMethods[i].getName(), raupenpilerMethods[i].getName()); - assertEquals(javacMethods[i].getReturnType(), raupenpilerMethods[i].getReturnType()); - assertEquals(javacMethods[i].getParameterCount(), raupenpilerMethods[i].getParameterCount()); - // assertEquals(javacMethods[i].getModifiers(), raupenpilerMethods[i].getModifiers()); + assertEquals(javacMethods[i].getName(), miniCompilerMethods[i].getName()); + assertEquals(javacMethods[i].getReturnType(), miniCompilerMethods[i].getReturnType()); + assertEquals(javacMethods[i].getParameterCount(), miniCompilerMethods[i].getParameterCount()); + // assertEquals(javacMethods[i].getModifiers(), miniCompilerMethods[i].getModifiers()); } // Fields Field[] javacLoadedClassDeclaredFields = javacLoadedClass.getDeclaredFields(); - Field[] raupenpilerLoadedClassDeclaredFields = raupenpilerLoadedClass.getDeclaredFields(); + Field[] miniCompilerLoadedClassDeclaredFields = miniCompilerLoadedClass.getDeclaredFields(); - assertEquals(javacLoadedClassDeclaredFields.length, raupenpilerLoadedClassDeclaredFields.length); + assertEquals(javacLoadedClassDeclaredFields.length, miniCompilerLoadedClassDeclaredFields.length); for (Field field : javacLoadedClassDeclaredFields) { - for (Field raupenpilerField : raupenpilerLoadedClassDeclaredFields) { - if (field.getName().equals(raupenpilerField.getName())) { - assertEquals(field.getType(), raupenpilerField.getType()); - // assertEquals(field.getModifiers(), raupenpilerField.getModifiers()); + for (Field miniCompilerField : miniCompilerLoadedClassDeclaredFields) { + if (field.getName().equals(miniCompilerField.getName())) { + assertEquals(field.getType(), miniCompilerField.getType()); + // assertEquals(field.getModifiers(), miniCompilerField.getModifiers()); } } } @@ -1493,8 +1493,8 @@ public class E2EReflectionsTest { public void NullTest() { final String FILE_NAME = "Null"; try { - // compile with raupenpiler - Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/raupenpiler"}); + // compile with miniCompiler + Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/miniCompiler"}); // Get the system Java compiler JavaCompiler javac = ToolProvider.getSystemJavaCompiler(); // Assert that the compiler is available @@ -1508,28 +1508,28 @@ public class E2EReflectionsTest { ClassLoader javacClassLoader = new java.net.URLClassLoader(new java.net.URL[]{javacClassPath.toUri().toURL()}); Class javacLoadedClass = javacClassLoader.loadClass(FILE_NAME); - // Load the raupenpiler class - Path raupenpilerClassPath = Paths.get("src/test/resources/output/raupenpiler"); - ClassLoader raupenpilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{raupenpilerClassPath.toUri().toURL()}); - Class raupenpilerLoadedClass = raupenpilerClassLoader.loadClass(FILE_NAME); + // Load the miniCompiler class + Path miniCompilerClassPath = Paths.get("src/test/resources/output/miniCompiler"); + ClassLoader miniCompilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{miniCompilerClassPath.toUri().toURL()}); + Class miniCompilerLoadedClass = miniCompilerClassLoader.loadClass(FILE_NAME); // Class Name assertEquals(FILE_NAME, javacLoadedClass.getName()); - assertEquals(FILE_NAME, raupenpilerLoadedClass.getName()); + assertEquals(FILE_NAME, miniCompilerLoadedClass.getName()); // Constructors Constructor[] javacConstructors = javacLoadedClass.getDeclaredConstructors(); - Constructor[] raupenpilerConstructors = raupenpilerLoadedClass.getDeclaredConstructors(); + Constructor[] miniCompilerConstructors = miniCompilerLoadedClass.getDeclaredConstructors(); - assertEquals(javacConstructors.length, raupenpilerConstructors.length); + assertEquals(javacConstructors.length, miniCompilerConstructors.length); for(Constructor c : javacConstructors) { - for(Constructor raupenpilerConstructor : raupenpilerConstructors) { - assertEquals(c.getParameterCount(), raupenpilerConstructor.getParameterCount()); - if (c.getParameterCount() == raupenpilerConstructor.getParameterCount()) { - assertEquals(c.getName(), raupenpilerConstructor.getName()); + for(Constructor miniCompilerConstructor : miniCompilerConstructors) { + assertEquals(c.getParameterCount(), miniCompilerConstructor.getParameterCount()); + if (c.getParameterCount() == miniCompilerConstructor.getParameterCount()) { + assertEquals(c.getName(), miniCompilerConstructor.getName()); } } } @@ -1537,29 +1537,29 @@ public class E2EReflectionsTest { // Methods Method[] javacMethods = javacLoadedClass.getDeclaredMethods(); - Method[] raupenpilerMethods = raupenpilerLoadedClass.getDeclaredMethods(); + Method[] miniCompilerMethods = miniCompilerLoadedClass.getDeclaredMethods(); - assertEquals(javacMethods.length, raupenpilerMethods.length); + assertEquals(javacMethods.length, miniCompilerMethods.length); for (int i = 0; i < javacMethods.length; i++) { - assertEquals(javacMethods[i].getName(), raupenpilerMethods[i].getName()); - assertEquals(javacMethods[i].getReturnType(), raupenpilerMethods[i].getReturnType()); - assertEquals(javacMethods[i].getParameterCount(), raupenpilerMethods[i].getParameterCount()); - // assertEquals(javacMethods[i].getModifiers(), raupenpilerMethods[i].getModifiers()); + assertEquals(javacMethods[i].getName(), miniCompilerMethods[i].getName()); + assertEquals(javacMethods[i].getReturnType(), miniCompilerMethods[i].getReturnType()); + assertEquals(javacMethods[i].getParameterCount(), miniCompilerMethods[i].getParameterCount()); + // assertEquals(javacMethods[i].getModifiers(), miniCompilerMethods[i].getModifiers()); } // Fields Field[] javacLoadedClassDeclaredFields = javacLoadedClass.getDeclaredFields(); - Field[] raupenpilerLoadedClassDeclaredFields = raupenpilerLoadedClass.getDeclaredFields(); + Field[] miniCompilerLoadedClassDeclaredFields = miniCompilerLoadedClass.getDeclaredFields(); - assertEquals(javacLoadedClassDeclaredFields.length, raupenpilerLoadedClassDeclaredFields.length); + assertEquals(javacLoadedClassDeclaredFields.length, miniCompilerLoadedClassDeclaredFields.length); for (Field field : javacLoadedClassDeclaredFields) { - for (Field raupenpilerField : raupenpilerLoadedClassDeclaredFields) { - if (field.getName().equals(raupenpilerField.getName())) { - assertEquals(field.getType(), raupenpilerField.getType()); - // assertEquals(field.getModifiers(), raupenpilerField.getModifiers()); + for (Field miniCompilerField : miniCompilerLoadedClassDeclaredFields) { + if (field.getName().equals(miniCompilerField.getName())) { + assertEquals(field.getType(), miniCompilerField.getType()); + // assertEquals(field.getModifiers(), miniCompilerField.getModifiers()); } } } @@ -1574,8 +1574,8 @@ public class E2EReflectionsTest { public void SelfReferenceTest() { final String FILE_NAME = "SelfReference"; try { - // compile with raupenpiler - Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/raupenpiler"}); + // compile with miniCompiler + Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/miniCompiler"}); // Get the system Java compiler JavaCompiler javac = ToolProvider.getSystemJavaCompiler(); // Assert that the compiler is available @@ -1589,28 +1589,28 @@ public class E2EReflectionsTest { ClassLoader javacClassLoader = new java.net.URLClassLoader(new java.net.URL[]{javacClassPath.toUri().toURL()}); Class javacLoadedClass = javacClassLoader.loadClass(FILE_NAME); - // Load the raupenpiler class - Path raupenpilerClassPath = Paths.get("src/test/resources/output/raupenpiler"); - ClassLoader raupenpilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{raupenpilerClassPath.toUri().toURL()}); - Class raupenpilerLoadedClass = raupenpilerClassLoader.loadClass(FILE_NAME); + // Load the miniCompiler class + Path miniCompilerClassPath = Paths.get("src/test/resources/output/miniCompiler"); + ClassLoader miniCompilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{miniCompilerClassPath.toUri().toURL()}); + Class miniCompilerLoadedClass = miniCompilerClassLoader.loadClass(FILE_NAME); // Class Name assertEquals(FILE_NAME, javacLoadedClass.getName()); - assertEquals(FILE_NAME, raupenpilerLoadedClass.getName()); + assertEquals(FILE_NAME, miniCompilerLoadedClass.getName()); // Constructors Constructor[] javacConstructors = javacLoadedClass.getDeclaredConstructors(); - Constructor[] raupenpilerConstructors = raupenpilerLoadedClass.getDeclaredConstructors(); + Constructor[] miniCompilerConstructors = miniCompilerLoadedClass.getDeclaredConstructors(); - assertEquals(javacConstructors.length, raupenpilerConstructors.length); + assertEquals(javacConstructors.length, miniCompilerConstructors.length); for(Constructor c : javacConstructors) { - for(Constructor raupenpilerConstructor : raupenpilerConstructors) { - assertEquals(c.getParameterCount(), raupenpilerConstructor.getParameterCount()); - if (c.getParameterCount() == raupenpilerConstructor.getParameterCount()) { - assertEquals(c.getName(), raupenpilerConstructor.getName()); + for(Constructor miniCompilerConstructor : miniCompilerConstructors) { + assertEquals(c.getParameterCount(), miniCompilerConstructor.getParameterCount()); + if (c.getParameterCount() == miniCompilerConstructor.getParameterCount()) { + assertEquals(c.getName(), miniCompilerConstructor.getName()); } } } @@ -1618,29 +1618,29 @@ public class E2EReflectionsTest { // Methods Method[] javacMethods = javacLoadedClass.getDeclaredMethods(); - Method[] raupenpilerMethods = raupenpilerLoadedClass.getDeclaredMethods(); + Method[] miniCompilerMethods = miniCompilerLoadedClass.getDeclaredMethods(); - assertEquals(javacMethods.length, raupenpilerMethods.length); + assertEquals(javacMethods.length, miniCompilerMethods.length); for (int i = 0; i < javacMethods.length; i++) { - assertEquals(javacMethods[i].getName(), raupenpilerMethods[i].getName()); - assertEquals(javacMethods[i].getReturnType(), raupenpilerMethods[i].getReturnType()); - assertEquals(javacMethods[i].getParameterCount(), raupenpilerMethods[i].getParameterCount()); - // assertEquals(javacMethods[i].getModifiers(), raupenpilerMethods[i].getModifiers()); + assertEquals(javacMethods[i].getName(), miniCompilerMethods[i].getName()); + assertEquals(javacMethods[i].getReturnType(), miniCompilerMethods[i].getReturnType()); + assertEquals(javacMethods[i].getParameterCount(), miniCompilerMethods[i].getParameterCount()); + // assertEquals(javacMethods[i].getModifiers(), miniCompilerMethods[i].getModifiers()); } // Fields Field[] javacLoadedClassDeclaredFields = javacLoadedClass.getDeclaredFields(); - Field[] raupenpilerLoadedClassDeclaredFields = raupenpilerLoadedClass.getDeclaredFields(); + Field[] miniCompilerLoadedClassDeclaredFields = miniCompilerLoadedClass.getDeclaredFields(); - assertEquals(javacLoadedClassDeclaredFields.length, raupenpilerLoadedClassDeclaredFields.length); + assertEquals(javacLoadedClassDeclaredFields.length, miniCompilerLoadedClassDeclaredFields.length); for (Field field : javacLoadedClassDeclaredFields) { - for (Field raupenpilerField : raupenpilerLoadedClassDeclaredFields) { - if (field.getName().equals(raupenpilerField.getName())) { - assertEquals(field.getType(), raupenpilerField.getType()); - // assertEquals(field.getModifiers(), raupenpilerField.getModifiers()); + for (Field miniCompilerField : miniCompilerLoadedClassDeclaredFields) { + if (field.getName().equals(miniCompilerField.getName())) { + assertEquals(field.getType(), miniCompilerField.getType()); + // assertEquals(field.getModifiers(), miniCompilerField.getModifiers()); } } } @@ -1655,8 +1655,8 @@ public class E2EReflectionsTest { public void ThisDotTest() { final String FILE_NAME = "ThisDot"; try { - // compile with raupenpiler - Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/raupenpiler"}); + // compile with miniCompiler + Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/miniCompiler"}); // Get the system Java compiler JavaCompiler javac = ToolProvider.getSystemJavaCompiler(); // Assert that the compiler is available @@ -1670,28 +1670,28 @@ public class E2EReflectionsTest { ClassLoader javacClassLoader = new java.net.URLClassLoader(new java.net.URL[]{javacClassPath.toUri().toURL()}); Class javacLoadedClass = javacClassLoader.loadClass(FILE_NAME); - // Load the raupenpiler class - Path raupenpilerClassPath = Paths.get("src/test/resources/output/raupenpiler"); - ClassLoader raupenpilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{raupenpilerClassPath.toUri().toURL()}); - Class raupenpilerLoadedClass = raupenpilerClassLoader.loadClass(FILE_NAME); + // Load the miniCompiler class + Path miniCompilerClassPath = Paths.get("src/test/resources/output/miniCompiler"); + ClassLoader miniCompilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{miniCompilerClassPath.toUri().toURL()}); + Class miniCompilerLoadedClass = miniCompilerClassLoader.loadClass(FILE_NAME); // Class Name assertEquals(FILE_NAME, javacLoadedClass.getName()); - assertEquals(FILE_NAME, raupenpilerLoadedClass.getName()); + assertEquals(FILE_NAME, miniCompilerLoadedClass.getName()); // Constructors Constructor[] javacConstructors = javacLoadedClass.getDeclaredConstructors(); - Constructor[] raupenpilerConstructors = raupenpilerLoadedClass.getDeclaredConstructors(); + Constructor[] miniCompilerConstructors = miniCompilerLoadedClass.getDeclaredConstructors(); - assertEquals(javacConstructors.length, raupenpilerConstructors.length); + assertEquals(javacConstructors.length, miniCompilerConstructors.length); for(Constructor c : javacConstructors) { - for(Constructor raupenpilerConstructor : raupenpilerConstructors) { - assertEquals(c.getParameterCount(), raupenpilerConstructor.getParameterCount()); - if (c.getParameterCount() == raupenpilerConstructor.getParameterCount()) { - assertEquals(c.getName(), raupenpilerConstructor.getName()); + for(Constructor miniCompilerConstructor : miniCompilerConstructors) { + assertEquals(c.getParameterCount(), miniCompilerConstructor.getParameterCount()); + if (c.getParameterCount() == miniCompilerConstructor.getParameterCount()) { + assertEquals(c.getName(), miniCompilerConstructor.getName()); } } } @@ -1699,29 +1699,29 @@ public class E2EReflectionsTest { // Methods Method[] javacMethods = javacLoadedClass.getDeclaredMethods(); - Method[] raupenpilerMethods = raupenpilerLoadedClass.getDeclaredMethods(); + Method[] miniCompilerMethods = miniCompilerLoadedClass.getDeclaredMethods(); - assertEquals(javacMethods.length, raupenpilerMethods.length); + assertEquals(javacMethods.length, miniCompilerMethods.length); for (int i = 0; i < javacMethods.length; i++) { - assertEquals(javacMethods[i].getName(), raupenpilerMethods[i].getName()); - assertEquals(javacMethods[i].getReturnType(), raupenpilerMethods[i].getReturnType()); - assertEquals(javacMethods[i].getParameterCount(), raupenpilerMethods[i].getParameterCount()); - // assertEquals(javacMethods[i].getModifiers(), raupenpilerMethods[i].getModifiers()); + assertEquals(javacMethods[i].getName(), miniCompilerMethods[i].getName()); + assertEquals(javacMethods[i].getReturnType(), miniCompilerMethods[i].getReturnType()); + assertEquals(javacMethods[i].getParameterCount(), miniCompilerMethods[i].getParameterCount()); + // assertEquals(javacMethods[i].getModifiers(), miniCompilerMethods[i].getModifiers()); } // Fields Field[] javacLoadedClassDeclaredFields = javacLoadedClass.getDeclaredFields(); - Field[] raupenpilerLoadedClassDeclaredFields = raupenpilerLoadedClass.getDeclaredFields(); + Field[] miniCompilerLoadedClassDeclaredFields = miniCompilerLoadedClass.getDeclaredFields(); - assertEquals(javacLoadedClassDeclaredFields.length, raupenpilerLoadedClassDeclaredFields.length); + assertEquals(javacLoadedClassDeclaredFields.length, miniCompilerLoadedClassDeclaredFields.length); for (Field field : javacLoadedClassDeclaredFields) { - for (Field raupenpilerField : raupenpilerLoadedClassDeclaredFields) { - if (field.getName().equals(raupenpilerField.getName())) { - assertEquals(field.getType(), raupenpilerField.getType()); - // assertEquals(field.getModifiers(), raupenpilerField.getModifiers()); + for (Field miniCompilerField : miniCompilerLoadedClassDeclaredFields) { + if (field.getName().equals(miniCompilerField.getName())) { + assertEquals(field.getType(), miniCompilerField.getType()); + // assertEquals(field.getModifiers(), miniCompilerField.getModifiers()); } } } @@ -1736,8 +1736,8 @@ public class E2EReflectionsTest { public void VariableCalculationTest() { final String FILE_NAME = "VariableCalculation"; try { - // compile with raupenpiler - Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/raupenpiler"}); + // compile with miniCompiler + Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/miniCompiler"}); // Get the system Java compiler JavaCompiler javac = ToolProvider.getSystemJavaCompiler(); // Assert that the compiler is available @@ -1751,28 +1751,28 @@ public class E2EReflectionsTest { ClassLoader javacClassLoader = new java.net.URLClassLoader(new java.net.URL[]{javacClassPath.toUri().toURL()}); Class javacLoadedClass = javacClassLoader.loadClass(FILE_NAME); - // Load the raupenpiler class - Path raupenpilerClassPath = Paths.get("src/test/resources/output/raupenpiler"); - ClassLoader raupenpilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{raupenpilerClassPath.toUri().toURL()}); - Class raupenpilerLoadedClass = raupenpilerClassLoader.loadClass(FILE_NAME); + // Load the miniCompiler class + Path miniCompilerClassPath = Paths.get("src/test/resources/output/miniCompiler"); + ClassLoader miniCompilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{miniCompilerClassPath.toUri().toURL()}); + Class miniCompilerLoadedClass = miniCompilerClassLoader.loadClass(FILE_NAME); // Class Name assertEquals(FILE_NAME, javacLoadedClass.getName()); - assertEquals(FILE_NAME, raupenpilerLoadedClass.getName()); + assertEquals(FILE_NAME, miniCompilerLoadedClass.getName()); // Constructors Constructor[] javacConstructors = javacLoadedClass.getDeclaredConstructors(); - Constructor[] raupenpilerConstructors = raupenpilerLoadedClass.getDeclaredConstructors(); + Constructor[] miniCompilerConstructors = miniCompilerLoadedClass.getDeclaredConstructors(); - assertEquals(javacConstructors.length, raupenpilerConstructors.length); + assertEquals(javacConstructors.length, miniCompilerConstructors.length); for(Constructor c : javacConstructors) { - for(Constructor raupenpilerConstructor : raupenpilerConstructors) { - assertEquals(c.getParameterCount(), raupenpilerConstructor.getParameterCount()); - if (c.getParameterCount() == raupenpilerConstructor.getParameterCount()) { - assertEquals(c.getName(), raupenpilerConstructor.getName()); + for(Constructor miniCompilerConstructor : miniCompilerConstructors) { + assertEquals(c.getParameterCount(), miniCompilerConstructor.getParameterCount()); + if (c.getParameterCount() == miniCompilerConstructor.getParameterCount()) { + assertEquals(c.getName(), miniCompilerConstructor.getName()); } } } @@ -1780,29 +1780,29 @@ public class E2EReflectionsTest { // Methods Method[] javacMethods = javacLoadedClass.getDeclaredMethods(); - Method[] raupenpilerMethods = raupenpilerLoadedClass.getDeclaredMethods(); + Method[] miniCompilerMethods = miniCompilerLoadedClass.getDeclaredMethods(); - assertEquals(javacMethods.length, raupenpilerMethods.length); + assertEquals(javacMethods.length, miniCompilerMethods.length); for (int i = 0; i < javacMethods.length; i++) { - assertEquals(javacMethods[i].getName(), raupenpilerMethods[i].getName()); - assertEquals(javacMethods[i].getReturnType(), raupenpilerMethods[i].getReturnType()); - assertEquals(javacMethods[i].getParameterCount(), raupenpilerMethods[i].getParameterCount()); - // assertEquals(javacMethods[i].getModifiers(), raupenpilerMethods[i].getModifiers()); + assertEquals(javacMethods[i].getName(), miniCompilerMethods[i].getName()); + assertEquals(javacMethods[i].getReturnType(), miniCompilerMethods[i].getReturnType()); + assertEquals(javacMethods[i].getParameterCount(), miniCompilerMethods[i].getParameterCount()); + // assertEquals(javacMethods[i].getModifiers(), miniCompilerMethods[i].getModifiers()); } // Fields Field[] javacLoadedClassDeclaredFields = javacLoadedClass.getDeclaredFields(); - Field[] raupenpilerLoadedClassDeclaredFields = raupenpilerLoadedClass.getDeclaredFields(); + Field[] miniCompilerLoadedClassDeclaredFields = miniCompilerLoadedClass.getDeclaredFields(); - assertEquals(javacLoadedClassDeclaredFields.length, raupenpilerLoadedClassDeclaredFields.length); + assertEquals(javacLoadedClassDeclaredFields.length, miniCompilerLoadedClassDeclaredFields.length); for (Field field : javacLoadedClassDeclaredFields) { - for (Field raupenpilerField : raupenpilerLoadedClassDeclaredFields) { - if (field.getName().equals(raupenpilerField.getName())) { - assertEquals(field.getType(), raupenpilerField.getType()); - // assertEquals(field.getModifiers(), raupenpilerField.getModifiers()); + for (Field miniCompilerField : miniCompilerLoadedClassDeclaredFields) { + if (field.getName().equals(miniCompilerField.getName())) { + assertEquals(field.getType(), miniCompilerField.getType()); + // assertEquals(field.getModifiers(), miniCompilerField.getModifiers()); } } } @@ -1817,8 +1817,8 @@ public class E2EReflectionsTest { public void VariableCompareTest() { final String FILE_NAME = "VariableCompare"; try { - // compile with raupenpiler - Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/raupenpiler"}); + // compile with miniCompiler + Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/miniCompiler"}); // Get the system Java compiler JavaCompiler javac = ToolProvider.getSystemJavaCompiler(); // Assert that the compiler is available @@ -1832,28 +1832,28 @@ public class E2EReflectionsTest { ClassLoader javacClassLoader = new java.net.URLClassLoader(new java.net.URL[]{javacClassPath.toUri().toURL()}); Class javacLoadedClass = javacClassLoader.loadClass(FILE_NAME); - // Load the raupenpiler class - Path raupenpilerClassPath = Paths.get("src/test/resources/output/raupenpiler"); - ClassLoader raupenpilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{raupenpilerClassPath.toUri().toURL()}); - Class raupenpilerLoadedClass = raupenpilerClassLoader.loadClass(FILE_NAME); + // Load the miniCompiler class + Path miniCompilerClassPath = Paths.get("src/test/resources/output/miniCompiler"); + ClassLoader miniCompilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{miniCompilerClassPath.toUri().toURL()}); + Class miniCompilerLoadedClass = miniCompilerClassLoader.loadClass(FILE_NAME); // Class Name assertEquals(FILE_NAME, javacLoadedClass.getName()); - assertEquals(FILE_NAME, raupenpilerLoadedClass.getName()); + assertEquals(FILE_NAME, miniCompilerLoadedClass.getName()); // Constructors Constructor[] javacConstructors = javacLoadedClass.getDeclaredConstructors(); - Constructor[] raupenpilerConstructors = raupenpilerLoadedClass.getDeclaredConstructors(); + Constructor[] miniCompilerConstructors = miniCompilerLoadedClass.getDeclaredConstructors(); - assertEquals(javacConstructors.length, raupenpilerConstructors.length); + assertEquals(javacConstructors.length, miniCompilerConstructors.length); for(Constructor c : javacConstructors) { - for(Constructor raupenpilerConstructor : raupenpilerConstructors) { - assertEquals(c.getParameterCount(), raupenpilerConstructor.getParameterCount()); - if (c.getParameterCount() == raupenpilerConstructor.getParameterCount()) { - assertEquals(c.getName(), raupenpilerConstructor.getName()); + for(Constructor miniCompilerConstructor : miniCompilerConstructors) { + assertEquals(c.getParameterCount(), miniCompilerConstructor.getParameterCount()); + if (c.getParameterCount() == miniCompilerConstructor.getParameterCount()) { + assertEquals(c.getName(), miniCompilerConstructor.getName()); } } } @@ -1861,29 +1861,29 @@ public class E2EReflectionsTest { // Methods Method[] javacMethods = javacLoadedClass.getDeclaredMethods(); - Method[] raupenpilerMethods = raupenpilerLoadedClass.getDeclaredMethods(); + Method[] miniCompilerMethods = miniCompilerLoadedClass.getDeclaredMethods(); - assertEquals(javacMethods.length, raupenpilerMethods.length); + assertEquals(javacMethods.length, miniCompilerMethods.length); for (int i = 0; i < javacMethods.length; i++) { - assertEquals(javacMethods[i].getName(), raupenpilerMethods[i].getName()); - assertEquals(javacMethods[i].getReturnType(), raupenpilerMethods[i].getReturnType()); - assertEquals(javacMethods[i].getParameterCount(), raupenpilerMethods[i].getParameterCount()); - // assertEquals(javacMethods[i].getModifiers(), raupenpilerMethods[i].getModifiers()); + assertEquals(javacMethods[i].getName(), miniCompilerMethods[i].getName()); + assertEquals(javacMethods[i].getReturnType(), miniCompilerMethods[i].getReturnType()); + assertEquals(javacMethods[i].getParameterCount(), miniCompilerMethods[i].getParameterCount()); + // assertEquals(javacMethods[i].getModifiers(), miniCompilerMethods[i].getModifiers()); } // Fields Field[] javacLoadedClassDeclaredFields = javacLoadedClass.getDeclaredFields(); - Field[] raupenpilerLoadedClassDeclaredFields = raupenpilerLoadedClass.getDeclaredFields(); + Field[] miniCompilerLoadedClassDeclaredFields = miniCompilerLoadedClass.getDeclaredFields(); - assertEquals(javacLoadedClassDeclaredFields.length, raupenpilerLoadedClassDeclaredFields.length); + assertEquals(javacLoadedClassDeclaredFields.length, miniCompilerLoadedClassDeclaredFields.length); for (Field field : javacLoadedClassDeclaredFields) { - for (Field raupenpilerField : raupenpilerLoadedClassDeclaredFields) { - if (field.getName().equals(raupenpilerField.getName())) { - assertEquals(field.getType(), raupenpilerField.getType()); - // assertEquals(field.getModifiers(), raupenpilerField.getModifiers()); + for (Field miniCompilerField : miniCompilerLoadedClassDeclaredFields) { + if (field.getName().equals(miniCompilerField.getName())) { + assertEquals(field.getType(), miniCompilerField.getType()); + // assertEquals(field.getModifiers(), miniCompilerField.getModifiers()); } } } @@ -1898,8 +1898,8 @@ public class E2EReflectionsTest { public void VoidMethodTest() { final String FILE_NAME = "VoidMethod"; try { - // compile with raupenpiler - Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/raupenpiler"}); + // compile with miniCompiler + Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/miniCompiler"}); // Get the system Java compiler JavaCompiler javac = ToolProvider.getSystemJavaCompiler(); // Assert that the compiler is available @@ -1913,28 +1913,28 @@ public class E2EReflectionsTest { ClassLoader javacClassLoader = new java.net.URLClassLoader(new java.net.URL[]{javacClassPath.toUri().toURL()}); Class javacLoadedClass = javacClassLoader.loadClass(FILE_NAME); - // Load the raupenpiler class - Path raupenpilerClassPath = Paths.get("src/test/resources/output/raupenpiler"); - ClassLoader raupenpilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{raupenpilerClassPath.toUri().toURL()}); - Class raupenpilerLoadedClass = raupenpilerClassLoader.loadClass(FILE_NAME); + // Load the miniCompiler class + Path miniCompilerClassPath = Paths.get("src/test/resources/output/miniCompiler"); + ClassLoader miniCompilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{miniCompilerClassPath.toUri().toURL()}); + Class miniCompilerLoadedClass = miniCompilerClassLoader.loadClass(FILE_NAME); // Class Name assertEquals(FILE_NAME, javacLoadedClass.getName()); - assertEquals(FILE_NAME, raupenpilerLoadedClass.getName()); + assertEquals(FILE_NAME, miniCompilerLoadedClass.getName()); // Constructors Constructor[] javacConstructors = javacLoadedClass.getDeclaredConstructors(); - Constructor[] raupenpilerConstructors = raupenpilerLoadedClass.getDeclaredConstructors(); + Constructor[] miniCompilerConstructors = miniCompilerLoadedClass.getDeclaredConstructors(); - assertEquals(javacConstructors.length, raupenpilerConstructors.length); + assertEquals(javacConstructors.length, miniCompilerConstructors.length); for(Constructor c : javacConstructors) { - for(Constructor raupenpilerConstructor : raupenpilerConstructors) { - assertEquals(c.getParameterCount(), raupenpilerConstructor.getParameterCount()); - if (c.getParameterCount() == raupenpilerConstructor.getParameterCount()) { - assertEquals(c.getName(), raupenpilerConstructor.getName()); + for(Constructor miniCompilerConstructor : miniCompilerConstructors) { + assertEquals(c.getParameterCount(), miniCompilerConstructor.getParameterCount()); + if (c.getParameterCount() == miniCompilerConstructor.getParameterCount()) { + assertEquals(c.getName(), miniCompilerConstructor.getName()); } } } @@ -1942,29 +1942,29 @@ public class E2EReflectionsTest { // Methods Method[] javacMethods = javacLoadedClass.getDeclaredMethods(); - Method[] raupenpilerMethods = raupenpilerLoadedClass.getDeclaredMethods(); + Method[] miniCompilerMethods = miniCompilerLoadedClass.getDeclaredMethods(); - assertEquals(javacMethods.length, raupenpilerMethods.length); + assertEquals(javacMethods.length, miniCompilerMethods.length); for (int i = 0; i < javacMethods.length; i++) { - assertEquals(javacMethods[i].getName(), raupenpilerMethods[i].getName()); - assertEquals(javacMethods[i].getReturnType(), raupenpilerMethods[i].getReturnType()); - assertEquals(javacMethods[i].getParameterCount(), raupenpilerMethods[i].getParameterCount()); - // assertEquals(javacMethods[i].getModifiers(), raupenpilerMethods[i].getModifiers()); + assertEquals(javacMethods[i].getName(), miniCompilerMethods[i].getName()); + assertEquals(javacMethods[i].getReturnType(), miniCompilerMethods[i].getReturnType()); + assertEquals(javacMethods[i].getParameterCount(), miniCompilerMethods[i].getParameterCount()); + // assertEquals(javacMethods[i].getModifiers(), miniCompilerMethods[i].getModifiers()); } // Fields Field[] javacLoadedClassDeclaredFields = javacLoadedClass.getDeclaredFields(); - Field[] raupenpilerLoadedClassDeclaredFields = raupenpilerLoadedClass.getDeclaredFields(); + Field[] miniCompilerLoadedClassDeclaredFields = miniCompilerLoadedClass.getDeclaredFields(); - assertEquals(javacLoadedClassDeclaredFields.length, raupenpilerLoadedClassDeclaredFields.length); + assertEquals(javacLoadedClassDeclaredFields.length, miniCompilerLoadedClassDeclaredFields.length); for (Field field : javacLoadedClassDeclaredFields) { - for (Field raupenpilerField : raupenpilerLoadedClassDeclaredFields) { - if (field.getName().equals(raupenpilerField.getName())) { - assertEquals(field.getType(), raupenpilerField.getType()); - // assertEquals(field.getModifiers(), raupenpilerField.getModifiers()); + for (Field miniCompilerField : miniCompilerLoadedClassDeclaredFields) { + if (field.getName().equals(miniCompilerField.getName())) { + assertEquals(field.getType(), miniCompilerField.getType()); + // assertEquals(field.getModifiers(), miniCompilerField.getModifiers()); } } } @@ -1979,8 +1979,8 @@ public class E2EReflectionsTest { public void WhileTest() { final String FILE_NAME = "While"; try { - // compile with raupenpiler - Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/raupenpiler"}); + // compile with miniCompiler + Main.main(new String[]{"src/test/resources/input/singleFeatureTests/" + FILE_NAME + ".java", "src/test/resources/output/miniCompiler"}); // Get the system Java compiler JavaCompiler javac = ToolProvider.getSystemJavaCompiler(); // Assert that the compiler is available @@ -1994,28 +1994,28 @@ public class E2EReflectionsTest { ClassLoader javacClassLoader = new java.net.URLClassLoader(new java.net.URL[]{javacClassPath.toUri().toURL()}); Class javacLoadedClass = javacClassLoader.loadClass(FILE_NAME); - // Load the raupenpiler class - Path raupenpilerClassPath = Paths.get("src/test/resources/output/raupenpiler"); - ClassLoader raupenpilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{raupenpilerClassPath.toUri().toURL()}); - Class raupenpilerLoadedClass = raupenpilerClassLoader.loadClass(FILE_NAME); + // Load the miniCompiler class + Path miniCompilerClassPath = Paths.get("src/test/resources/output/miniCompiler"); + ClassLoader miniCompilerClassLoader = new java.net.URLClassLoader(new java.net.URL[]{miniCompilerClassPath.toUri().toURL()}); + Class miniCompilerLoadedClass = miniCompilerClassLoader.loadClass(FILE_NAME); // Class Name assertEquals(FILE_NAME, javacLoadedClass.getName()); - assertEquals(FILE_NAME, raupenpilerLoadedClass.getName()); + assertEquals(FILE_NAME, miniCompilerLoadedClass.getName()); // Constructors Constructor[] javacConstructors = javacLoadedClass.getDeclaredConstructors(); - Constructor[] raupenpilerConstructors = raupenpilerLoadedClass.getDeclaredConstructors(); + Constructor[] miniCompilerConstructors = miniCompilerLoadedClass.getDeclaredConstructors(); - assertEquals(javacConstructors.length, raupenpilerConstructors.length); + assertEquals(javacConstructors.length, miniCompilerConstructors.length); for(Constructor c : javacConstructors) { - for(Constructor raupenpilerConstructor : raupenpilerConstructors) { - assertEquals(c.getParameterCount(), raupenpilerConstructor.getParameterCount()); - if (c.getParameterCount() == raupenpilerConstructor.getParameterCount()) { - assertEquals(c.getName(), raupenpilerConstructor.getName()); + for(Constructor miniCompilerConstructor : miniCompilerConstructors) { + assertEquals(c.getParameterCount(), miniCompilerConstructor.getParameterCount()); + if (c.getParameterCount() == miniCompilerConstructor.getParameterCount()) { + assertEquals(c.getName(), miniCompilerConstructor.getName()); } } } @@ -2023,29 +2023,29 @@ public class E2EReflectionsTest { // Methods Method[] javacMethods = javacLoadedClass.getDeclaredMethods(); - Method[] raupenpilerMethods = raupenpilerLoadedClass.getDeclaredMethods(); + Method[] miniCompilerMethods = miniCompilerLoadedClass.getDeclaredMethods(); - assertEquals(javacMethods.length, raupenpilerMethods.length); + assertEquals(javacMethods.length, miniCompilerMethods.length); for (int i = 0; i < javacMethods.length; i++) { - assertEquals(javacMethods[i].getName(), raupenpilerMethods[i].getName()); - assertEquals(javacMethods[i].getReturnType(), raupenpilerMethods[i].getReturnType()); - assertEquals(javacMethods[i].getParameterCount(), raupenpilerMethods[i].getParameterCount()); - // assertEquals(javacMethods[i].getModifiers(), raupenpilerMethods[i].getModifiers()); + assertEquals(javacMethods[i].getName(), miniCompilerMethods[i].getName()); + assertEquals(javacMethods[i].getReturnType(), miniCompilerMethods[i].getReturnType()); + assertEquals(javacMethods[i].getParameterCount(), miniCompilerMethods[i].getParameterCount()); + // assertEquals(javacMethods[i].getModifiers(), miniCompilerMethods[i].getModifiers()); } // Fields Field[] javacLoadedClassDeclaredFields = javacLoadedClass.getDeclaredFields(); - Field[] raupenpilerLoadedClassDeclaredFields = raupenpilerLoadedClass.getDeclaredFields(); + Field[] miniCompilerLoadedClassDeclaredFields = miniCompilerLoadedClass.getDeclaredFields(); - assertEquals(javacLoadedClassDeclaredFields.length, raupenpilerLoadedClassDeclaredFields.length); + assertEquals(javacLoadedClassDeclaredFields.length, miniCompilerLoadedClassDeclaredFields.length); for (Field field : javacLoadedClassDeclaredFields) { - for (Field raupenpilerField : raupenpilerLoadedClassDeclaredFields) { - if (field.getName().equals(raupenpilerField.getName())) { - assertEquals(field.getType(), raupenpilerField.getType()); - // assertEquals(field.getModifiers(), raupenpilerField.getModifiers()); + for (Field miniCompilerField : miniCompilerLoadedClassDeclaredFields) { + if (field.getName().equals(miniCompilerField.getName())) { + assertEquals(field.getType(), miniCompilerField.getType()); + // assertEquals(field.getModifiers(), miniCompilerField.getModifiers()); } } } diff --git a/src/test/java/main/EndToEndTester.java b/src/test/java/main/EndToEndTester.java index 233a9c3..d7e40ef 100644 --- a/src/test/java/main/EndToEndTester.java +++ b/src/test/java/main/EndToEndTester.java @@ -11,8 +11,6 @@ package main; * Wenn unser Compiler funktioniert, sollten keine Errors kommen (sondern nur die Ausgaben, die wir in der CompilerInput.java Datei gemacht haben, * oder Methoden, die wir hier aufrufen).

* - *

PROBLEM: Hier kommen Errors, was eigentlich heißt, dass der Compiler nicht funktioniert, der Test sollte eigentlich passen. - *
DENN: Wenn ich statt unserem CompilerInput.class die CompilerInput.class von javac verwende (aus src/test/resources/output/javac ), dann funktioniert es.

*/ public class EndToEndTester { public static void main(String[] args) {