newest state

This commit is contained in:
julian 2024-04-27 17:37:15 +02:00
parent 514a504f0f
commit 6247416e6c
8 changed files with 50 additions and 23 deletions

Binary file not shown.

View File

@ -3,7 +3,7 @@
SRCDIR="javatx-src/main/java"
DESTDIR="out"
JAVAC_FLAGS="-g:none -nowarn"
JAVATX_COMPILER_PATH="JavaTXcompiler-2.4-jar-with-dependencies.jar"
JAVATX_COMPILER_PATH="JavaTXcompiler-2.5-jar-with-dependencies.jar"
#remove all files, if the script is called with parameter "clear"
if [ "$1" = "clean" ]; then
@ -16,10 +16,14 @@ if [ "$1" != "" ]; then
exit 1
fi
#find all .java/.jav files recursively and store them in an array
#find all .java/.jav files and store paths in an array
#note: somehow absolute paths don't work correctly with find -newer
#JAVA_FILES=($(find "$SRCDIR" -name "*.java" -exec realpath {} \;))
#JAV_FILES=($(find "$SRCDIR" -name "*.jav" -exec realpath {} \;))
JAVA_FILES=($(find "$SRCDIR" -name "*.java"))
JAV_FILES=($(find "$SRCDIR" -name "*.jav"))
#create empty arrays for .class file paths
JAVA_CLASSES=()
JAV_CLASSES=()
@ -56,22 +60,22 @@ for file in "${JAV_FILES[@]}"; do
done
#if [ "${#JAV_CHANGED[@]}" -ne 0 ]; then
# echo "java -jar $JAVATX_COMPILER_PATH -d $DESTDIR -cp "$SRCDIR:$DESTDIR:target/dependencies/" ${JAV_CHANGED[@]}"
# java -jar $JAVATX_COMPILER_PATH -d $DESTDIR -cp "$SRCDIR:$DESTDIR:target/dependencies/" "${JAV_CHANGED[@]}"
#fi
if [ "${#JAV_CHANGED[@]}" -ne 0 ]; then
echo "java -jar $JAVATX_COMPILER_PATH -d $DESTDIR -cp "$SRCDIR:$DESTDIR:target/dependencies/" ${JAV_CHANGED[@]}"
java -jar $JAVATX_COMPILER_PATH -d $DESTDIR -cp "$SRCDIR:$DESTDIR:target/dependencies/" "${JAV_CHANGED[@]}"
for ((i = 0; i < "${#JAV_CHANGED[@]}"; i++)); do
echo "java -jar $(realpath $JAVATX_COMPILER_PATH) -d $(realpath "$DESTDIR") -cp "$(realpath $SRCDIR):$(realpath $DESTDIR):$(realpath "target/dependencies/")" ${JAV_CHANGED[i]}"
java -jar $JAVATX_COMPILER_PATH -d "$DESTDIR" -cp "$SRCDIR:$DESTDIR:target/dependencies/" "${JAV_CHANGED[i]}"
if [ $? -eq 1 ]; then
exit 1;
fi
done
fi
#if [ "${#JAV_CHANGED[@]}" -ne 0 ]; then
# for ((i = 0; i < "${#JAV_CHANGED[@]}"; i++)); do
# echo "java -jar $JAVATX_COMPILER_PATH -d "$DESTDIR" -cp "$SRCDIR:$DESTDIR:target/dependencies/" ${JAV_CHANGED[i]}"
# java -jar $JAVATX_COMPILER_PATH -d "$DESTDIR" -cp "$SRCDIR:$DESTDIR:target/dependencies/" "${JAV_CHANGED[i]}"
# if [ $? -eq 1 ]; then
# exit 1;
# fi
# done
#fi
#if [ "${#JAVA_CHANGED[@]}" -ne 0 ]; then
# echo "javac -d $DESTDIR -cp "$SRCDIR:$DESTDIR:target/dependencies/*" $JAVAC_FLAGS ${JAVA_CHANGED[@]}"
# javac -d $DESTDIR -cp "$SRCDIR:$DESTDIR:target/dependencies/*" $JAVAC_FLAGS "${JAVA_CHANGED[@]}"
#fi
if [ "${#JAVA_CHANGED[@]}" -ne 0 ]; then
echo "javac -d $DESTDIR -cp "$SRCDIR:$DESTDIR:target/dependencies/*" $JAVAC_FLAGS ${JAVA_CHANGED[@]}"
javac -d $DESTDIR -cp "$SRCDIR:$DESTDIR:target/dependencies/*" $JAVAC_FLAGS "${JAVA_CHANGED[@]}"
fi

View File

@ -16,7 +16,15 @@ import java.util.Optional;
import java.util.function.Predicate;
import java.util.stream.Stream;
import de.dhbwstuttgart.syntaxtree.*;
//import de.dhbwstuttgart.syntaxtree.*;
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
import de.dhbwstuttgart.syntaxtree.Field;
import de.dhbwstuttgart.syntaxtree.Constructor;
import de.dhbwstuttgart.syntaxtree.Method;
import de.dhbwstuttgart.syntaxtree.GenericDeclarationList;
import de.dhbwstuttgart.syntaxtree.GenericTypeVar;
import de.dhbwstuttgart.syntaxtree.TypeScope;
import de.dhbwstuttgart.syntaxtree.ASTVisitor;
import java.lang.Boolean;
import java.lang.String;

View File

@ -3,8 +3,18 @@ package de.dhbwstuttgart.syntaxtree;
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
import org.antlr.v4.runtime.Token;
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
import java.lang.String;
import java.lang.Integer;
import de.dhbwstuttgart.syntaxtree.ASTVisitor;
import de.dhbwstuttgart.syntaxtree.GenericTypeVar;
import java.lang.Iterable;
import de.dhbwstuttgart.syntaxtree.TypeScope;
import java.util.ArrayList;
//TODO: curretly types are needed, or else wrong bytecode type in visitor.accept -> runtime crash, figure out why
public class Field extends SyntaxTreeNode implements TypeScope {
public final int modifier;

View File

@ -1,8 +1,9 @@
package de.dhbwstuttgart.syntaxtree;
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
import de.dhbwstuttgart.syntaxtree.GenericTypeVar;
import java.util.Collection;
import java.lang.Iterable;
public interface TypeScope {

View File

@ -68,7 +68,8 @@ public class FieldAssumption extends Assumption{
return resolver.resolve(type);
}
public getReceiverType(resolver) {
//Hier inferiert Java-TX RefType, obwohl RefTypeOrTPHOrWildcardOrGeneric genereller sein sollte
public RefTypeOrTPHOrWildcardOrGeneric getReceiverType(resolver) {
List<RefTypeOrTPHOrWildcardOrGeneric> params = new ArrayList<>();
for(gtv : receiverClass.getGenerics()){
//Hier wird ein GenericRefType gebildet, welcher einen für dieses Feld eindeutigen Namen hat

View File

@ -27,6 +27,9 @@ import java.util.Objects;
import java.lang.Integer;
import java.lang.String;
import java.lang.Boolean;
import java.lang.Iterable;
import java.util.Collection;
public class FunNClass extends ClassOrInterface {
public FunNClass(funNParams) {

View File

@ -24,13 +24,13 @@ public class TypeInferenceBlockInformation extends TypeInferenceInformation {
private TypeScope methodContext;
private ClassOrInterface currentClass;
public TypeInferenceBlockInformation(availableClasses, currentClass, methodContext) {
public TypeInferenceBlockInformation(Collection<ClassOrInterface> availableClasses, ClassOrInterface currentClass, TypeScope methodContext) {
super(availableClasses);
this.methodContext = new TypeScopeContainer(currentClass, methodContext);
this.currentClass = currentClass;
}
public TypeInferenceBlockInformation(oldScope, newScope) {
public TypeInferenceBlockInformation(TypeInferenceBlockInformation oldScope, TypeScope newScope) {
this(oldScope.getAvailableClasses(), oldScope.currentClass, new TypeScopeContainer(oldScope.methodContext, newScope));
}
public getCurrentClass() {