testing with compiler without java classpath

This commit is contained in:
i21023 2024-05-15 22:08:37 +02:00
parent e54e4dc04a
commit d5c0717763
6 changed files with 34 additions and 35 deletions

Binary file not shown.

View File

@ -64,7 +64,7 @@ done
if [ "${#JAV_CHANGED[@]}" -ne 0 ]; then
echo "java -jar $JAVATX_COMPILER_PATH -d $DESTDIR -cp "$SRCDIR:dependencies/" ${JAV_CHANGED[@]}"
java -jar $JAVATX_COMPILER_PATH -d $DESTDIR -cp "$SRCDIR:dependencies/" "${JAV_CHANGED[@]}"
java -jar $JAVATX_COMPILER_PATH -d $DESTDIR -cp "$SRCDIR:dependencies/:java-compiler-classes/" "${JAV_CHANGED[@]}"
if [ $? -ne 0 ]; then
echo "Fehler beim Kompilieren der Jav-Dateien. Beende das Skript."
exit 1
@ -82,8 +82,8 @@ fi
#fi
if [ "${#JAVA_CHANGED[@]}" -ne 0 ]; then
echo "javac -d $DESTDIR -cp "$SRCDIR:$DESTDIR:dependencies/*" $JAVAC_FLAGS ${JAVA_CHANGED[@]}"
javac -d $DESTDIR -cp "$SRCDIR:$DESTDIR:dependencies/*" $JAVAC_FLAGS "${JAVA_CHANGED[@]}"
echo "javac -d $DESTDIR -cp "$SRCDIR:$DESTDIR:dependencies/*:java-compiler-classes/*" $JAVAC_FLAGS ${JAVA_CHANGED[@]}"
javac -d $DESTDIR -cp "$SRCDIR:$DESTDIR:dependencies/*:java-compiler-classes/*" $JAVAC_FLAGS "${JAVA_CHANGED[@]}"
fi
# if [ $? -eq 0 ]; then

View File

@ -3,7 +3,7 @@ package de.dhbwstuttgart.syntaxtree.type;
import org.antlr.v4.runtime.Token;
import de.dhbwstuttgart.parser.scope.JavaClassName;
import de.dhbwstuttgart.syntaxtree.type.RefType;
public class Void extends RefType
{

View File

@ -31,7 +31,7 @@ public class ConstraintSet<A> {
this.oderConstraints.addAll(allOderConstraints);
}
public void addAll(ConstraintSet constraints) {
public void addAll(ConstraintSet<A> constraints) {
this.addAllUndConstraint(constraints.undConstraints);
this.addAllOderConstraint(constraints.oderConstraints);
}

View File

@ -49,6 +49,7 @@ public class TYPE {
var allClasses = new HashSet<ClassOrInterface>();
allClasses.addAll(allAvailableClasses);
allClasses.addAll(sf.availableClasses);
//ret.addAll(new ConstraintSet());
ret.addAll(getConstraintsClass(cl, new TypeInferenceInformation(allClasses)));
}
return ret;
@ -56,21 +57,21 @@ public class TYPE {
private ConstraintSet getConstraintsClass(ClassOrInterface cl, TypeInferenceInformation info) {
ConstraintSet ret = new ConstraintSet();
ConstraintSet methConstrains;
ConstraintSet methConstrains = new ConstraintSet();
for(Method m : cl.getMethods()){
ret.addAll(methConstrains = getConstraintsMethod(m,info, cl));
m.constraints.addAll(methConstrains);
//methConstrains = getConstraintsMethod(m,info, cl);
ret.addAll(methConstrains);
// m.constraints.addAll(methConstrains);
}
for(Constructor m : cl.getConstructors()){
ret.addAll(getConstraintsConstructor(m,info, cl));
}
if (cl.getfieldInitializations().isPresent()) {
ret.addAll(getConstraintsConstructor(cl.getfieldInitializations().get(), info, cl));
}
if (cl.getStaticInitializer().isPresent()) {
ret.addAll(getConstraintsMethod(cl.getStaticInitializer().get(), info, cl));
}
// for(Constructor m : cl.getConstructors()){
// //ret.addAll(getConstraintsConstructor(m,info, cl));
// }
// if (cl.getfieldInitializations().isPresent()) {
// //ret.addAll(getConstraintsConstructor(cl.getfieldInitializations().get(), info, cl));
// }
// if (cl.getStaticInitializer().isPresent()) {
// //ret.addAll(getConstraintsMethod(cl.getStaticInitializer().get(), info, cl));
// }
return ret;
}
/*
@ -95,20 +96,20 @@ public class TYPE {
}
*/
private ConstraintSet getConstraintsMethod(Method m, TypeInferenceInformation info, ClassOrInterface currentClass) {
if(m.block == null)return new ConstraintSet(); //Abstrakte Methoden generieren keine Constraints
TypeInferenceBlockInformation blockInfo = new TypeInferenceBlockInformation(info.getAvailableClasses(), currentClass, m);
TYPEStmt methodScope = new TYPEStmt(blockInfo);
m.block.accept(methodScope);
return methodScope.getConstraints();
}
// private getConstraintsMethod(Method m, TypeInferenceInformation info, ClassOrInterface currentClass) {
// if(m.block == null)return new ConstraintSet(); //Abstrakte Methoden generieren keine Constraints
// TypeInferenceBlockInformation blockInfo = new TypeInferenceBlockInformation(info.getAvailableClasses(), currentClass, m);
// TYPEStmt methodScope = new TYPEStmt(blockInfo);
// m.block.accept(methodScope);
// return methodScope.getConstraints();
// }
private ConstraintSet getConstraintsConstructor(Constructor m, TypeInferenceInformation info, ClassOrInterface currentClass) {
TypeInferenceBlockInformation blockInfo = new TypeInferenceBlockInformation(info.getAvailableClasses(), currentClass, m);
TYPEStmt methodScope = new TYPEStmt(blockInfo);
//for(Statement stmt : m.fieldInitializations)stmt.accept(methodScope);
ConstraintSet ret = this.getConstraintsMethod(m, info, currentClass);
ret.addAll(methodScope.getConstraints());
return ret;
}
// private getConstraintsConstructor(Constructor m, TypeInferenceInformation info, ClassOrInterface currentClass) {
// TypeInferenceBlockInformation blockInfo = new TypeInferenceBlockInformation(info.getAvailableClasses(), currentClass, m);
// TYPEStmt methodScope = new TYPEStmt(blockInfo);
// //for(Statement stmt : m.fieldInitializations)stmt.accept(methodScope);
// ConstraintSet ret = this.getConstraintsMethod(m, info, currentClass);
// ret.addAll(methodScope.getConstraints());
// return ret;
// }
}

View File

@ -4,8 +4,6 @@ SRCDIR="javatx-src/main/java"
DESTDIR="out/src"
TESTDESTDIR="out/tests"
DEPENDENCIES="dependencies"
JAVAC_FLAGS="-g:none -nowarn"
JAVATX_COMPILER_PATH="JavaTXcompiler-2.5-jar-with-dependencies.jar"
#compile all necessary test files
javac -cp "$DESTDIR:$DEPENDENCIES/*" -d "out/tests" tests/targetast/*