modified: ../../../../main/java/de/dhbwstuttgart/bytecode/BytecodeGenMethod.java

Bug "." wird in replaceAll nicht ersetzt, deshalb "/" durch "." und nicht "." durch "/" ersetzt.

	modified:   ../../../java/packages/OLTest.java
	modified:   ../../../java/packages/mathStrucVectorTest.java
	renamed:    de/test/OL.jav -> OL.jav
	renamed:    de/test/OLMain.jav -> OLMain.jav
OL ins default-Package verschoben
This commit is contained in:
pl@gohorb.ba-horb.de 2020-01-07 18:37:43 +01:00
parent ac3f8ece0e
commit 6779f10b08
5 changed files with 12 additions and 9 deletions

View File

@ -960,7 +960,7 @@ public class BytecodeGenMethod implements StatementVisitor {
boolean typesEqual = true;
Class<?>[] pTypes = m.getParameterTypes();
for(int j = 0; j<typesOfParams.length; ++j) {
if(!typesOfParams[j].equals(pTypes[j].getName().replaceAll(".", "/")) && !pTypes[j].getName().replace(".", "/").equals(Type.getInternalName(Object.class))) {
if(!typesOfParams[j].replaceAll("/", ".").equals(pTypes[j].getName()) && !pTypes[j].getName().replace(".", "/").equals(Type.getInternalName(Object.class))) {
typesEqual = false;
break;
}

View File

@ -29,19 +29,19 @@ public class OLTest {
@BeforeClass
public static void setUpBeforeClass() throws Exception {
path = System.getProperty("user.dir")+"/src/test/resources/javFiles/packageTest/de/test/OL.jav";
path = System.getProperty("user.dir")+"/src/test/resources/javFiles/packageTest/OL.jav";
fileToTest = new File(path);
compiler = new JavaTXCompiler(fileToTest);
pathToClassFile = System.getProperty("user.dir")+"/src/test/resources/javFiles/packageTest/de/test/";
pathToClassFile = System.getProperty("user.dir")+"/src/test/resources/javFiles/packageTest/";
compiler.generateBytecode(pathToClassFile);
loader = new URLClassLoader(new URL[] {new URL("file://"+pathToClassFile)});
classToTest = loader.loadClass("OL");
instanceOfClass = classToTest.getDeclaredConstructor().newInstance();
path = System.getProperty("user.dir")+"/src/test/resources/javFiles/packageTest/de/test/OLMain.jav";
path = System.getProperty("user.dir")+"/src/test/resources/javFiles/packageTest/OLMain.jav";
fileToTest = new File(path);
compiler = new JavaTXCompiler(fileToTest);
pathToClassFile = System.getProperty("user.dir")+"/src/test/resources/javFiles/packageTest/de/test/";
pathToClassFile = System.getProperty("user.dir")+"/src/test/resources/javFiles/packageTest/";
compiler.generateBytecode(pathToClassFile);
loader = new URLClassLoader(new URL[] {new URL("file://"+pathToClassFile)});
classToTest1 = loader.loadClass("OLMain");

View File

@ -20,16 +20,17 @@ public class mathStrucVectorTest extends TestCase {
Generate ToImport class in rootDirectory and in output-Directory
*/
/* PL 2020-01-07 kann z.Zt. nicht erzeugt werden (siehe Bug 170, http://bugzilla.ba-horb.de/show_bug.cgi?id=170)
JavaTXCompiler compiler = new JavaTXCompiler(new File(rootDirectory+"mathStruc.jav"));
compiler.typeInference();
compiler.generateBytecode(rootDirectory + "output/");
File f = new File(rootDirectory + "output/de/test/mathStruc.class");
assertTrue(f.exists());
compiler = new JavaTXCompiler(new File(rootDirectory+"vectorAdd.jav"));
*/
JavaTXCompiler compiler = new JavaTXCompiler(new File(rootDirectory+"vectorAdd.jav"));
compiler.typeInference();
compiler.generateBytecode(rootDirectory + "output/");
f = new File(rootDirectory + "output/de/test/vectorAdd.class");
File f = new File(rootDirectory + "output/de/test/vectorAdd.class");
assertTrue(f.exists());
}

View File

@ -1,4 +1,6 @@
import OL;
import java.lang.String;
import java.lang.Integer;
import java.lang.Double;
public class OLMain {