diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..2dc7c8d Binary files /dev/null and b/.DS_Store differ diff --git a/applyLambda.jav b/applyLambda.jav new file mode 100644 index 0000000..331bfbf --- /dev/null +++ b/applyLambda.jav @@ -0,0 +1,16 @@ +import java.util.Vector; +class Apply { } + +public class applyLambda { + + m () { + var lam1 = (x) -> { + return x; + }; + + return lam1.apply(new Apply()); + //return lam1; + //return new Vector(); + } +} + diff --git a/compile.sh b/compile.sh new file mode 100755 index 0000000..d540f94 --- /dev/null +++ b/compile.sh @@ -0,0 +1,97 @@ +#!/bin/bash + +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" + +#remove all files, if the script is called with parameter "clear" +if [ "$1" = "clean" ]; then + rm -r "$DESTDIR" + exit 0 +fi + +if [ "$1" != "" ]; then + echo "invalid argument: $1" + exit 1 +fi + +#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=() + +JAVA_CHANGED=() +JAV_CHANGED=() + +mkdir -p $DESTDIR + +#fill class files arrays by subsituting .java/.jav -> .class for each file +for file in "${JAVA_FILES[@]}"; do + #substitute destination dir with source dir + class_name="$DESTDIR${file#$SRCDIR}" + #substitute *.java -> *.class + class_name="${class_name%.java}.class" + #if .class file does not exists or .class file older than .java file + if [ ! -f "$class_name" ] || [ "$(find "$file" -prune -newer "$class_name")" ]; then + JAVA_CHANGED+=("$file") + JAVA_CLASSES+=("$class_name") + fi +done + + +for file in "${JAV_FILES[@]}"; do + #substitute destination dir with source dir + class_name="$DESTDIR${file#$SRCDIR}" + #substitute *.jav -> *.class + class_name="${class_name%.jav}.class" + #if .class file does not exists or .class file older than .jav file + if [ ! -f "$class_name" ] || [ "$(find "$file" -prune -newer "$class_name")" ]; then + JAV_CHANGED+=("$file") + JAV_CLASSES+=("$class_name") + fi +done + + +if [ "${#JAV_CHANGED[@]}" -ne 0 ]; then + echo "java -jar $JAVATX_COMPILER_PATH -d $DESTDIR -cp "$SRCDIR:$DESTDIR:dependencies/" ${JAV_CHANGED[@]}" + java -jar $JAVATX_COMPILER_PATH -d $DESTDIR -cp "$SRCDIR:$DESTDIR:dependencies/" "${JAV_CHANGED[@]}" +fi + +#if [ "${#JAV_CHANGED[@]}" -ne 0 ]; then +# 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 [ "${#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[@]}" +fi + +##TEST ENVIRONMENT## + +#compile all necessary test files +javac -cp "$DESTDIR:$DEPENDENCIES/*" -d "out/tests" tests/targetast/* +javac -cp "$TESTDESTDIR:$DESTDIR:$DEPENDENCIES/*" -d "out/tests" tests/TestComplete.java + +cp -r resources out/tests/resources/ + +cd "$TESTDESTDIR" + +#run tests with junit +java -cp "../src:.:../../dependencies/*" org.junit.runner.JUnitCore TestComplete + diff --git a/funnclass b/funnclass new file mode 100644 index 0000000..61e5a3a --- /dev/null +++ b/funnclass @@ -0,0 +1,3470 @@ +de.dhbwstuttgart.syntaxtree.ClassOrInterface +de.dhbwstuttgart.syntaxtree.ClassOrInterface +de.dhbwstuttgart.syntaxtree.ClassOrInterface +de.dhbwstuttgart.syntaxtree.ClassOrInterface +{java.util.ArrayList=Elem: Node(java.util.ArrayList) +Prec: [java.util.List, java.lang.Cloneable, java.lang.Object, java.util.AbstractCollection, java.lang.Iterable, java.util.RandomAccess, java.util.Collection, java.io.Serializable, java.util.SequencedCollection, java.util.AbstractList] +Desc: [] + +, java.lang.Number=Elem: Node(java.lang.Number) +Prec: [java.lang.Object, java.io.Serializable] +Desc: [java.lang.Integer] + +, de.dhbwstuttgart.syntaxtree.factory.NameGenerator=Elem: Node(de.dhbwstuttgart.syntaxtree.factory.NameGenerator) +Prec: [java.lang.Object] +Desc: [] + +, de.dhbwstuttgart.syntaxtree.TypeScope=Elem: Node(de.dhbwstuttgart.syntaxtree.TypeScope) +Prec: [java.lang.Object] +Desc: [de.dhbwstuttgart.syntaxtree.Method, de.dhbwstuttgart.syntaxtree.Constructor, de.dhbwstuttgart.typeinference.assumptions.FunNClass, de.dhbwstuttgart.syntaxtree.ClassOrInterface] + +, java.lang.String=Elem: Node(java.lang.String) +Prec: [java.lang.Object, java.lang.constant.Constable, java.lang.Comparable, java.io.Serializable, java.lang.CharSequence, java.lang.constant.ConstantDesc] +Desc: [] + +, de.dhbwstuttgart.syntaxtree.type.GenericRefType=Elem: Node(de.dhbwstuttgart.syntaxtree.type.GenericRefType) +Prec: [java.lang.Object, de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric, de.dhbwstuttgart.syntaxtree.SyntaxTreeNode, de.dhbwstuttgart.core.IItemWithOffset] +Desc: [] + +, java.lang.CharSequence=Elem: Node(java.lang.CharSequence) +Prec: [java.lang.Object] +Desc: [java.lang.String] + +, java.util.AbstractList=Elem: Node(java.util.AbstractList) +Prec: [java.util.List, java.lang.Object, java.util.AbstractCollection, java.lang.Iterable, java.util.Collection, java.util.SequencedCollection] +Desc: [java.util.ArrayList] + +, java.lang.Cloneable=Elem: Node(java.lang.Cloneable) +Prec: [java.lang.Object] +Desc: [java.util.ArrayList] + +, java.lang.Iterable=Elem: Node(java.lang.Iterable) +Prec: [java.lang.Object] +Desc: [java.util.List, java.util.ArrayList, java.util.AbstractCollection, java.util.Collection, java.util.SequencedCollection, java.util.AbstractList] + +, de.dhbwstuttgart.syntaxtree.Constructor=Elem: Node(de.dhbwstuttgart.syntaxtree.Constructor) +Prec: [java.lang.Object, de.dhbwstuttgart.syntaxtree.TypeScope, de.dhbwstuttgart.syntaxtree.SyntaxTreeNode, de.dhbwstuttgart.syntaxtree.Method, de.dhbwstuttgart.core.IItemWithOffset] +Desc: [] + +, de.dhbwstuttgart.syntaxtree.type.TypePlaceholder=Elem: Node(de.dhbwstuttgart.syntaxtree.type.TypePlaceholder) +Prec: [java.lang.Object, de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric, de.dhbwstuttgart.syntaxtree.SyntaxTreeNode, de.dhbwstuttgart.core.IItemWithOffset] +Desc: [] + +, de.dhbwstuttgart.syntaxtree.GenericDeclarationList=Elem: Node(de.dhbwstuttgart.syntaxtree.GenericDeclarationList) +Prec: [java.lang.Object, de.dhbwstuttgart.syntaxtree.SyntaxTreeNode, de.dhbwstuttgart.core.IItemWithOffset, java.lang.Iterable] +Desc: [] + +, de.dhbwstuttgart.syntaxtree.ClassOrInterface=Elem: Node(de.dhbwstuttgart.syntaxtree.ClassOrInterface) +Prec: [java.lang.Object, de.dhbwstuttgart.syntaxtree.TypeScope, de.dhbwstuttgart.syntaxtree.SyntaxTreeNode, de.dhbwstuttgart.core.IItemWithOffset] +Desc: [de.dhbwstuttgart.typeinference.assumptions.FunNClass] + +, de.dhbwstuttgart.syntaxtree.GenericTypeVar=Elem: Node(de.dhbwstuttgart.syntaxtree.GenericTypeVar) +Prec: [java.lang.Object, de.dhbwstuttgart.syntaxtree.SyntaxTreeNode, de.dhbwstuttgart.core.IItemWithOffset] +Desc: [] + +, java.lang.Iterable=Elem: Node(java.lang.Iterable) +Prec: [java.lang.Object] +Desc: [de.dhbwstuttgart.syntaxtree.GenericDeclarationList] + +, java.util.List=Elem: Node(java.util.List) +Prec: [java.lang.Object, java.lang.Iterable, java.util.Collection, java.util.SequencedCollection] +Desc: [java.util.ArrayList, java.util.AbstractList] + +, de.dhbwstuttgart.parser.scope.JavaClassName=Elem: Node(de.dhbwstuttgart.parser.scope.JavaClassName) +Prec: [java.lang.Object] +Desc: [] + +, java.lang.Integer=Elem: Node(java.lang.Integer) +Prec: [java.lang.Number, java.lang.Object, java.lang.constant.Constable, java.io.Serializable, java.lang.constant.ConstantDesc, java.lang.Comparable] +Desc: [] + +, java.util.Optional=Elem: Node(java.util.Optional) +Prec: [java.lang.Object] +Desc: [] + +, de.dhbwstuttgart.parser.NullToken=Elem: Node(de.dhbwstuttgart.parser.NullToken) +Prec: [java.lang.Object, org.antlr.v4.runtime.Token] +Desc: [] + +, de.dhbwstuttgart.syntaxtree.ASTVisitor=Elem: Node(de.dhbwstuttgart.syntaxtree.ASTVisitor) +Prec: [java.lang.Object, de.dhbwstuttgart.syntaxtree.StatementVisitor] +Desc: [] + +, java.lang.Boolean=Elem: Node(java.lang.Boolean) +Prec: [java.lang.Object, java.lang.constant.Constable, java.lang.Comparable, java.io.Serializable] +Desc: [] + +, javax.swing.text.html.Option=Elem: Node(javax.swing.text.html.Option) +Prec: [java.lang.Object, java.io.Serializable] +Desc: [] + +, de.dhbwstuttgart.syntaxtree.Method=Elem: Node(de.dhbwstuttgart.syntaxtree.Method) +Prec: [java.lang.Object, de.dhbwstuttgart.syntaxtree.TypeScope, de.dhbwstuttgart.syntaxtree.SyntaxTreeNode, de.dhbwstuttgart.core.IItemWithOffset] +Desc: [de.dhbwstuttgart.syntaxtree.Constructor] + +, java.lang.Comparable=Elem: Node(java.lang.Comparable) +Prec: [java.lang.Object] +Desc: [java.lang.String] + +, de.dhbwstuttgart.typeinference.assumptions.FunNClass=Elem: Node(de.dhbwstuttgart.typeinference.assumptions.FunNClass) +Prec: [java.lang.Object, de.dhbwstuttgart.syntaxtree.TypeScope, de.dhbwstuttgart.syntaxtree.SyntaxTreeNode, de.dhbwstuttgart.core.IItemWithOffset, de.dhbwstuttgart.syntaxtree.ClassOrInterface] +Desc: [] + +, org.antlr.v4.runtime.Token=Elem: Node(org.antlr.v4.runtime.Token) +Prec: [java.lang.Object] +Desc: [de.dhbwstuttgart.parser.NullToken] + +, de.dhbwstuttgart.syntaxtree.factory.ASTFactory=Elem: Node(de.dhbwstuttgart.syntaxtree.factory.ASTFactory) +Prec: [java.lang.Object] +Desc: [] + +, java.lang.constant.ConstantDesc=Elem: Node(java.lang.constant.ConstantDesc) +Prec: [java.lang.Object] +Desc: [java.lang.Integer, java.lang.String] + +, de.dhbwstuttgart.syntaxtree.type.RefType=Elem: Node(de.dhbwstuttgart.syntaxtree.type.RefType) +Prec: [java.lang.Object, de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric, de.dhbwstuttgart.syntaxtree.SyntaxTreeNode, de.dhbwstuttgart.core.IItemWithOffset] +Desc: [] + +, java.lang.Object=Elem: Node(java.lang.Object) +Prec: [java.lang.Object] +Desc: [java.util.ArrayList, java.lang.Number, de.dhbwstuttgart.syntaxtree.factory.NameGenerator, de.dhbwstuttgart.syntaxtree.TypeScope, de.dhbwstuttgart.syntaxtree.type.GenericRefType, java.lang.String, java.lang.CharSequence, java.util.AbstractList, java.lang.Cloneable, java.lang.Iterable, de.dhbwstuttgart.syntaxtree.Constructor, de.dhbwstuttgart.syntaxtree.type.TypePlaceholder, de.dhbwstuttgart.syntaxtree.GenericDeclarationList, de.dhbwstuttgart.syntaxtree.GenericTypeVar, de.dhbwstuttgart.syntaxtree.ClassOrInterface, java.lang.Iterable, java.util.List, de.dhbwstuttgart.parser.scope.JavaClassName, java.lang.Integer, java.util.Optional, de.dhbwstuttgart.syntaxtree.ASTVisitor, de.dhbwstuttgart.parser.NullToken, javax.swing.text.html.Option, java.lang.Boolean, de.dhbwstuttgart.syntaxtree.Method, java.lang.Comparable, de.dhbwstuttgart.typeinference.assumptions.FunNClass, org.antlr.v4.runtime.Token, de.dhbwstuttgart.syntaxtree.factory.ASTFactory, java.lang.constant.ConstantDesc, de.dhbwstuttgart.syntaxtree.type.RefType, java.lang.Object, java.util.Objects, de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric, java.util.AbstractCollection, java.lang.constant.Constable, java.lang.Comparable, java.util.RandomAccess, de.dhbwstuttgart.syntaxtree.StatementVisitor, de.dhbwstuttgart.syntaxtree.SyntaxTreeNode, java.util.Collection, java.io.Serializable, java.util.SequencedCollection, de.dhbwstuttgart.core.IItemWithOffset, java.lang.Comparable] + +, de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric=Elem: Node(de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric) +Prec: [java.lang.Object, de.dhbwstuttgart.syntaxtree.SyntaxTreeNode, de.dhbwstuttgart.core.IItemWithOffset] +Desc: [de.dhbwstuttgart.syntaxtree.type.GenericRefType, de.dhbwstuttgart.syntaxtree.type.TypePlaceholder, de.dhbwstuttgart.syntaxtree.type.RefType] + +, java.util.Objects=Elem: Node(java.util.Objects) +Prec: [java.lang.Object] +Desc: [] + +, java.util.AbstractCollection=Elem: Node(java.util.AbstractCollection) +Prec: [java.lang.Object, java.lang.Iterable, java.util.Collection] +Desc: [java.util.ArrayList, java.util.AbstractList] + +, java.lang.constant.Constable=Elem: Node(java.lang.constant.Constable) +Prec: [java.lang.Object] +Desc: [java.lang.Integer, java.lang.String, java.lang.Boolean] + +, java.util.RandomAccess=Elem: Node(java.util.RandomAccess) +Prec: [java.lang.Object] +Desc: [java.util.ArrayList] + +, java.lang.Comparable=Elem: Node(java.lang.Comparable) +Prec: [java.lang.Object] +Desc: [java.lang.Boolean] + +, de.dhbwstuttgart.syntaxtree.SyntaxTreeNode=Elem: Node(de.dhbwstuttgart.syntaxtree.SyntaxTreeNode) +Prec: [java.lang.Object, de.dhbwstuttgart.core.IItemWithOffset] +Desc: [de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric, de.dhbwstuttgart.syntaxtree.type.GenericRefType, de.dhbwstuttgart.syntaxtree.Method, de.dhbwstuttgart.syntaxtree.Constructor, de.dhbwstuttgart.typeinference.assumptions.FunNClass, de.dhbwstuttgart.syntaxtree.type.TypePlaceholder, de.dhbwstuttgart.syntaxtree.GenericDeclarationList, de.dhbwstuttgart.syntaxtree.GenericTypeVar, de.dhbwstuttgart.syntaxtree.ClassOrInterface, de.dhbwstuttgart.syntaxtree.type.RefType] + +, de.dhbwstuttgart.syntaxtree.StatementVisitor=Elem: Node(de.dhbwstuttgart.syntaxtree.StatementVisitor) +Prec: [java.lang.Object] +Desc: [de.dhbwstuttgart.syntaxtree.ASTVisitor] + +, java.io.Serializable=Elem: Node(java.io.Serializable) +Prec: [java.lang.Object] +Desc: [java.util.ArrayList, java.lang.Number, java.lang.Integer, java.lang.String, javax.swing.text.html.Option, java.lang.Boolean] + +, java.util.Collection=Elem: Node(java.util.Collection) +Prec: [java.lang.Object, java.lang.Iterable] +Desc: [java.util.List, java.util.ArrayList, java.util.AbstractCollection, java.util.SequencedCollection, java.util.AbstractList] + +, java.util.SequencedCollection=Elem: Node(java.util.SequencedCollection) +Prec: [java.lang.Object, java.lang.Iterable, java.util.Collection] +Desc: [java.util.List, java.util.ArrayList, java.util.AbstractList] + +, de.dhbwstuttgart.core.IItemWithOffset=Elem: Node(de.dhbwstuttgart.core.IItemWithOffset) +Prec: [java.lang.Object] +Desc: [de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric, de.dhbwstuttgart.syntaxtree.type.GenericRefType, de.dhbwstuttgart.syntaxtree.SyntaxTreeNode, de.dhbwstuttgart.syntaxtree.Method, de.dhbwstuttgart.syntaxtree.Constructor, de.dhbwstuttgart.typeinference.assumptions.FunNClass, de.dhbwstuttgart.syntaxtree.type.TypePlaceholder, de.dhbwstuttgart.syntaxtree.GenericDeclarationList, de.dhbwstuttgart.syntaxtree.GenericTypeVar, de.dhbwstuttgart.syntaxtree.ClassOrInterface, de.dhbwstuttgart.syntaxtree.type.RefType] + +, java.lang.Comparable=Elem: Node(java.lang.Comparable) +Prec: [java.lang.Object] +Desc: [java.lang.Integer] + +} +xxx1 +Unify: +UND:[(java.lang.Boolean =. java.lang.Boolean, )@36 in FunNClass.jav, (BK =. de.dhbwstuttgart.syntaxtree.ClassOrInterface, 0 WC: true, IT: false), (de.dhbwstuttgart.syntaxtree.GenericDeclarationList <. BN, , 0 WC: true, IT: false)@46 in FunNClass.jav, (AG =. de.dhbwstuttgart.typeinference.assumptions.FunNClass, 0 WC: true, IT: false)@36 in FunNClass.jav, (BO <. java.lang.Iterable, 0 WC: true, IT: false)@42 in FunNClass.jav, (CR <. CP, 0 WC: true, IT: false, 0 WC: true, IT: false)@50 in FunNClass.jav, (java.util.ArrayList <. BP, , 0 WC: true, IT: false)@41 in FunNClass.jav, (Z =. de.dhbwstuttgart.typeinference.assumptions.FunNClass, 0 WC: true, IT: false)@36 in FunNClass.jav, (java.lang.String =. java.lang.String, )@36 in FunNClass.jav, (void <. A, , 0 WC: true, IT: false)@0 in FunNClass.jav] +isInherited = false + +ODER: +[[(java.util.ArrayList <. java.util.ArrayList, )@41 in FunNClass.jav, (BR =. java.util.ArrayList, 0 WC: true, IT: false)] +isInherited = false +] +[[(java.lang.String <. BU, , 0 WC: true, IT: false)@43 in FunNClass.jav, (BS =. ? extends de.dhbwstuttgart.syntaxtree.type.GenericRefType, 0 WC: true, IT: false)@43 in FunNClass.jav] +isInherited = false +, [(BS =. de.dhbwstuttgart.syntaxtree.type.GenericRefType, 0 WC: true, IT: false)@43 in FunNClass.jav, (java.lang.String <. BU, , 0 WC: true, IT: false)@43 in FunNClass.jav] +isInherited = false +] +[[(java.util.ArrayList <. java.util.ArrayList, )@44 in FunNClass.jav, (BX =. java.util.ArrayList, 0 WC: true, IT: false)] +isInherited = false +] +[[(BY =. de.dhbwstuttgart.parser.NullToken, 0 WC: true, IT: false), (de.dhbwstuttgart.parser.NullToken <. de.dhbwstuttgart.parser.NullToken, )@44 in FunNClass.jav] +isInherited = false +] +[[(BZ =. de.dhbwstuttgart.parser.NullToken, 0 WC: true, IT: false), (de.dhbwstuttgart.parser.NullToken <. de.dhbwstuttgart.parser.NullToken, )@44 in FunNClass.jav] +isInherited = false +] +[[(java.util.ArrayList <. java.util.List, )@43 in FunNClass.jav, (CE =. de.dhbwstuttgart.syntaxtree.GenericTypeVar, 0 WC: true, IT: false), (CA =. java.lang.String, 0 WC: true, IT: false), (CB =. java.util.List, 0 WC: true, IT: false), (CD =. org.antlr.v4.runtime.Token, 0 WC: true, IT: false), (CC =. org.antlr.v4.runtime.Token, 0 WC: true, IT: false), (de.dhbwstuttgart.parser.NullToken <. org.antlr.v4.runtime.Token, )@43 in FunNClass.jav, (BU <. java.lang.String, 0 WC: true, IT: false)@43 in FunNClass.jav, (de.dhbwstuttgart.syntaxtree.GenericTypeVar <. de.dhbwstuttgart.syntaxtree.GenericTypeVar, )@43 in FunNClass.jav] +isInherited = false +] +[[(java.lang.String <. BU, , 0 WC: true, IT: false)@43 in FunNClass.jav, (BS =. ? extends de.dhbwstuttgart.syntaxtree.type.GenericRefType, 0 WC: true, IT: false)@43 in FunNClass.jav] +isInherited = false +, [(BS =. de.dhbwstuttgart.syntaxtree.type.GenericRefType, 0 WC: true, IT: false)@43 in FunNClass.jav, (java.lang.String <. BU, , 0 WC: true, IT: false)@43 in FunNClass.jav] +isInherited = false +] +[[(java.util.ArrayList <. java.util.ArrayList, )@44 in FunNClass.jav, (BX =. java.util.ArrayList, 0 WC: true, IT: false)] +isInherited = false +] +[[(BY =. de.dhbwstuttgart.parser.NullToken, 0 WC: true, IT: false), (de.dhbwstuttgart.parser.NullToken <. de.dhbwstuttgart.parser.NullToken, )@44 in FunNClass.jav] +isInherited = false +] +[[(BZ =. de.dhbwstuttgart.parser.NullToken, 0 WC: true, IT: false), (de.dhbwstuttgart.parser.NullToken <. de.dhbwstuttgart.parser.NullToken, )@44 in FunNClass.jav] +isInherited = false +] +[[(java.util.ArrayList <. java.util.List, )@43 in FunNClass.jav, (CE =. de.dhbwstuttgart.syntaxtree.GenericTypeVar, 0 WC: true, IT: false), (CA =. java.lang.String, 0 WC: true, IT: false), (CB =. java.util.List, 0 WC: true, IT: false), (CD =. org.antlr.v4.runtime.Token, 0 WC: true, IT: false), (CC =. org.antlr.v4.runtime.Token, 0 WC: true, IT: false), (de.dhbwstuttgart.parser.NullToken <. org.antlr.v4.runtime.Token, )@43 in FunNClass.jav, (BU <. java.lang.String, 0 WC: true, IT: false)@43 in FunNClass.jav, (de.dhbwstuttgart.syntaxtree.GenericTypeVar <. de.dhbwstuttgart.syntaxtree.GenericTypeVar, )@43 in FunNClass.jav] +isInherited = false +] +[[(BP =. ? extends java.util.ArrayList, 0 WC: true, IT: false)@43 in FunNClass.jav, (java.lang.Boolean <. CH, , 0 WC: true, IT: false)@43 in FunNClass.jav, (de.dhbwstuttgart.syntaxtree.GenericTypeVar <. AXO, , 0 WC: true, IT: true)@43 in FunNClass.jav] +isInherited = false +, [(BP =. java.util.ArrayList, 0 WC: true, IT: false)@43 in FunNClass.jav, (java.lang.Boolean <. CH, , 0 WC: true, IT: false)@43 in FunNClass.jav, (de.dhbwstuttgart.syntaxtree.GenericTypeVar <. AXO, , 0 WC: true, IT: true)@43 in FunNClass.jav] +isInherited = false +, [(BP =. ? extends java.util.List, 0 WC: true, IT: false)@43 in FunNClass.jav, (java.lang.Boolean <. CH, , 0 WC: true, IT: false)@43 in FunNClass.jav, (de.dhbwstuttgart.syntaxtree.GenericTypeVar <. AXQ, , 0 WC: true, IT: true)@43 in FunNClass.jav] +isInherited = false +, [(java.lang.Boolean <. CH, , 0 WC: true, IT: false)@43 in FunNClass.jav, (de.dhbwstuttgart.syntaxtree.GenericTypeVar <. AXQ, , 0 WC: true, IT: true)@43 in FunNClass.jav, (BP =. java.util.List, 0 WC: true, IT: false)@43 in FunNClass.jav] +isInherited = false +] +[[(CK =. de.dhbwstuttgart.parser.NullToken, 0 WC: true, IT: false), (de.dhbwstuttgart.parser.NullToken <. de.dhbwstuttgart.parser.NullToken, )@46 in FunNClass.jav] +isInherited = false +] +[[(CK =. de.dhbwstuttgart.parser.NullToken, 0 WC: true, IT: false), (de.dhbwstuttgart.parser.NullToken <. de.dhbwstuttgart.parser.NullToken, )@46 in FunNClass.jav] +isInherited = false +] +[[(CM =. org.antlr.v4.runtime.Token, 0 WC: true, IT: false), (CN =. de.dhbwstuttgart.syntaxtree.GenericDeclarationList, 0 WC: true, IT: false), (de.dhbwstuttgart.syntaxtree.GenericDeclarationList <. de.dhbwstuttgart.syntaxtree.GenericDeclarationList, )@46 in FunNClass.jav, (BP <. java.lang.Iterable, 0 WC: true, IT: false)@46 in FunNClass.jav, (de.dhbwstuttgart.parser.NullToken <. org.antlr.v4.runtime.Token, )@46 in FunNClass.jav, (CL =. java.lang.Iterable, 0 WC: true, IT: false)] +isInherited = false +, [(CM =. org.antlr.v4.runtime.Token, 0 WC: true, IT: false), (CL =. java.util.ArrayList, 0 WC: true, IT: false), (CN =. de.dhbwstuttgart.syntaxtree.GenericDeclarationList, 0 WC: true, IT: false), (BP <. java.util.ArrayList, 0 WC: true, IT: false)@46 in FunNClass.jav, (de.dhbwstuttgart.syntaxtree.GenericDeclarationList <. de.dhbwstuttgart.syntaxtree.GenericDeclarationList, )@46 in FunNClass.jav, (de.dhbwstuttgart.parser.NullToken <. org.antlr.v4.runtime.Token, )@46 in FunNClass.jav] +isInherited = false +] +[[(D =. java.lang.Integer, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +] +[[(B =. java.util.List, 0 WC: true, IT: false)@36 in FunNClass.jav, (java.lang.Integer <. H, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(B =. ? extends java.util.ArrayList, 0 WC: true, IT: false)@36 in FunNClass.jav, (java.lang.Integer <. H, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(B =. java.util.ArrayList, 0 WC: true, IT: false)@36 in FunNClass.jav, (java.lang.Integer <. H, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(B =. ? extends java.util.List, 0 WC: true, IT: false)@36 in FunNClass.jav, (java.lang.Integer <. H, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +] +[[(J =. java.lang.Integer, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +] +[[(J <. java.lang.Integer, 0 WC: true, IT: false)@36 in FunNClass.jav, (java.lang.Integer =. K, , 0 WC: true, IT: false)@36 in FunNClass.jav, (H <. java.lang.Integer, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +] +[[(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. ? extends de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. de.dhbwstuttgart.syntaxtree.Constructor, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. java.lang.Object, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. java.util.Objects, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. ? extends java.lang.Integer, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(K =. ? extends java.lang.String, 0 WC: true, IT: false)@36 in FunNClass.jav, (java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. ? extends de.dhbwstuttgart.syntaxtree.ClassOrInterface, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. ? extends java.lang.Record, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(K =. de.dhbwstuttgart.syntaxtree.ASTVisitor, 0 WC: true, IT: false)@36 in FunNClass.jav, (java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(K =. ? extends java.lang.Boolean, 0 WC: true, IT: false)@36 in FunNClass.jav, (java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. de.dhbwstuttgart.syntaxtree.type.TypePlaceholder, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. de.dhbwstuttgart.syntaxtree.Method, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. ? extends de.dhbwstuttgart.syntaxtree.type.GenericRefType, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. de.dhbwstuttgart.parser.scope.JavaClassName, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. java.util.ArrayList, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. java.lang.Boolean, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(K =. java.lang.Record, 0 WC: true, IT: false)@36 in FunNClass.jav, (java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(K =. javax.swing.text.html.Option, 0 WC: true, IT: false)@36 in FunNClass.jav, (java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. de.dhbwstuttgart.syntaxtree.type.RefType, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. ? extends de.dhbwstuttgart.syntaxtree.factory.ASTFactory, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. ? extends de.dhbwstuttgart.syntaxtree.GenericDeclarationList, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. java.lang.String, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. de.dhbwstuttgart.typeinference.assumptions.FunNClass, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. de.dhbwstuttgart.syntaxtree.factory.NameGenerator, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. ? extends java.util.List, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. ? extends java.util.Objects, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(K =. org.antlr.v4.runtime.Token, 0 WC: true, IT: false)@36 in FunNClass.jav, (java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. ? extends de.dhbwstuttgart.syntaxtree.GenericTypeVar, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(K =. ? extends java.util.Optional, 0 WC: true, IT: false)@36 in FunNClass.jav, (java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. ? extends de.dhbwstuttgart.syntaxtree.Constructor, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. ? extends de.dhbwstuttgart.syntaxtree.ASTVisitor, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. ? extends java.lang.Object, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. ? extends de.dhbwstuttgart.syntaxtree.type.TypePlaceholder, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. java.lang.Integer, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. de.dhbwstuttgart.parser.NullToken, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(K =. de.dhbwstuttgart.syntaxtree.type.GenericRefType, 0 WC: true, IT: false)@36 in FunNClass.jav, (java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. ? extends de.dhbwstuttgart.syntaxtree.Method, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(K =. ? extends de.dhbwstuttgart.syntaxtree.type.RefType, 0 WC: true, IT: false)@36 in FunNClass.jav, (java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. ? extends de.dhbwstuttgart.parser.NullToken, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. ? extends de.dhbwstuttgart.typeinference.assumptions.FunNClass, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. ? extends java.util.ArrayList, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. de.dhbwstuttgart.syntaxtree.ClassOrInterface, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(K =. ? extends javax.swing.text.html.Option, 0 WC: true, IT: false)@36 in FunNClass.jav, (java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(K =. ? extends de.dhbwstuttgart.parser.scope.JavaClassName, 0 WC: true, IT: false)@36 in FunNClass.jav, (java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(K =. de.dhbwstuttgart.syntaxtree.GenericDeclarationList, 0 WC: true, IT: false)@36 in FunNClass.jav, (java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(K =. ? extends de.dhbwstuttgart.syntaxtree.factory.NameGenerator, 0 WC: true, IT: false)@36 in FunNClass.jav, (java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. java.util.List, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(K =. java.util.Optional, 0 WC: true, IT: false)@36 in FunNClass.jav, (java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. ? extends org.antlr.v4.runtime.Token, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(K =. de.dhbwstuttgart.syntaxtree.factory.ASTFactory, 0 WC: true, IT: false)@36 in FunNClass.jav, (java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. de.dhbwstuttgart.syntaxtree.GenericTypeVar, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +] +[[(java.lang.String =. M, , 0 WC: true, IT: false)@36 in FunNClass.jav, (java.lang.String =. java.lang.String, )@36 in FunNClass.jav, (F =. java.lang.String, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(java.lang.Integer =. M, , 0 WC: true, IT: false)@36 in FunNClass.jav, (java.lang.String <. java.lang.Integer, )@36 in FunNClass.jav, (F <. java.lang.Integer, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +] +[[(de.dhbwstuttgart.parser.scope.JavaClassName <. de.dhbwstuttgart.parser.scope.JavaClassName, )@36 in FunNClass.jav, (O =. de.dhbwstuttgart.parser.scope.JavaClassName, 0 WC: true, IT: false), (N =. java.lang.String, 0 WC: true, IT: false), (M <. java.lang.String, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +] +[[(Q =. java.util.ArrayList, 0 WC: true, IT: false), (java.util.ArrayList <. java.util.ArrayList

, )@36 in FunNClass.jav] +isInherited = false +] +[[(java.util.Optional =. java.util.Optional, )@36 in FunNClass.jav, (java.util.Optional <. S, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(java.util.Optional =. ? extends java.util.Optional, )@36 in FunNClass.jav, (java.util.Optional <. S, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +] +[[(java.util.Optional =. java.util.Optional, )@36 in FunNClass.jav, (java.util.Optional <. W, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(java.util.Optional <. W, , 0 WC: true, IT: false)@36 in FunNClass.jav, (java.util.Optional =. ? extends java.util.Optional, )@36 in FunNClass.jav] +isInherited = false +] +[[(CP <. AC, 0 WC: true, IT: false, 0 WC: true, IT: false)@36 in FunNClass.jav, (B <. CQ, 0 WC: true, IT: false, 0 WC: true, IT: false)@36 in FunNClass.jav, (Z =. ? extends de.dhbwstuttgart.typeinference.assumptions.FunNClass, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(CP <. AC, 0 WC: true, IT: false, 0 WC: true, IT: false)@36 in FunNClass.jav, (Z =. de.dhbwstuttgart.typeinference.assumptions.FunNClass, 0 WC: true, IT: false)@36 in FunNClass.jav, (B <. CQ, 0 WC: true, IT: false, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +] +[[(java.util.ArrayList <. java.util.ArrayList, )@36 in FunNClass.jav, (AF =. java.util.ArrayList, 0 WC: true, IT: false)] +isInherited = false +] +[[(B <. BO, 0 WC: true, IT: false, 0 WC: true, IT: false)@36 in FunNClass.jav, (AG =. ? extends de.dhbwstuttgart.typeinference.assumptions.FunNClass, 0 WC: true, IT: false)@36 in FunNClass.jav, (BN <. AJ, 0 WC: true, IT: false, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(B <. java.lang.String, 0 WC: true, IT: false)@36 in FunNClass.jav, (de.dhbwstuttgart.syntaxtree.GenericDeclarationList <. AJ, , 0 WC: true, IT: false)@36 in FunNClass.jav, (AG =. de.dhbwstuttgart.syntaxtree.factory.ASTFactory, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(B <. java.lang.String, 0 WC: true, IT: false)@36 in FunNClass.jav, (de.dhbwstuttgart.syntaxtree.GenericDeclarationList <. AJ, , 0 WC: true, IT: false)@36 in FunNClass.jav, (AG =. ? extends de.dhbwstuttgart.syntaxtree.factory.ASTFactory, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(AG =. de.dhbwstuttgart.typeinference.assumptions.FunNClass, 0 WC: true, IT: false)@36 in FunNClass.jav, (B <. BO, 0 WC: true, IT: false, 0 WC: true, IT: false)@36 in FunNClass.jav, (BN <. AJ, 0 WC: true, IT: false, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +] +[[(de.dhbwstuttgart.syntaxtree.type.RefType <. AM, , 0 WC: true, IT: false)@36 in FunNClass.jav, (de.dhbwstuttgart.syntaxtree.factory.ASTFactory =. ? extends de.dhbwstuttgart.syntaxtree.factory.ASTFactory, )@36 in FunNClass.jav] +isInherited = false +, [(de.dhbwstuttgart.syntaxtree.factory.ASTFactory =. de.dhbwstuttgart.syntaxtree.factory.ASTFactory, )@36 in FunNClass.jav, (de.dhbwstuttgart.syntaxtree.type.RefType <. AM, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +] +[[(java.util.ArrayList <. java.util.ArrayList, )@36 in FunNClass.jav, (AP =. java.util.ArrayList, 0 WC: true, IT: false)] +isInherited = false +] +[[(java.util.ArrayList <. java.util.ArrayList, )@36 in FunNClass.jav, (AR =. java.util.ArrayList, 0 WC: true, IT: false)] +isInherited = false +] +[[(AS =. de.dhbwstuttgart.parser.NullToken, 0 WC: true, IT: false), (de.dhbwstuttgart.parser.NullToken <. de.dhbwstuttgart.parser.NullToken, )@36 in FunNClass.jav] +isInherited = false +] +[[(AJ <. de.dhbwstuttgart.syntaxtree.GenericDeclarationList, 0 WC: true, IT: false)@36 in FunNClass.jav, (void <. void, )@36 in FunNClass.jav, (AC <. java.util.List, 0 WC: true, IT: false)@36 in FunNClass.jav, (java.util.ArrayList

<. java.util.List, )@36 in FunNClass.jav, (java.util.ArrayList <. java.util.List, )@36 in FunNClass.jav, (de.dhbwstuttgart.parser.NullToken <. org.antlr.v4.runtime.Token, )@36 in FunNClass.jav, (S <. java.util.Optional, 0 WC: true, IT: false)@36 in FunNClass.jav, (AM <. de.dhbwstuttgart.syntaxtree.type.RefType, 0 WC: true, IT: false)@36 in FunNClass.jav, (AT <. java.lang.String, 0 WC: true, IT: false)@36 in FunNClass.jav, (java.util.ArrayList <. java.util.List, )@36 in FunNClass.jav, (D <. java.lang.Integer, 0 WC: true, IT: false)@36 in FunNClass.jav, (de.dhbwstuttgart.parser.scope.JavaClassName <. de.dhbwstuttgart.parser.scope.JavaClassName, )@36 in FunNClass.jav, (java.util.ArrayList <. java.util.List, )@36 in FunNClass.jav, (W <. java.util.Optional, 0 WC: true, IT: false)@36 in FunNClass.jav, (java.lang.Boolean <. java.lang.Boolean, )@36 in FunNClass.jav] +isInherited = false +] +class de.dhbwstuttgart.typeinference.assumptions.FunNClass { + +FunNClass()({ + })::TPH CT + TPH BN createGenerics(TPH BO funNParams)({ + TPH BP generics; + (generics)::TPH BP = new java.util.ArrayList(); + for(TPH BS param : (funNParams)::TPH BO) + ({ + ((generics)::TPH BP.add Signature: [TPH CF, TPH CG](new de.dhbwstuttgart.syntaxtree.GenericTypeVar(((param)::TPH BS.getParsedName Signature: [TPH BT]())::TPH BU, new java.util.ArrayList(), new de.dhbwstuttgart.parser.NullToken(), new de.dhbwstuttgart.parser.NullToken())))::TPH CH; + })::TPH CJ; + return new de.dhbwstuttgart.syntaxtree.GenericDeclarationList((generics)::TPH BP, new de.dhbwstuttgart.parser.NullToken()); + })::TPH CO + + TPH CP createMethods(TPH CQ funNParams)({ + return null; + })::TPH CS + + FunNClass(TPH B funNParams)({ + super((0, new de.dhbwstuttgart.parser.scope.JavaClassName(Fun | (((funNParams)::TPH B.size Signature: [TPH G]())::TPH H | 1.toString Signature: [TPH E]())::TPH F), new java.util.ArrayList(), (.empty Signature: [TPH R]())::TPH S, (.empty Signature: [TPH V]())::TPH W, ((this)::TPH Z.createMethods Signature: [TPH AA, TPH AB]((funNParams)::TPH B))::TPH AC, new java.util.ArrayList(), ((this)::TPH AG.createGenerics Signature: [TPH AH, TPH AI]((funNParams)::TPH B))::TPH AJ, (.createObjectType Signature: [TPH AL]())::TPH AM, true, false, new java.util.ArrayList(), new java.util.ArrayList(), new de.dhbwstuttgart.parser.NullToken(), null)); + return; + })::TPH BM + +} +Unify nach Oder-Constraints-Anpassung: +UND:[(java.lang.Boolean =. java.lang.Boolean, )@36 in FunNClass.jav, (BK =. de.dhbwstuttgart.syntaxtree.ClassOrInterface, 0 WC: true, IT: false), (de.dhbwstuttgart.syntaxtree.GenericDeclarationList <. BN, , -1 WC: false, IT: false)@46 in FunNClass.jav, (AG =. de.dhbwstuttgart.typeinference.assumptions.FunNClass, 0 WC: true, IT: false)@36 in FunNClass.jav, (BO <. java.lang.Iterable, 1 WC: false, IT: false)@42 in FunNClass.jav, (CR <. CP, 0 WC: true, IT: false, -1 WC: false, IT: false)@50 in FunNClass.jav, (java.util.ArrayList <. BP, , 0 WC: true, IT: false)@41 in FunNClass.jav, (Z =. de.dhbwstuttgart.typeinference.assumptions.FunNClass, 0 WC: true, IT: false)@36 in FunNClass.jav, (java.lang.String =. java.lang.String, )@36 in FunNClass.jav, (void <. A, , 0 WC: true, IT: false)@0 in FunNClass.jav] +isInherited = false + +ODER: +[[(java.util.ArrayList <. java.util.ArrayList, )@41 in FunNClass.jav, (BR =. java.util.ArrayList, 0 WC: true, IT: false)] +isInherited = false +] +[[(java.lang.String <. BU, , 0 WC: true, IT: false)@43 in FunNClass.jav, (BS =. ? extends de.dhbwstuttgart.syntaxtree.type.GenericRefType, 0 WC: true, IT: false)@43 in FunNClass.jav] +isInherited = false +, [(BS =. de.dhbwstuttgart.syntaxtree.type.GenericRefType, 0 WC: true, IT: false)@43 in FunNClass.jav, (java.lang.String <. BU, , 0 WC: true, IT: false)@43 in FunNClass.jav] +isInherited = false +] +[[(java.util.ArrayList <. java.util.ArrayList, )@44 in FunNClass.jav, (BX =. java.util.ArrayList, 0 WC: true, IT: false)] +isInherited = false +] +[[(BY =. de.dhbwstuttgart.parser.NullToken, 0 WC: true, IT: false), (de.dhbwstuttgart.parser.NullToken <. de.dhbwstuttgart.parser.NullToken, )@44 in FunNClass.jav] +isInherited = false +] +[[(BZ =. de.dhbwstuttgart.parser.NullToken, 0 WC: true, IT: false), (de.dhbwstuttgart.parser.NullToken <. de.dhbwstuttgart.parser.NullToken, )@44 in FunNClass.jav] +isInherited = false +] +[[(java.util.ArrayList <. java.util.List, )@43 in FunNClass.jav, (CE =. de.dhbwstuttgart.syntaxtree.GenericTypeVar, 0 WC: true, IT: false), (CA =. java.lang.String, 0 WC: true, IT: false), (CB =. java.util.List, 0 WC: true, IT: false), (CD =. org.antlr.v4.runtime.Token, 0 WC: true, IT: false), (CC =. org.antlr.v4.runtime.Token, 0 WC: true, IT: false), (de.dhbwstuttgart.parser.NullToken <. org.antlr.v4.runtime.Token, )@43 in FunNClass.jav, (BU <. java.lang.String, 0 WC: true, IT: false)@43 in FunNClass.jav, (de.dhbwstuttgart.syntaxtree.GenericTypeVar <. de.dhbwstuttgart.syntaxtree.GenericTypeVar, )@43 in FunNClass.jav] +isInherited = false +] +[[(java.lang.String <. BU, , 0 WC: true, IT: false)@43 in FunNClass.jav, (BS =. ? extends de.dhbwstuttgart.syntaxtree.type.GenericRefType, 0 WC: true, IT: false)@43 in FunNClass.jav] +isInherited = false +, [(BS =. de.dhbwstuttgart.syntaxtree.type.GenericRefType, 0 WC: true, IT: false)@43 in FunNClass.jav, (java.lang.String <. BU, , 0 WC: true, IT: false)@43 in FunNClass.jav] +isInherited = false +] +[[(java.util.ArrayList <. java.util.ArrayList, )@44 in FunNClass.jav, (BX =. java.util.ArrayList, 0 WC: true, IT: false)] +isInherited = false +] +[[(BY =. de.dhbwstuttgart.parser.NullToken, 0 WC: true, IT: false), (de.dhbwstuttgart.parser.NullToken <. de.dhbwstuttgart.parser.NullToken, )@44 in FunNClass.jav] +isInherited = false +] +[[(BZ =. de.dhbwstuttgart.parser.NullToken, 0 WC: true, IT: false), (de.dhbwstuttgart.parser.NullToken <. de.dhbwstuttgart.parser.NullToken, )@44 in FunNClass.jav] +isInherited = false +] +[[(java.util.ArrayList <. java.util.List, )@43 in FunNClass.jav, (CE =. de.dhbwstuttgart.syntaxtree.GenericTypeVar, 0 WC: true, IT: false), (CA =. java.lang.String, 0 WC: true, IT: false), (CB =. java.util.List, 0 WC: true, IT: false), (CD =. org.antlr.v4.runtime.Token, 0 WC: true, IT: false), (CC =. org.antlr.v4.runtime.Token, 0 WC: true, IT: false), (de.dhbwstuttgart.parser.NullToken <. org.antlr.v4.runtime.Token, )@43 in FunNClass.jav, (BU <. java.lang.String, 0 WC: true, IT: false)@43 in FunNClass.jav, (de.dhbwstuttgart.syntaxtree.GenericTypeVar <. de.dhbwstuttgart.syntaxtree.GenericTypeVar, )@43 in FunNClass.jav] +isInherited = false +] +[[(BP =. ? extends java.util.ArrayList, 0 WC: true, IT: false)@43 in FunNClass.jav, (java.lang.Boolean <. CH, , 0 WC: true, IT: false)@43 in FunNClass.jav, (de.dhbwstuttgart.syntaxtree.GenericTypeVar <. AXO, , 0 WC: true, IT: true)@43 in FunNClass.jav] +isInherited = false +, [(BP =. java.util.ArrayList, 0 WC: true, IT: false)@43 in FunNClass.jav, (java.lang.Boolean <. CH, , 0 WC: true, IT: false)@43 in FunNClass.jav, (de.dhbwstuttgart.syntaxtree.GenericTypeVar <. AXO, , 0 WC: true, IT: true)@43 in FunNClass.jav] +isInherited = false +, [(BP =. ? extends java.util.List, 0 WC: true, IT: false)@43 in FunNClass.jav, (java.lang.Boolean <. CH, , 0 WC: true, IT: false)@43 in FunNClass.jav, (de.dhbwstuttgart.syntaxtree.GenericTypeVar <. AXQ, , 0 WC: true, IT: true)@43 in FunNClass.jav] +isInherited = false +, [(java.lang.Boolean <. CH, , 0 WC: true, IT: false)@43 in FunNClass.jav, (de.dhbwstuttgart.syntaxtree.GenericTypeVar <. AXQ, , 0 WC: true, IT: true)@43 in FunNClass.jav, (BP =. java.util.List, 0 WC: true, IT: false)@43 in FunNClass.jav] +isInherited = false +] +[[(CK =. de.dhbwstuttgart.parser.NullToken, 0 WC: true, IT: false), (de.dhbwstuttgart.parser.NullToken <. de.dhbwstuttgart.parser.NullToken, )@46 in FunNClass.jav] +isInherited = false +] +[[(CK =. de.dhbwstuttgart.parser.NullToken, 0 WC: true, IT: false), (de.dhbwstuttgart.parser.NullToken <. de.dhbwstuttgart.parser.NullToken, )@46 in FunNClass.jav] +isInherited = false +] +[[(CM =. org.antlr.v4.runtime.Token, 0 WC: true, IT: false), (CN =. de.dhbwstuttgart.syntaxtree.GenericDeclarationList, 0 WC: true, IT: false), (de.dhbwstuttgart.syntaxtree.GenericDeclarationList <. de.dhbwstuttgart.syntaxtree.GenericDeclarationList, )@46 in FunNClass.jav, (BP <. java.lang.Iterable, 0 WC: true, IT: false)@46 in FunNClass.jav, (de.dhbwstuttgart.parser.NullToken <. org.antlr.v4.runtime.Token, )@46 in FunNClass.jav, (CL =. java.lang.Iterable, 0 WC: true, IT: false)] +isInherited = false +, [(CM =. org.antlr.v4.runtime.Token, 0 WC: true, IT: false), (CL =. java.util.ArrayList, 0 WC: true, IT: false), (CN =. de.dhbwstuttgart.syntaxtree.GenericDeclarationList, 0 WC: true, IT: false), (BP <. java.util.ArrayList, 0 WC: true, IT: false)@46 in FunNClass.jav, (de.dhbwstuttgart.syntaxtree.GenericDeclarationList <. de.dhbwstuttgart.syntaxtree.GenericDeclarationList, )@46 in FunNClass.jav, (de.dhbwstuttgart.parser.NullToken <. org.antlr.v4.runtime.Token, )@46 in FunNClass.jav] +isInherited = false +] +[[(D =. java.lang.Integer, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +] +[[(B =. java.util.List, 1 WC: false, IT: false)@36 in FunNClass.jav, (java.lang.Integer <. H, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(B =. ? extends java.util.ArrayList, 1 WC: false, IT: false)@36 in FunNClass.jav, (java.lang.Integer <. H, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(B =. java.util.ArrayList, 1 WC: false, IT: false)@36 in FunNClass.jav, (java.lang.Integer <. H, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(B =. ? extends java.util.List, 1 WC: false, IT: false)@36 in FunNClass.jav, (java.lang.Integer <. H, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +] +[[(J =. java.lang.Integer, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +] +[[(J <. java.lang.Integer, 0 WC: true, IT: false)@36 in FunNClass.jav, (java.lang.Integer =. K, , 0 WC: true, IT: false)@36 in FunNClass.jav, (H <. java.lang.Integer, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +] +[[(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. ? extends de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. de.dhbwstuttgart.syntaxtree.Constructor, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. java.lang.Object, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. java.util.Objects, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. ? extends java.lang.Integer, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(K =. ? extends java.lang.String, 0 WC: true, IT: false)@36 in FunNClass.jav, (java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. ? extends de.dhbwstuttgart.syntaxtree.ClassOrInterface, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. ? extends java.lang.Record, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(K =. de.dhbwstuttgart.syntaxtree.ASTVisitor, 0 WC: true, IT: false)@36 in FunNClass.jav, (java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(K =. ? extends java.lang.Boolean, 0 WC: true, IT: false)@36 in FunNClass.jav, (java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. de.dhbwstuttgart.syntaxtree.type.TypePlaceholder, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. de.dhbwstuttgart.syntaxtree.Method, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. ? extends de.dhbwstuttgart.syntaxtree.type.GenericRefType, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. de.dhbwstuttgart.parser.scope.JavaClassName, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. java.util.ArrayList, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. java.lang.Boolean, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(K =. java.lang.Record, 0 WC: true, IT: false)@36 in FunNClass.jav, (java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(K =. javax.swing.text.html.Option, 0 WC: true, IT: false)@36 in FunNClass.jav, (java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. de.dhbwstuttgart.syntaxtree.type.RefType, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. ? extends de.dhbwstuttgart.syntaxtree.factory.ASTFactory, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. ? extends de.dhbwstuttgart.syntaxtree.GenericDeclarationList, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. java.lang.String, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. de.dhbwstuttgart.typeinference.assumptions.FunNClass, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. de.dhbwstuttgart.syntaxtree.factory.NameGenerator, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. ? extends java.util.List, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. ? extends java.util.Objects, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(K =. org.antlr.v4.runtime.Token, 0 WC: true, IT: false)@36 in FunNClass.jav, (java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. ? extends de.dhbwstuttgart.syntaxtree.GenericTypeVar, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(K =. ? extends java.util.Optional, 0 WC: true, IT: false)@36 in FunNClass.jav, (java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. ? extends de.dhbwstuttgart.syntaxtree.Constructor, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. ? extends de.dhbwstuttgart.syntaxtree.ASTVisitor, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. ? extends java.lang.Object, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. ? extends de.dhbwstuttgart.syntaxtree.type.TypePlaceholder, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. java.lang.Integer, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. de.dhbwstuttgart.parser.NullToken, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(K =. de.dhbwstuttgart.syntaxtree.type.GenericRefType, 0 WC: true, IT: false)@36 in FunNClass.jav, (java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. ? extends de.dhbwstuttgart.syntaxtree.Method, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(K =. ? extends de.dhbwstuttgart.syntaxtree.type.RefType, 0 WC: true, IT: false)@36 in FunNClass.jav, (java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. ? extends de.dhbwstuttgart.parser.NullToken, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. ? extends de.dhbwstuttgart.typeinference.assumptions.FunNClass, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. ? extends java.util.ArrayList, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. de.dhbwstuttgart.syntaxtree.ClassOrInterface, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(K =. ? extends javax.swing.text.html.Option, 0 WC: true, IT: false)@36 in FunNClass.jav, (java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(K =. ? extends de.dhbwstuttgart.parser.scope.JavaClassName, 0 WC: true, IT: false)@36 in FunNClass.jav, (java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(K =. de.dhbwstuttgart.syntaxtree.GenericDeclarationList, 0 WC: true, IT: false)@36 in FunNClass.jav, (java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(K =. ? extends de.dhbwstuttgart.syntaxtree.factory.NameGenerator, 0 WC: true, IT: false)@36 in FunNClass.jav, (java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. java.util.List, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(K =. java.util.Optional, 0 WC: true, IT: false)@36 in FunNClass.jav, (java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. ? extends org.antlr.v4.runtime.Token, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(K =. de.dhbwstuttgart.syntaxtree.factory.ASTFactory, 0 WC: true, IT: false)@36 in FunNClass.jav, (java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = true +, [(java.lang.String <. F, , 0 WC: true, IT: false)@36 in FunNClass.jav, (K =. de.dhbwstuttgart.syntaxtree.GenericTypeVar, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +] +[[(java.lang.String =. M, , 0 WC: true, IT: false)@36 in FunNClass.jav, (java.lang.String =. java.lang.String, )@36 in FunNClass.jav, (F =. java.lang.String, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(java.lang.Integer =. M, , 0 WC: true, IT: false)@36 in FunNClass.jav, (java.lang.String <. java.lang.Integer, )@36 in FunNClass.jav, (F <. java.lang.Integer, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +] +[[(de.dhbwstuttgart.parser.scope.JavaClassName <. de.dhbwstuttgart.parser.scope.JavaClassName, )@36 in FunNClass.jav, (O =. de.dhbwstuttgart.parser.scope.JavaClassName, 0 WC: true, IT: false), (N =. java.lang.String, 0 WC: true, IT: false), (M <. java.lang.String, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +] +[[(Q =. java.util.ArrayList, 0 WC: true, IT: false), (java.util.ArrayList <. java.util.ArrayList

, )@36 in FunNClass.jav] +isInherited = false +] +[[(java.util.Optional =. java.util.Optional, )@36 in FunNClass.jav, (java.util.Optional <. S, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(java.util.Optional =. ? extends java.util.Optional, )@36 in FunNClass.jav, (java.util.Optional <. S, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +] +[[(java.util.Optional =. java.util.Optional, )@36 in FunNClass.jav, (java.util.Optional <. W, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(java.util.Optional <. W, , 0 WC: true, IT: false)@36 in FunNClass.jav, (java.util.Optional =. ? extends java.util.Optional, )@36 in FunNClass.jav] +isInherited = false +] +[[(CP <. AC, -1 WC: false, IT: false, 0 WC: true, IT: false)@36 in FunNClass.jav, (B <. CQ, 1 WC: false, IT: false, 1 WC: false, IT: false)@36 in FunNClass.jav, (Z =. ? extends de.dhbwstuttgart.typeinference.assumptions.FunNClass, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(CP <. AC, -1 WC: false, IT: false, 0 WC: true, IT: false)@36 in FunNClass.jav, (Z =. de.dhbwstuttgart.typeinference.assumptions.FunNClass, 0 WC: true, IT: false)@36 in FunNClass.jav, (B <. CQ, 1 WC: false, IT: false, 1 WC: false, IT: false)@36 in FunNClass.jav] +isInherited = false +] +[[(java.util.ArrayList <. java.util.ArrayList, )@36 in FunNClass.jav, (AF =. java.util.ArrayList, 0 WC: true, IT: false)] +isInherited = false +] +[[(B <. BO, 1 WC: false, IT: false, 1 WC: false, IT: false)@36 in FunNClass.jav, (AG =. ? extends de.dhbwstuttgart.typeinference.assumptions.FunNClass, 0 WC: true, IT: false)@36 in FunNClass.jav, (BN <. AJ, -1 WC: false, IT: false, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(B <. java.lang.String, 1 WC: false, IT: false)@36 in FunNClass.jav, (de.dhbwstuttgart.syntaxtree.GenericDeclarationList <. AJ, , 0 WC: true, IT: false)@36 in FunNClass.jav, (AG =. de.dhbwstuttgart.syntaxtree.factory.ASTFactory, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(B <. java.lang.String, 1 WC: false, IT: false)@36 in FunNClass.jav, (de.dhbwstuttgart.syntaxtree.GenericDeclarationList <. AJ, , 0 WC: true, IT: false)@36 in FunNClass.jav, (AG =. ? extends de.dhbwstuttgart.syntaxtree.factory.ASTFactory, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +, [(AG =. de.dhbwstuttgart.typeinference.assumptions.FunNClass, 0 WC: true, IT: false)@36 in FunNClass.jav, (B <. BO, 1 WC: false, IT: false, 1 WC: false, IT: false)@36 in FunNClass.jav, (BN <. AJ, -1 WC: false, IT: false, 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +] +[[(de.dhbwstuttgart.syntaxtree.type.RefType <. AM, , 0 WC: true, IT: false)@36 in FunNClass.jav, (de.dhbwstuttgart.syntaxtree.factory.ASTFactory =. ? extends de.dhbwstuttgart.syntaxtree.factory.ASTFactory, )@36 in FunNClass.jav] +isInherited = false +, [(de.dhbwstuttgart.syntaxtree.factory.ASTFactory =. de.dhbwstuttgart.syntaxtree.factory.ASTFactory, )@36 in FunNClass.jav, (de.dhbwstuttgart.syntaxtree.type.RefType <. AM, , 0 WC: true, IT: false)@36 in FunNClass.jav] +isInherited = false +] +[[(java.util.ArrayList <. java.util.ArrayList, )@36 in FunNClass.jav, (AP =. java.util.ArrayList, 0 WC: true, IT: false)] +isInherited = false +] +[[(java.util.ArrayList <. java.util.ArrayList, )@36 in FunNClass.jav, (AR =. java.util.ArrayList, 0 WC: true, IT: false)] +isInherited = false +] +[[(AS =. de.dhbwstuttgart.parser.NullToken, 0 WC: true, IT: false), (de.dhbwstuttgart.parser.NullToken <. de.dhbwstuttgart.parser.NullToken, )@36 in FunNClass.jav] +isInherited = false +] +[[(AJ <. de.dhbwstuttgart.syntaxtree.GenericDeclarationList, 0 WC: true, IT: false)@36 in FunNClass.jav, (void <. void, )@36 in FunNClass.jav, (AC <. java.util.List, 0 WC: true, IT: false)@36 in FunNClass.jav, (java.util.ArrayList

<. java.util.List, )@36 in FunNClass.jav, (java.util.ArrayList <. java.util.List, )@36 in FunNClass.jav, (de.dhbwstuttgart.parser.NullToken <. org.antlr.v4.runtime.Token, )@36 in FunNClass.jav, (S <. java.util.Optional, 0 WC: true, IT: false)@36 in FunNClass.jav, (AM <. de.dhbwstuttgart.syntaxtree.type.RefType, 0 WC: true, IT: false)@36 in FunNClass.jav, (AT <. java.lang.String, 0 WC: true, IT: false)@36 in FunNClass.jav, (java.util.ArrayList <. java.util.List, )@36 in FunNClass.jav, (D <. java.lang.Integer, 0 WC: true, IT: false)@36 in FunNClass.jav, (de.dhbwstuttgart.parser.scope.JavaClassName <. de.dhbwstuttgart.parser.scope.JavaClassName, )@36 in FunNClass.jav, (java.util.ArrayList <. java.util.List, )@36 in FunNClass.jav, (W <. java.util.Optional, 0 WC: true, IT: false)@36 in FunNClass.jav, (java.lang.Boolean <. java.lang.Boolean, )@36 in FunNClass.jav] +isInherited = false +] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +RESULT Final: [[(TPH O = de.dhbwstuttgart.parser.scope.JavaClassName), (TPH BLB = de.dhbwstuttgart.syntaxtree.GenericTypeVar), (TPH BLM = de.dhbwstuttgart.syntaxtree.Method), (TPH F = java.lang.String), (TPH AL = de.dhbwstuttgart.syntaxtree.type.RefType), (TPH BKR = ? extends de.dhbwstuttgart.syntaxtree.type.GenericRefType), (TPH BZ = de.dhbwstuttgart.parser.NullToken), (TPH N = java.lang.String), (TPH BLF = de.dhbwstuttgart.syntaxtree.Constructor), (TPH CD = org.antlr.v4.runtime.Token), (TPH BU = java.lang.String), (TPH CN = de.dhbwstuttgart.syntaxtree.GenericDeclarationList), (TPH BT = java.lang.String), (TPH E = java.lang.String), (TPH BLL = de.dhbwstuttgart.syntaxtree.Method), (TPH BX = java.util.ArrayList), (TPH CG = java.lang.Boolean), (TPH BLE = de.dhbwstuttgart.syntaxtree.Constructor), (TPH M = java.lang.String), (TPH BLD = de.dhbwstuttgart.syntaxtree.type.RefType), (TPH BKZ = ? extends de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric), (TPH BKO = de.dhbwstuttgart.syntaxtree.Constructor), (TPH BLK = de.dhbwstuttgart.syntaxtree.Method), (TPH CE = de.dhbwstuttgart.syntaxtree.GenericTypeVar), (TPH AM = de.dhbwstuttgart.syntaxtree.type.RefType), (TPH AA = java.lang.Object), (TPH AR = java.util.ArrayList), (TPH CL = java.lang.Iterable), (TPH Q = java.util.ArrayList), (TPH BLC = de.dhbwstuttgart.syntaxtree.Method), (TPH AB = java.util.ArrayList), (TPH BK = de.dhbwstuttgart.syntaxtree.ClassOrInterface), (TPH BLQ = ? extends de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric), (TPH BKY = de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric), (TPH BKU = de.dhbwstuttgart.syntaxtree.type.RefType), (TPH J = java.lang.Integer), (TPH BR = java.util.ArrayList), (TPH CQ = java.lang.Object), (TPH BKW = de.dhbwstuttgart.syntaxtree.type.RefType), (TPH AS = de.dhbwstuttgart.parser.NullToken), (TPH BLH = de.dhbwstuttgart.syntaxtree.type.GenericRefType), (TPH CB = java.util.List), (TPH BN = de.dhbwstuttgart.syntaxtree.GenericDeclarationList), (TPH CF = GTV E), (TPH AP = java.util.ArrayList), (TPH AG = de.dhbwstuttgart.typeinference.assumptions.FunNClass), (TPH CA = java.lang.String), (TPH AF = java.util.ArrayList), (TPH AI = de.dhbwstuttgart.syntaxtree.GenericDeclarationList), (TPH AT = java.lang.String), (TPH CH = java.lang.Boolean), (TPH BLP = de.dhbwstuttgart.syntaxtree.Method), (TPH AXO = de.dhbwstuttgart.syntaxtree.GenericTypeVar), (TPH BKT = de.dhbwstuttgart.syntaxtree.Constructor), (TPH B = java.util.List), (TPH BLA = de.dhbwstuttgart.syntaxtree.GenericTypeVar), (TPH BLG = de.dhbwstuttgart.syntaxtree.type.GenericRefType), (TPH D = java.lang.Integer), (TPH CM = org.antlr.v4.runtime.Token), (TPH AJ = de.dhbwstuttgart.syntaxtree.GenericDeclarationList), (TPH BLO = de.dhbwstuttgart.syntaxtree.type.RefType), (TPH R = java.util.Optional), (TPH G = java.lang.Integer), (TPH K = java.lang.Integer), (TPH S = java.util.Optional), (TPH CP = java.util.ArrayList), (TPH BP = java.util.ArrayList), (TPH H = java.lang.Integer), (TPH BS = de.dhbwstuttgart.syntaxtree.type.GenericRefType), (TPH BY = de.dhbwstuttgart.parser.NullToken), (TPH AC = java.util.ArrayList), (TPH W = java.util.Optional), (TPH CC = org.antlr.v4.runtime.Token), (TPH Z = de.dhbwstuttgart.typeinference.assumptions.FunNClass), (TPH BO = java.lang.Iterable), (TPH CR = java.util.ArrayList), (TPH BKS = de.dhbwstuttgart.syntaxtree.Method), (TPH BLN = ? extends de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric), (TPH BKX = de.dhbwstuttgart.syntaxtree.Constructor), (TPH BKP = ? extends de.dhbwstuttgart.syntaxtree.type.GenericRefType), (TPH V = java.util.Optional), (TPH CK = de.dhbwstuttgart.parser.NullToken), (TPH BKV = de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric), (TPH A = void), (TPH BLJ = de.dhbwstuttgart.syntaxtree.GenericTypeVar), (TPH BKQ = de.dhbwstuttgart.syntaxtree.Field), (TPH BLI = de.dhbwstuttgart.syntaxtree.Field), (TPH AH = java.lang.Iterable)], [(TPH AH = java.lang.Iterable), (TPH V = java.util.Optional), (TPH AC = java.util.ArrayList), (TPH BLT = de.dhbwstuttgart.syntaxtree.Field), (TPH BMT = ? extends de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric), (TPH BLX = de.dhbwstuttgart.syntaxtree.type.RefType), (TPH BMS = de.dhbwstuttgart.syntaxtree.Method), (TPH F = java.lang.String), (TPH BLW = de.dhbwstuttgart.syntaxtree.Constructor), (TPH R = java.util.Optional), (TPH CQ = java.lang.Object), (TPH BX = java.util.ArrayList), (TPH AP = java.util.ArrayList), (TPH BMO = de.dhbwstuttgart.syntaxtree.Method), (TPH J = java.lang.Integer), (TPH BML = de.dhbwstuttgart.syntaxtree.Field), (TPH Q = java.util.ArrayList), (TPH AA = java.lang.Object), (TPH CN = de.dhbwstuttgart.syntaxtree.GenericDeclarationList), (TPH AJ = de.dhbwstuttgart.syntaxtree.GenericDeclarationList), (TPH BU = java.lang.String), (TPH M = java.lang.String), (TPH AM = de.dhbwstuttgart.syntaxtree.type.RefType), (TPH AT = java.lang.String), (TPH CH = java.lang.Boolean), (TPH A = void), (TPH AXO = de.dhbwstuttgart.syntaxtree.GenericTypeVar), (TPH K = java.lang.Integer), (TPH BN = de.dhbwstuttgart.syntaxtree.GenericDeclarationList), (TPH D = java.lang.Integer), (TPH BMK = de.dhbwstuttgart.syntaxtree.type.GenericRefType), (TPH BR = java.util.ArrayList), (TPH BY = de.dhbwstuttgart.parser.NullToken), (TPH AG = de.dhbwstuttgart.typeinference.assumptions.FunNClass), (TPH W = java.util.Optional), (TPH AI = de.dhbwstuttgart.syntaxtree.GenericDeclarationList), (TPH BK = de.dhbwstuttgart.syntaxtree.ClassOrInterface), (TPH CE = de.dhbwstuttgart.syntaxtree.GenericTypeVar), (TPH CD = org.antlr.v4.runtime.Token), (TPH BMQ = ? extends de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric), (TPH CL = java.util.ArrayList), (TPH BMC = ? extends de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric), (TPH CB = java.util.List), (TPH N = java.lang.String), (TPH H = java.lang.Integer), (TPH BMI = de.dhbwstuttgart.syntaxtree.Constructor), (TPH AB = java.util.ArrayList), (TPH BS = de.dhbwstuttgart.syntaxtree.type.GenericRefType), (TPH CR = java.util.ArrayList), (TPH BMN = de.dhbwstuttgart.syntaxtree.Method), (TPH BLV = de.dhbwstuttgart.syntaxtree.Method), (TPH CM = org.antlr.v4.runtime.Token), (TPH BMR = de.dhbwstuttgart.syntaxtree.type.RefType), (TPH E = java.lang.String), (TPH Z = de.dhbwstuttgart.typeinference.assumptions.FunNClass), (TPH BP = java.util.ArrayList), (TPH AF = java.util.ArrayList), (TPH CG = java.lang.Boolean), (TPH BME = de.dhbwstuttgart.syntaxtree.GenericTypeVar), (TPH BMP = de.dhbwstuttgart.syntaxtree.Method), (TPH CP = java.util.ArrayList), (TPH AL = de.dhbwstuttgart.syntaxtree.type.RefType), (TPH CC = org.antlr.v4.runtime.Token), (TPH BZ = de.dhbwstuttgart.parser.NullToken), (TPH AS = de.dhbwstuttgart.parser.NullToken), (TPH BMF = de.dhbwstuttgart.syntaxtree.Method), (TPH AR = java.util.ArrayList), (TPH BLR = de.dhbwstuttgart.syntaxtree.Constructor), (TPH O = de.dhbwstuttgart.parser.scope.JavaClassName), (TPH BMG = de.dhbwstuttgart.syntaxtree.type.RefType), (TPH CA = java.lang.String), (TPH BLS = ? extends de.dhbwstuttgart.syntaxtree.type.GenericRefType), (TPH CK = de.dhbwstuttgart.parser.NullToken), (TPH BLZ = de.dhbwstuttgart.syntaxtree.type.RefType), (TPH BMB = de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric), (TPH BMD = de.dhbwstuttgart.syntaxtree.GenericTypeVar), (TPH BO = java.lang.Iterable), (TPH BT = java.lang.String), (TPH S = java.util.Optional), (TPH B = java.util.List), (TPH BMJ = de.dhbwstuttgart.syntaxtree.type.GenericRefType), (TPH BLY = de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric), (TPH BMA = de.dhbwstuttgart.syntaxtree.Constructor), (TPH G = java.lang.Integer), (TPH BMH = de.dhbwstuttgart.syntaxtree.Constructor), (TPH CF = GTV E), (TPH BLU = ? extends de.dhbwstuttgart.syntaxtree.type.GenericRefType), (TPH BMM = de.dhbwstuttgart.syntaxtree.GenericTypeVar)], [(TPH CF = GTV E), (TPH BNM = de.dhbwstuttgart.syntaxtree.Method), (TPH AC = java.util.ArrayList), (TPH AB = java.util.ArrayList), (TPH CP = java.util.ArrayList), (TPH BK = de.dhbwstuttgart.syntaxtree.ClassOrInterface), (TPH BO = java.lang.Iterable), (TPH BNA = ? extends de.dhbwstuttgart.syntaxtree.type.GenericRefType), (TPH BNF = de.dhbwstuttgart.syntaxtree.Constructor), (TPH CA = java.lang.String), (TPH F = java.lang.String), (TPH AH = java.lang.Iterable), (TPH CD = org.antlr.v4.runtime.Token), (TPH BMU = de.dhbwstuttgart.syntaxtree.type.GenericRefType), (TPH BMV = de.dhbwstuttgart.syntaxtree.Constructor), (TPH CM = org.antlr.v4.runtime.Token), (TPH CG = java.lang.Boolean), (TPH BMW = de.dhbwstuttgart.syntaxtree.type.GenericRefType), (TPH Z = de.dhbwstuttgart.typeinference.assumptions.FunNClass), (TPH BNJ = de.dhbwstuttgart.syntaxtree.GenericTypeVar), (TPH A = void), (TPH BT = java.lang.String), (TPH BNK = de.dhbwstuttgart.syntaxtree.Method), (TPH BNQ = ? extends de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric), (TPH D = java.lang.Integer), (TPH BY = de.dhbwstuttgart.parser.NullToken), (TPH AP = java.util.ArrayList), (TPH AI = de.dhbwstuttgart.syntaxtree.GenericDeclarationList), (TPH BND = de.dhbwstuttgart.syntaxtree.type.RefType), (TPH BNO = de.dhbwstuttgart.syntaxtree.Method), (TPH BNP = de.dhbwstuttgart.syntaxtree.Field), (TPH BN = de.dhbwstuttgart.syntaxtree.GenericDeclarationList), (TPH AG = de.dhbwstuttgart.typeinference.assumptions.FunNClass), (TPH BNV = ? extends de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric), (TPH BNT = de.dhbwstuttgart.syntaxtree.Method), (TPH V = java.util.Optional), (TPH CH = java.lang.Boolean), (TPH AT = java.lang.String), (TPH H = java.lang.Integer), (TPH BNI = de.dhbwstuttgart.syntaxtree.GenericTypeVar), (TPH AJ = de.dhbwstuttgart.syntaxtree.GenericDeclarationList), (TPH BNE = de.dhbwstuttgart.syntaxtree.Constructor), (TPH CL = java.lang.Iterable), (TPH B = java.util.ArrayList), (TPH CN = de.dhbwstuttgart.syntaxtree.GenericDeclarationList), (TPH BMZ = de.dhbwstuttgart.syntaxtree.Constructor), (TPH BNH = ? extends de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric), (TPH O = de.dhbwstuttgart.parser.scope.JavaClassName), (TPH AF = java.util.ArrayList), (TPH G = java.lang.Integer), (TPH S = java.util.Optional), (TPH R = java.util.Optional), (TPH BX = java.util.ArrayList), (TPH BR = java.util.ArrayList), (TPH BNB = de.dhbwstuttgart.syntaxtree.type.RefType), (TPH CR = java.util.ArrayList), (TPH BNG = de.dhbwstuttgart.syntaxtree.Method), (TPH BNU = de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric), (TPH AA = java.lang.Object), (TPH BP = java.util.ArrayList), (TPH N = java.lang.String), (TPH W = java.util.Optional), (TPH BMX = de.dhbwstuttgart.syntaxtree.GenericTypeVar), (TPH BNS = de.dhbwstuttgart.syntaxtree.Method), (TPH BNR = de.dhbwstuttgart.syntaxtree.type.RefType), (TPH K = java.lang.Integer), (TPH AL = de.dhbwstuttgart.syntaxtree.type.RefType), (TPH BNL = de.dhbwstuttgart.syntaxtree.type.RefType), (TPH CE = de.dhbwstuttgart.syntaxtree.GenericTypeVar), (TPH AS = de.dhbwstuttgart.parser.NullToken), (TPH Q = java.util.ArrayList), (TPH CQ = java.lang.Object), (TPH AXO = de.dhbwstuttgart.syntaxtree.GenericTypeVar), (TPH E = java.lang.String), (TPH BZ = de.dhbwstuttgart.parser.NullToken), (TPH BMY = de.dhbwstuttgart.syntaxtree.Field), (TPH CB = java.util.List), (TPH BNC = ? extends de.dhbwstuttgart.syntaxtree.type.GenericRefType), (TPH BNN = de.dhbwstuttgart.syntaxtree.Constructor), (TPH CC = org.antlr.v4.runtime.Token), (TPH M = java.lang.String), (TPH AM = de.dhbwstuttgart.syntaxtree.type.RefType), (TPH J = java.lang.Integer), (TPH AR = java.util.ArrayList), (TPH CK = de.dhbwstuttgart.parser.NullToken), (TPH BS = de.dhbwstuttgart.syntaxtree.type.GenericRefType), (TPH BU = java.lang.String)], [(TPH BOJ = ? extends de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric), (TPH E = java.lang.String), (TPH CC = org.antlr.v4.runtime.Token), (TPH CK = de.dhbwstuttgart.parser.NullToken), (TPH BOM = de.dhbwstuttgart.syntaxtree.Method), (TPH N = java.lang.String), (TPH BOT = de.dhbwstuttgart.syntaxtree.type.RefType), (TPH CL = java.util.ArrayList), (TPH H = java.lang.Integer), (TPH BOB = de.dhbwstuttgart.syntaxtree.Constructor), (TPH BOF = de.dhbwstuttgart.syntaxtree.type.RefType), (TPH BX = java.util.ArrayList), (TPH BZ = de.dhbwstuttgart.parser.NullToken), (TPH BP = java.util.ArrayList), (TPH BOO = de.dhbwstuttgart.syntaxtree.Method), (TPH CD = org.antlr.v4.runtime.Token), (TPH O = de.dhbwstuttgart.parser.scope.JavaClassName), (TPH AB = java.util.ArrayList), (TPH B = java.util.ArrayList), (TPH AG = de.dhbwstuttgart.typeinference.assumptions.FunNClass), (TPH BOG = de.dhbwstuttgart.syntaxtree.Constructor), (TPH BOL = de.dhbwstuttgart.syntaxtree.GenericTypeVar), (TPH BON = de.dhbwstuttgart.syntaxtree.type.RefType), (TPH CH = java.lang.Boolean), (TPH Q = java.util.ArrayList), (TPH K = java.lang.Integer), (TPH J = java.lang.Integer), (TPH BOQ = de.dhbwstuttgart.syntaxtree.Method), (TPH BT = java.lang.String), (TPH BNW = de.dhbwstuttgart.syntaxtree.type.GenericRefType), (TPH BOP = de.dhbwstuttgart.syntaxtree.Constructor), (TPH AT = java.lang.String), (TPH AM = de.dhbwstuttgart.syntaxtree.type.RefType), (TPH AL = de.dhbwstuttgart.syntaxtree.type.RefType), (TPH AI = de.dhbwstuttgart.syntaxtree.GenericDeclarationList), (TPH CB = java.util.List), (TPH BOA = de.dhbwstuttgart.syntaxtree.Field), (TPH BNY = de.dhbwstuttgart.syntaxtree.type.GenericRefType), (TPH CQ = java.lang.Object), (TPH BN = de.dhbwstuttgart.syntaxtree.GenericDeclarationList), (TPH CE = de.dhbwstuttgart.syntaxtree.GenericTypeVar), (TPH AXO = de.dhbwstuttgart.syntaxtree.GenericTypeVar), (TPH R = java.util.Optional), (TPH BOV = de.dhbwstuttgart.syntaxtree.Method), (TPH BOD = de.dhbwstuttgart.syntaxtree.type.RefType), (TPH BS = de.dhbwstuttgart.syntaxtree.type.GenericRefType), (TPH BNX = de.dhbwstuttgart.syntaxtree.Constructor), (TPH AP = java.util.ArrayList), (TPH BOH = de.dhbwstuttgart.syntaxtree.Constructor), (TPH D = java.lang.Integer), (TPH BY = de.dhbwstuttgart.parser.NullToken), (TPH BR = java.util.ArrayList), (TPH BU = java.lang.String), (TPH M = java.lang.String), (TPH A = void), (TPH AS = de.dhbwstuttgart.parser.NullToken), (TPH AA = java.lang.Object), (TPH BO = java.lang.Iterable), (TPH BOW = de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric), (TPH F = java.lang.String), (TPH CA = java.lang.String), (TPH Z = de.dhbwstuttgart.typeinference.assumptions.FunNClass), (TPH BOC = ? extends de.dhbwstuttgart.syntaxtree.type.GenericRefType), (TPH BK = de.dhbwstuttgart.syntaxtree.ClassOrInterface), (TPH CG = java.lang.Boolean), (TPH CR = java.util.ArrayList), (TPH BOU = de.dhbwstuttgart.syntaxtree.Method), (TPH AF = java.util.ArrayList), (TPH AJ = de.dhbwstuttgart.syntaxtree.GenericDeclarationList), (TPH S = java.util.Optional), (TPH AC = java.util.ArrayList), (TPH BOI = de.dhbwstuttgart.syntaxtree.Method), (TPH BOE = ? extends de.dhbwstuttgart.syntaxtree.type.GenericRefType), (TPH BOK = de.dhbwstuttgart.syntaxtree.GenericTypeVar), (TPH BOX = ? extends de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric), (TPH CN = de.dhbwstuttgart.syntaxtree.GenericDeclarationList), (TPH G = java.lang.Integer), (TPH AH = java.lang.Iterable), (TPH BOR = de.dhbwstuttgart.syntaxtree.Field), (TPH W = java.util.Optional), (TPH BNZ = de.dhbwstuttgart.syntaxtree.GenericTypeVar), (TPH CM = org.antlr.v4.runtime.Token), (TPH CF = GTV E), (TPH CP = java.util.ArrayList), (TPH BOS = ? extends de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric), (TPH AR = java.util.ArrayList), (TPH V = java.util.Optional)]] +Constraints for Generated Generics: ??? +TPH O = de.dhbwstuttgart.parser.scope.JavaClassName +TPH BLB = de.dhbwstuttgart.syntaxtree.GenericTypeVar +TPH BLM = de.dhbwstuttgart.syntaxtree.Method +TPH F = java.lang.String +TPH AL = de.dhbwstuttgart.syntaxtree.type.RefType +TPH BKR = ? extends de.dhbwstuttgart.syntaxtree.type.GenericRefType +TPH BZ = de.dhbwstuttgart.parser.NullToken +TPH N = java.lang.String +TPH BLF = de.dhbwstuttgart.syntaxtree.Constructor +TPH CD = org.antlr.v4.runtime.Token +TPH BU = java.lang.String +TPH CN = de.dhbwstuttgart.syntaxtree.GenericDeclarationList +TPH BT = java.lang.String +TPH E = java.lang.String +TPH BLL = de.dhbwstuttgart.syntaxtree.Method +TPH BX = java.util.ArrayList +TPH CG = java.lang.Boolean +TPH BLE = de.dhbwstuttgart.syntaxtree.Constructor +TPH M = java.lang.String +TPH BLD = de.dhbwstuttgart.syntaxtree.type.RefType +TPH BKZ = ? extends de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric +TPH BKO = de.dhbwstuttgart.syntaxtree.Constructor +TPH BLK = de.dhbwstuttgart.syntaxtree.Method +TPH CE = de.dhbwstuttgart.syntaxtree.GenericTypeVar +TPH AM = de.dhbwstuttgart.syntaxtree.type.RefType +TPH AA = java.lang.Object +TPH AR = java.util.ArrayList +TPH CL = java.lang.Iterable +TPH Q = java.util.ArrayList +TPH BLC = de.dhbwstuttgart.syntaxtree.Method +TPH AB = java.util.ArrayList +TPH BK = de.dhbwstuttgart.syntaxtree.ClassOrInterface +TPH BLQ = ? extends de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric +TPH BKY = de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric +TPH BKU = de.dhbwstuttgart.syntaxtree.type.RefType +TPH J = java.lang.Integer +TPH BR = java.util.ArrayList +TPH CQ = java.lang.Object +TPH BKW = de.dhbwstuttgart.syntaxtree.type.RefType +TPH AS = de.dhbwstuttgart.parser.NullToken +TPH BLH = de.dhbwstuttgart.syntaxtree.type.GenericRefType +TPH CB = java.util.List +TPH BN = de.dhbwstuttgart.syntaxtree.GenericDeclarationList +TPH CF = GTV E +TPH AP = java.util.ArrayList +TPH AG = de.dhbwstuttgart.typeinference.assumptions.FunNClass +TPH CA = java.lang.String +TPH AF = java.util.ArrayList +TPH AI = de.dhbwstuttgart.syntaxtree.GenericDeclarationList +TPH AT = java.lang.String +TPH CH = java.lang.Boolean +TPH BLP = de.dhbwstuttgart.syntaxtree.Method +TPH AXO = de.dhbwstuttgart.syntaxtree.GenericTypeVar +TPH BKT = de.dhbwstuttgart.syntaxtree.Constructor +TPH B = java.util.List +TPH BLA = de.dhbwstuttgart.syntaxtree.GenericTypeVar +TPH BLG = de.dhbwstuttgart.syntaxtree.type.GenericRefType +TPH D = java.lang.Integer +TPH CM = org.antlr.v4.runtime.Token +TPH AJ = de.dhbwstuttgart.syntaxtree.GenericDeclarationList +TPH BLO = de.dhbwstuttgart.syntaxtree.type.RefType +TPH R = java.util.Optional +TPH G = java.lang.Integer +TPH K = java.lang.Integer +TPH S = java.util.Optional +TPH CP = java.util.ArrayList +TPH BP = java.util.ArrayList +TPH H = java.lang.Integer +TPH BS = de.dhbwstuttgart.syntaxtree.type.GenericRefType +TPH BY = de.dhbwstuttgart.parser.NullToken +TPH AC = java.util.ArrayList +TPH W = java.util.Optional +TPH CC = org.antlr.v4.runtime.Token +TPH Z = de.dhbwstuttgart.typeinference.assumptions.FunNClass +TPH BO = java.lang.Iterable +TPH CR = java.util.ArrayList +TPH BKS = de.dhbwstuttgart.syntaxtree.Method +TPH BLN = ? extends de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric +TPH BKX = de.dhbwstuttgart.syntaxtree.Constructor +TPH BKP = ? extends de.dhbwstuttgart.syntaxtree.type.GenericRefType +TPH V = java.util.Optional +TPH CK = de.dhbwstuttgart.parser.NullToken +TPH BKV = de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric +TPH A = void +TPH BLJ = de.dhbwstuttgart.syntaxtree.GenericTypeVar +TPH BKQ = de.dhbwstuttgart.syntaxtree.Field +TPH BLI = de.dhbwstuttgart.syntaxtree.Field +TPH AH = java.lang.Iterable +Simplified constraints: [] +TPH O = de.dhbwstuttgart.parser.scope.JavaClassName +TPH BLB = de.dhbwstuttgart.syntaxtree.GenericTypeVar +TPH BLM = de.dhbwstuttgart.syntaxtree.Method +TPH F = java.lang.String +TPH AL = de.dhbwstuttgart.syntaxtree.type.RefType +TPH BKR = ? extends de.dhbwstuttgart.syntaxtree.type.GenericRefType +TPH BZ = de.dhbwstuttgart.parser.NullToken +TPH N = java.lang.String +TPH BLF = de.dhbwstuttgart.syntaxtree.Constructor +TPH CD = org.antlr.v4.runtime.Token +TPH BU = java.lang.String +TPH CN = de.dhbwstuttgart.syntaxtree.GenericDeclarationList +TPH BT = java.lang.String +TPH E = java.lang.String +TPH BLL = de.dhbwstuttgart.syntaxtree.Method +TPH BX = java.util.ArrayList +TPH CG = java.lang.Boolean +TPH BLE = de.dhbwstuttgart.syntaxtree.Constructor +TPH M = java.lang.String +TPH BLD = de.dhbwstuttgart.syntaxtree.type.RefType +TPH BKZ = ? extends de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric +TPH BKO = de.dhbwstuttgart.syntaxtree.Constructor +TPH BLK = de.dhbwstuttgart.syntaxtree.Method +TPH CE = de.dhbwstuttgart.syntaxtree.GenericTypeVar +TPH AM = de.dhbwstuttgart.syntaxtree.type.RefType +TPH AA = java.lang.Object +TPH AR = java.util.ArrayList +TPH CL = java.lang.Iterable +TPH Q = java.util.ArrayList +TPH BLC = de.dhbwstuttgart.syntaxtree.Method +TPH AB = java.util.ArrayList +TPH BK = de.dhbwstuttgart.syntaxtree.ClassOrInterface +TPH BLQ = ? extends de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric +TPH BKY = de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric +TPH BKU = de.dhbwstuttgart.syntaxtree.type.RefType +TPH J = java.lang.Integer +TPH BR = java.util.ArrayList +TPH CQ = java.lang.Object +TPH BKW = de.dhbwstuttgart.syntaxtree.type.RefType +TPH AS = de.dhbwstuttgart.parser.NullToken +TPH BLH = de.dhbwstuttgart.syntaxtree.type.GenericRefType +TPH CB = java.util.List +TPH BN = de.dhbwstuttgart.syntaxtree.GenericDeclarationList +TPH CF = GTV E +TPH AP = java.util.ArrayList +TPH AG = de.dhbwstuttgart.typeinference.assumptions.FunNClass +TPH CA = java.lang.String +TPH AF = java.util.ArrayList +TPH AI = de.dhbwstuttgart.syntaxtree.GenericDeclarationList +TPH AT = java.lang.String +TPH CH = java.lang.Boolean +TPH BLP = de.dhbwstuttgart.syntaxtree.Method +TPH AXO = de.dhbwstuttgart.syntaxtree.GenericTypeVar +TPH BKT = de.dhbwstuttgart.syntaxtree.Constructor +TPH B = java.util.List +TPH BLA = de.dhbwstuttgart.syntaxtree.GenericTypeVar +TPH BLG = de.dhbwstuttgart.syntaxtree.type.GenericRefType +TPH D = java.lang.Integer +TPH CM = org.antlr.v4.runtime.Token +TPH AJ = de.dhbwstuttgart.syntaxtree.GenericDeclarationList +TPH BLO = de.dhbwstuttgart.syntaxtree.type.RefType +TPH R = java.util.Optional +TPH G = java.lang.Integer +TPH K = java.lang.Integer +TPH S = java.util.Optional +TPH CP = java.util.ArrayList +TPH BP = java.util.ArrayList +TPH H = java.lang.Integer +TPH BS = de.dhbwstuttgart.syntaxtree.type.GenericRefType +TPH BY = de.dhbwstuttgart.parser.NullToken +TPH AC = java.util.ArrayList +TPH W = java.util.Optional +TPH CC = org.antlr.v4.runtime.Token +TPH Z = de.dhbwstuttgart.typeinference.assumptions.FunNClass +TPH BO = java.lang.Iterable +TPH CR = java.util.ArrayList +TPH BKS = de.dhbwstuttgart.syntaxtree.Method +TPH BLN = ? extends de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric +TPH BKX = de.dhbwstuttgart.syntaxtree.Constructor +TPH BKP = ? extends de.dhbwstuttgart.syntaxtree.type.GenericRefType +TPH V = java.util.Optional +TPH CK = de.dhbwstuttgart.parser.NullToken +TPH BKV = de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric +TPH A = void +TPH BLJ = de.dhbwstuttgart.syntaxtree.GenericTypeVar +TPH BKQ = de.dhbwstuttgart.syntaxtree.Field +TPH BLI = de.dhbwstuttgart.syntaxtree.Field +TPH AH = java.lang.Iterable +Simplified constraints: [] +TPH AH = java.lang.Iterable +TPH V = java.util.Optional +TPH AC = java.util.ArrayList +TPH BLT = de.dhbwstuttgart.syntaxtree.Field +TPH BMT = ? extends de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric +TPH BLX = de.dhbwstuttgart.syntaxtree.type.RefType +TPH BMS = de.dhbwstuttgart.syntaxtree.Method +TPH F = java.lang.String +TPH BLW = de.dhbwstuttgart.syntaxtree.Constructor +TPH R = java.util.Optional +TPH CQ = java.lang.Object +TPH BX = java.util.ArrayList +TPH AP = java.util.ArrayList +TPH BMO = de.dhbwstuttgart.syntaxtree.Method +TPH J = java.lang.Integer +TPH BML = de.dhbwstuttgart.syntaxtree.Field +TPH Q = java.util.ArrayList +TPH AA = java.lang.Object +TPH CN = de.dhbwstuttgart.syntaxtree.GenericDeclarationList +TPH AJ = de.dhbwstuttgart.syntaxtree.GenericDeclarationList +TPH BU = java.lang.String +TPH M = java.lang.String +TPH AM = de.dhbwstuttgart.syntaxtree.type.RefType +TPH AT = java.lang.String +TPH CH = java.lang.Boolean +TPH A = void +TPH AXO = de.dhbwstuttgart.syntaxtree.GenericTypeVar +TPH K = java.lang.Integer +TPH BN = de.dhbwstuttgart.syntaxtree.GenericDeclarationList +TPH D = java.lang.Integer +TPH BMK = de.dhbwstuttgart.syntaxtree.type.GenericRefType +TPH BR = java.util.ArrayList +TPH BY = de.dhbwstuttgart.parser.NullToken +TPH AG = de.dhbwstuttgart.typeinference.assumptions.FunNClass +TPH W = java.util.Optional +TPH AI = de.dhbwstuttgart.syntaxtree.GenericDeclarationList +TPH BK = de.dhbwstuttgart.syntaxtree.ClassOrInterface +TPH CE = de.dhbwstuttgart.syntaxtree.GenericTypeVar +TPH CD = org.antlr.v4.runtime.Token +TPH BMQ = ? extends de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric +TPH CL = java.util.ArrayList +TPH BMC = ? extends de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric +TPH CB = java.util.List +TPH N = java.lang.String +TPH H = java.lang.Integer +TPH BMI = de.dhbwstuttgart.syntaxtree.Constructor +TPH AB = java.util.ArrayList +TPH BS = de.dhbwstuttgart.syntaxtree.type.GenericRefType +TPH CR = java.util.ArrayList +TPH BMN = de.dhbwstuttgart.syntaxtree.Method +TPH BLV = de.dhbwstuttgart.syntaxtree.Method +TPH CM = org.antlr.v4.runtime.Token +TPH BMR = de.dhbwstuttgart.syntaxtree.type.RefType +TPH E = java.lang.String +TPH Z = de.dhbwstuttgart.typeinference.assumptions.FunNClass +TPH BP = java.util.ArrayList +TPH AF = java.util.ArrayList +TPH CG = java.lang.Boolean +TPH BME = de.dhbwstuttgart.syntaxtree.GenericTypeVar +TPH BMP = de.dhbwstuttgart.syntaxtree.Method +TPH CP = java.util.ArrayList +TPH AL = de.dhbwstuttgart.syntaxtree.type.RefType +TPH CC = org.antlr.v4.runtime.Token +TPH BZ = de.dhbwstuttgart.parser.NullToken +TPH AS = de.dhbwstuttgart.parser.NullToken +TPH BMF = de.dhbwstuttgart.syntaxtree.Method +TPH AR = java.util.ArrayList +TPH BLR = de.dhbwstuttgart.syntaxtree.Constructor +TPH O = de.dhbwstuttgart.parser.scope.JavaClassName +TPH BMG = de.dhbwstuttgart.syntaxtree.type.RefType +TPH CA = java.lang.String +TPH BLS = ? extends de.dhbwstuttgart.syntaxtree.type.GenericRefType +TPH CK = de.dhbwstuttgart.parser.NullToken +TPH BLZ = de.dhbwstuttgart.syntaxtree.type.RefType +TPH BMB = de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric +TPH BMD = de.dhbwstuttgart.syntaxtree.GenericTypeVar +TPH BO = java.lang.Iterable +TPH BT = java.lang.String +TPH S = java.util.Optional +TPH B = java.util.List +TPH BMJ = de.dhbwstuttgart.syntaxtree.type.GenericRefType +TPH BLY = de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric +TPH BMA = de.dhbwstuttgart.syntaxtree.Constructor +TPH G = java.lang.Integer +TPH BMH = de.dhbwstuttgart.syntaxtree.Constructor +TPH CF = GTV E +TPH BLU = ? extends de.dhbwstuttgart.syntaxtree.type.GenericRefType +TPH BMM = de.dhbwstuttgart.syntaxtree.GenericTypeVar +Simplified constraints: [] +TPH AH = java.lang.Iterable +TPH V = java.util.Optional +TPH AC = java.util.ArrayList +TPH BLT = de.dhbwstuttgart.syntaxtree.Field +TPH BMT = ? extends de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric +TPH BLX = de.dhbwstuttgart.syntaxtree.type.RefType +TPH BMS = de.dhbwstuttgart.syntaxtree.Method +TPH F = java.lang.String +TPH BLW = de.dhbwstuttgart.syntaxtree.Constructor +TPH R = java.util.Optional +TPH CQ = java.lang.Object +TPH BX = java.util.ArrayList +TPH AP = java.util.ArrayList +TPH BMO = de.dhbwstuttgart.syntaxtree.Method +TPH J = java.lang.Integer +TPH BML = de.dhbwstuttgart.syntaxtree.Field +TPH Q = java.util.ArrayList +TPH AA = java.lang.Object +TPH CN = de.dhbwstuttgart.syntaxtree.GenericDeclarationList +TPH AJ = de.dhbwstuttgart.syntaxtree.GenericDeclarationList +TPH BU = java.lang.String +TPH M = java.lang.String +TPH AM = de.dhbwstuttgart.syntaxtree.type.RefType +TPH AT = java.lang.String +TPH CH = java.lang.Boolean +TPH A = void +TPH AXO = de.dhbwstuttgart.syntaxtree.GenericTypeVar +TPH K = java.lang.Integer +TPH BN = de.dhbwstuttgart.syntaxtree.GenericDeclarationList +TPH D = java.lang.Integer +TPH BMK = de.dhbwstuttgart.syntaxtree.type.GenericRefType +TPH BR = java.util.ArrayList +TPH BY = de.dhbwstuttgart.parser.NullToken +TPH AG = de.dhbwstuttgart.typeinference.assumptions.FunNClass +TPH W = java.util.Optional +TPH AI = de.dhbwstuttgart.syntaxtree.GenericDeclarationList +TPH BK = de.dhbwstuttgart.syntaxtree.ClassOrInterface +TPH CE = de.dhbwstuttgart.syntaxtree.GenericTypeVar +TPH CD = org.antlr.v4.runtime.Token +TPH BMQ = ? extends de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric +TPH CL = java.util.ArrayList +TPH BMC = ? extends de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric +TPH CB = java.util.List +TPH N = java.lang.String +TPH H = java.lang.Integer +TPH BMI = de.dhbwstuttgart.syntaxtree.Constructor +TPH AB = java.util.ArrayList +TPH BS = de.dhbwstuttgart.syntaxtree.type.GenericRefType +TPH CR = java.util.ArrayList +TPH BMN = de.dhbwstuttgart.syntaxtree.Method +TPH BLV = de.dhbwstuttgart.syntaxtree.Method +TPH CM = org.antlr.v4.runtime.Token +TPH BMR = de.dhbwstuttgart.syntaxtree.type.RefType +TPH E = java.lang.String +TPH Z = de.dhbwstuttgart.typeinference.assumptions.FunNClass +TPH BP = java.util.ArrayList +TPH AF = java.util.ArrayList +TPH CG = java.lang.Boolean +TPH BME = de.dhbwstuttgart.syntaxtree.GenericTypeVar +TPH BMP = de.dhbwstuttgart.syntaxtree.Method +TPH CP = java.util.ArrayList +TPH AL = de.dhbwstuttgart.syntaxtree.type.RefType +TPH CC = org.antlr.v4.runtime.Token +TPH BZ = de.dhbwstuttgart.parser.NullToken +TPH AS = de.dhbwstuttgart.parser.NullToken +TPH BMF = de.dhbwstuttgart.syntaxtree.Method +TPH AR = java.util.ArrayList +TPH BLR = de.dhbwstuttgart.syntaxtree.Constructor +TPH O = de.dhbwstuttgart.parser.scope.JavaClassName +TPH BMG = de.dhbwstuttgart.syntaxtree.type.RefType +TPH CA = java.lang.String +TPH BLS = ? extends de.dhbwstuttgart.syntaxtree.type.GenericRefType +TPH CK = de.dhbwstuttgart.parser.NullToken +TPH BLZ = de.dhbwstuttgart.syntaxtree.type.RefType +TPH BMB = de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric +TPH BMD = de.dhbwstuttgart.syntaxtree.GenericTypeVar +TPH BO = java.lang.Iterable +TPH BT = java.lang.String +TPH S = java.util.Optional +TPH B = java.util.List +TPH BMJ = de.dhbwstuttgart.syntaxtree.type.GenericRefType +TPH BLY = de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric +TPH BMA = de.dhbwstuttgart.syntaxtree.Constructor +TPH G = java.lang.Integer +TPH BMH = de.dhbwstuttgart.syntaxtree.Constructor +TPH CF = GTV E +TPH BLU = ? extends de.dhbwstuttgart.syntaxtree.type.GenericRefType +TPH BMM = de.dhbwstuttgart.syntaxtree.GenericTypeVar +Simplified constraints: [] +TPH CF = GTV E +TPH BNM = de.dhbwstuttgart.syntaxtree.Method +TPH AC = java.util.ArrayList +TPH AB = java.util.ArrayList +TPH CP = java.util.ArrayList +TPH BK = de.dhbwstuttgart.syntaxtree.ClassOrInterface +TPH BO = java.lang.Iterable +TPH BNA = ? extends de.dhbwstuttgart.syntaxtree.type.GenericRefType +TPH BNF = de.dhbwstuttgart.syntaxtree.Constructor +TPH CA = java.lang.String +TPH F = java.lang.String +TPH AH = java.lang.Iterable +TPH CD = org.antlr.v4.runtime.Token +TPH BMU = de.dhbwstuttgart.syntaxtree.type.GenericRefType +TPH BMV = de.dhbwstuttgart.syntaxtree.Constructor +TPH CM = org.antlr.v4.runtime.Token +TPH CG = java.lang.Boolean +TPH BMW = de.dhbwstuttgart.syntaxtree.type.GenericRefType +TPH Z = de.dhbwstuttgart.typeinference.assumptions.FunNClass +TPH BNJ = de.dhbwstuttgart.syntaxtree.GenericTypeVar +TPH A = void +TPH BT = java.lang.String +TPH BNK = de.dhbwstuttgart.syntaxtree.Method +TPH BNQ = ? extends de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric +TPH D = java.lang.Integer +TPH BY = de.dhbwstuttgart.parser.NullToken +TPH AP = java.util.ArrayList +TPH AI = de.dhbwstuttgart.syntaxtree.GenericDeclarationList +TPH BND = de.dhbwstuttgart.syntaxtree.type.RefType +TPH BNO = de.dhbwstuttgart.syntaxtree.Method +TPH BNP = de.dhbwstuttgart.syntaxtree.Field +TPH BN = de.dhbwstuttgart.syntaxtree.GenericDeclarationList +TPH AG = de.dhbwstuttgart.typeinference.assumptions.FunNClass +TPH BNV = ? extends de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric +TPH BNT = de.dhbwstuttgart.syntaxtree.Method +TPH V = java.util.Optional +TPH CH = java.lang.Boolean +TPH AT = java.lang.String +TPH H = java.lang.Integer +TPH BNI = de.dhbwstuttgart.syntaxtree.GenericTypeVar +TPH AJ = de.dhbwstuttgart.syntaxtree.GenericDeclarationList +TPH BNE = de.dhbwstuttgart.syntaxtree.Constructor +TPH CL = java.lang.Iterable +TPH B = java.util.ArrayList +TPH CN = de.dhbwstuttgart.syntaxtree.GenericDeclarationList +TPH BMZ = de.dhbwstuttgart.syntaxtree.Constructor +TPH BNH = ? extends de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric +TPH O = de.dhbwstuttgart.parser.scope.JavaClassName +TPH AF = java.util.ArrayList +TPH G = java.lang.Integer +TPH S = java.util.Optional +TPH R = java.util.Optional +TPH BX = java.util.ArrayList +TPH BR = java.util.ArrayList +TPH BNB = de.dhbwstuttgart.syntaxtree.type.RefType +TPH CR = java.util.ArrayList +TPH BNG = de.dhbwstuttgart.syntaxtree.Method +TPH BNU = de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric +TPH AA = java.lang.Object +TPH BP = java.util.ArrayList +TPH N = java.lang.String +TPH W = java.util.Optional +TPH BMX = de.dhbwstuttgart.syntaxtree.GenericTypeVar +TPH BNS = de.dhbwstuttgart.syntaxtree.Method +TPH BNR = de.dhbwstuttgart.syntaxtree.type.RefType +TPH K = java.lang.Integer +TPH AL = de.dhbwstuttgart.syntaxtree.type.RefType +TPH BNL = de.dhbwstuttgart.syntaxtree.type.RefType +TPH CE = de.dhbwstuttgart.syntaxtree.GenericTypeVar +TPH AS = de.dhbwstuttgart.parser.NullToken +TPH Q = java.util.ArrayList +TPH CQ = java.lang.Object +TPH AXO = de.dhbwstuttgart.syntaxtree.GenericTypeVar +TPH E = java.lang.String +TPH BZ = de.dhbwstuttgart.parser.NullToken +TPH BMY = de.dhbwstuttgart.syntaxtree.Field +TPH CB = java.util.List +TPH BNC = ? extends de.dhbwstuttgart.syntaxtree.type.GenericRefType +TPH BNN = de.dhbwstuttgart.syntaxtree.Constructor +TPH CC = org.antlr.v4.runtime.Token +TPH M = java.lang.String +TPH AM = de.dhbwstuttgart.syntaxtree.type.RefType +TPH J = java.lang.Integer +TPH AR = java.util.ArrayList +TPH CK = de.dhbwstuttgart.parser.NullToken +TPH BS = de.dhbwstuttgart.syntaxtree.type.GenericRefType +TPH BU = java.lang.String +Simplified constraints: [] +TPH CF = GTV E +TPH BNM = de.dhbwstuttgart.syntaxtree.Method +TPH AC = java.util.ArrayList +TPH AB = java.util.ArrayList +TPH CP = java.util.ArrayList +TPH BK = de.dhbwstuttgart.syntaxtree.ClassOrInterface +TPH BO = java.lang.Iterable +TPH BNA = ? extends de.dhbwstuttgart.syntaxtree.type.GenericRefType +TPH BNF = de.dhbwstuttgart.syntaxtree.Constructor +TPH CA = java.lang.String +TPH F = java.lang.String +TPH AH = java.lang.Iterable +TPH CD = org.antlr.v4.runtime.Token +TPH BMU = de.dhbwstuttgart.syntaxtree.type.GenericRefType +TPH BMV = de.dhbwstuttgart.syntaxtree.Constructor +TPH CM = org.antlr.v4.runtime.Token +TPH CG = java.lang.Boolean +TPH BMW = de.dhbwstuttgart.syntaxtree.type.GenericRefType +TPH Z = de.dhbwstuttgart.typeinference.assumptions.FunNClass +TPH BNJ = de.dhbwstuttgart.syntaxtree.GenericTypeVar +TPH A = void +TPH BT = java.lang.String +TPH BNK = de.dhbwstuttgart.syntaxtree.Method +TPH BNQ = ? extends de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric +TPH D = java.lang.Integer +TPH BY = de.dhbwstuttgart.parser.NullToken +TPH AP = java.util.ArrayList +TPH AI = de.dhbwstuttgart.syntaxtree.GenericDeclarationList +TPH BND = de.dhbwstuttgart.syntaxtree.type.RefType +TPH BNO = de.dhbwstuttgart.syntaxtree.Method +TPH BNP = de.dhbwstuttgart.syntaxtree.Field +TPH BN = de.dhbwstuttgart.syntaxtree.GenericDeclarationList +TPH AG = de.dhbwstuttgart.typeinference.assumptions.FunNClass +TPH BNV = ? extends de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric +TPH BNT = de.dhbwstuttgart.syntaxtree.Method +TPH V = java.util.Optional +TPH CH = java.lang.Boolean +TPH AT = java.lang.String +TPH H = java.lang.Integer +TPH BNI = de.dhbwstuttgart.syntaxtree.GenericTypeVar +TPH AJ = de.dhbwstuttgart.syntaxtree.GenericDeclarationList +TPH BNE = de.dhbwstuttgart.syntaxtree.Constructor +TPH CL = java.lang.Iterable +TPH B = java.util.ArrayList +TPH CN = de.dhbwstuttgart.syntaxtree.GenericDeclarationList +TPH BMZ = de.dhbwstuttgart.syntaxtree.Constructor +TPH BNH = ? extends de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric +TPH O = de.dhbwstuttgart.parser.scope.JavaClassName +TPH AF = java.util.ArrayList +TPH G = java.lang.Integer +TPH S = java.util.Optional +TPH R = java.util.Optional +TPH BX = java.util.ArrayList +TPH BR = java.util.ArrayList +TPH BNB = de.dhbwstuttgart.syntaxtree.type.RefType +TPH CR = java.util.ArrayList +TPH BNG = de.dhbwstuttgart.syntaxtree.Method +TPH BNU = de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric +TPH AA = java.lang.Object +TPH BP = java.util.ArrayList +TPH N = java.lang.String +TPH W = java.util.Optional +TPH BMX = de.dhbwstuttgart.syntaxtree.GenericTypeVar +TPH BNS = de.dhbwstuttgart.syntaxtree.Method +TPH BNR = de.dhbwstuttgart.syntaxtree.type.RefType +TPH K = java.lang.Integer +TPH AL = de.dhbwstuttgart.syntaxtree.type.RefType +TPH BNL = de.dhbwstuttgart.syntaxtree.type.RefType +TPH CE = de.dhbwstuttgart.syntaxtree.GenericTypeVar +TPH AS = de.dhbwstuttgart.parser.NullToken +TPH Q = java.util.ArrayList +TPH CQ = java.lang.Object +TPH AXO = de.dhbwstuttgart.syntaxtree.GenericTypeVar +TPH E = java.lang.String +TPH BZ = de.dhbwstuttgart.parser.NullToken +TPH BMY = de.dhbwstuttgart.syntaxtree.Field +TPH CB = java.util.List +TPH BNC = ? extends de.dhbwstuttgart.syntaxtree.type.GenericRefType +TPH BNN = de.dhbwstuttgart.syntaxtree.Constructor +TPH CC = org.antlr.v4.runtime.Token +TPH M = java.lang.String +TPH AM = de.dhbwstuttgart.syntaxtree.type.RefType +TPH J = java.lang.Integer +TPH AR = java.util.ArrayList +TPH CK = de.dhbwstuttgart.parser.NullToken +TPH BS = de.dhbwstuttgart.syntaxtree.type.GenericRefType +TPH BU = java.lang.String +Simplified constraints: [] +TPH BOJ = ? extends de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric +TPH E = java.lang.String +TPH CC = org.antlr.v4.runtime.Token +TPH CK = de.dhbwstuttgart.parser.NullToken +TPH BOM = de.dhbwstuttgart.syntaxtree.Method +TPH N = java.lang.String +TPH BOT = de.dhbwstuttgart.syntaxtree.type.RefType +TPH CL = java.util.ArrayList +TPH H = java.lang.Integer +TPH BOB = de.dhbwstuttgart.syntaxtree.Constructor +TPH BOF = de.dhbwstuttgart.syntaxtree.type.RefType +TPH BX = java.util.ArrayList +TPH BZ = de.dhbwstuttgart.parser.NullToken +TPH BP = java.util.ArrayList +TPH BOO = de.dhbwstuttgart.syntaxtree.Method +TPH CD = org.antlr.v4.runtime.Token +TPH O = de.dhbwstuttgart.parser.scope.JavaClassName +TPH AB = java.util.ArrayList +TPH B = java.util.ArrayList +TPH AG = de.dhbwstuttgart.typeinference.assumptions.FunNClass +TPH BOG = de.dhbwstuttgart.syntaxtree.Constructor +TPH BOL = de.dhbwstuttgart.syntaxtree.GenericTypeVar +TPH BON = de.dhbwstuttgart.syntaxtree.type.RefType +TPH CH = java.lang.Boolean +TPH Q = java.util.ArrayList +TPH K = java.lang.Integer +TPH J = java.lang.Integer +TPH BOQ = de.dhbwstuttgart.syntaxtree.Method +TPH BT = java.lang.String +TPH BNW = de.dhbwstuttgart.syntaxtree.type.GenericRefType +TPH BOP = de.dhbwstuttgart.syntaxtree.Constructor +TPH AT = java.lang.String +TPH AM = de.dhbwstuttgart.syntaxtree.type.RefType +TPH AL = de.dhbwstuttgart.syntaxtree.type.RefType +TPH AI = de.dhbwstuttgart.syntaxtree.GenericDeclarationList +TPH CB = java.util.List +TPH BOA = de.dhbwstuttgart.syntaxtree.Field +TPH BNY = de.dhbwstuttgart.syntaxtree.type.GenericRefType +TPH CQ = java.lang.Object +TPH BN = de.dhbwstuttgart.syntaxtree.GenericDeclarationList +TPH CE = de.dhbwstuttgart.syntaxtree.GenericTypeVar +TPH AXO = de.dhbwstuttgart.syntaxtree.GenericTypeVar +TPH R = java.util.Optional +TPH BOV = de.dhbwstuttgart.syntaxtree.Method +TPH BOD = de.dhbwstuttgart.syntaxtree.type.RefType +TPH BS = de.dhbwstuttgart.syntaxtree.type.GenericRefType +TPH BNX = de.dhbwstuttgart.syntaxtree.Constructor +TPH AP = java.util.ArrayList +TPH BOH = de.dhbwstuttgart.syntaxtree.Constructor +TPH D = java.lang.Integer +TPH BY = de.dhbwstuttgart.parser.NullToken +TPH BR = java.util.ArrayList +TPH BU = java.lang.String +TPH M = java.lang.String +TPH A = void +TPH AS = de.dhbwstuttgart.parser.NullToken +TPH AA = java.lang.Object +TPH BO = java.lang.Iterable +TPH BOW = de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric +TPH F = java.lang.String +TPH CA = java.lang.String +TPH Z = de.dhbwstuttgart.typeinference.assumptions.FunNClass +TPH BOC = ? extends de.dhbwstuttgart.syntaxtree.type.GenericRefType +TPH BK = de.dhbwstuttgart.syntaxtree.ClassOrInterface +TPH CG = java.lang.Boolean +TPH CR = java.util.ArrayList +TPH BOU = de.dhbwstuttgart.syntaxtree.Method +TPH AF = java.util.ArrayList +TPH AJ = de.dhbwstuttgart.syntaxtree.GenericDeclarationList +TPH S = java.util.Optional +TPH AC = java.util.ArrayList +TPH BOI = de.dhbwstuttgart.syntaxtree.Method +TPH BOE = ? extends de.dhbwstuttgart.syntaxtree.type.GenericRefType +TPH BOK = de.dhbwstuttgart.syntaxtree.GenericTypeVar +TPH BOX = ? extends de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric +TPH CN = de.dhbwstuttgart.syntaxtree.GenericDeclarationList +TPH G = java.lang.Integer +TPH AH = java.lang.Iterable +TPH BOR = de.dhbwstuttgart.syntaxtree.Field +TPH W = java.util.Optional +TPH BNZ = de.dhbwstuttgart.syntaxtree.GenericTypeVar +TPH CM = org.antlr.v4.runtime.Token +TPH CF = GTV E +TPH CP = java.util.ArrayList +TPH BOS = ? extends de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric +TPH AR = java.util.ArrayList +TPH V = java.util.Optional +Simplified constraints: [] +TPH BOJ = ? extends de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric +TPH E = java.lang.String +TPH CC = org.antlr.v4.runtime.Token +TPH CK = de.dhbwstuttgart.parser.NullToken +TPH BOM = de.dhbwstuttgart.syntaxtree.Method +TPH N = java.lang.String +TPH BOT = de.dhbwstuttgart.syntaxtree.type.RefType +TPH CL = java.util.ArrayList +TPH H = java.lang.Integer +TPH BOB = de.dhbwstuttgart.syntaxtree.Constructor +TPH BOF = de.dhbwstuttgart.syntaxtree.type.RefType +TPH BX = java.util.ArrayList +TPH BZ = de.dhbwstuttgart.parser.NullToken +TPH BP = java.util.ArrayList +TPH BOO = de.dhbwstuttgart.syntaxtree.Method +TPH CD = org.antlr.v4.runtime.Token +TPH O = de.dhbwstuttgart.parser.scope.JavaClassName +TPH AB = java.util.ArrayList +TPH B = java.util.ArrayList +TPH AG = de.dhbwstuttgart.typeinference.assumptions.FunNClass +TPH BOG = de.dhbwstuttgart.syntaxtree.Constructor +TPH BOL = de.dhbwstuttgart.syntaxtree.GenericTypeVar +TPH BON = de.dhbwstuttgart.syntaxtree.type.RefType +TPH CH = java.lang.Boolean +TPH Q = java.util.ArrayList +TPH K = java.lang.Integer +TPH J = java.lang.Integer +TPH BOQ = de.dhbwstuttgart.syntaxtree.Method +TPH BT = java.lang.String +TPH BNW = de.dhbwstuttgart.syntaxtree.type.GenericRefType +TPH BOP = de.dhbwstuttgart.syntaxtree.Constructor +TPH AT = java.lang.String +TPH AM = de.dhbwstuttgart.syntaxtree.type.RefType +TPH AL = de.dhbwstuttgart.syntaxtree.type.RefType +TPH AI = de.dhbwstuttgart.syntaxtree.GenericDeclarationList +TPH CB = java.util.List +TPH BOA = de.dhbwstuttgart.syntaxtree.Field +TPH BNY = de.dhbwstuttgart.syntaxtree.type.GenericRefType +TPH CQ = java.lang.Object +TPH BN = de.dhbwstuttgart.syntaxtree.GenericDeclarationList +TPH CE = de.dhbwstuttgart.syntaxtree.GenericTypeVar +TPH AXO = de.dhbwstuttgart.syntaxtree.GenericTypeVar +TPH R = java.util.Optional +TPH BOV = de.dhbwstuttgart.syntaxtree.Method +TPH BOD = de.dhbwstuttgart.syntaxtree.type.RefType +TPH BS = de.dhbwstuttgart.syntaxtree.type.GenericRefType +TPH BNX = de.dhbwstuttgart.syntaxtree.Constructor +TPH AP = java.util.ArrayList +TPH BOH = de.dhbwstuttgart.syntaxtree.Constructor +TPH D = java.lang.Integer +TPH BY = de.dhbwstuttgart.parser.NullToken +TPH BR = java.util.ArrayList +TPH BU = java.lang.String +TPH M = java.lang.String +TPH A = void +TPH AS = de.dhbwstuttgart.parser.NullToken +TPH AA = java.lang.Object +TPH BO = java.lang.Iterable +TPH BOW = de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric +TPH F = java.lang.String +TPH CA = java.lang.String +TPH Z = de.dhbwstuttgart.typeinference.assumptions.FunNClass +TPH BOC = ? extends de.dhbwstuttgart.syntaxtree.type.GenericRefType +TPH BK = de.dhbwstuttgart.syntaxtree.ClassOrInterface +TPH CG = java.lang.Boolean +TPH CR = java.util.ArrayList +TPH BOU = de.dhbwstuttgart.syntaxtree.Method +TPH AF = java.util.ArrayList +TPH AJ = de.dhbwstuttgart.syntaxtree.GenericDeclarationList +TPH S = java.util.Optional +TPH AC = java.util.ArrayList +TPH BOI = de.dhbwstuttgart.syntaxtree.Method +TPH BOE = ? extends de.dhbwstuttgart.syntaxtree.type.GenericRefType +TPH BOK = de.dhbwstuttgart.syntaxtree.GenericTypeVar +TPH BOX = ? extends de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric +TPH CN = de.dhbwstuttgart.syntaxtree.GenericDeclarationList +TPH G = java.lang.Integer +TPH AH = java.lang.Iterable +TPH BOR = de.dhbwstuttgart.syntaxtree.Field +TPH W = java.util.Optional +TPH BNZ = de.dhbwstuttgart.syntaxtree.GenericTypeVar +TPH CM = org.antlr.v4.runtime.Token +TPH CF = GTV E +TPH CP = java.util.ArrayList +TPH BOS = ? extends de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric +TPH AR = java.util.ArrayList +TPH V = java.util.Optional +Simplified constraints: [] +T1s: [] T2s: [BQ] +T1s: [] T2s: [] +T1s: [BU] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [BW] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [BP] T2s: [] +T1s: [] T2s: [] +T1s: [AC, S, AT, D, W, AJ, AM] T2s: [] +T1s: [M] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [P] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [B] T2s: [] +In: FunNClass Method: createMethods +T1s: [] T2s: [AE] +T1s: [B] T2s: [] +In: FunNClass Method: createGenerics +T1s: [] T2s: [] +T1s: [] T2s: [AO] +T1s: [] T2s: [AQ] +T1s: [] T2s: [] +T1s: [] T2s: [BQ] +T1s: [] T2s: [] +T1s: [BU] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [BW] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [BP] T2s: [] +T1s: [] T2s: [] +T1s: [AC, S, AT, D, W, AJ, AM] T2s: [] +T1s: [M] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [P] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [B] T2s: [] +In: FunNClass Method: createMethods +T1s: [] T2s: [AE] +T1s: [B] T2s: [] +In: FunNClass Method: createGenerics +T1s: [] T2s: [] +T1s: [] T2s: [AO] +T1s: [] T2s: [AQ] +T1s: [] T2s: [] +JavaGenerics createGenerics: [] +JavaGenerics createMethods: [] +JavaGenerics FunNClass: [] +JavaGenerics Class FunNClass: [] +T1s: [] T2s: [BQ] +T1s: [] T2s: [] +T1s: [BU] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [BW] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [BP] T2s: [] +T1s: [] T2s: [] +T1s: [AC, S, AT, D, W, AJ, AM] T2s: [] +T1s: [M] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [P] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [B] T2s: [] +In: FunNClass Method: createMethods +T1s: [] T2s: [AE] +T1s: [B] T2s: [] +In: FunNClass Method: createGenerics +T1s: [] T2s: [] +T1s: [] T2s: [AO] +T1s: [] T2s: [AQ] +T1s: [] T2s: [] +T1s: [] T2s: [BQ] +T1s: [] T2s: [] +T1s: [BU] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [BW] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [BP] T2s: [] +T1s: [] T2s: [] +T1s: [AC, S, AT, D, W, AJ, AM] T2s: [] +T1s: [M] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [P] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [B] T2s: [] +In: FunNClass Method: createMethods +T1s: [] T2s: [AE] +T1s: [B] T2s: [] +In: FunNClass Method: createGenerics +T1s: [] T2s: [] +T1s: [] T2s: [AO] +T1s: [] T2s: [AQ] +T1s: [] T2s: [] +TxGenerics createGenerics: [] +TxGenerics createMethods: [] +TxGenerics FunNClass: [] +TxGenerics Class FunNClass: [] +Cached FunNClass: [] +Cached FunNClass: [] +T1s: [] T2s: [BQ] +T1s: [] T2s: [] +T1s: [BU] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [BW] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [BP] T2s: [] +T1s: [] T2s: [] +T1s: [AC, S, AT, D, W, AJ, AM] T2s: [] +T1s: [M] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [P] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [B] T2s: [] +In: FunNClass Method: createMethods +T1s: [] T2s: [AE] +T1s: [B] T2s: [] +In: FunNClass Method: createGenerics +T1s: [] T2s: [] +T1s: [] T2s: [AO] +T1s: [] T2s: [AQ] +T1s: [] T2s: [] +T1s: [] T2s: [BQ] +T1s: [] T2s: [] +T1s: [BU] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [BW] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [BP] T2s: [] +T1s: [] T2s: [] +T1s: [AC, S, AT, D, W, AJ, AM] T2s: [] +T1s: [M] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [P] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [B] T2s: [] +In: FunNClass Method: createMethods +T1s: [] T2s: [AE] +T1s: [B] T2s: [] +In: FunNClass Method: createGenerics +T1s: [] T2s: [] +T1s: [] T2s: [AO] +T1s: [] T2s: [AQ] +T1s: [] T2s: [] +JavaGenerics createGenerics: [] +JavaGenerics createMethods: [] +Cached FunNClass: [] +JavaGenerics Class FunNClass: [] +JavaGenerics FunNClass: [] +T1s: [] T2s: [BQ] +T1s: [] T2s: [] +T1s: [BU] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [BW] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [BP] T2s: [] +T1s: [] T2s: [] +T1s: [AC, S, AT, D, W, AJ, AM] T2s: [] +T1s: [M] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [P] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [B] T2s: [] +In: FunNClass Method: createMethods +T1s: [] T2s: [AE] +T1s: [B] T2s: [] +In: FunNClass Method: createGenerics +T1s: [] T2s: [] +T1s: [] T2s: [AO] +T1s: [] T2s: [AQ] +T1s: [] T2s: [] +T1s: [] T2s: [BQ] +T1s: [] T2s: [] +T1s: [BU] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [BW] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [BP] T2s: [] +T1s: [] T2s: [] +T1s: [AC, S, AT, D, W, AJ, AM] T2s: [] +T1s: [M] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [P] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [B] T2s: [] +In: FunNClass Method: createMethods +T1s: [] T2s: [AE] +T1s: [B] T2s: [] +In: FunNClass Method: createGenerics +T1s: [] T2s: [] +T1s: [] T2s: [AO] +T1s: [] T2s: [AQ] +T1s: [] T2s: [] +TxGenerics createGenerics: [] +TxGenerics createMethods: [] +Cached FunNClass: [] +TxGenerics Class FunNClass: [] +TxGenerics FunNClass: [] +T1s: [] T2s: [BQ] +T1s: [] T2s: [] +T1s: [BU] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [BW] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [BP] T2s: [] +T1s: [] T2s: [] +T1s: [AC, S, AT, D, W, AJ, AM] T2s: [] +T1s: [M] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [P] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [B] T2s: [] +In: FunNClass Method: createMethods +T1s: [] T2s: [AE] +T1s: [B] T2s: [] +In: FunNClass Method: createGenerics +T1s: [] T2s: [] +T1s: [] T2s: [AO] +T1s: [] T2s: [AQ] +T1s: [] T2s: [] +T1s: [] T2s: [BQ] +T1s: [] T2s: [] +T1s: [BU] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [BW] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [BP] T2s: [] +T1s: [] T2s: [] +T1s: [AC, S, AT, D, W, AJ, AM] T2s: [] +T1s: [M] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [P] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [B] T2s: [] +In: FunNClass Method: createMethods +T1s: [] T2s: [AE] +T1s: [B] T2s: [] +In: FunNClass Method: createGenerics +T1s: [] T2s: [] +T1s: [] T2s: [AO] +T1s: [] T2s: [AQ] +T1s: [] T2s: [] +JavaGenerics createGenerics: [] +JavaGenerics createMethods: [] +Cached FunNClass: [] +JavaGenerics Class FunNClass: [] +JavaGenerics FunNClass: [] +T1s: [] T2s: [BQ] +T1s: [] T2s: [] +T1s: [BU] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [BW] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [BP] T2s: [] +T1s: [] T2s: [] +T1s: [AC, S, AT, D, W, AJ, AM] T2s: [] +T1s: [M] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [P] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [B] T2s: [] +In: FunNClass Method: createMethods +T1s: [] T2s: [AE] +T1s: [B] T2s: [] +In: FunNClass Method: createGenerics +T1s: [] T2s: [] +T1s: [] T2s: [AO] +T1s: [] T2s: [AQ] +T1s: [] T2s: [] +T1s: [] T2s: [BQ] +T1s: [] T2s: [] +T1s: [BU] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [BW] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [BP] T2s: [] +T1s: [] T2s: [] +T1s: [AC, S, AT, D, W, AJ, AM] T2s: [] +T1s: [M] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [P] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [B] T2s: [] +In: FunNClass Method: createMethods +T1s: [] T2s: [AE] +T1s: [B] T2s: [] +In: FunNClass Method: createGenerics +T1s: [] T2s: [] +T1s: [] T2s: [AO] +T1s: [] T2s: [AQ] +T1s: [] T2s: [] +TxGenerics createGenerics: [] +TxGenerics createMethods: [] +Cached FunNClass: [] +TxGenerics Class FunNClass: [] +TxGenerics FunNClass: [] +T1s: [] T2s: [BQ] +T1s: [] T2s: [] +T1s: [BU] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [BW] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [BP] T2s: [] +T1s: [] T2s: [] +T1s: [AC, S, AT, D, W, AJ, AM] T2s: [] +T1s: [M] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [P] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [B] T2s: [] +In: FunNClass Method: createMethods +T1s: [] T2s: [AE] +T1s: [B] T2s: [] +In: FunNClass Method: createGenerics +T1s: [] T2s: [] +T1s: [] T2s: [AO] +T1s: [] T2s: [AQ] +T1s: [] T2s: [] +T1s: [] T2s: [BQ] +T1s: [] T2s: [] +T1s: [BU] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [BW] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [BP] T2s: [] +T1s: [] T2s: [] +T1s: [AC, S, AT, D, W, AJ, AM] T2s: [] +T1s: [M] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [P] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [B] T2s: [] +In: FunNClass Method: createMethods +T1s: [] T2s: [AE] +T1s: [B] T2s: [] +In: FunNClass Method: createGenerics +T1s: [] T2s: [] +T1s: [] T2s: [AO] +T1s: [] T2s: [AQ] +T1s: [] T2s: [] +JavaGenerics createGenerics: [] +JavaGenerics createMethods: [] +Cached FunNClass: [] +JavaGenerics Class FunNClass: [] +JavaGenerics FunNClass: [] +T1s: [] T2s: [BQ] +T1s: [] T2s: [] +T1s: [BU] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [BW] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [BP] T2s: [] +T1s: [] T2s: [] +T1s: [AC, S, AT, D, W, AJ, AM] T2s: [] +T1s: [M] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [P] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [B] T2s: [] +In: FunNClass Method: createMethods +T1s: [] T2s: [AE] +T1s: [B] T2s: [] +In: FunNClass Method: createGenerics +T1s: [] T2s: [] +T1s: [] T2s: [AO] +T1s: [] T2s: [AQ] +T1s: [] T2s: [] +T1s: [] T2s: [BQ] +T1s: [] T2s: [] +T1s: [BU] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [BW] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [BP] T2s: [] +T1s: [] T2s: [] +T1s: [AC, S, AT, D, W, AJ, AM] T2s: [] +T1s: [M] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [] T2s: [P] +T1s: [] T2s: [] +T1s: [] T2s: [] +T1s: [B] T2s: [] +In: FunNClass Method: createMethods +T1s: [] T2s: [AE] +T1s: [B] T2s: [] +In: FunNClass Method: createGenerics +T1s: [] T2s: [] +T1s: [] T2s: [AO] +T1s: [] T2s: [AQ] +T1s: [] T2s: [] +TxGenerics createGenerics: [] +TxGenerics createMethods: [] +Cached FunNClass: [] +TxGenerics Class FunNClass: [] +TxGenerics FunNClass: [] +Cached createGenerics: [] +Cached createGenerics: [] +Cached createGenerics: [] +Cached createGenerics: [] +Cached createGenerics: [] +Cached createGenerics: [] +Cached createGenerics: [] +Cached createGenerics: [] +Cached createMethods: [] +Cached createMethods: [] +Cached createMethods: [] +Cached createMethods: [] +Cached createMethods: [] +Cached createMethods: [] +Cached createMethods: [] +Cached createMethods: [] +JavaGenerics FunNClass: [] +TxGenerics FunNClass: [] +JavaGenerics FunNClass: [] +TxGenerics FunNClass: [] +JavaGenerics FunNClass: [] +TxGenerics FunNClass: [] +JavaGenerics FunNClass: [] +TxGenerics FunNClass: [] +generating de.dhbwstuttgart.typeinference.assumptions.FunNClass.class file ... +javatx-src/main/java/de/dhbwstuttgart/typeinference/assumptions/FunNClass.class +de.dhbwstuttgart.typeinference.assumptions.FunNClass.class file generated diff --git a/javatx-src/main/antlr4/de/dhbwstuttgart/parser/antlr/Java17Lexer.g4 b/javatx-src/main/antlr4/de/dhbwstuttgart/parser/antlr/Java17Lexer.g4 new file mode 100644 index 0000000..7be32da --- /dev/null +++ b/javatx-src/main/antlr4/de/dhbwstuttgart/parser/antlr/Java17Lexer.g4 @@ -0,0 +1,241 @@ +/* + [The "BSD licence"] + Copyright (c) 2013 Terence Parr, Sam Harwell + Copyright (c) 2017 Ivan Kochurkin (upgrade to Java 8) + Copyright (c) 2021 Michał Lorek (upgrade to Java 11) + Copyright (c) 2022 Michał Lorek (upgrade to Java 17) + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +lexer grammar Java17Lexer; + +// Keywords + +ABSTRACT: 'abstract'; +ASSERT: 'assert'; +BOOLEAN: 'boolean'; +BREAK: 'break'; +BYTE: 'byte'; +CASE: 'case'; +CATCH: 'catch'; +CHAR: 'char'; +CLASS: 'class'; +CONST: 'const'; +CONTINUE: 'continue'; +DEFAULT: 'default'; +DO: 'do'; +DOUBLE: 'double'; +ELSE: 'else'; +ENUM: 'enum'; +EXTENDS: 'extends'; +FINAL: 'final'; +FINALLY: 'finally'; +FLOAT: 'float'; +FOR: 'for'; +IF: 'if'; +GOTO: 'goto'; +IMPLEMENTS: 'implements'; +IMPORT: 'import'; +INSTANCEOF: 'instanceof'; +INT: 'int'; +INTERFACE: 'interface'; +LONG: 'long'; +NATIVE: 'native'; +NEW: 'new'; +PACKAGE: 'package'; +PRIVATE: 'private'; +PROTECTED: 'protected'; +PUBLIC: 'public'; +RETURN: 'return'; +SHORT: 'short'; +STATIC: 'static'; +STRICTFP: 'strictfp'; +SUPER: 'super'; +SWITCH: 'switch'; +SYNCHRONIZED: 'synchronized'; +THIS: 'this'; +THROW: 'throw'; +THROWS: 'throws'; +TRANSIENT: 'transient'; +TRY: 'try'; +VOID: 'void'; +VOLATILE: 'volatile'; +WHILE: 'while'; + +// Module related keywords +MODULE: 'module'; +OPEN: 'open'; +REQUIRES: 'requires'; +EXPORTS: 'exports'; +OPENS: 'opens'; +TO: 'to'; +USES: 'uses'; +PROVIDES: 'provides'; +WITH: 'with'; +TRANSITIVE: 'transitive'; + +// Local Variable Type Inference +VAR: 'var'; // reserved type name + +// Switch Expressions +YIELD: 'yield'; // reserved type name from Java 14 + +// Records +RECORD: 'record'; + +// Sealed Classes +SEALED: 'sealed'; +PERMITS: 'permits'; +NON_SEALED: 'non-sealed'; + +// Literals + +DECIMAL_LITERAL: ('0' | [1-9] (Digits? | '_'+ Digits)) [lL]?; +HEX_LITERAL: '0' [xX] [0-9a-fA-F] ([0-9a-fA-F_]* [0-9a-fA-F])? [lL]?; +OCT_LITERAL: '0' '_'* [0-7] ([0-7_]* [0-7])? [lL]?; +BINARY_LITERAL: '0' [bB] [01] ([01_]* [01])? [lL]?; + +FLOAT_LITERAL: (Digits '.' Digits? | '.' Digits) ExponentPart? [fFdD]? + | Digits (ExponentPart [fFdD]? | [fFdD]) + ; + +HEX_FLOAT_LITERAL: '0' [xX] (HexDigits '.'? | HexDigits? '.' HexDigits) [pP] [+-]? Digits [fFdD]?; + +BOOL_LITERAL: 'true' + | 'false' + ; + +CHAR_LITERAL: '\'' (~['\\\r\n] | EscapeSequence) '\''; + +STRING_LITERAL: '"' (~["\\\r\n] | EscapeSequence)* '"'; + +TEXT_BLOCK: '"""' [ \t]* [\r\n] (. | EscapeSequence)*? '"""'; + +NULL_LITERAL: 'null'; + +// Separators + +LPAREN: '('; +RPAREN: ')'; +LBRACE: '{'; +RBRACE: '}'; +LBRACK: '['; +RBRACK: ']'; +SEMI: ';'; +COMMA: ','; +DOT: '.'; + +// Operators + +ASSIGN: '='; +GT: '>'; +LT: '<'; +BANG: '!'; +TILDE: '~'; +QUESTION: '?'; +COLON: ':'; +EQUAL: '=='; +LE: '<='; +GE: '>='; +NOTEQUAL: '!='; +AND: '&&'; +OR: '||'; +INC: '++'; +DEC: '--'; +ADD: '+'; +SUB: '-'; +MUL: '*'; +DIV: '/'; +BITAND: '&'; +BITOR: '|'; +CARET: '^'; +MOD: '%'; + +ADD_ASSIGN: '+='; +SUB_ASSIGN: '-='; +MUL_ASSIGN: '*='; +DIV_ASSIGN: '/='; +AND_ASSIGN: '&='; +OR_ASSIGN: '|='; +XOR_ASSIGN: '^='; +MOD_ASSIGN: '%='; +LSHIFT_ASSIGN: '<<='; +RSHIFT_ASSIGN: '>>='; +URSHIFT_ASSIGN: '>>>='; + +// Java 8 tokens + +ARROW: '->'; +COLONCOLON: '::'; + +// Additional symbols not defined in the lexical specification + +AT: '@'; +ELLIPSIS: '...'; + +// Whitespace and comments + +WS: [ \t\r\n\u000C]+ -> channel(HIDDEN); +COMMENT: '/*' .*? '*/' -> channel(HIDDEN); +LINE_COMMENT: '//' ~[\r\n]* -> channel(HIDDEN); + +// Identifiers + +IDENTIFIER: Letter LetterOrDigit*; + +// Fragment rules + +fragment ExponentPart + : [eE] [+-]? Digits + ; + +fragment EscapeSequence + : '\\' [btnfr"'\\] + | '\\' ([0-3]? [0-7])? [0-7] + | '\\' 'u'+ HexDigit HexDigit HexDigit HexDigit + ; + +fragment HexDigits + : HexDigit ((HexDigit | '_')* HexDigit)? + ; + +fragment HexDigit + : [0-9a-fA-F] + ; + +fragment Digits + : [0-9] ([0-9_]* [0-9])? + ; + +fragment LetterOrDigit + : Letter + | [0-9] + ; + +fragment Letter + : [a-zA-Z$_] // these are the "java letters" below 0x7F + | ~[\u0000-\u007F\uD800-\uDBFF] // covers all characters above 0x7F which are not a surrogate + | [\uD800-\uDBFF] [\uDC00-\uDFFF] // covers UTF-16 surrogate pairs encodings for U+10000 to U+10FFFF + ; \ No newline at end of file diff --git a/javatx-src/main/antlr4/de/dhbwstuttgart/parser/antlr/Java17Parser.g4 b/javatx-src/main/antlr4/de/dhbwstuttgart/parser/antlr/Java17Parser.g4 new file mode 100644 index 0000000..be87c4d --- /dev/null +++ b/javatx-src/main/antlr4/de/dhbwstuttgart/parser/antlr/Java17Parser.g4 @@ -0,0 +1,816 @@ +/* + [The "BSD licence"] + Copyright (c) 2013 Terence Parr, Sam Harwell + Copyright (c) 2017 Ivan Kochurkin (upgrade to Java 8) + Copyright (c) 2021 Michał Lorek (upgrade to Java 11) + Copyright (c) 2022 Michał Lorek (upgrade to Java 17) + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +parser grammar Java17Parser; + +options { tokenVocab=Java17Lexer; } + +sourceFile + : packageDeclaration? importDeclaration* classOrInterface* # srcfile + | moduleDeclaration EOF # moduledecl + ; + +packageDeclaration + : annotation* PACKAGE qualifiedName ';' + ; + +importDeclaration + : IMPORT STATIC? qualifiedName ('.' '*')? ';' + ; + +classOrInterface + : classOrInterfaceModifier* + (classDeclaration | enumDeclaration | interfaceDeclaration | annotationTypeDeclaration | recordDeclaration) # classorinterfacedecl + | ';' # noclassorinterface + ; + +modifier + : classOrInterfaceModifier + | NATIVE + | SYNCHRONIZED + | TRANSIENT + | VOLATILE + ; + +classOrInterfaceModifier + : annotation + | PUBLIC + | PROTECTED + | PRIVATE + | STATIC + | ABSTRACT + | FINAL // FINAL for class only -- does not apply to interfaces + | STRICTFP + | SEALED // Java17 + | NON_SEALED // Java17 + ; + +variableModifier + : FINAL # finalvarmod + | annotation # annotationvarmod + ; + +classDeclaration + : CLASS identifier genericDeclarationList? + (EXTENDS typeType)? + (IMPLEMENTS typeList)? + (PERMITS typeList)? // Java17 + classBody + ; + +genericDeclarationList + : '<' genericTypeVar (',' genericTypeVar)* '>' + ; + +genericTypeVar + : annotation* identifier ((EXTENDS | IMPLEMENTS) annotation* typeBound)? + ; + +typeBound + : typeType ('&' typeType)* + ; + +enumDeclaration + : ENUM identifier (IMPLEMENTS typeList)? '{' enumConstants? ','? enumBodyDeclarations? '}' + ; + +enumConstants + : enumConstant (',' enumConstant)* + ; + +enumConstant + : annotation* identifier arguments? classBody? + ; + +enumBodyDeclarations + : ';' classBodyDeclaration* + ; + +interfaceDeclaration + : INTERFACE identifier genericDeclarationList? (EXTENDS typeList)? (PERMITS typeList)? interfaceBody + ; + +classBody + : '{' classBodyDeclaration* '}' + ; + +interfaceBody + : '{' interfaceBodyDeclaration* '}' + ; + +classBodyDeclaration + : ';' # emptyclassbody + | STATIC? block # classblock + | modifier* memberDeclaration # memberdecl + ; + +memberDeclaration + : classOrInterface # memberclassorinterface + | fieldDeclaration # memberfield + | method # membermethod + | constructor # memberconstructor + ; + +method + : methodDeclaration # methoddecl + | genericMethodDeclaration # genericmethod + ; + +/* We use rule this even for void methods which cannot have [] after parameters. + This simplifies grammar and we can consider void to be a type, which + renders the [] matching as a context-sensitive issue or a semantic check + for invalid return type after parsing. + */ +methodDeclaration + : methodHeader + (THROWS exceptionList)? + methodBody + ; + +methodHeader + : refType? identifier formalParameters ('[' ']')* + ; + +methodBody + : block # methodblock + | ';' # emptymethod + ; + +refType + : typeType # refType2 + | VOID # refvoid + ; + +genericMethodDeclaration + : genericDeclarationList methodDeclaration + ; + +constructor + : genericConstructorDeclaration # genericconstructor + | constructorDeclaration # constructordecl + ; + +genericConstructorDeclaration + : genericDeclarationList constructorDeclaration + ; + +constructorDeclaration + : identifier formalParameters (THROWS exceptionList)? constructorBody=block + ; + +fieldDeclaration + : typeType? variableDeclarators ';' + ; + +interfaceBodyDeclaration + : modifier* interfaceMemberDeclaration # interfacemember + | ';' # emptyinterface + ; + +interfaceMemberDeclaration + : constDeclaration # interfaceconst + | interfaceMethodDeclaration # interfacemethod + | genericInterfaceMethodDeclaration # genericinterfacemethod + | classOrInterface # subclassorinterface + ; + +constDeclaration + : typeType? constantDeclarator (',' constantDeclarator)* ';' + ; + +constantDeclarator + : identifier ('[' ']')* '=' variableInitializer + ; + +// Early versions of Java allows brackets after the method name, eg. +// public int[] return2DArray() [] { ... } +// is the same as +// public int[][] return2DArray() { ... } +interfaceMethodDeclaration + : interfaceMethodModifier* interfaceCommonBodyDeclaration + ; + +// Java8 +interfaceMethodModifier + : annotation + | PUBLIC + | ABSTRACT + | DEFAULT + | STATIC + | STRICTFP + ; + +genericInterfaceMethodDeclaration + : interfaceMethodModifier* genericDeclarationList interfaceCommonBodyDeclaration + ; + +interfaceCommonBodyDeclaration + : annotation* refType? identifier formalParameters ('[' ']')* (THROWS exceptionList)? methodBody + ; + +variableDeclarators + : variableDeclarator (',' variableDeclarator)* + ; + +variableDeclarator + : variableDeclaratorId ('=' variableInitializer)? + ; + +variableDeclaratorId + : identifier ('[' ']')* + ; + +variableInitializer + : arrayInitializer + | expression + ; + +arrayInitializer + : '{' (variableInitializer (',' variableInitializer)* (',')? )? '}' + ; + +classOrInterfaceType + : (identifier typeArguments? '.')* typeIdentifier typeArguments? + ; + +typeArgument + : typeType + | wildcardType + ; + +wildcardType + : annotation* '?' (extendsWildcardType | superWildcardType)? + ; + +extendsWildcardType + : EXTENDS typeType + ; + +superWildcardType + : SUPER typeType + ; + +qualifiedNameList + : qualifiedName (',' qualifiedName)* + ; + +exceptionList + : qualifiedNameList + ; + +formalParameters + : '(' ( receiverParameter? + | receiverParameter (',' formalParameterList)? + | formalParameterList? + ) ')' + ; + +receiverParameter + : typeType? (identifier '.')* THIS + ; + +formalParameterList + : formalParameter (',' formalParameter)* (',' lastFormalParameter)? + | lastFormalParameter + ; + +formalParameter + : variableModifier* typeType? variableDeclaratorId + | pattern // Pattern matching for Methods + ; + +lastFormalParameter + : variableModifier* typeType? annotation* '...' variableDeclaratorId + ; + +// local variable type inference +lambdaLVTIList + : lambdaLVTIParameter (',' lambdaLVTIParameter)* + ; + +lambdaLVTIParameter + : variableModifier* VAR identifier + ; + +qualifiedName + : identifier ('.' identifier)* + ; + +literal + : integerLiteral # intLiteral + | floatLiteral # fltLiteral + | CHAR_LITERAL # charLiteral + | STRING_LITERAL # stringLiteral + | BOOL_LITERAL # boolLiteral + | NULL_LITERAL # nullLiteral + | TEXT_BLOCK # textBlock // Java17 + ; + +integerLiteral + : DECIMAL_LITERAL + | HEX_LITERAL + | OCT_LITERAL + | BINARY_LITERAL + ; + +floatLiteral + : FLOAT_LITERAL + | HEX_FLOAT_LITERAL + ; + +// ANNOTATIONS +altAnnotationQualifiedName + : (identifier DOT)* '@' identifier + ; + +annotation + : ('@' qualifiedName | altAnnotationQualifiedName) ('(' ( elementValuePairs | elementValue )? ')')? + ; + +elementValuePairs + : elementValuePair (',' elementValuePair)* + ; + +elementValuePair + : identifier '=' elementValue + ; + +elementValue + : expression + | annotation + | elementValueArrayInitializer + ; + +elementValueArrayInitializer + : '{' (elementValue (',' elementValue)*)? (',')? '}' + ; + +annotationTypeDeclaration + : '@' INTERFACE identifier annotationTypeBody + ; + +annotationTypeBody + : '{' (annotationTypeElementDeclaration)* '}' + ; + +annotationTypeElementDeclaration + : modifier* annotationTypeElementRest + | ';' // this is not allowed by the grammar, but apparently allowed by the actual compiler + ; + +annotationTypeElementRest + : typeType annotationMethodOrConstantRest ';' + | classOrInterface ';'? + ; + +annotationMethodOrConstantRest + : annotationMethodRest + | annotationConstantRest + ; + +annotationMethodRest + : identifier '(' ')' defaultValue? + ; + +annotationConstantRest + : variableDeclarators + ; + +defaultValue + : DEFAULT elementValue + ; + +// MODULES - Java9 + +moduleDeclaration + : OPEN? MODULE qualifiedName moduleBody + ; + +moduleBody + : '{' moduleDirective* '}' + ; + +moduleDirective + : REQUIRES requiresModifier* qualifiedName ';' + | EXPORTS qualifiedName (TO qualifiedName)? ';' + | OPENS qualifiedName (TO qualifiedName)? ';' + | USES qualifiedName ';' + | PROVIDES qualifiedName WITH qualifiedName ';' + ; + +requiresModifier + : TRANSITIVE + | STATIC + ; + +// RECORDS - Java 17 + +recordDeclaration + : RECORD identifier genericDeclarationList? recordHeader + (IMPLEMENTS typeList)? + recordBody + ; + +recordHeader + : '(' recordComponentList? ')' + ; + +recordComponentList + : recordComponent (',' recordComponent)* + ; + +recordComponent + : typeType? identifier + ; + +recordBody + : '{' classBodyDeclaration* '}' + ; + +// STATEMENTS / BLOCKS + +block + : '{' blockStatement* '}' + ; + +blockStatement + : localVariableDeclaration ';' + | localTypeDeclaration + | statement + ; + +localVariableDeclaration + : variableModifier* (VAR | typeType) variableDeclarators + ; + +identifier + : IDENTIFIER + | MODULE + | OPEN + | REQUIRES + | EXPORTS + | OPENS + | TO + | USES + | PROVIDES + | WITH + | TRANSITIVE + | YIELD + | SEALED + | PERMITS + | RECORD + | VAR + ; + +typeIdentifier // Identifiers that are not restricted for type declarations + : IDENTIFIER + | MODULE + | OPEN + | REQUIRES + | EXPORTS + | OPENS + | TO + | USES + | PROVIDES + | WITH + | TRANSITIVE + | SEALED + | PERMITS + | RECORD + ; + +localTypeDeclaration + : classOrInterfaceModifier* + (classDeclaration | interfaceDeclaration | recordDeclaration) + | ';' + ; + +statement + : blockLabel=block #blockstmt + | ASSERT expression (':' expression)? ';' #assertstmt + | IF parExpression statement (ELSE statement)? #conditionalstmt + | FOR '(' forControl ')' statement #forloop + | WHILE parExpression statement #whileloop + | DO statement WHILE parExpression ';' #dowhileloop + | TRY block (catchClause+ finallyBlock? | finallyBlock) #trycatchblock + | TRY resourceSpecification block catchClause* finallyBlock? #trycatchresource + | SWITCH parExpression '{' switchBlockStatementGroup* switchLabel* '}' #switchstmt + | SYNCHRONIZED parExpression block #synchronizedstmt + | RETURN expression? ';' #returnstmt + | THROW expression ';' #throwstmt + | BREAK identifier? ';' #breakstmt + | CONTINUE identifier? ';' #continuestmt + | YIELD expression ';' #yieldstmt // Java17 + | SEMI #semistmt + | statementExpression=expression ';' #stmtexpression + | identifierLabel=identifier ':' statement #labeledstmt + ; + +catchClause + : CATCH '(' variableModifier* catchType? identifier ')' block + ; + +catchType + : qualifiedName ('|' qualifiedName)* + ; + +finallyBlock + : FINALLY block + ; + +resourceSpecification + : '(' resources ';'? ')' + ; + +resources + : resource (';' resource)* + ; + +resource + : variableModifier* ( classOrInterfaceType? variableDeclaratorId | VAR identifier ) '=' expression + | identifier + ; + +/** Matches cases then statements, both of which are mandatory. + * To handle empty cases at the end, we add switchLabel* to statement. + */ +switchBlockStatementGroup + : switchLabel+ blockStatement+ + ; + +switchLabel + : CASE constantExpression=expression ':' #switchLabelConst + | CASE enumConstantName=IDENTIFIER ':' #switchLabelEnum + | CASE pattern ':' #switchLabelPattern + | DEFAULT ':' #switchLabelDefault + ; + +forControl + : enhancedForControl + | forInit? ';' expression? ';' forUpdate=expressionList? + ; + +forInit + : localVariableDeclaration + | expressionList + ; + +enhancedForControl + : variableModifier* (typeType? | VAR) variableDeclaratorId ':' expression + ; + +// EXPRESSIONS + +parExpression + : '(' expression ')' + ; + +expressionList + : expression (',' expression)* + ; + +methodCall + : identifier '(' expressionList? ')' + | THIS '(' expressionList? ')' + | SUPER '(' expressionList? ')' + ; + +expression + : primary #primaryExpression2 + | expression bop='.' + ( + identifier + | methodCall + | THIS + | NEW nonWildcardTypeArguments? innerCreator + | SUPER superSuffix + | explicitGenericInvocation + ) # dottedexpression + | expression '[' expression ']' #arrayaccessexpression + | methodCall #methodcallexpression + | NEW creator #newinstanceexpression + | '(' annotation* typeType ('&' typeType)* ')' expression #castexpression + | expression postfix=('++' | '--') #postfixexpression + | prefix=('+'|'-'|'++'|'--'|'~'|'!') expression #prefixexpression + | expression bop=('*'|'/'|'%') expression #mathmuldivmodexpression + | expression bop=('+'|'-') expression #mathaddsubexpression + | expression ('<' '<' | '>' '>' '>' | '>' '>') expression #shiftexpression + | expression bop=('<=' | '>=' | '>' | '<') expression #relationalexpression + | expression bop=INSTANCEOF (typeType | pattern) #instanceofexpression + | expression bop=('==' | '!=') expression #equalityexpression + | expression bop='&' expression #bitwiseandexpression + | expression bop='^' expression #bitwisexorexpression + | expression bop='|' expression #bitwiseorexpression + | expression bop='&&' expression #andexpression + | expression bop='||' expression #orexpression + | expression bop='?' expression ':' expression #conditionalassignexpression + | expression + bop=('=' | '+=' | '-=' | '*=' | '/=' | '&=' | '|=' | '^=' | '>>=' | '>>>=' | '<<=' | '%=') + expression #assignexpression + | lambdaExpression #lambdaExpression2 // Java8 + | switchExpression #switchExpression2 // Java17 + + // Java 8 methodReference + | expression '::' typeArguments? identifier #methodreferenceexpression + | typeType '::' (typeArguments? identifier | NEW) #methodorcreatorreferenceexpression + | classType '::' typeArguments? NEW #creatorreferenceexpression + ; + +// Java17 +pattern + : primaryPattern #pPattern + | guardedPattern #gPattern + ; + +primaryPattern + : typePattern #tPattern + | recordPattern #rPattern + | '(' pattern ')' #enclosedPattern + ; + +recordPattern + : typeType recordStructurePattern identifier? + ; + +typePattern + : variableModifier* typeType identifier + ; + +recordStructurePattern + : '(' recordComponentPatternList? ')' + ; + +recordComponentPatternElement + : pattern + | identifier + ; + +recordComponentPatternList + : pattern (',' pattern)* + ; + +// Java8 +lambdaExpression + : lambdaParameters '->' lambdaBody + ; + +// Java8 +lambdaParameters + : identifier + | '(' formalParameterList? ')' + | '(' identifier (',' identifier)* ')' + | '(' lambdaLVTIList? ')' + ; + +// Java8 +lambdaBody + : expression + | block + ; + +primary + : '(' expression ')' # primaryExpression + | THIS # primaryThis + | SUPER # primarySuper + | literal # primaryLiteral + | identifier # primaryIdentifier + | refType '.' CLASS # primaryClassref + | nonWildcardTypeArguments (explicitGenericInvocationSuffix | THIS arguments) # primaryInvocation + ; + +// Java17 +switchExpression + : SWITCH parExpression '{' switchLabeledRule* '}' + ; + +// Java17 +switchLabeledRule + : switchLabelCase switchRuleOutcome + ; + +switchLabelCase + : CASE expressionList (ARROW | COLON) #labeledRuleExprList + | CASE NULL_LITERAL (ARROW | COLON) #labeledRuleNull + | CASE pattern (ARROW | COLON) #labeledRulePattern + | DEFAULT (ARROW | COLON) #labeledRuleDefault + ; + +// Java20 +guardedPattern + : primaryPattern WITH expression + ; + +// Java17 +switchRuleOutcome + : block + | expression ';' + ; + +classType + : (classOrInterfaceType '.')? annotation* identifier typeArguments? + ; + +creator + : nonWildcardTypeArguments createdName classCreatorRest + | createdName (arrayCreatorRest | classCreatorRest) + ; + +createdName + : identifier typeArgumentsOrDiamond? + | primitiveType + ; + +innerCreator + : identifier nonWildcardTypeArgumentsOrDiamond? classCreatorRest + ; + +arrayCreatorRest + : '[' (']' ('[' ']')* arrayInitializer | expression ']' ('[' expression ']')* ('[' ']')*) + ; + +classCreatorRest + : arguments classBody? + ; + +explicitGenericInvocation + : nonWildcardTypeArguments explicitGenericInvocationSuffix + ; + +typeArgumentsOrDiamond + : '<' '>' + | typeArguments + ; + +nonWildcardTypeArgumentsOrDiamond + : '<' '>' + | nonWildcardTypeArguments + ; + +nonWildcardTypeArguments + : '<' typeList '>' + ; + +typeList + : typeType (',' typeType)* + ; + +typeType + : annotation* (classOrInterfaceType | primitiveType) (annotation* '[' ']')* + ; + +primitiveType + : BOOLEAN + | CHAR + | BYTE + | SHORT + | INT + | LONG + | FLOAT + | DOUBLE + ; + +typeArguments + : '<' typeArgument (',' typeArgument)* '>' + ; + +superSuffix + : arguments + | '.' typeArguments? identifier arguments? + ; + +explicitGenericInvocationSuffix + : SUPER superSuffix + | identifier arguments + ; + +arguments + : '(' expressionList? ')' + ; \ No newline at end of file diff --git a/javatx-src/main/java/Main.java b/javatx-src/main/java/Main.java new file mode 100644 index 0000000..7a571a4 --- /dev/null +++ b/javatx-src/main/java/Main.java @@ -0,0 +1,10 @@ +import de.dhbwstuttgart.core.ConsoleInterface; + +import java.io.IOException; + +public class Main { + + public static void main(String[] args) throws IOException, ClassNotFoundException { + ConsoleInterface.main(args); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/bytecode/CodeGenException.java b/javatx-src/main/java/de/dhbwstuttgart/bytecode/CodeGenException.java new file mode 100644 index 0000000..633e0a1 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/bytecode/CodeGenException.java @@ -0,0 +1,7 @@ +package de.dhbwstuttgart.bytecode; + +public class CodeGenException extends RuntimeException { + public CodeGenException(String cause) { + super(cause); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/bytecode/Codegen.java b/javatx-src/main/java/de/dhbwstuttgart/bytecode/Codegen.java new file mode 100644 index 0000000..52bffb3 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/bytecode/Codegen.java @@ -0,0 +1,1567 @@ +package de.dhbwstuttgart.bytecode; + +import de.dhbwstuttgart.core.JavaTXCompiler; +import de.dhbwstuttgart.exceptions.NotImplementedException; +import de.dhbwstuttgart.parser.NullToken; +import de.dhbwstuttgart.parser.scope.JavaClassName; +import de.dhbwstuttgart.syntaxtree.ClassOrInterface; +import de.dhbwstuttgart.syntaxtree.type.RefType; +import de.dhbwstuttgart.target.tree.*; +import de.dhbwstuttgart.target.tree.expression.*; +import de.dhbwstuttgart.target.tree.type.*; +import org.objectweb.asm.*; + +import java.lang.invoke.*; +import java.lang.reflect.Modifier; +import java.util.*; + +import static org.objectweb.asm.Opcodes.*; +import static de.dhbwstuttgart.target.tree.expression.TargetBinaryOp.*; +import static de.dhbwstuttgart.target.tree.expression.TargetLiteral.*; + +public class Codegen { + private final TargetStructure clazz; + private final ClassWriter cw; + public final String className; + private int lambdaCounter = 0; + private final HashMap lambdas = new HashMap<>(); + private final JavaTXCompiler compiler; + + public Codegen(TargetStructure clazz, JavaTXCompiler compiler) { + this.clazz = clazz; + this.className = clazz.qualifiedName().getClassName(); + this.cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS) { + @Override + protected ClassLoader getClassLoader() { + return compiler.getClassLoader(); + } + }; + this.compiler = compiler; + } + + private record LocalVar(int index, String name, TargetType type) { + } + + private static class Scope { + Scope parent; + Map locals = new HashMap<>(); + + Scope(Scope parent) { + this.parent = parent; + } + + void add(LocalVar var) { + locals.put(var.name, var); + } + + LocalVar get(String name) { + var local = locals.get(name); + if (local != null) { + return local; + } + if (parent != null) { + return parent.get(name); + } + throw new CodeGenException("Unknown symbol '" + name + "'"); + } + } + + private static class BreakEnv { + String labelName; // TODO This is for labeled statements (Not implemented) + Label startLabel; + Label endLabel; + } + + private static class State { + Scope scope = new Scope(null); + int localCounter; + MethodVisitor mv; + TargetType returnType; + // This is used to remember the type from lambda expressions + TargetType contextType; + + Stack breakStack = new Stack<>(); + Stack switchResultValue = new Stack<>(); + + State(TargetType returnType, MethodVisitor mv, int localCounter) { + this.returnType = returnType; + this.mv = mv; + this.localCounter = localCounter; + } + + void enterScope() { + this.scope = new Scope(this.scope); + } + + void exitScope() { + this.scope = this.scope.parent; + } + + LocalVar createVariable(String name, TargetType type) { + var local = new LocalVar(localCounter, name, type); + scope.add(local); + localCounter += 1; + return local; + } + + void pushSwitch() { + switchResultValue.push(this.localCounter++); + } + void popSwitch() { + switchResultValue.pop(); + } + } + + private void popValue(State state, TargetType type) { + if (type.equals(TargetType.Double) || type.equals(TargetType.Long)) + state.mv.visitInsn(POP2); + else + state.mv.visitInsn(POP); + } + + private void boxPrimitive(State state, TargetType type) { + var mv = state.mv; + if (type.equals(TargetType.Boolean) || type.equals(TargetType.boolean_)) { + mv.visitMethodInsn(INVOKESTATIC, "java/lang/Boolean", "valueOf", "(Z)Ljava/lang/Boolean;", false); + } else if (type.equals(TargetType.Byte) || type.equals(TargetType.byte_)) { + mv.visitMethodInsn(INVOKESTATIC, "java/lang/Byte", "valueOf", "(B)Ljava/lang/Byte;", false); + } else if (type.equals(TargetType.Double) || type.equals(TargetType.double_)) { + mv.visitMethodInsn(INVOKESTATIC, "java/lang/Double", "valueOf", "(D)Ljava/lang/Double;", false); + } else if (type.equals(TargetType.Long) || type.equals(TargetType.long_)) { + mv.visitMethodInsn(INVOKESTATIC, "java/lang/Long", "valueOf", "(J)Ljava/lang/Long;", false); + } else if (type.equals(TargetType.Integer) || type.equals(TargetType.int_)) { + mv.visitMethodInsn(INVOKESTATIC, "java/lang/Integer", "valueOf", "(I)Ljava/lang/Integer;", false); + } else if (type.equals(TargetType.Float) || type.equals(TargetType.float_)) { + mv.visitMethodInsn(INVOKESTATIC, "java/lang/Float", "valueOf", "(F)Ljava/lang/Float;", false); + } else if (type.equals(TargetType.Short) || type.equals(TargetType.short_)) { + mv.visitMethodInsn(INVOKESTATIC, "java/lang/Short", "valueOf", "(S)Ljava/lang/Short;", false); + } else if (type.equals(TargetType.Char) || type.equals(TargetType.char_)) { + mv.visitMethodInsn(INVOKESTATIC, "java/lang/Character", "valueOf", "(C)Ljava/lang/Character;", false); + } + } + + private void unboxPrimitive(State state, TargetType type) { + var mv = state.mv; + if (type.equals(TargetType.Boolean)) { + mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Boolean", "booleanValue", "()Z", false); + } else if (type.equals(TargetType.Byte)) { + mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Byte", "byteValue", "()B", false); + } else if (type.equals(TargetType.Double)) { + mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Double", "doubleValue", "()D", false); + } else if (type.equals(TargetType.Long)) { + mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Long", "longValue", "()J", false); + } else if (type.equals(TargetType.Integer)) { + mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Integer", "intValue", "()I", false); + } else if (type.equals(TargetType.Float)) { + mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Float", "floatValue", "()F", false); + } else if (type.equals(TargetType.Short)) { + mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Short", "shortValue", "()S", false); + } else if (type.equals(TargetType.Char)) { + mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Character", "charValue", "()C", false); + } + } + + private void generateRelationalOperator(State state, TargetRelationalOp op, TargetType type, int code) { + var mv = state.mv; + Label if_true = new Label(); + Label end = new Label(); + generate(state, op.left()); + convertTo(state, op.left().type(), type); + generate(state, op.right()); + convertTo(state, op.right().type(), type); + mv.visitJumpInsn(code, if_true); + mv.visitInsn(ICONST_0); + mv.visitJumpInsn(GOTO, end); + mv.visitLabel(if_true); + mv.visitInsn(ICONST_1); + mv.visitLabel(end); + } + + private void generateRelationalOperator(State state, TargetRelationalOp op, TargetType type, int cmp, int code) { + var mv = state.mv; + Label if_true = new Label(); + Label end = new Label(); + generate(state, op.left()); + convertTo(state, op.left().type(), type); + generate(state, op.right()); + convertTo(state, op.right().type(), type); + mv.visitInsn(cmp); + mv.visitJumpInsn(code, if_true); + mv.visitInsn(ICONST_0); + mv.visitJumpInsn(GOTO, end); + mv.visitLabel(if_true); + mv.visitInsn(ICONST_1); + mv.visitLabel(end); + } + + private void convertToString(State state, TargetType type) { + var mv = state.mv; + if (type.equals(TargetType.Boolean)) { + mv.visitMethodInsn(INVOKESTATIC, "java/lang/String", "valueOf", "(Z)Ljava/lang/Boolean;", false); + } else if (type.equals(TargetType.Byte)) { + mv.visitMethodInsn(INVOKESTATIC, "java/lang/String", "valueOf", "(B)Ljava/lang/Byte;", false); + } else if (type.equals(TargetType.Double)) { + mv.visitMethodInsn(INVOKESTATIC, "java/lang/String", "valueOf", "(D)Ljava/lang/Double;", false); + } else if (type.equals(TargetType.Long)) { + mv.visitMethodInsn(INVOKESTATIC, "java/lang/String", "valueOf", "(J)Ljava/lang/Long;", false); + } else if (type.equals(TargetType.Integer)) { + mv.visitMethodInsn(INVOKESTATIC, "java/lang/String", "valueOf", "(I)Ljava/lang/Integer;", false); + } else if (type.equals(TargetType.Float)) { + mv.visitMethodInsn(INVOKESTATIC, "java/lang/String", "valueOf", "(F)Ljava/lang/Float;", false); + } else if (type.equals(TargetType.Short)) { + mv.visitMethodInsn(INVOKESTATIC, "java/lang/String", "valueOf", "(S)Ljava/lang/Short;", false); + } else if (type.equals(TargetType.Char)) { + mv.visitMethodInsn(INVOKESTATIC, "java/lang/String", "valueOf", "(C)Ljava/lang/Char;", false); + } + } + + private void convertTo(State state, TargetType source, TargetType dest) { + var mv = state.mv; + if (source.equals(dest)) + return; + if (source.equals(TargetType.Long)) { + if (dest.equals(TargetType.Integer)) { + mv.visitInsn(L2I); + } else if (dest.equals(TargetType.Float)) + mv.visitInsn(L2F); + else if (dest.equals(TargetType.Double)) + mv.visitInsn(L2D); + else if (dest.equals(TargetType.Byte) || dest.equals(TargetType.Char) || dest.equals(TargetType.Short)) { + mv.visitInsn(L2I); + convertTo(state, TargetType.Integer, dest); + } + } else if (source.equals(TargetType.Float)) { + if (dest.equals(TargetType.Integer)) + mv.visitInsn(F2I); + else if (dest.equals(TargetType.Double)) + mv.visitInsn(F2D); + else if (dest.equals(TargetType.Long)) + mv.visitInsn(F2L); + else if (dest.equals(TargetType.Byte) || dest.equals(TargetType.Char) || dest.equals(TargetType.Short)) { + mv.visitInsn(F2I); + convertTo(state, TargetType.Integer, dest); + } + } else if (source.equals(TargetType.Double)) { + if (dest.equals(TargetType.Integer)) + mv.visitInsn(D2I); + else if (dest.equals(TargetType.Float)) + mv.visitInsn(D2F); + else if (dest.equals(TargetType.Long)) + mv.visitInsn(D2L); + else if (dest.equals(TargetType.Byte) || dest.equals(TargetType.Char) || dest.equals(TargetType.Short)) { + mv.visitInsn(D2I); + convertTo(state, TargetType.Integer, dest); + } + } else if (source.equals(TargetType.Byte) || source.equals(TargetType.Char) || source.equals(TargetType.Short) || source.equals(TargetType.Integer)) { + if (dest.equals(TargetType.Byte)) + mv.visitInsn(I2B); + else if (dest.equals(TargetType.Char)) + mv.visitInsn(I2C); + else if (dest.equals(TargetType.Short)) + mv.visitInsn(I2S); + else if (dest.equals(TargetType.Long)) + mv.visitInsn(I2L); + else if (dest.equals(TargetType.Float)) + mv.visitInsn(I2F); + else if (dest.equals(TargetType.Double)) + mv.visitInsn(I2D); + } else if (!(dest instanceof TargetGenericType)) { + boxPrimitive(state, source); + mv.visitTypeInsn(CHECKCAST, dest.getInternalName()); + unboxPrimitive(state, dest); + } + } + + private TargetType largerType(TargetType left, TargetType right) { + if (left.equals(TargetType.String) || right.equals(TargetType.String)) { + return TargetType.String; + } else if (left.equals(TargetType.Double) || right.equals(TargetType.Double)) { + return TargetType.Double; + } else if (left.equals(TargetType.Float) || right.equals(TargetType.Float)) { + return TargetType.Float; + } else if (left.equals(TargetType.Long) || right.equals(TargetType.Long)) { + return TargetType.Long; + } else { + return TargetType.Integer; + } + } + + private void generateBinaryOp(State state, TargetBinaryOp op) { + var mv = state.mv; + switch (op) { + case Add add: { + if (add.type().equals(TargetType.String)) { + mv.visitTypeInsn(NEW, "java/lang/StringBuilder"); + mv.visitInsn(DUP); + generate(state, add.left()); + convertToString(state, add.left().type()); + mv.visitMethodInsn(INVOKESPECIAL, "java/lang/StringBuilder", "", "(Ljava/lang/String;)V", false); + } else { + generate(state, add.left()); + convertTo(state, add.left().type(), add.type()); + generate(state, add.right()); + convertTo(state, add.right().type(), add.type()); + var type = add.type(); + if (type.equals(TargetType.Byte) || type.equals(TargetType.Char) || type.equals(TargetType.Integer) || type.equals(TargetType.Short)) { + mv.visitInsn(IADD); + } else if (type.equals(TargetType.Long)) { + mv.visitInsn(LADD); + } else if (type.equals(TargetType.Float)) { + mv.visitInsn(FADD); + } else if (type.equals(TargetType.Double)) { + mv.visitInsn(DADD); + } else { + throw new CodeGenException("Invalid argument to Add expression, type: " + add.type()); + } + } + if (add.type().equals(TargetType.String)) { + generate(state, add.right()); + convertToString(state, add.right().type()); + mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/StringBuilder", "append", "(Ljava/lang/String;)Ljava/lang/StringBuilder;", false); + mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/StringBuilder", "toString", "()Ljava/lang/String;", false); + } + break; + } + case Sub sub: { + generate(state, sub.left()); + convertTo(state, sub.left().type(), op.type()); + generate(state, sub.right()); + convertTo(state, sub.right().type(), op.type()); + var type = sub.type(); + if (type.equals(TargetType.Byte) || type.equals(TargetType.Char) || type.equals(TargetType.Integer) || type.equals(TargetType.Short)) { + mv.visitInsn(ISUB); + } else if (type.equals(TargetType.Long)) { + mv.visitInsn(LSUB); + } else if (type.equals(TargetType.Float)) { + mv.visitInsn(FSUB); + } else if (type.equals(TargetType.Double)) { + mv.visitInsn(DSUB); + } else { + throw new CodeGenException("Invalid argument to Sub expression"); + } + break; + } + case Div div: { + generate(state, div.left()); + convertTo(state, div.left().type(), op.type()); + generate(state, div.right()); + convertTo(state, div.right().type(), op.type()); + var type = div.type(); + if (type.equals(TargetType.Byte) || type.equals(TargetType.Char) || type.equals(TargetType.Integer) || type.equals(TargetType.Short)) { + mv.visitInsn(IDIV); + } else if (type.equals(TargetType.Long)) { + mv.visitInsn(LDIV); + } else if (type.equals(TargetType.Float)) { + mv.visitInsn(FDIV); + } else if (type.equals(TargetType.Double)) { + mv.visitInsn(DDIV); + } else { + throw new CodeGenException("Invalid argument to Div expression"); + } + break; + } + case Mul mul: { + generate(state, mul.left()); + convertTo(state, mul.left().type(), op.type()); + generate(state, mul.right()); + convertTo(state, mul.right().type(), op.type()); + var type = mul.type(); + if (type.equals(TargetType.Byte) || type.equals(TargetType.Char) || type.equals(TargetType.Integer) || type.equals(TargetType.Short)) { + mv.visitInsn(IMUL); + } else if (type.equals(TargetType.Long)) { + mv.visitInsn(LMUL); + } else if (type.equals(TargetType.Float)) { + mv.visitInsn(FMUL); + } else if (type.equals(TargetType.Double)) { + mv.visitInsn(DMUL); + } else { + throw new CodeGenException("Invalid argument to Mul expression"); + } + break; + } + case Rem rem: { + generate(state, rem.left()); + convertTo(state, rem.left().type(), op.type()); + generate(state, rem.right()); + convertTo(state, rem.right().type(), op.type()); + var type = rem.type(); + if (type.equals(TargetType.Byte) || type.equals(TargetType.Char) || type.equals(TargetType.Integer) || type.equals(TargetType.Short)) { + mv.visitInsn(IREM); + } else if (type.equals(TargetType.Long)) { + mv.visitInsn(LREM); + } else if (type.equals(TargetType.Float)) { + mv.visitInsn(FREM); + } else if (type.equals(TargetType.Double)) { + mv.visitInsn(DREM); + } else { + throw new CodeGenException("Invalid argument to Rem expression"); + } + break; + } + case Or or: { + Label or_false = new Label(); + Label or_true = new Label(); + Label end = new Label(); + generate(state, or.left()); + mv.visitJumpInsn(IFNE, or_true); + generate(state, or.right()); + mv.visitJumpInsn(IFEQ, or_false); + mv.visitLabel(or_true); + mv.visitInsn(ICONST_1); + mv.visitJumpInsn(GOTO, end); + mv.visitLabel(or_false); + mv.visitInsn(ICONST_0); + mv.visitLabel(end); + break; + } + case And and: { + Label and_false = new Label(); + Label end = new Label(); + generate(state, and.left()); + mv.visitJumpInsn(IFEQ, and_false); + generate(state, and.right()); + mv.visitJumpInsn(IFEQ, and_false); + mv.visitInsn(ICONST_1); + mv.visitJumpInsn(GOTO, end); + mv.visitLabel(and_false); + mv.visitInsn(ICONST_0); + mv.visitLabel(end); + break; + } + case BAnd band: { + generate(state, band.left()); + convertTo(state, band.left().type(), op.type()); + generate(state, band.right()); + convertTo(state, band.right().type(), op.type()); + if (band.type().equals(TargetType.Long)) + mv.visitInsn(LAND); + else + mv.visitInsn(IAND); + break; + } + case BOr bor: { + generate(state, bor.left()); + convertTo(state, bor.left().type(), op.type()); + generate(state, bor.right()); + convertTo(state, bor.right().type(), op.type()); + if (bor.type().equals(TargetType.Long)) + mv.visitInsn(LOR); + else + mv.visitInsn(IOR); + break; + } + case XOr xor: { + generate(state, xor.left()); + convertTo(state, xor.left().type(), op.type()); + generate(state, xor.right()); + convertTo(state, xor.right().type(), op.type()); + if (xor.type().equals(TargetType.Long)) + mv.visitInsn(LXOR); + else + mv.visitInsn(IXOR); + break; + } + case Instof instof: { + // TODO + throw new NotImplementedException(); + } + case Shl shl: { + generate(state, shl.left()); + convertTo(state, shl.left().type(), op.type()); + generate(state, shl.right()); + convertTo(state, shl.right().type(), op.type()); + if (shl.type().equals(TargetType.Long)) + mv.visitInsn(LSHL); + else + mv.visitInsn(ISHL); + break; + } + case Shr shr: { + generate(state, shr.left()); + convertTo(state, shr.left().type(), op.type()); + generate(state, shr.right()); + convertTo(state, shr.right().type(), op.type()); + if (shr.type().equals(TargetType.Long)) + mv.visitInsn(LSHR); + else + mv.visitInsn(ISHR); + break; + } + case UShr ushr: { + generate(state, ushr.left()); + convertTo(state, ushr.left().type(), op.type()); + generate(state, ushr.right()); + convertTo(state, ushr.right().type(), op.type()); + if (ushr.type().equals(TargetType.Long)) + mv.visitInsn(LUSHR); + else + mv.visitInsn(IUSHR); + break; + } + case Greater greater: { + var type = largerType(greater.left().type(), greater.right().type()); + if (type.equals(TargetType.Long)) { + generateRelationalOperator(state, greater, type, LCMP, IFGT); + } else if (type.equals(TargetType.Float)) { + generateRelationalOperator(state, greater, type, FCMPL, IFGT); + } else if (type.equals(TargetType.Double)) { + generateRelationalOperator(state, greater, type, DCMPL, IFGT); + } else { + generateRelationalOperator(state, greater, type, IF_ICMPGT); + } + break; + } + case Less less: { + var type = largerType(less.left().type(), less.right().type()); + if (type.equals(TargetType.Long)) { + generateRelationalOperator(state, less, type, LCMP, IFLT); + } else if (type.equals(TargetType.Float)) { + generateRelationalOperator(state, less, type, FCMPL, IFLT); + } else if (type.equals(TargetType.Double)) { + generateRelationalOperator(state, less, type, DCMPL, IFLT); + } else { + generateRelationalOperator(state, less, type, IF_ICMPLT); + } + break; + } + case GreaterOrEqual greaterOrEqual: { + var type = largerType(greaterOrEqual.left().type(), greaterOrEqual.right().type()); + if (type.equals(TargetType.Long)) { + generateRelationalOperator(state, greaterOrEqual, type, LCMP, IFGE); + } else if (type.equals(TargetType.Float)) { + generateRelationalOperator(state, greaterOrEqual, type, FCMPL, IFGE); + } else if (type.equals(TargetType.Double)) { + generateRelationalOperator(state, greaterOrEqual, type, DCMPL, IFGE); + } else { + generateRelationalOperator(state, greaterOrEqual, type, IF_ICMPGE); + } + break; + } + case LessOrEqual lessOrEqual: { + var type = largerType(lessOrEqual.left().type(), lessOrEqual.right().type()); + if (type.equals(TargetType.Long)) { + generateRelationalOperator(state, lessOrEqual, type, LCMP, IFLE); + } else if (type.equals(TargetType.Float)) { + generateRelationalOperator(state, lessOrEqual, type, FCMPL, IFLE); + } else if (type.equals(TargetType.Double)) { + generateRelationalOperator(state, lessOrEqual, type, DCMPL, IFLE); + } else { + generateRelationalOperator(state, lessOrEqual, type, IF_ICMPLE); + } + break; + } + case Equal equal: { + var type = largerType(equal.left().type(), equal.right().type()); + if (type.equals(TargetType.Long)) { + generateRelationalOperator(state, equal, type, LCMP, IFEQ); + } else if (type.equals(TargetType.Float)) { + generateRelationalOperator(state, equal, type, FCMPL, IFEQ); + } else if (type.equals(TargetType.Double)) { + generateRelationalOperator(state, equal, type, DCMPL, IFEQ); + } else if (type.equals(TargetType.Char) || type.equals(TargetType.Short) || type.equals(TargetType.Byte) || type.equals(TargetType.Integer) || type.equals(TargetType.Boolean)) { + generateRelationalOperator(state, equal, type, IF_ICMPEQ); + } else { + generateRelationalOperator(state, equal, type, IF_ACMPEQ); + } + break; + } + case NotEqual notEqual: { + var type = largerType(notEqual.left().type(), notEqual.right().type()); + if (type.equals(TargetType.Long)) { + generateRelationalOperator(state, notEqual, type, LCMP, IFNE); + } else if (type.equals(TargetType.Float)) { + generateRelationalOperator(state, notEqual, type, FCMPL, IFNE); + } else if (type.equals(TargetType.Double)) { + generateRelationalOperator(state, notEqual, type, DCMPL, IFNE); + } else if (type.equals(TargetType.Char) || type.equals(TargetType.Short) || type.equals(TargetType.Byte) || type.equals(TargetType.Integer)) { + generateRelationalOperator(state, notEqual, type, IF_ICMPNE); + } else { + generateRelationalOperator(state, notEqual, type, IF_ACMPNE); + } + break; + } + default: { + throw new NotImplementedException(); + } + } + } + + private void afterIncDec(State state, TargetUnaryOp op) { + var mv = state.mv; + if (op.expr() instanceof TargetLocalVar localVar) { + mv.visitVarInsn(ASTORE, state.scope.get(localVar.name()).index); + } else if (op.expr() instanceof TargetFieldVar fieldVar) { + generate(state, fieldVar.left()); + mv.visitInsn(SWAP); + mv.visitFieldInsn(PUTFIELD, fieldVar.owner().getInternalName(), fieldVar.right(), fieldVar.type().toSignature()); + } + } + + private void generateUnaryOp(State state, TargetUnaryOp op) { + var mv = state.mv; + switch (op) { + case TargetUnaryOp.Add add -> + // This literally does nothing + generate(state, add.expr()); + case TargetUnaryOp.Negate negate -> { + generate(state, negate.expr()); + if (negate.type().equals(TargetType.Double)) + mv.visitInsn(DNEG); + else if (negate.type().equals(TargetType.Float)) + mv.visitInsn(FNEG); + else if (negate.type().equals(TargetType.Long)) + mv.visitInsn(LNEG); + else + mv.visitInsn(INEG); + } + case TargetUnaryOp.Not not -> { + generate(state, not.expr()); + if (not.type().equals(TargetType.Long)) { + mv.visitLdcInsn(-1L); + mv.visitInsn(LXOR); + } else { + mv.visitInsn(ICONST_M1); + mv.visitInsn(IXOR); + } + } + case TargetUnaryOp.PreIncrement preIncrement -> { + generate(state, preIncrement.expr()); + if (preIncrement.type().equals(TargetType.Float)) { + mv.visitLdcInsn(1F); + mv.visitInsn(FADD); + mv.visitInsn(DUP); + } else if (preIncrement.type().equals(TargetType.Double)) { + mv.visitLdcInsn(1D); + mv.visitInsn(DADD); + mv.visitInsn(DUP2); + } else if (preIncrement.type().equals(TargetType.Long)) { + mv.visitLdcInsn(1L); + mv.visitInsn(LADD); + mv.visitInsn(DUP2); + } else { + mv.visitLdcInsn(1); + mv.visitInsn(IADD); + mv.visitInsn(DUP); + } + boxPrimitive(state, preIncrement.type()); + afterIncDec(state, preIncrement); + } + case TargetUnaryOp.PreDecrement preDecrement -> { + generate(state, preDecrement.expr()); + if (preDecrement.type().equals(TargetType.Float)) { + mv.visitLdcInsn(1F); + mv.visitInsn(FSUB); + mv.visitInsn(DUP); + } else if (preDecrement.type().equals(TargetType.Double)) { + mv.visitLdcInsn(1D); + mv.visitInsn(DSUB); + mv.visitInsn(DUP2); + } else if (preDecrement.type().equals(TargetType.Long)) { + mv.visitLdcInsn(1L); + mv.visitInsn(LSUB); + mv.visitInsn(DUP2); + } else { + mv.visitLdcInsn(1); + mv.visitInsn(ISUB); + mv.visitInsn(DUP); + } + boxPrimitive(state, preDecrement.type()); + afterIncDec(state, preDecrement); + } + case TargetUnaryOp.PostIncrement postIncrement -> { + generate(state, postIncrement.expr()); + if (postIncrement.type().equals(TargetType.Float)) { + mv.visitInsn(DUP); + mv.visitLdcInsn(1F); + mv.visitInsn(FADD); + } else if (postIncrement.type().equals(TargetType.Double)) { + mv.visitInsn(DUP2); + mv.visitLdcInsn(1D); + mv.visitInsn(DADD); + } else if (postIncrement.type().equals(TargetType.Long)) { + mv.visitInsn(DUP2); + mv.visitLdcInsn(1L); + mv.visitInsn(LADD); + } else { + mv.visitInsn(DUP); + mv.visitLdcInsn(1); + mv.visitInsn(IADD); + } + boxPrimitive(state, postIncrement.type()); + afterIncDec(state, postIncrement); + } + case TargetUnaryOp.PostDecrement postDecrement -> { + generate(state, postDecrement.expr()); + if (postDecrement.type().equals(TargetType.Float)) { + mv.visitInsn(DUP); + mv.visitLdcInsn(1F); + mv.visitInsn(FSUB); + } else if (postDecrement.type().equals(TargetType.Double)) { + mv.visitInsn(DUP2); + mv.visitLdcInsn(1D); + mv.visitInsn(DSUB); + } else if (postDecrement.type().equals(TargetType.Long)) { + mv.visitInsn(DUP2); + mv.visitLdcInsn(1L); + mv.visitInsn(LSUB); + } else { + mv.visitInsn(DUP); + mv.visitLdcInsn(1); + mv.visitInsn(ISUB); + } + boxPrimitive(state, postDecrement.type()); + afterIncDec(state, postDecrement); + } + } + } + + private void generateLambdaExpression(State state, TargetLambdaExpression lambda) { + var mv = state.mv; + + TargetMethod impl; + if (lambdas.containsKey(lambda)) { + impl = lambdas.get(lambda); + } else { + var name = "lambda$" + lambdaCounter++; + var parameters = new ArrayList<>(lambda.captures()); + parameters.addAll(lambda.params().stream().map(param -> param.pattern().type() instanceof TargetGenericType ? param.withType(TargetType.Object) : param).toList()); + + impl = new TargetMethod(0, name, lambda.block(), new TargetMethod.Signature(Set.of(), parameters, lambda.returnType() instanceof TargetGenericType ? TargetType.Object : lambda.returnType()), null); + generateMethod(impl); + lambdas.put(lambda, impl); + } + + var mt = MethodType.methodType(CallSite.class, MethodHandles.Lookup.class, String.class, MethodType.class, MethodType.class, MethodHandle.class, MethodType.class); + + var bootstrap = new Handle(H_INVOKESTATIC, "java/lang/invoke/LambdaMetafactory", "metafactory", mt.toMethodDescriptorString(), false); + var handle = new Handle(H_INVOKEVIRTUAL, clazz.getName(), impl.name(), impl.getDescriptor(), false); + + // TODO maybe make this a function? + var desugared = "("; + for (var param : lambda.params()) + desugared += "Ljava/lang/Object;"; + desugared += ")"; + if (lambda.returnType() != null) + desugared += "Ljava/lang/Object;"; + else + desugared += "V"; + + var params = new ArrayList(); + params.add(new TargetRefType(clazz.qualifiedName().getClassName())); + params.addAll(lambda.captures().stream().map(mp -> mp.pattern().type()).toList()); + + var descriptor = TargetMethod.getDescriptor(state.contextType, params.toArray(TargetType[]::new)); + mv.visitVarInsn(ALOAD, 0); + for (var capture : lambda.captures()) { + var pattern = (TargetTypePattern) capture.pattern(); + mv.visitVarInsn(ALOAD, state.scope.get(pattern.name()).index); + } + + String methodName; + var intf = compiler.getClass(new JavaClassName(state.contextType.name())); + if (intf == null) methodName = "apply"; // TODO Weird fallback logic here + else methodName = intf.getMethods().stream().filter(m -> Modifier.isAbstract(m.modifier)).findFirst().orElseThrow().getName(); + + mv.visitInvokeDynamicInsn(methodName, descriptor, bootstrap, Type.getType(desugared), handle, Type.getType(TargetMethod.getDescriptor(impl.signature().returnType(), lambda.params().stream().map(mp -> mp.pattern().type()).toArray(TargetType[]::new)))); + } + + private void generate(State state, TargetExpression expr) { + var mv = state.mv; + switch (expr) { + case TargetClassName ignored: + break; // NOP + case TargetBlock block: { + var localCounter = state.localCounter; + state.enterScope(); + for (var e : block.statements()) { + generate(state, e); + if (e instanceof TargetMethodCall) { + if (e.type() != null) + popValue(state, e.type()); + } else if (e instanceof TargetAssign) { + mv.visitInsn(POP); // TODO Nasty fix, we don't know if it is a primitive double or long + } else if (e instanceof TargetStatementExpression se) { + popValue(state, se.type()); + } + } + state.exitScope(); + state.localCounter = localCounter; + break; + } + case TargetCast cast: + var ctx = state.contextType; + state.contextType = cast.type(); + generate(state, cast.expr()); + state.contextType = ctx; + convertTo(state, cast.expr().type(), cast.type()); + break; + case TargetInstanceOf instanceOf: + generateInstanceOf(state, instanceOf); + break; + case TargetLiteral literal: + switch (literal) { + case IntLiteral intLiteral -> mv.visitLdcInsn(intLiteral.value()); + case FloatLiteral floatLiteral -> mv.visitLdcInsn(floatLiteral.value()); + case LongLiteral longLiteral -> mv.visitLdcInsn(longLiteral.value()); + case StringLiteral stringLiteral -> mv.visitLdcInsn(stringLiteral.value()); + case CharLiteral charLiteral -> mv.visitIntInsn(BIPUSH, charLiteral.value()); + case DoubleLiteral doubleLiteral -> mv.visitLdcInsn(doubleLiteral.value()); + case Null ignored -> mv.visitInsn(ACONST_NULL); + case BooleanLiteral booleanLiteral -> { + if (booleanLiteral.value()) { + mv.visitInsn(ICONST_1); + } else { + mv.visitInsn(ICONST_0); + } + } + } + break; + case TargetVarDecl varDecl: { + var local = state.createVariable(varDecl.name(), varDecl.varType()); + if (varDecl.value() != null) { + generate(state, varDecl.value()); + boxPrimitive(state, varDecl.varType()); + mv.visitVarInsn(ASTORE, local.index()); + } else { + mv.visitInsn(ACONST_NULL); + mv.visitVarInsn(ASTORE, local.index()); + } + break; + } + case TargetBinaryOp op: + generateBinaryOp(state, op); + break; + case TargetUnaryOp op: + generateUnaryOp(state, op); + break; + case TargetAssign assign: { + switch (assign.left()) { + case TargetLocalVar localVar -> { + var ctype = state.contextType; + state.contextType = localVar.type(); + generate(state, assign.right()); + state.contextType = ctype; + + convertTo(state, assign.right().type(), localVar.type()); + boxPrimitive(state, localVar.type()); + var local = state.scope.get(localVar.name()); + mv.visitInsn(DUP); + mv.visitVarInsn(ASTORE, local.index()); + } + case TargetFieldVar dot -> { + var fieldType = dot.type(); + if (!(dot.left() instanceof TargetThis && dot.isStatic())) + generate(state, dot.left()); + + var ctype = state.contextType; + state.contextType = fieldType; + generate(state, assign.right()); + state.contextType = ctype; + + convertTo(state, assign.right().type(), fieldType); + boxPrimitive(state, fieldType); + if (dot.isStatic()) + mv.visitInsn(DUP); + else + mv.visitInsn(DUP_X1); + mv.visitFieldInsn(dot.isStatic() ? PUTSTATIC : PUTFIELD, dot.owner().getInternalName(), dot.right(), fieldType.toSignature()); + } + default -> throw new CodeGenException("Invalid assignment"); + } + break; + } + case TargetLocalVar localVar: { + LocalVar local = state.scope.get(localVar.name()); + mv.visitVarInsn(ALOAD, local.index()); + unboxPrimitive(state, local.type()); + break; + } + case TargetFieldVar dot: { + if (!dot.isStatic()) + generate(state, dot.left()); + mv.visitFieldInsn(dot.isStatic() ? GETSTATIC : GETFIELD, dot.left().type().getInternalName(), dot.right(), dot.type().toSignature()); + unboxPrimitive(state, dot.type()); + break; + } + case TargetFor _for: { + state.enterScope(); + var localCounter = state.localCounter; + if (_for.init() != null) { + for (var e : _for.init()) { + generate(state, e); + if (e instanceof TargetAssign) mv.visitInsn(POP); + } + } + + Label start = new Label(); + Label end = new Label(); + mv.visitLabel(start); + if (_for.termination() != null) + generate(state, _for.termination()); + else + mv.visitInsn(ICONST_1); + mv.visitJumpInsn(IFEQ, end); + + var env = new BreakEnv(); + env.startLabel = start; + env.endLabel = end; + + state.breakStack.push(env); + generate(state, _for.body()); + state.breakStack.pop(); + + if (_for.increment() != null) { + _for.increment().forEach(e -> { + generate(state, e); + if (e.type() != null) { + popValue(state, e.type()); + } + }); + } + mv.visitJumpInsn(GOTO, start); + mv.visitLabel(end); + state.exitScope(); + state.localCounter = localCounter; + break; + } + case TargetForEach forEach: + generateForEach(forEach, state); + break; + case TargetWhile _while: { + Label start = new Label(); + Label end = new Label(); + mv.visitLabel(start); + generate(state, _while.cond()); + mv.visitJumpInsn(IFEQ, end); + + var env = new BreakEnv(); + env.startLabel = start; + env.endLabel = end; + + state.breakStack.push(env); + generate(state, _while.body()); + state.breakStack.pop(); + + mv.visitJumpInsn(GOTO, start); + mv.visitLabel(end); + break; + } + case TargetIf _if: { + generate(state, _if.cond()); + Label _else = new Label(); + Label end = new Label(); + mv.visitJumpInsn(IFEQ, _else); + generate(state, _if.if_body()); + mv.visitJumpInsn(GOTO, end); + mv.visitLabel(_else); + if (_if.else_body() != null) { + generate(state, _if.else_body()); + } + mv.visitLabel(end); + break; + } + case TargetReturn ret: { + if (ret.expression() != null && state.returnType != null) { + var ctype = state.contextType; + state.contextType = state.returnType; + generate(state, ret.expression()); + state.contextType = ctype; + convertTo(state, ret.expression().type(), state.returnType); + boxPrimitive(state, state.returnType); + mv.visitInsn(ARETURN); + } else + mv.visitInsn(RETURN); + break; + } + case TargetYield yield: { + generate(state, yield.expression()); + try { + yieldValue(state, yield.expression().type()); + mv.visitJumpInsn(GOTO, state.breakStack.peek().endLabel); + } catch (EmptyStackException e) { + throw new CodeGenException("Yield outside of switch expression"); + } + break; + } + case TargetSwitch _switch: { + generateSwitch(state, _switch); + break; + } + case TargetBreak brk: { + if (state.breakStack.isEmpty()) throw new CodeGenException("Break outside of switch or loop"); + mv.visitJumpInsn(GOTO, state.breakStack.peek().endLabel); + break; + } + case TargetContinue cnt: { + if (state.breakStack.isEmpty()) throw new CodeGenException("Continue outside of loop"); + var env = state.breakStack.peek(); + if (env.startLabel == null) throw new CodeGenException("Continue outside of loop"); + mv.visitJumpInsn(GOTO, env.startLabel); + break; + } + case TargetThis _this: { + mv.visitVarInsn(ALOAD, 0); + break; + } + case TargetSuper _super: { + mv.visitVarInsn(ALOAD, 0); + break; + } + case TargetMethodCall call: { + generate(state, call.expr()); + for (var i = 0; i < call.args().size(); i++) { + var e = call.args().get(i); + var arg = call.parameterTypes().get(i); + var ctype = state.contextType; + state.contextType = arg; + generate(state, e); + if (!(arg instanceof TargetPrimitiveType)) + boxPrimitive(state, e.type()); + state.contextType = ctype; + } + var descriptor = call.getDescriptor(); + if (call.owner() instanceof TargetFunNType) // Decay FunN + descriptor = TargetMethod.getDescriptor(call.returnType() == null ? null : TargetType.Object, call.parameterTypes().stream().map(x -> TargetType.Object).toArray(TargetType[]::new)); + + mv.visitMethodInsn(call.isInterface() ? INVOKEINTERFACE : call.isStatic() ? INVOKESTATIC : call.name().equals("") ? INVOKESPECIAL : INVOKEVIRTUAL, call.owner().getInternalName(), call.name(), descriptor, call.isInterface()); + + if (call.type() != null && call.returnType() != null && !(call.returnType() instanceof TargetPrimitiveType)) { + if (!call.returnType().equals(call.type()) && !(call.type() instanceof TargetGenericType)) + mv.visitTypeInsn(CHECKCAST, call.type().getInternalName()); + unboxPrimitive(state, call.type()); + } + break; + } + case TargetLambdaExpression lambda: + generateLambdaExpression(state, lambda); + break; + case TargetNew _new: { + mv.visitTypeInsn(NEW, _new.type().getInternalName()); + mv.visitInsn(DUP); + for (TargetExpression e : _new.params()) { + generate(state, e); + boxPrimitive(state, e.type()); + } + mv.visitMethodInsn(INVOKESPECIAL, _new.type().getInternalName(), "", _new.getDescriptor(), false); + break; + } + case TargetThrow _throw: { + generate(state, _throw.expr()); + mv.visitInsn(ATHROW); + break; + } + default: + throw new CodeGenException("Unexpected value: " + expr); + } + } + + private void generateForEach(TargetForEach forEach, State state) { + state.enterScope(); + TargetVarDecl vd = (TargetVarDecl) forEach.vardecl(); + var localVar = state.createVariable(vd.name(), vd.varType()); + + var expr = forEach.expression(); + // TODO Check for arrays + var mv = state.mv; + generate(state, expr); + mv.visitMethodInsn(INVOKEINTERFACE, "java/lang/Iterable", "iterator", "()Ljava/util/Iterator;", true); + var start = new Label(); + var end = new Label(); + mv.visitLabel(start); + mv.visitInsn(DUP); + mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Iterator", "hasNext", "()Z", true); + mv.visitJumpInsn(IFEQ, end); + mv.visitInsn(DUP); + mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Iterator", "next", "()Ljava/lang/Object;", true); + mv.visitTypeInsn(CHECKCAST, localVar.type().getInternalName()); + mv.visitVarInsn(ASTORE, localVar.index); + + generate(state, forEach.body()); + + mv.visitJumpInsn(GOTO, start); + mv.visitLabel(end); + mv.visitInsn(POP); + + state.exitScope(); + } + + private void generateInstanceOf(State state, TargetInstanceOf instanceOf) { + var mv = state.mv; + + if (instanceOf.right() instanceof TargetTypePattern right && right.name() == null) { + generate(state, instanceOf.left()); + mv.visitTypeInsn(INSTANCEOF, right.type().getInternalName()); + return; + } + + throw new NotImplementedException(); + } + + private void yieldValue(State state, TargetType type) { + boxPrimitive(state, type); + state.mv.visitVarInsn(ASTORE, state.switchResultValue.peek()); + } + + private void generateClassicSwitch(State state, TargetSwitch aSwitch) { + // TODO Constant expressions are allowed, we need to evaluate them somehow... + // For now we just assume we get literals... + // TODO This always uses a lookupswitch, a tableswitch may be faster in some cases but we can't generate that every time + // TODO We can't switch on Strings yet, the idea for this (like javac does it) would be to implement the hash code at compile time + // and switch based on that, adding an equals check for every case and going to yet another tableswitch which finally decides which branch to take + var mv = state.mv; + if (aSwitch.isExpression()) + state.pushSwitch(); + + generate(state, aSwitch.expr()); + + state.enterScope(); + + var keys = new int[aSwitch.cases().stream().mapToInt(c -> c.labels().size()).sum()]; + var labels = new Label[keys.length]; + var bodyLabels = new Label[aSwitch.cases().size()]; + + var end = new Label(); + var env = new BreakEnv(); + env.endLabel = end; + state.breakStack.push(env); + + var i = 0; + var j = 0; + for (var case_ : aSwitch.cases()) { + bodyLabels[j] = new Label(); + for (var label : case_.labels()) { + if (!(label instanceof TargetLiteral literal)) + throw new CodeGenException("Labels may only be constants for now"); + keys[i] = (int) literal.value(); + labels[i] = bodyLabels[j]; + i += 1; + } + j += 1; + } + + var defaultLabel = end; + if (aSwitch.default_() != null) { + defaultLabel = new Label(); + } + + mv.visitLookupSwitchInsn(defaultLabel, keys, labels); + + for (var k = 0; k < aSwitch.cases().size(); k++) { + mv.visitLabel(bodyLabels[k]); + var cse = aSwitch.cases().get(k); + generate(state, cse.body()); + if (cse.isSingleExpression() && aSwitch.isExpression()) + yieldValue(state, cse.body().statements().get(0).type()); + if (aSwitch.isExpression()) mv.visitJumpInsn(GOTO, end); + } + + if (aSwitch.default_() != null) { + mv.visitLabel(defaultLabel); + generate(state, aSwitch.default_().body()); + if (aSwitch.default_().isSingleExpression() && aSwitch.isExpression()) + yieldValue(state, aSwitch.default_().body().statements().get(0).type()); + } + + mv.visitLabel(end); + state.breakStack.pop(); + + if (aSwitch.isExpression()) { + mv.visitVarInsn(ALOAD, state.switchResultValue.peek()); + unboxPrimitive(state, aSwitch.type()); + state.popSwitch(); + } + + state.exitScope(); + } + + private void generateEnhancedSwitch(State state, TargetSwitch aSwitch) { + var mv = state.mv; + generate(state, aSwitch.expr()); + var tmp = state.localCounter; + mv.visitInsn(DUP); + mv.visitVarInsn(ASTORE, tmp); + + state.enterScope(); + // This is the index to start the switch from + mv.visitInsn(ICONST_0); + if (aSwitch.isExpression()) + state.pushSwitch(); + + // To be able to skip ahead to the next case + var start = new Label(); + mv.visitLabel(start); + + var end = new Label(); + var env = new BreakEnv(); + env.endLabel = end; + state.breakStack.push(env); + + var mt = MethodType.methodType(CallSite.class, MethodHandles.Lookup.class, String.class, MethodType.class, Object[].class); + var bootstrap = new Handle(H_INVOKESTATIC, "java/lang/runtime/SwitchBootstraps", "typeSwitch", mt.toMethodDescriptorString(), false); + + var types = new ArrayList(aSwitch.cases().size()); + for (var cse : aSwitch.cases()) for (var label : cse.labels()) { + if (label instanceof TargetTypePattern || label instanceof TargetComplexPattern) + types.add(Type.getObjectType(label.type().getInternalName())); + else if (label instanceof TargetLiteral lit) + types.add(lit.value()); + else if (label instanceof TargetGuard guard) + types.add(Type.getObjectType(guard.inner().type().getInternalName())); + // TODO Same here we need to evaluate constant; + else { + System.out.println(label); + throw new NotImplementedException(); + } + } + + mv.visitInvokeDynamicInsn("typeSwitch", "(Ljava/lang/Object;I)I", bootstrap, types.toArray()); + + var caseLabels = new Label[aSwitch.cases().size()]; + var labels = new Label[aSwitch.cases().stream().mapToInt(c -> c.labels().size()).sum()]; + var j = 0; + for (var i = 0; i < caseLabels.length; i++) { + var cse = aSwitch.cases().get(i); + var label = new Label(); + caseLabels[i] = label; + for (var k = 0; k < cse.labels().size(); k++) { + labels[j] = label; + j += 1; + } + } + + var defaultLabel = end; + if (aSwitch.default_() != null) { + defaultLabel = new Label(); + } + + mv.visitTableSwitchInsn(0, labels.length - 1, defaultLabel, labels); + + for (var i = 0; i < aSwitch.cases().size(); i++) { + mv.visitLabel(caseLabels[i]); + var cse = aSwitch.cases().get(i); + + if (cse.labels().size() == 1) { + var label = cse.labels().get(0); + if (label instanceof TargetGuard gd) { + state.mv.visitVarInsn(ALOAD, tmp); + bindPattern(state, aSwitch.expr().type(), gd.inner(), start, i, 1); + } else if (label instanceof TargetPattern pat) { + state.mv.visitVarInsn(ALOAD, tmp); + bindPattern(state, aSwitch.expr().type(), pat, start, i, 1); + } + + if (label instanceof TargetGuard gd) { + generate(state, gd.expression()); + var next = new Label(); + mv.visitJumpInsn(IFNE, next); + mv.visitVarInsn(ALOAD, tmp); + // Push the offset onto the stack (this is used by the invokedynamic call) + mv.visitLdcInsn(i + 1); + mv.visitJumpInsn(GOTO, start); + mv.visitLabel(next); + } + } + + generate(state, cse.body()); + if (cse.isSingleExpression() && aSwitch.isExpression()) + yieldValue(state, cse.body().statements().get(0).type()); + if (aSwitch.isExpression()) mv.visitJumpInsn(GOTO, end); + } + + if (aSwitch.default_() != null) { + mv.visitLabel(defaultLabel); + generate(state, aSwitch.default_().body()); + if (aSwitch.default_().isSingleExpression() && aSwitch.isExpression()) + yieldValue(state, aSwitch.default_().body().statements().get(0).type()); + } + + mv.visitLabel(end); + //mv.visitInsn(POP); + + state.breakStack.pop(); + if (aSwitch.isExpression()) { + mv.visitVarInsn(ALOAD, state.switchResultValue.peek()); + unboxPrimitive(state, aSwitch.type()); + state.popSwitch(); + } + + state.exitScope(); + } + + private void extractField(State state, TargetType type, int i, ClassOrInterface clazz) { + if (i >= clazz.getFieldDecl().size()) + throw new CodeGenException("Couldn't find suitable field accessor for '" + type.name() + "'"); + var field = clazz.getFieldDecl().get(i); + var fieldType = new TargetRefType(((RefType) field.getType()).getName().toString()); + state.mv.visitMethodInsn(INVOKEVIRTUAL, type.getInternalName(), field.getName(), "()" + fieldType.toDescriptor(), false); + } + + private void bindPattern(State state, TargetType type, TargetPattern pat, Label start, int index, int depth) { + if (pat.type() instanceof TargetPrimitiveType) + boxPrimitive(state, pat.type()); + + state.mv.visitInsn(DUP); + state.mv.visitTypeInsn(INSTANCEOF, pat.type().getInternalName()); + + var cont = new Label(); + state.mv.visitJumpInsn(IFNE, cont); + for (var i = 0; i < depth; i++) { + state.mv.visitInsn(POP); + } + state.mv.visitVarInsn(ALOAD, state.switchResultValue.peek()); + state.mv.visitLdcInsn(index + 1); + state.mv.visitJumpInsn(GOTO, start); + state.mv.visitLabel(cont); + + state.mv.visitTypeInsn(CHECKCAST, pat.type().getInternalName()); + + if (pat instanceof TargetTypePattern sp) { + var local = state.createVariable(sp.name(), sp.type()); + state.mv.visitVarInsn(ASTORE, local.index); + } else if (pat instanceof TargetComplexPattern cp) { + if (cp.name() != null) { + state.mv.visitInsn(DUP); + var local = state.createVariable(cp.name(), cp.type()); + state.mv.visitVarInsn(ASTORE, local.index); + } + + var clazz = findClass(new JavaClassName(cp.type().name())); + if (clazz == null) throw new CodeGenException("Class definition for '" + cp.type().name() + "' not found"); + // TODO Check if class is a Record + + for (var i = 0; i < cp.subPatterns().size(); i++) { + state.mv.visitInsn(DUP); + + var subPattern = cp.subPatterns().get(i); + extractField(state, cp.type(), i, clazz); + bindPattern(state, subPattern.type(), subPattern, start, index, depth + 1); + } + state.mv.visitInsn(POP); + } + } + + final Set wrapperTypes = Set.of(TargetType.Long, TargetType.Integer, TargetType.Byte, TargetType.Char, TargetType.Boolean, TargetType.Double, TargetType.Float); + + private void generateSwitch(State state, TargetSwitch aSwitch) { + if (!wrapperTypes.contains(aSwitch.expr().type())) { + generateEnhancedSwitch(state, aSwitch); + return; + } + else for (var case_ : aSwitch.cases()) { + if (case_.labels().stream().anyMatch(c -> c instanceof TargetPattern)) { + generateEnhancedSwitch(state, aSwitch); + return; + } + } + generateClassicSwitch(state, aSwitch); + } + + private void generateField(TargetField field) { + var access = field.access(); + //if ((access & ACC_PRIVATE) == 0 && (access & ACC_PROTECTED) == 0) // TODO Implement access modifiers properly + // access |= ACC_PUBLIC; + + cw.visitField(access, field.name(), field.type().toSignature(), field.type().toDescriptor(), null); + } + + private void generateStaticConstructor(TargetMethod constructor) { + MethodVisitor mv = cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "", "()V", null, null); + mv.visitCode(); + + var state = new State(null, mv, 0); + generate(state, constructor.block()); + + mv.visitInsn(RETURN); + mv.visitMaxs(0, 0); + mv.visitEnd(); + } + + private void generateConstructor(TargetConstructor constructor) { + MethodVisitor mv = cw.visitMethod(constructor.access(), "", constructor.getDescriptor(), constructor.getSignature(), null); + if (constructor.txGenerics() != null) + mv.visitAttribute(new JavaTXSignatureAttribute(constructor.getTXSignature())); + + mv.visitCode(); + var state = new State(null, mv, 1); + for (var param : constructor.parameters()) { + var pattern = param.pattern(); + if (pattern instanceof TargetTypePattern tp) + state.createVariable(tp.name(), tp.type()); + else throw new NotImplementedException(); + } + + var stmts = constructor.block().statements(); + generate(state, stmts.get(0)); + if (constructor.fieldInitializer() != null) { + var stmts2 = constructor.fieldInitializer().statements(); + for (TargetExpression expression : stmts2) { + generate(state, expression); + } + } + for (var i = 1; i < stmts.size(); i++) + generate(state, stmts.get(i)); + + mv.visitInsn(RETURN); + mv.visitMaxs(0, 0); + mv.visitEnd(); + } + + private int bindLocalVariables(State state, TargetPattern pattern, int offset, int field) { + if (pattern instanceof TargetComplexPattern cp) { + state.mv.visitVarInsn(ALOAD, offset); + + var clazz = findClass(new JavaClassName(cp.type().name())); + if (clazz == null) throw new CodeGenException("Class definition for '" + cp.type().name() + "' not found"); + + for (var i = 0; i < cp.subPatterns().size(); i++) { + var subPattern = cp.subPatterns().get(i); + + if (i < cp.subPatterns().size() - 1) + state.mv.visitInsn(DUP); + + extractField(state, cp.type(), i, clazz); + state.mv.visitTypeInsn(CHECKCAST, subPattern.type().getInternalName()); + state.mv.visitVarInsn(ASTORE, offset); + offset = bindLocalVariables(state, subPattern, offset, i); + } + } else if (pattern instanceof TargetTypePattern tp) { + offset++; + state.createVariable(tp.name(), tp.type()); + } else throw new NotImplementedException(); + return offset; + } + + private void generateMethod(TargetMethod method) { + var access = method.access(); + if (method.block() == null) + access |= ACC_ABSTRACT; + if (clazz instanceof TargetInterface) + access |= ACC_PUBLIC; + + // TODO The older codegen has set ACC_PUBLIC for all methods, good for testing but bad for everything else + MethodVisitor mv = cw.visitMethod(access, method.name(), method.getDescriptor(), method.getSignature(), null); + if (method.txSignature() != null) { + mv.visitAttribute(new JavaTXSignatureAttribute(method.getTXSignature())); + } + + if (method.block() != null) { + mv.visitCode(); + var state = new State(method.signature().returnType(), mv, method.isStatic() ? 0 : 1); + for (var param : method.signature().parameters()) { + bindLocalVariables(state, param.pattern(), 1, 0); + } + generate(state, method.block()); + if (method.signature().returnType() == null) + mv.visitInsn(RETURN); + mv.visitMaxs(0, 0); + } + mv.visitEnd(); + } + + private static String generateSignature(TargetStructure clazz, Set generics) { + String ret = ""; + if (!generics.isEmpty()) { + ret += "<"; + for (var generic : generics) { + ret += generic.name() + ":" + generic.bound().toDescriptor(); + } + ret += ">"; + } + if (clazz.superType() != null) + ret += clazz.superType().toDescriptor(); + for (var intf : clazz.implementingInterfaces()) { + ret += intf.toSignature(); + } + + return ret.isEmpty() ? null : ret; + } + + public byte[] generate() { + var access = clazz.modifiers(); + //if ((access & ACC_PRIVATE) == 0 && (access & ACC_PROTECTED) == 0) // TODO Implement access modifiers properly + // access |= ACC_PUBLIC; + if (!(clazz instanceof TargetInterface)) + access |= ACC_SUPER; + + var signature = generateSignature(clazz, clazz.generics()); + var interfaces = clazz.implementingInterfaces().stream().map(TargetType::getInternalName).toArray(String[]::new); + var superType = clazz.superType() != null ? clazz.superType().getInternalName() : "java/lang/Object"; + + cw.visit(V1_8, access, clazz.qualifiedName().toString().replaceAll("\\.", "/"), signature, superType, interfaces); + if (clazz.txGenerics() != null && signature != null) + cw.visitAttribute(new JavaTXSignatureAttribute(generateSignature(clazz, clazz.txGenerics()))); + + clazz.fields().forEach(this::generateField); + clazz.constructors().forEach(this::generateConstructor); + clazz.methods().forEach(this::generateMethod); + + if (clazz.staticConstructor() != null) + generateStaticConstructor(clazz.staticConstructor()); + + if (clazz instanceof TargetRecord) + generateRecordMethods(); + + cw.visitEnd(); + return cw.toByteArray(); + } + + private ClassOrInterface findClass(JavaClassName className) { + try { + for (var sf : compiler.sourceFiles.values()) { + for (var clazz : compiler.getAvailableClasses(sf)) { + if (clazz.getClassName().equals(className)) + return clazz; + } + for (var clazz : sf.KlassenVektor) { + if (clazz.getClassName().equals(className)) + return clazz; + } + } + } catch (ClassNotFoundException ignored) {} + + return null; + } + + private void generateRecordMethods() { + var mt = MethodType.methodType(Object.class, MethodHandles.Lookup.class, String.class, TypeDescriptor.class, Class.class, String.class, MethodHandle[].class); + var bootstrap = new Handle(H_INVOKESTATIC, "java/lang/runtime/ObjectMethods", "bootstrap", mt.toMethodDescriptorString(), false); + var bootstrapArgs = new Object[2 + clazz.fields().size()]; + + bootstrapArgs[0] = Type.getObjectType(clazz.getName()); + bootstrapArgs[1] = String.join(";", clazz.fields().stream().map(TargetField::name).toArray(String[]::new)); + for (var i = 0; i < clazz.fields().size(); i++) { + var field = clazz.fields().get(i); + var fieldRef = new Handle(H_GETFIELD, clazz.getName(), field.name(), field.type().toDescriptor(), false); + bootstrapArgs[i + 2] = fieldRef; + } + + { // hashCode + var mv = cw.visitMethod(ACC_PUBLIC, "hashCode", "()I", null, null); + mv.visitCode(); + mv.visitVarInsn(ALOAD, 0); + mv.visitInvokeDynamicInsn("hashCode", "(L" + clazz.getName() + ";)I", bootstrap, bootstrapArgs); + mv.visitInsn(IRETURN); + mv.visitMaxs(0, 0); + mv.visitEnd(); + } + { // equals + var mv = cw.visitMethod(ACC_PUBLIC, "equals", "(Ljava/lang/Object;)Z", null, null); + mv.visitCode(); + mv.visitVarInsn(ALOAD, 0); + mv.visitVarInsn(ALOAD, 1); + mv.visitInvokeDynamicInsn("equals", "(L" + clazz.getName() + ";Ljava/lang/Object;)Z", bootstrap, bootstrapArgs); + mv.visitInsn(IRETURN); + mv.visitMaxs(0, 0); + mv.visitEnd(); + } + { // toString + var mv = cw.visitMethod(ACC_PUBLIC, "toString", "()Ljava/lang/String;", null, null); + mv.visitCode(); + mv.visitVarInsn(ALOAD, 0); + mv.visitInvokeDynamicInsn("toString", "(L" + clazz.getName() + ";)Ljava/lang/String;", bootstrap, bootstrapArgs); + mv.visitInsn(ARETURN); + mv.visitMaxs(0, 0); + mv.visitEnd(); + } + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/bytecode/FunNGenerator.java b/javatx-src/main/java/de/dhbwstuttgart/bytecode/FunNGenerator.java new file mode 100644 index 0000000..411d9bf --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/bytecode/FunNGenerator.java @@ -0,0 +1,158 @@ +package de.dhbwstuttgart.bytecode; + +import de.dhbwstuttgart.target.tree.TargetGeneric; +import de.dhbwstuttgart.target.tree.type.*; +import org.objectweb.asm.ClassWriter; +import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Type; + +import java.util.*; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import static org.objectweb.asm.Opcodes.*; + +/** + * //ToDo beschreiben + * + * @since Studienarbeit Type Erasure + * @author etiennezink + */ +public class FunNGenerator { + + private static final String argumentGenericBase = "T"; + private static final String returnGeneric = "R"; + private static final String methodName = "apply"; + private static final int bytecodeVersion = V1_8; + + private static final String objectSuperType = Type.getInternalName(Object.class).replace('.','/'); + private static final String objectSignature = applySignature(TargetType.Object); + + private static final String VOID = "Ljava/lang/Void;"; + + public static class GenericParameters { + int start; + public List parameters = new ArrayList<>(); + } + + private static String applyDescriptor(TargetType type, GenericParameters gep) { + if (type == null) return VOID; + var res = "L" + type.getInternalName(); + if (type instanceof TargetSpecializedType a) { + if (a.params().size() > 0) { + res += "<"; + for (var param : a.params()) { + if (param instanceof TargetGenericType gp) { + gep.parameters.add(param); + res += "TT" + gep.start + ";"; + gep.start += 1; + } else { + res += applyDescriptor(param, gep); + } + } + res += ">"; + } + } else { + gep.parameters.add(null); + return type.toDescriptor(); + } + res += ";"; + + return res; + } + + private static String applySignature(TargetType a) { return a.toSignature(); } + private static String applyNameDescriptor(TargetType a){ return a instanceof TargetGenericType ? "LTPH;" : String.format("%s", applySignature(a)); } + + public static String encodeType(TargetType type) { + if (type == null) return VOID; + return applyNameDescriptor(type).replace("/", "$").replace(";", "$_$"); + } + + public static byte[] generateSuperBytecode(int numberArguments) { + StringBuilder superFunNClassSignature = new StringBuilder("<"); + StringBuilder superFunNMethodSignature = new StringBuilder("("); + StringBuilder superFunNMethodDescriptor = new StringBuilder("("); + + for (int currentParameter = 1; currentParameter <= numberArguments; currentParameter++){ + superFunNClassSignature.append(String.format("%s%d:%s", argumentGenericBase, currentParameter, objectSignature)); + superFunNMethodSignature.append(String.format("T%s;", argumentGenericBase + currentParameter)); + superFunNMethodDescriptor.append(objectSignature); + } + superFunNClassSignature.append(String.format("%s:%s>%s", returnGeneric, objectSignature, objectSignature)); + superFunNMethodSignature.append(String.format(")T%s;", returnGeneric)); + superFunNMethodDescriptor.append(String.format(")%s", objectSignature)); + + System.out.println(superFunNMethodSignature); + + ClassWriter classWriter = new ClassWriter(0); + MethodVisitor methodVisitor; + classWriter.visit(bytecodeVersion, ACC_PUBLIC | ACC_ABSTRACT | ACC_INTERFACE, getSuperClassName(numberArguments), superFunNClassSignature.toString(), objectSuperType, null); + methodVisitor = classWriter.visitMethod(ACC_PUBLIC | ACC_ABSTRACT, methodName, superFunNMethodDescriptor.toString(), superFunNMethodSignature.toString(), null); + methodVisitor.visitEnd(); + classWriter.visitEnd(); + return classWriter.toByteArray(); + } + + public static String getSuperClassName(int numberArguments) { + return String.format("Fun%d$$", numberArguments); + } + + public static byte[] generateSpecializedBytecode(List argumentTypes, TargetType returnType, GenericParameters gep) { + List parameters = Stream + .concat(argumentTypes.stream(), Stream.of(returnType)) + .toList(); + + StringBuilder funNClassSignature = new StringBuilder(objectSignature + applyDescriptor(new TargetRefType(getSuperClassName(argumentTypes.size()), parameters), gep)); + boolean containsGeneric = false; + + String genericSignature = "<"; + for (var i = 0; i < gep.start; i++) { + genericSignature += String.format("T%d:%s", i, objectSignature); + containsGeneric = true; + } + + genericSignature += ">"; + if (containsGeneric) funNClassSignature.insert(0, genericSignature); + System.out.println(funNClassSignature.toString()); + + ClassWriter classWriter = new ClassWriter(0); + classWriter.visit(bytecodeVersion, ACC_PUBLIC | ACC_ABSTRACT | ACC_INTERFACE, getSpecializedClassName(argumentTypes, returnType), funNClassSignature.toString(), objectSuperType, new String[]{getSuperClassName(argumentTypes.size())}); + classWriter.visitEnd(); + return classWriter.toByteArray(); + } + + private static void collectGenericTypeArguments(Map generics, TargetType typeArgument) { + if (typeArgument instanceof TargetSpecializedType specializedType) { + for (var arg : specializedType.params()) + collectGenericTypeArguments(generics, arg); + } else if (typeArgument instanceof TargetGenericType genericType) { + if (generics.containsKey(genericType)) + generics.put(genericType, generics.get(genericType) + 1); + else generics.put(genericType, 0); + } + } + + public static String getSpecializedClassName(List argumentTypes, TargetType returnType) { + return String.format("Fun%d$$%s%s", + argumentTypes.size(), + argumentTypes + .stream() + .map(FunNGenerator::encodeType) + .collect(Collectors.joining()), + encodeType(returnType)); + } + + public static List getArguments(List list) { + return list + .stream() + .limit(Math.max(0, list.size() - 1)) + .collect(Collectors.toList()); + } + + public static TargetType getReturnType(List list) { + if(list.size() == 0) + throw new IndexOutOfBoundsException(); + return list.get(list.size() - 1); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/bytecode/JavaTXSignatureAttribute.java b/javatx-src/main/java/de/dhbwstuttgart/bytecode/JavaTXSignatureAttribute.java new file mode 100644 index 0000000..ee7b2e5 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/bytecode/JavaTXSignatureAttribute.java @@ -0,0 +1,30 @@ +package de.dhbwstuttgart.bytecode; + +import org.objectweb.asm.*; + +public class JavaTXSignatureAttribute extends Attribute { + public String signature; + + public JavaTXSignatureAttribute() { + super("JavaTXSignature"); + } + protected JavaTXSignatureAttribute(String signature) { + this(); + this.signature = signature; + } + + @Override + protected Attribute read(ClassReader classReader, int offset, int length, char[] charBuffer, int codeAttributeOffset, Label[] labels) { + var data = new byte[length]; + System.arraycopy(classReader.b, offset, data, 0, length); + var constantPoolOffset = data[0] << 8 | data[1]; + return new JavaTXSignatureAttribute((String) classReader.readConst(constantPoolOffset, charBuffer)); + } + + @Override + protected ByteVector write(ClassWriter classWriter, byte[] code, int codeLength, int maxStack, int maxLocals) { + var data = new ByteVector(); + data.putShort(classWriter.newConst(this.signature)); + return data; + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/core/ConsoleInterface.java b/javatx-src/main/java/de/dhbwstuttgart/core/ConsoleInterface.java new file mode 100644 index 0000000..760ae62 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/core/ConsoleInterface.java @@ -0,0 +1,45 @@ +package de.dhbwstuttgart.core; + +import java.io.File; +import java.io.IOException; +import java.util.*; +public class ConsoleInterface { + private static final String directory = System.getProperty("user.dir"); + + public static void main(String[] args) throws IOException, ClassNotFoundException { + List input = new ArrayList<>(); + List classpath = new ArrayList<>(); + String outputPath = null; + Iterator it = Arrays.asList(args).iterator(); + if(args.length == 0){ + System.out.println("No input files given. Get help with --help"); + System.exit(1); + }else if(args.length == 1 && args[0].equals("--help")){ + System.out.println("Usage: javatx [OPTION]... [FILE]...\n" + + "\t-cp\tSet Classpath\n" + + "\t-d\tSet destination directory"); + System.exit(1); + } + while(it.hasNext()){ + String arg = it.next(); + if(arg.equals("-d")){ + outputPath = it.next(); + }else if(arg.startsWith("-d")) { + outputPath = arg.substring(2); + }else if(arg.equals("-cp") || arg.equals("-classpath")){ + String[] cps = it.next().split(":"); + for(String cp : cps){ + classpath.add(new File(cp)); + } + }else{ + System.out.println(arg); + input.add(new File(arg)); + } + } + JavaTXCompiler compiler = new JavaTXCompiler(input, classpath); + //compiler.typeInference(); + compiler.generateBytecode(outputPath); + } + + +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/core/IItemWithOffset.java b/javatx-src/main/java/de/dhbwstuttgart/core/IItemWithOffset.java new file mode 100644 index 0000000..1a6fd19 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/core/IItemWithOffset.java @@ -0,0 +1,9 @@ +package de.dhbwstuttgart.core; + + +import org.antlr.v4.runtime.Token; + +public interface IItemWithOffset +{ + Token getOffset(); +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java b/javatx-src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java new file mode 100644 index 0000000..7debd5e --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java @@ -0,0 +1,828 @@ +//PL 2018-12-19: typeInferenceOld nach typeInference uebertragen +package de.dhbwstuttgart.core; + +import com.google.common.collect.Lists; +import de.dhbwstuttgart.bytecode.Codegen; +import de.dhbwstuttgart.environment.CompilationEnvironment; +import de.dhbwstuttgart.environment.DirectoryClassLoader; +import de.dhbwstuttgart.exceptions.DebugException; +import de.dhbwstuttgart.parser.JavaTXParser; +import de.dhbwstuttgart.parser.NullToken; +import de.dhbwstuttgart.parser.scope.GenericsRegistry; +import de.dhbwstuttgart.parser.SyntaxTreeGenerator.SyntaxTreeGenerator; +import de.dhbwstuttgart.parser.antlr.Java17Parser.SourceFileContext; +import de.dhbwstuttgart.parser.scope.JavaClassName; +import de.dhbwstuttgart.parser.scope.JavaClassRegistry; +import de.dhbwstuttgart.syntaxtree.ClassOrInterface; +import de.dhbwstuttgart.syntaxtree.GenericTypeVar; +import de.dhbwstuttgart.syntaxtree.Method; +import de.dhbwstuttgart.syntaxtree.ParameterList; +import de.dhbwstuttgart.syntaxtree.SourceFile; +import de.dhbwstuttgart.syntaxtree.GenericDeclarationList; +import de.dhbwstuttgart.syntaxtree.factory.ASTFactory; +import de.dhbwstuttgart.syntaxtree.factory.UnifyTypeFactory; +import de.dhbwstuttgart.syntaxtree.type.ExtendsWildcardType; +import de.dhbwstuttgart.syntaxtree.type.GenericRefType; +import de.dhbwstuttgart.syntaxtree.type.RefType; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import de.dhbwstuttgart.syntaxtree.type.SuperWildcardType; +import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; +import de.dhbwstuttgart.syntaxtree.type.TypeVisitor; +import de.dhbwstuttgart.syntaxtree.visual.ASTTypePrinter; +import de.dhbwstuttgart.target.generate.ASTToTargetAST; +import de.dhbwstuttgart.target.generate.GenericsResult; +import de.dhbwstuttgart.target.tree.expression.TargetBinaryOp; +import de.dhbwstuttgart.typeinference.constraints.Constraint; +import de.dhbwstuttgart.typeinference.constraints.ConstraintSet; +import de.dhbwstuttgart.typeinference.constraints.Pair; +import de.dhbwstuttgart.typeinference.result.ResultSet; +import de.dhbwstuttgart.typeinference.typeAlgo.TYPE; +import de.dhbwstuttgart.typeinference.unify.RuleSet; +import de.dhbwstuttgart.typeinference.unify.TypeUnify; +import de.dhbwstuttgart.typeinference.unify.distributeVariance; +import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure; +import de.dhbwstuttgart.typeinference.unify.model.PairOperator; +import de.dhbwstuttgart.typeinference.unify.model.PlaceholderType; +import de.dhbwstuttgart.typeinference.unify.model.UnifyPair; +import de.dhbwstuttgart.typeinference.unify.model.UnifyType; +import de.dhbwstuttgart.typeinference.unify.TypeUnifyTask; +import de.dhbwstuttgart.typeinference.unify.UnifyResultListener; +import de.dhbwstuttgart.typeinference.unify.UnifyResultListenerImpl; +import de.dhbwstuttgart.typeinference.unify.UnifyResultModel; +import de.dhbwstuttgart.typeinference.unify.UnifyTaskModel; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.Writer; +import java.sql.Array; +import java.util.*; +import java.util.Map.Entry; +import java.util.function.Function; +import java.util.stream.Collectors; + +import org.apache.commons.io.output.NullOutputStream; + +public class JavaTXCompiler { + + // public static JavaTXCompiler INSTANCE; + final CompilationEnvironment environment; + Boolean resultmodel = true; + public final Map sourceFiles = new HashMap<>(); + + Boolean log = false; //gibt an ob ein Log-File nach System.getProperty("user.dir")+""/logFiles/"" geschrieben werden soll? + public volatile UnifyTaskModel usedTasks = new UnifyTaskModel(); + private final DirectoryClassLoader classLoader; + + private final List classPath; + + public DirectoryClassLoader getClassLoader() { + return classLoader; + } + + public JavaTXCompiler(File sourceFile) throws IOException, ClassNotFoundException { + this(Arrays.asList(sourceFile), null); + } + + public JavaTXCompiler(File sourceFile, Boolean log) throws IOException, ClassNotFoundException { + this(sourceFile); + this.log = log; + } + + public JavaTXCompiler(List sourceFiles) throws IOException, ClassNotFoundException { + this(sourceFiles, null); + } + + public JavaTXCompiler(List sources, List contextPath) throws IOException, ClassNotFoundException { + if (contextPath == null || contextPath.isEmpty()) { + // When no contextPaths are given, the working directory is the sources root + contextPath = Lists.newArrayList(new File(System.getProperty("user.dir"))); + } + classLoader = new DirectoryClassLoader(contextPath, ClassLoader.getSystemClassLoader()); + environment = new CompilationEnvironment(sources); + classPath = contextPath; + + for (File s : sources) { + parse(s); + } + // INSTANCE = this; + } + + private void addSourceFile(File file, SourceFile sf) { + sourceFiles.put(file, sf); + } + + public ClassOrInterface getClass(JavaClassName name) { + for (var sf : sourceFiles.values()) { + for (var clazz : sf.KlassenVektor) { + if (clazz.getClassName().equals(name)) return clazz; + } + } + try { + var clazz = classLoader.loadClass(name.toString()); + if (clazz != null) + return ASTFactory.createClass(clazz); + } catch (ClassNotFoundException ignored) {} + return null; + } + + public ConstraintSet getConstraints() throws ClassNotFoundException, IOException { + Set allClasses = new HashSet<>();// environment.getAllAvailableClasses(); + ClassOrInterface objectClass = ASTFactory.createClass(classLoader.loadClass(new JavaClassName("java.lang.Object").toString())); + // Alle Importierten Klassen in allen geparsten Sourcefiles kommen ins FC + for (Entry source : sourceFiles.entrySet()) { + var importedClasses = new ArrayList(); + for (JavaClassName name : source.getValue().getImports()) { + importedClasses.addAll(getAvailableClasses(name)); + } + for (Class c : CompilationEnvironment.loadDefaultPackageClasses(source.getValue().getPkgName(), source.getKey(), this)) { + ClassOrInterface importedClass = ASTFactory.createClass(c); + importedClasses.add(importedClass); + } + source.getValue().availableClasses.addAll(importedClasses); + } + for (File f : this.sourceFiles.keySet()) { + SourceFile sf = sourceFiles.get(f); + SourceFile sf_new = new SourceFile(sf.getPkgName(), sf.KlassenVektor.stream().map(cl -> new ClassOrInterface(cl)).collect(Collectors.toCollection(ArrayList::new)), sf.imports); + // sf enthaelt neues Source-File, neue Klassen-Objekte und neue + // ArrayListen-Objekte fuer Fields, Construktoren und Methoden + // Alle anderen Objekte werden nur kopiert. + sf_new.KlassenVektor.forEach(cl -> addMethods(sf_new, cl, sf.availableClasses, objectClass)); + allClasses.addAll(sf_new.getClasses()); + } + TYPE ty = new TYPE(sourceFiles.values(), allClasses); + return ty.getConstraints(); + } + + void addMethods(SourceFile sf, ClassOrInterface cl, List importedClasses, ClassOrInterface objectClass) { + if (!cl.areMethodsAdded()) { + ClassOrInterface superclass = null; + Optional optSuperclass = importedClasses.stream().filter(x -> x.getClassName().equals(cl.getSuperClass().getName())).findFirst(); + if (optSuperclass.isPresent()) { + superclass = optSuperclass.get(); + } else { + optSuperclass = sf.KlassenVektor.stream().filter(x -> x.getClassName().equals(cl.getSuperClass().getName())).findFirst(); + if (optSuperclass.isPresent()) { + superclass = optSuperclass.get(); + addMethods(sf, superclass, importedClasses, objectClass); + } else { + try { + var className = cl.getSuperClass().getName().toString(); + superclass = ASTFactory.createClass(classLoader.loadClass(className)); + } catch (ClassNotFoundException ignored) {} + // throw new ClassNotFoundException(""); + } + } + + Iterator paraIt = cl.getSuperClass().getParaList().iterator(); + Iterator tvarVarIt = superclass.getGenerics().iterator(); + + HashMap gtvs = new HashMap<>(); + while (paraIt.hasNext()) { + gtvs.put(tvarVarIt.next().getName(), paraIt.next()); + } + Iterator methodIt = superclass.getMethods().iterator(); + // TODO: PL 2020-05-06: Hier müssen ueberschriebene Methoden noch rausgefiltert + // werden + while (methodIt.hasNext()) { + Method m = methodIt.next(); + ParameterList newParaList = new ParameterList(m.getParameterList().getFormalparalist().stream().map(fp -> fp.withType(fp.getType().acceptTV(new TypeExchanger(gtvs)))).collect(Collectors.toCollection(ArrayList::new)), m.getParameterList().getOffset()); + cl.getMethods().add(new Method(m.modifier, m.name, m.getReturnType().acceptTV(new TypeExchanger(gtvs)), newParaList, m.block, + // new GenericDeclarationList(newGenericsList, + // ((GenericDeclarationList)m.getGenerics()).getOffset()), + (GenericDeclarationList) m.getGenerics(), m.getOffset(), true)); + } + + } + cl.setMethodsAdded(); + } + + private List getAvailableClasses(JavaClassName name) throws ClassNotFoundException { + Set allClasses = new HashSet<>(); + if (loadJavaTXClass(name)) { + var file = findFileForClass(name); + var sf = sourceFiles.get(file); + if (sf != null) allClasses.addAll(sf.KlassenVektor); + } else { + ClassOrInterface importedClass = ASTFactory.createClass(classLoader.loadClass(name.toString())); + allClasses.add(importedClass); + } + return new ArrayList<>(allClasses); + } + + public List getAvailableClasses(SourceFile forSourceFile) throws ClassNotFoundException { + // PL 2018-09-18: List durch Set ersetzt, damit die Klassen nur einmal + // hinzugefuegt werden + // List allClasses = new + // ArrayList<>();//environment.getAllAvailableClasses(); + Set allClasses = new HashSet<>(); + + for (JavaClassName name : forSourceFile.getImports()) { + allClasses.addAll(getAvailableClasses(name)); + } + return new ArrayList<>(allClasses); + } + + /* + * public List typeInferenceOld() throws ClassNotFoundException { List allClasses = new ArrayList<>();//environment.getAllAvailableClasses(); //Alle Importierten Klassen in allen geparsten Sourcefiles kommen ins FC for(SourceFile sf : this.sourceFiles.values()) { allClasses.addAll(getAvailableClasses(sf)); allClasses.addAll(sf.getClasses()); } + * + * final ConstraintSet cons = getConstraints(); + * + * FiniteClosure finiteClosure = UnifyTypeFactory.generateFC(allClasses); System.out.println(finiteClosure); ConstraintSet unifyCons = UnifyTypeFactory.convert(cons); + * + * TypeUnify unify = new TypeUnify(); Set> results = new HashSet<>(); try { File logPath = new File(System.getProperty("user.dir")+"/target/logFiles/"); logPath.mkdirs(); FileWriter logFile = new FileWriter(new File(logPath, "log")); logFile.write("FC:\\" + finiteClosure.toString()+"\n"); for(SourceFile sf : this.sourceFiles.values()) { logFile.write(ASTTypePrinter.print(sf)); } logFile.flush(); Set>> cardProd = unifyCons.cartesianProduct(); for + * (List> xCons : cardProd ){ Set xConsSet = new HashSet<>(); for (Constraint constraint : xCons) { xConsSet.addAll(constraint); } //.collect(Collectors.toCollection(ArrayList::new)))) System.out.println(xConsSet); Set methodParaTypeVarNames = allClasses.stream().map(x -> x.getMethods().stream().map(y -> y.getParameterList().getFormalparalist() .stream().filter(z -> z.getType() instanceof TypePlaceholder) .map(z -> + * ((TypePlaceholder)z.getType()).getName()).collect(Collectors.toCollection( HashSet::new))) .reduce(new HashSet(), (a,b) -> { a.addAll(b); return a;}, (a,b) -> { a.addAll(b); return a;} ) ) .reduce(new HashSet(), (a,b) -> { a.addAll(b); return a;} ); + * + * Set constructorParaTypeVarNames = allClasses.stream().map(x -> x.getConstructors().stream().map(y -> y.getParameterList().getFormalparalist() .stream().filter(z -> z.getType() instanceof TypePlaceholder) .map(z -> ((TypePlaceholder)z.getType()).getName()).collect(Collectors.toCollection( HashSet::new))) .reduce(new HashSet(), (a,b) -> { a.addAll(b); return a;}, (a,b) -> { a.addAll(b); return a;} ) ) .reduce(new HashSet(), (a,b) -> { a.addAll(b); return a;} ); + * + * Set paraTypeVarNames = methodParaTypeVarNames; paraTypeVarNames.addAll(constructorParaTypeVarNames); + * + * Set returnTypeVarNames = allClasses.stream().map(x -> x.getMethods().stream().filter(y -> y.getReturnType() instanceof TypePlaceholder) .map(z -> ((TypePlaceholder)z.getReturnType()).getName()).collect(Collectors. toCollection(HashSet::new))).reduce((a,b) -> { a.addAll(b); return a;} ).get(); + * + * Set fieldTypeVarNames = allClasses.stream().map(x -> x.getFieldDecl().stream().filter(y -> y.getReturnType() instanceof TypePlaceholder) .map(z -> ((TypePlaceholder)z.getReturnType()).getName()).collect(Collectors. toCollection(HashSet::new))).reduce((a,b) -> { a.addAll(b); return a;} ).get(); + * + * returnTypeVarNames.addAll(fieldTypeVarNames); + * + * xConsSet = xConsSet.stream().map(x -> { //Hier muss ueberlegt werden, ob //1. alle Argument- und Retuntyp-Variablen in allen UnifyPairs // mit disableWildcardtable() werden. //2. alle Typvariablen mit Argument- oder Retuntyp-Variablen //in Beziehung auch auf disableWildcardtable() gesetzt werden muessen //PL 2018-04-23 if ((x.getLhsType() instanceof PlaceholderType)) { if (paraTypeVarNames.contains(x.getLhsType().getName())) { ((PlaceholderType)x.getLhsType()).setVariance((byte)1); + * ((PlaceholderType)x.getLhsType()).disableWildcardtable(); } if (returnTypeVarNames.contains(x.getLhsType().getName())) { ((PlaceholderType)x.getLhsType()).setVariance((byte)-1); ((PlaceholderType)x.getLhsType()).disableWildcardtable(); } } if ((x.getRhsType() instanceof PlaceholderType)) { if (paraTypeVarNames.contains(x.getRhsType().getName())) { ((PlaceholderType)x.getRhsType()).setVariance((byte)1); ((PlaceholderType)x.getRhsType()).disableWildcardtable(); } if + * (returnTypeVarNames.contains(x.getRhsType().getName())) { ((PlaceholderType)x.getRhsType()).setVariance((byte)-1); ((PlaceholderType)x.getRhsType()).disableWildcardtable(); } } return x;//HIER DIE JEWEILS RECHT BZW. LINKE SEITE AUF GLEICHE VARIANZ SETZEN WIE DIE JEWEILS ANDERE SEITE }).map( y -> { if ((y.getLhsType() instanceof PlaceholderType) && (y.getRhsType() instanceof PlaceholderType)) { if (((PlaceholderType)y.getLhsType()).getVariance() != 0 && + * ((PlaceholderType)y.getRhsType()).getVariance() == 0) { ((PlaceholderType)y.getRhsType()).setVariance(((PlaceholderType)y.getLhsType( )).getVariance()); } if (((PlaceholderType)y.getLhsType()).getVariance() == 0 && ((PlaceholderType)y.getRhsType()).getVariance() != 0) { ((PlaceholderType)y.getLhsType()).setVariance(((PlaceholderType)y.getRhsType( )).getVariance()); } } return y; } ) .collect(Collectors.toCollection(HashSet::new)); varianceInheritance(xConsSet); Set> result = + * unify.unifySequential(xConsSet, finiteClosure, logFile, log); //Set> result = unify.unify(xConsSet, finiteClosure); System.out.println("RESULT: " + result); logFile.write("RES: " + result.toString()+"\n"); logFile.flush(); results.addAll(result); } + * + * results = results.stream().map(x -> { Optional> res = new RuleSet().subst(x.stream().map(y -> { if (y.getPairOp() == PairOperator.SMALLERDOTWC) y.setPairOp(PairOperator.EQUALSDOT); return y; //alle Paare a <.? b erden durch a =. b ersetzt }).collect(Collectors.toCollection(HashSet::new))); if (res.isPresent()) {//wenn subst ein Erg liefert wurde was veraendert return new TypeUnifyTask().applyTypeUnificationRules(res.get(), finiteClosure); } else return x; //wenn nichts + * veraendert wurde wird x zurueckgegeben }).collect(Collectors.toCollection(HashSet::new)); System.out.println("RESULT Final: " + results); logFile.write("RES_FINAL: " + results.toString()+"\n"); logFile.flush(); logFile.write("PLACEHOLDERS: " + PlaceholderType.EXISTING_PLACEHOLDERS); logFile.flush(); } catch (IOException e) { e.printStackTrace(); } return results.stream().map((unifyPairs -> new ResultSet(UnifyTypeFactory.convert(unifyPairs, + * generateTPHMap(cons))))).collect(Collectors.toList()); } + */ + /** + * Vererbt alle Variancen bei Paaren (a <. theta) oder (Theta <. a) wenn a eine Variance !=0 hat auf alle Typvariablen in Theta. + * + * + */ + /* + * private void varianceInheritance(Set eq) { Set usedTPH = new HashSet<>(); Set phSet = eq.stream().map(x -> { Set pair = new HashSet<>(); if (x.getLhsType() instanceof PlaceholderType) pair.add((PlaceholderType)x.getLhsType()); if (x.getRhsType() instanceof PlaceholderType) pair.add((PlaceholderType)x.getRhsType()); return pair; }).reduce(new HashSet<>(), (a,b) -> { a.addAll(b); return a;} , (c,d) -> { c.addAll(d); return c;}); + * + * ArrayList phSetVariance = new ArrayList<>(phSet); phSetVariance.removeIf(x -> (x.getVariance() == 0)); while(!phSetVariance.isEmpty()) { PlaceholderType a = phSetVariance.remove(0); usedTPH.add(a); //HashMap ht = new HashMap<>(); //ht.put(a, a.getVariance()); Set eq1 = new HashSet<>(eq); eq1.removeIf(x -> !(x.getLhsType() instanceof PlaceholderType && ((PlaceholderType)x.getLhsType()).equals(a))); eq1.stream().forEach(x -> { + * x.getRhsType().accept(new distributeVariance(), a.getVariance());}); eq1 = new HashSet<>(eq); eq1.removeIf(x -> !(x.getRhsType() instanceof PlaceholderType && ((PlaceholderType)x.getRhsType()).equals(a))); eq1.stream().forEach(x -> { x.getLhsType().accept(new distributeVariance(), a.getVariance());}); phSetVariance = new ArrayList<>(phSet); phSetVariance.removeIf(x -> (x.getVariance() == 0 || usedTPH.contains(x))); } } + */ + + public UnifyResultModel typeInferenceAsync(UnifyResultListener resultListener, Writer logFile) throws ClassNotFoundException, IOException { + List allClasses = new ArrayList<>();// environment.getAllAvailableClasses(); + // Alle Importierten Klassen in allen geparsten Sourcefiles kommen ins FC + for (Entry source : this.sourceFiles.entrySet()) { + SourceFile sf = source.getValue(); + allClasses.addAll(getAvailableClasses(sf)); + allClasses.addAll(sf.getClasses()); + allClasses.addAll(CompilationEnvironment.loadDefaultPackageClasses(sf.getPkgName(), source.getKey(), this).stream().map(ASTFactory::createClass).collect(Collectors.toList())); + } + + final ConstraintSet cons = getConstraints(); + Set> results = new HashSet<>(); + UnifyResultModel urm = null; + // urm.addUnifyResultListener(resultListener); + try { + logFile = logFile == null ? new FileWriter(new File("log_" + sourceFiles.keySet().iterator().next().getName())) : logFile; + IFiniteClosure finiteClosure = UnifyTypeFactory.generateFC(allClasses, logFile, getClassLoader()); + System.out.println(finiteClosure); + urm = new UnifyResultModel(cons, finiteClosure); + urm.addUnifyResultListener(resultListener); + ConstraintSet unifyCons = UnifyTypeFactory.convert(cons); + + Function distributeInnerVars = x -> { + UnifyType lhs, rhs; + if (((lhs = x.getLhsType()) instanceof PlaceholderType) && ((rhs = x.getRhsType()) instanceof PlaceholderType) && (((PlaceholderType) lhs).isInnerType() || ((PlaceholderType) rhs).isInnerType())) { + ((PlaceholderType) lhs).setInnerType(true); + ((PlaceholderType) rhs).setInnerType(true); + } + return x; + + }; + logFile.write(unifyCons.toString()); + unifyCons = unifyCons.map(distributeInnerVars); + logFile.write(unifyCons.toString()); + TypeUnify unify = new TypeUnify(); + // Set> results = new HashSet<>(); Nach vorne gezogen + logFile.write("FC:\\" + finiteClosure.toString() + "\n"); + for (SourceFile sf : this.sourceFiles.values()) { + logFile.write(ASTTypePrinter.print(sf)); + } + logFile.flush(); + + Set methodParaTypeVarNames = allClasses.stream().map(x -> x.getMethods().stream().map(y -> y.getParameterList().getFormalparalist().stream().filter(z -> z.getType() instanceof TypePlaceholder).map(z -> ((TypePlaceholder) z.getType()).getName()).collect(Collectors.toCollection(HashSet::new))).reduce(new HashSet(), (a, b) -> { + a.addAll(b); + return a; + }, (a, b) -> { + a.addAll(b); + return a; + })).reduce(new HashSet(), (a, b) -> { + a.addAll(b); + return a; + }); + + Set constructorParaTypeVarNames = allClasses.stream().map(x -> x.getConstructors().stream().map(y -> y.getParameterList().getFormalparalist().stream().filter(z -> z.getType() instanceof TypePlaceholder).map(z -> ((TypePlaceholder) z.getType()).getName()).collect(Collectors.toCollection(HashSet::new))).reduce(new HashSet(), (a, b) -> { + a.addAll(b); + return a; + }, (a, b) -> { + a.addAll(b); + return a; + })).reduce(new HashSet(), (a, b) -> { + a.addAll(b); + return a; + }); + + Set paraTypeVarNames = methodParaTypeVarNames; + paraTypeVarNames.addAll(constructorParaTypeVarNames); + + Set returnTypeVarNames = allClasses.stream().map(x -> x.getMethods().stream().filter(y -> y.getReturnType() instanceof TypePlaceholder).map(z -> ((TypePlaceholder) z.getReturnType()).getName()).collect(Collectors.toCollection(HashSet::new))).reduce((a, b) -> { + a.addAll(b); + return a; + }).get(); + + Set fieldTypeVarNames = allClasses.stream().map(x -> x.getFieldDecl().stream().filter(y -> y.getReturnType() instanceof TypePlaceholder).map(z -> ((TypePlaceholder) z.getReturnType()).getName()).collect(Collectors.toCollection(HashSet::new))).reduce((a, b) -> { + a.addAll(b); + return a; + }).get(); + + returnTypeVarNames.addAll(fieldTypeVarNames); + + unifyCons = unifyCons.map(x -> { + // Hier muss ueberlegt werden, ob + // 1. alle Argument- und Retuntyp-Variablen in allen UnifyPairs + // mit disableWildcardtable() werden. + // 2. alle Typvariablen mit Argument- oder Retuntyp-Variablen + // in Beziehung auch auf disableWildcardtable() gesetzt werden muessen + // PL 2018-04-23 + if ((x.getLhsType() instanceof PlaceholderType)) { + if (paraTypeVarNames.contains(x.getLhsType().getName())) { + ((PlaceholderType) x.getLhsType()).setVariance((byte) 1); + ((PlaceholderType) x.getLhsType()).disableWildcardtable(); + } + if (returnTypeVarNames.contains(x.getLhsType().getName())) { + ((PlaceholderType) x.getLhsType()).setVariance((byte) -1); + ((PlaceholderType) x.getLhsType()).disableWildcardtable(); + } + } + if ((x.getRhsType() instanceof PlaceholderType)) { + if (paraTypeVarNames.contains(x.getRhsType().getName())) { + ((PlaceholderType) x.getRhsType()).setVariance((byte) 1); + ((PlaceholderType) x.getRhsType()).disableWildcardtable(); + } + if (returnTypeVarNames.contains(x.getRhsType().getName())) { + ((PlaceholderType) x.getRhsType()).setVariance((byte) -1); + ((PlaceholderType) x.getRhsType()).disableWildcardtable(); + } + } + return x;// HIER DIE JEWEILS RECHT BZW. LINKE SEITE AUF GLEICHE VARIANZ SETZEN WIE DIE + // JEWEILS ANDERE SEITE + }); + Set varianceTPHold; + Set varianceTPH = new HashSet<>(); + varianceTPH = varianceInheritanceConstraintSet(unifyCons); + + /* + * PL 2018-11-07 wird in varianceInheritanceConstraintSet erledigt do { //PL 2018-11-05 Huellenbildung Variance auf alle TPHs der Terme auf der jeweiligen //anderen Seite übertragen varianceTPHold = new HashSet<>(varianceTPH); varianceTPH = varianceInheritanceConstraintSet(unifyCons); unifyCons.map( y -> { if ((y.getLhsType() instanceof PlaceholderType) && (y.getRhsType() instanceof PlaceholderType)) { if (((PlaceholderType)y.getLhsType()).getVariance() != 0 && + * ((PlaceholderType)y.getRhsType()).getVariance() == 0) { ((PlaceholderType)y.getRhsType()).setVariance(((PlaceholderType)y.getLhsType( )).getVariance()); } if (((PlaceholderType)y.getLhsType()).getVariance() == 0 && ((PlaceholderType)y.getRhsType()).getVariance() != 0) { ((PlaceholderType)y.getLhsType()).setVariance(((PlaceholderType)y.getRhsType( )).getVariance()); } } return y; } ); } while (!varianceTPHold.equals(varianceTPH)); + */ + + // Set> result = unify.unifySequential(xConsSet, finiteClosure, + // logFile, log); + // Set> result = unify.unify(xConsSet, finiteClosure); + List>> oderConstraints = unifyCons.getOderConstraints()/* + * .stream().map(x -> { Set> ret = new HashSet<>(); for (Constraint y : x) { ret.add(new HashSet<>(y)); } return ret; }).collect(Collectors. toCollection(ArrayList::new)) + */; + unify.unifyAsync(unifyCons.getUndConstraints(), oderConstraints, finiteClosure, logFile, log, urm, usedTasks); + } catch (IOException e) { + System.err.println("kein LogFile"); + } + return urm; + } + + public List typeInference() throws ClassNotFoundException, IOException { + List allClasses = new ArrayList<>();// environment.getAllAvailableClasses(); + // Alle Importierten Klassen in allen geparsten Sourcefiles kommen ins FC + for (Entry source : this.sourceFiles.entrySet()) { + SourceFile sf = source.getValue(); + allClasses.addAll(getAvailableClasses(sf)); + allClasses.addAll(sf.getClasses()); + var newClasses = CompilationEnvironment.loadDefaultPackageClasses(sf.getPkgName(), source.getKey(), this).stream().map(ASTFactory::createClass).collect(Collectors.toList()); + for (var clazz : newClasses) { + // Don't load classes that get recompiled + if (sf.getClasses().stream().anyMatch(nf -> nf.getClassName().equals(clazz.getClassName()))) + continue; + if (allClasses.stream().noneMatch(old -> old.getClassName().equals(clazz.getClassName()))) + allClasses.add(clazz); + } + } + + final ConstraintSet cons = getConstraints(); + Set> results = new HashSet<>(); + try { + var logFolder = new File(System.getProperty("user.dir") + "/logFiles/"); + if (log) logFolder.mkdirs(); + Writer logFile = log ? new FileWriter(new File(logFolder, "log_" + sourceFiles.keySet().iterator().next().getName())) : new OutputStreamWriter(new NullOutputStream()); + IFiniteClosure finiteClosure = UnifyTypeFactory.generateFC(allClasses, logFile, classLoader); + System.out.println(finiteClosure); + ConstraintSet unifyCons = UnifyTypeFactory.convert(cons); + System.out.println("xxx1"); + Function distributeInnerVars = x -> { + UnifyType lhs, rhs; + if (((lhs = x.getLhsType()) instanceof PlaceholderType) && ((rhs = x.getRhsType()) instanceof PlaceholderType) && (((PlaceholderType) lhs).isInnerType() || ((PlaceholderType) rhs).isInnerType())) { + ((PlaceholderType) lhs).setInnerType(true); + ((PlaceholderType) rhs).setInnerType(true); + } + return x; + + }; + + logFile.write("Unify:" + unifyCons.toString()); + System.out.println("Unify:" + unifyCons.toString()); + unifyCons = unifyCons.map(distributeInnerVars); + logFile.write("\nUnify_distributeInnerVars: " + unifyCons.toString()); + TypeUnify unify = new TypeUnify(); + // Set> results = new HashSet<>(); Nach vorne gezogen + logFile.write("FC:\\" + finiteClosure.toString() + "\n"); + for (SourceFile sf : this.sourceFiles.values()) { + logFile.write(ASTTypePrinter.print(sf)); + System.out.println(ASTTypePrinter.print(sf)); + } + logFile.flush(); + + Set methodParaTypeVarNames = allClasses.stream().map(x -> x.getMethods().stream().map(y -> y.getParameterList().getFormalparalist().stream().filter(z -> z.getType() instanceof TypePlaceholder).map(z -> ((TypePlaceholder) z.getType()).getName()).collect(Collectors.toCollection(HashSet::new))).reduce(new HashSet(), (a, b) -> { + a.addAll(b); + return a; + }, (a, b) -> { + a.addAll(b); + return a; + })).reduce(new HashSet(), (a, b) -> { + a.addAll(b); + return a; + }); + + Set constructorParaTypeVarNames = allClasses.stream().map(x -> x.getConstructors().stream().map(y -> y.getParameterList().getFormalparalist().stream().filter(z -> z.getType() instanceof TypePlaceholder).map(z -> ((TypePlaceholder) z.getType()).getName()).collect(Collectors.toCollection(HashSet::new))).reduce(new HashSet(), (a, b) -> { + a.addAll(b); + return a; + }, (a, b) -> { + a.addAll(b); + return a; + })).reduce(new HashSet(), (a, b) -> { + a.addAll(b); + return a; + }); + + Set paraTypeVarNames = methodParaTypeVarNames; + paraTypeVarNames.addAll(constructorParaTypeVarNames); + + Set returnTypeVarNames = allClasses.stream().map(x -> x.getMethods().stream().filter(y -> y.getReturnType() instanceof TypePlaceholder).map(z -> ((TypePlaceholder) z.getReturnType()).getName()).collect(Collectors.toCollection(HashSet::new))).reduce((a, b) -> { + a.addAll(b); + return a; + }).get(); + + Set fieldTypeVarNames = allClasses.stream().map(x -> x.getFieldDecl().stream().filter(y -> y.getReturnType() instanceof TypePlaceholder).map(z -> ((TypePlaceholder) z.getReturnType()).getName()).collect(Collectors.toCollection(HashSet::new))).reduce((a, b) -> { + a.addAll(b); + return a; + }).get(); + + returnTypeVarNames.addAll(fieldTypeVarNames); + + unifyCons = unifyCons.map(x -> { + // Hier muss ueberlegt werden, ob + // 1. alle Argument- und Retuntyp-Variablen in allen UnifyPairs + // mit disableWildcardtable() werden. + // 2. alle Typvariablen mit Argument- oder Retuntyp-Variablen + // in Beziehung auch auf disableWildcardtable() gesetzt werden muessen + // PL 2018-04-23 + if ((x.getLhsType() instanceof PlaceholderType)) { + if (paraTypeVarNames.contains(x.getLhsType().getName())) { + ((PlaceholderType) x.getLhsType()).setVariance((byte) 1); + ((PlaceholderType) x.getLhsType()).disableWildcardtable(); + } + if (returnTypeVarNames.contains(x.getLhsType().getName())) { + ((PlaceholderType) x.getLhsType()).setVariance((byte) -1); + ((PlaceholderType) x.getLhsType()).disableWildcardtable(); + } + } + if ((x.getRhsType() instanceof PlaceholderType)) { + if (paraTypeVarNames.contains(x.getRhsType().getName())) { + ((PlaceholderType) x.getRhsType()).setVariance((byte) 1); + ((PlaceholderType) x.getRhsType()).disableWildcardtable(); + } + if (returnTypeVarNames.contains(x.getRhsType().getName())) { + ((PlaceholderType) x.getRhsType()).setVariance((byte) -1); + ((PlaceholderType) x.getRhsType()).disableWildcardtable(); + } + } + return x;// HIER DIE JEWEILS RECHT BZW. LINKE SEITE AUF GLEICHE VARIANZ SETZEN WIE DIE + // JEWEILS ANDERE SEITE + }); + + // PL 2020-02-05 alle Oder-Constraints Receiver und Parameter werden auf + // variance 1 gesetzt + // Es wird davon ausgegangen, dass in OderConstraints in Bedingungen für + // Parameter die Typen der Argumente links stehen + // und die Typen der Rückgabewerte immer rechts stehen + + /* + * unifyCons.getOderConstraints().forEach(z -> z.forEach(y -> y.forEach(x -> { if ((x.getLhsType() instanceof PlaceholderType) && x.getPairOp().compareTo(PairOperator.SMALLERDOT) == 0) { ((PlaceholderType) x.getLhsType()).setVariance((byte)1); } else if ((x.getRhsType() instanceof PlaceholderType) && x.getPairOp().compareTo(PairOperator.EQUALSDOT) == 0) { ((PlaceholderType) x.getRhsType()).setVariance((byte)-1); } }))); + */ + + System.out.println("Unify nach Oder-Constraints-Anpassung:" + unifyCons.toString()); + Set varianceTPHold; + Set varianceTPH = new HashSet<>(); + varianceTPH = varianceInheritanceConstraintSet(unifyCons); + + /* + * PL 2018-11-07 wird in varianceInheritanceConstraintSet erledigt do { //PL 2018-11-05 Huellenbildung Variance auf alle TPHs der Terme auf der jeweiligen //anderen Seite übertragen varianceTPHold = new HashSet<>(varianceTPH); varianceTPH = varianceInheritanceConstraintSet(unifyCons); unifyCons.map( y -> { if ((y.getLhsType() instanceof PlaceholderType) && (y.getRhsType() instanceof PlaceholderType)) { if (((PlaceholderType)y.getLhsType()).getVariance() != 0 && + * ((PlaceholderType)y.getRhsType()).getVariance() == 0) { ((PlaceholderType)y.getRhsType()).setVariance(((PlaceholderType)y.getLhsType( )).getVariance()); } if (((PlaceholderType)y.getLhsType()).getVariance() == 0 && ((PlaceholderType)y.getRhsType()).getVariance() != 0) { ((PlaceholderType)y.getLhsType()).setVariance(((PlaceholderType)y.getRhsType( )).getVariance()); } } return y; } ); } while (!varianceTPHold.equals(varianceTPH)); + */ + + // Set> result = unify.unifySequential(xConsSet, finiteClosure, + // logFile, log); + // Set> result = unify.unify(xConsSet, finiteClosure); + List>> oderConstraints = unifyCons.getOderConstraints()// .stream().map(x -> { + /* + * Set> ret = new HashSet<>(); for (Constraint y : x) { ret.add(new HashSet<>(y)); } return ret; }).collect(Collectors.toCollection(ArrayList::new)) + */; + if (resultmodel) { + /* UnifyResultModel Anfang */ + UnifyResultModel urm = new UnifyResultModel(cons, finiteClosure); + UnifyResultListenerImpl li = new UnifyResultListenerImpl(); + urm.addUnifyResultListener(li); + unify.unifyParallel(unifyCons.getUndConstraints(), oderConstraints, finiteClosure, logFile, log, urm, usedTasks); + System.out.println("RESULT Final: " + li.getResults()); + System.out.println("Constraints for Generated Generics: " + " ???"); + logFile.write("RES_FINAL: " + li.getResults().toString() + "\n"); + logFile.flush(); + return li.getResults(); + } + /* UnifyResultModel End */ + else { + // Set> result = unify.unify(unifyCons.getUndConstraints(), + // oderConstraints, finiteClosure, logFile, log, new UnifyResultModel(cons, + // finiteClosure)); + Set> result = unify.unifyOderConstraints(unifyCons.getUndConstraints(), oderConstraints, finiteClosure, logFile, log, new UnifyResultModel(cons, finiteClosure), usedTasks); + System.out.println("RESULT: " + result); + logFile.write("RES: " + result.toString() + "\n"); + logFile.flush(); + results.addAll(result); + + results = results.stream().map(x -> { + Optional> res = new RuleSet().subst(x.stream().map(y -> { + if (y.getPairOp() == PairOperator.SMALLERDOTWC) + y.setPairOp(PairOperator.EQUALSDOT); + return y; // alle Paare a <.? b erden durch a =. b ersetzt + }).collect(Collectors.toCollection(HashSet::new))); + if (res.isPresent()) {// wenn subst ein Erg liefert wurde was veraendert + return new TypeUnifyTask().applyTypeUnificationRules(res.get(), finiteClosure); + } else + return x; // wenn nichts veraendert wurde wird x zurueckgegeben + }).collect(Collectors.toCollection(HashSet::new)); + System.out.println("RESULT Final: " + results); + System.out.println("Constraints for Generated Generics: " + " ???"); + logFile.write("RES_FINAL: " + results.toString() + "\n"); + logFile.flush(); + logFile.write("PLACEHOLDERS: " + PlaceholderType.EXISTING_PLACEHOLDERS); + logFile.flush(); + } + } catch (IOException e) { + System.err.println("kein LogFile"); + } + return results.stream().map((unifyPairs -> new ResultSet(UnifyTypeFactory.convert(unifyPairs, Pair.generateTPHMap(cons))))).collect(Collectors.toList()); + } + + /** + * Vererbt alle Variancen bei Paaren (a <. theta) oder (Theta <. a) wenn a eine Variance !=0 hat auf alle Typvariablen in Theta. + * + * + */ + private Set varianceInheritanceConstraintSet(ConstraintSet cons) { + Set eq = cons.getAll(); + Set usedTPH = new HashSet<>(); + Set phSet = eq.stream().map(x -> { + Set pair = new HashSet<>(); + if (x.getLhsType() instanceof PlaceholderType) + pair.add((PlaceholderType) x.getLhsType()); + if (x.getRhsType() instanceof PlaceholderType) + pair.add((PlaceholderType) x.getRhsType()); + return pair; + }).reduce(new HashSet<>(), (a, b) -> { + a.addAll(b); + return a; + }, (c, d) -> { + c.addAll(d); + return c; + }); + + ArrayList phSetVariance = new ArrayList<>(phSet); + phSetVariance.removeIf(x -> (x.getVariance() == 0)); + while (!phSetVariance.isEmpty()) { + PlaceholderType a = phSetVariance.remove(0); + usedTPH.add(a); + // HashMap ht = new HashMap<>(); + // ht.put(a, a.getVariance()); + // ConstraintSet eq1 = cons; + // eq1.removeIf(x -> !(x.getLhsType() instanceof PlaceholderType && + // ((PlaceholderType)x.getLhsType()).equals(a))); + // durch if-Abfrage im foreach geloest + cons.forEach(x -> { + if (x.getLhsType() instanceof PlaceholderType && ((PlaceholderType) x.getLhsType()).equals(a)) { + x.getRhsType().accept(new distributeVariance(), a.getVariance()); + } + }); + // ` eq1 = new HashSet<>(eq); + // eq1.removeIf(x -> !(x.getRhsType() instanceof PlaceholderType && + // ((PlaceholderType)x.getRhsType()).equals(a))); + // durch if-Abfrage im foreach geloest + cons.forEach(x -> { + if (x.getRhsType() instanceof PlaceholderType && ((PlaceholderType) x.getRhsType()).equals(a)) { + x.getLhsType().accept(new distributeVariance(), a.getVariance()); + } + }); + phSetVariance = new ArrayList<>(phSet); // macht vermutlich keinen Sinn PL 2018-10-18, doch, es koennen neue + // TPHs mit Variancen dazugekommen sein PL 2018-11-07 + phSetVariance.removeIf(x -> (x.getVariance() == 0 || usedTPH.contains(x))); + } + return usedTPH; + } + + public final JavaClassRegistry classRegistry = new JavaClassRegistry(); + + private SourceFile parse(File sourceFile) throws IOException, java.lang.ClassNotFoundException { + SourceFileContext tree = JavaTXParser.parse(sourceFile); + environment.addClassesToRegistry(classRegistry, tree, sourceFile, this); + SyntaxTreeGenerator generator = new SyntaxTreeGenerator(this, classRegistry, new GenericsRegistry(null), sourceFile.getName()); + var classes = new ArrayList(); + var sf = new SourceFile(generator.pkgName, classes, generator.imports); + addSourceFile(sourceFile, sf); + generator.convert(classes, tree, environment.packageCrawler); + sf.imports.addAll(generator.imports); + return sf; + } + + /** + * When an import tries to import a JavaTX class it first looks it up in the cache and + * if it doesn't exist it's going to compile it and add it to the source files list + * @param name + */ + public boolean loadJavaTXClass(JavaClassName name) { + var file = findFileForClass(name); + if (file != null) { + if (classRegistry.contains(name)) return true; + try { + var tree = JavaTXParser.parse(file); + classRegistry.addName(name.toString(), 0); // TODO This gets overwritten later, is it bad if we don't know this right away? + environment.addClassesToRegistry(classRegistry, tree, file, this); + SyntaxTreeGenerator generator = new SyntaxTreeGenerator(this, classRegistry, new GenericsRegistry(null), file.getName()); + var classes = new ArrayList(); + var sf = new SourceFile(generator.pkgName, classes, generator.imports); + addSourceFile(file, sf); + generator.convert(classes, tree, environment.packageCrawler); + return true; + } catch (Exception e) { + throw new RuntimeException(e); + } + } + return false; + } + + public File findFileForClass(JavaClassName name) { + var packageName = name.getPackageName(); + var className = name.getClassName().split("\\.")[0]; + for (var cp : classPath) { + var file = new File(cp, packageName.replaceAll("\\.", "/") + "/" + className + ".jav"); + if (file.exists()) return file; + } + return null; + } + + public void generateBytecode() throws ClassNotFoundException, IOException { + generateBytecode((File) null); + } + + /** + * @param path - can be null, then class file output is in the same directory as the parsed source files + */ + public void generateBytecode(String path) throws ClassNotFoundException, IOException { + if (path != null) + generateBytecode(new File(path)); + else + generateBytecode(); + } + + /** + * @param path - output-Directory can be null, then class file output is in the same directory as the parsed source files + */ + public void generateBytecode(File path) throws ClassNotFoundException, IOException { + List typeinferenceResult = this.typeInference(); + generateBytecode(path, typeinferenceResult); + } + + private Map> generatedGenerics = new HashMap<>(); + + public Map> getGeneratedGenerics() { + return generatedGenerics; + } + + /** + * @param outputPath - can be null, then class file output is in the same directory as the parsed source files + * @param typeinferenceResult + * @throws IOException + */ + public void generateBytecode(File outputPath, List typeinferenceResult) throws IOException { + for (File f : sourceFiles.keySet()) { + HashMap classFiles = new HashMap<>(); + SourceFile sf = sourceFiles.get(f); + File path; + if (outputPath == null) { + path = f.getParentFile(); // Set path to path of the parsed .jav file + } else { + path = new File(outputPath, sf.getPkgName().replace(".", "/")); // add package path to root path + } + + var generatedClasses = generateBytecode(sf, typeinferenceResult); + writeClassFile(generatedClasses, path); + } + } + + public synchronized Map generateBytecode(SourceFile sf, List typeInferenceResult) { + var converter = new ASTToTargetAST(this, typeInferenceResult, sf, classLoader); + var generatedClasses = new HashMap(); + for (var clazz : sf.getClasses()) { + var codegen = new Codegen(converter.convert(clazz), this); + var code = codegen.generate(); + generatedClasses.put(clazz.getClassName(), code); + converter.auxiliaries.forEach((name, source) -> { + generatedClasses.put(new JavaClassName(name), source); + }); + } + generatedGenerics.put(sf, converter.javaGenerics()); + return generatedClasses; + } + + public synchronized void writeClassFile(Map classFiles, File path) throws IOException { + FileOutputStream output; + for (JavaClassName name : classFiles.keySet()) { + byte[] bytecode = classFiles.get(name); + System.out.println("generating " + name + ".class file ..."); + // output = new FileOutputStream(new File(System.getProperty("user.dir") + + // "/testBytecode/generatedBC/" +name+".class")); + File outputFile = new File(path, name.getClassName() + ".class"); + outputFile.getAbsoluteFile().getParentFile().mkdirs(); + output = new FileOutputStream(outputFile); + output.write(bytecode); + output.close(); + System.out.println(name + ".class file generated"); + } + } + + /* PL 2020-03-17 mit TypeExchanger in FCGenerator.java zusammenfuehren */ + /** + * Tauscht die GTVs in einem Typ gegen die entsprechenden Typen in der übergebenen Map aus. + */ + private static class TypeExchanger implements TypeVisitor { + + private final HashMap gtvs; + + TypeExchanger(HashMap gtvs) { + this.gtvs = gtvs; + } + + @Override + public RefTypeOrTPHOrWildcardOrGeneric visit(RefType refType) { + List params = new ArrayList<>(); + for (RefTypeOrTPHOrWildcardOrGeneric param : refType.getParaList()) { + params.add(param.acceptTV(this)); + } + RefTypeOrTPHOrWildcardOrGeneric ret = new RefType(refType.getName(), params, new NullToken()); + return ret; + } + + @Override + public RefTypeOrTPHOrWildcardOrGeneric visit(SuperWildcardType superWildcardType) { + SuperWildcardType ret = new SuperWildcardType(superWildcardType.getInnerType().acceptTV(this), superWildcardType.getOffset()); + return ret; + } + + @Override + public RefTypeOrTPHOrWildcardOrGeneric visit(TypePlaceholder typePlaceholder) { + return typePlaceholder; // TypePlaceholder der vererbert wird kann bei der Vererbung nicht instanziert + // werden. + } + + @Override + public RefTypeOrTPHOrWildcardOrGeneric visit(ExtendsWildcardType extendsWildcardType) { + ExtendsWildcardType ret = new ExtendsWildcardType(extendsWildcardType.getInnerType().acceptTV(this), extendsWildcardType.getOffset()); + return ret; + } + + @Override + public RefTypeOrTPHOrWildcardOrGeneric visit(GenericRefType genericRefType) { + if (!gtvs.containsKey(genericRefType.getParsedName())) + throw new DebugException("Dieser Fall darf nicht auftreten"); + return gtvs.get(genericRefType.getParsedName()); + } + + } + +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/environment/ByteArrayClassLoader.java b/javatx-src/main/java/de/dhbwstuttgart/environment/ByteArrayClassLoader.java new file mode 100644 index 0000000..2dd310f --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/environment/ByteArrayClassLoader.java @@ -0,0 +1,13 @@ +package de.dhbwstuttgart.environment; + +public class ByteArrayClassLoader extends ClassLoader implements IByteArrayClassLoader { + @Override + public Class _defineClass(String name, byte[] code, int i, int length) throws ClassFormatError { + return defineClass(name, code, i, length); + } + + @Override + public Class findClass(String name) throws ClassNotFoundException { + return super.findClass(name); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/environment/CompilationEnvironment.java b/javatx-src/main/java/de/dhbwstuttgart/environment/CompilationEnvironment.java new file mode 100644 index 0000000..0e2a453 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/environment/CompilationEnvironment.java @@ -0,0 +1,112 @@ +package de.dhbwstuttgart.environment; + +import java.io.File; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.*; + +import com.google.common.collect.Lists; +import de.dhbwstuttgart.core.JavaTXCompiler; +import de.dhbwstuttgart.syntaxtree.ClassOrInterface; +import de.dhbwstuttgart.syntaxtree.factory.ASTFactory; + +import de.dhbwstuttgart.exceptions.DebugException; +import de.dhbwstuttgart.exceptions.NotImplementedException; +import de.dhbwstuttgart.parser.JavaTXParser; +import de.dhbwstuttgart.parser.antlr.Java17Parser.SourceFileContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.SrcfileContext; +import de.dhbwstuttgart.parser.scope.GatherNames; +import de.dhbwstuttgart.parser.scope.JavaClassRegistry; + +/** + * Stellt die Java-Environment dar und speichert alle Binarys, Librarys und Sourcefiles im zu kompilierenden Projekt Sie erstellt anhand dieser Informationen die JavaClassNameRegistry + * + * TODO: Zur Initialisierung der CompilationEnvironment sollten alle SourceFiles mit ANTLR geparst werden und alle Klassen Generics und Typen herausgefunden werden + */ +public class CompilationEnvironment { + private final List librarys; + private final List sourceFiles; + public final PackageCrawler packageCrawler; + + /** + * Imitiert die Environment beim Aufruf des JavaCompilers auf einer Menge von java-Dateien Die Environment enth�lt automatisch die Java Standard Library + * + * @param sourceFiles die zu kompilierenden Dateien + */ + public CompilationEnvironment(List sourceFiles) { + /** + * Java 9 bringt einige Änderungen am Classloader So funktioniert der BootClassLoader nicht mehr. hier gibts ein paar Quellen zum nachlesen: http://java9.wtf/class-loading/ https://stackoverflow.com/questions/46494112/classloaders-hierarchy-in-java-9 + * + */ + // String bootClassPath = System.getProperty("sun.boot.class.path"); + // DirectoryClassLoader cl = DirectoryClassLoader.getPlatformClassLoader(); + String bootClassPath = System.getProperty("java.class.path"); + librarys = new ArrayList<>(); + for (String path : bootClassPath.split(File.pathSeparator)) { + try { + librarys.add(new URL("file:" + path)); + } catch (MalformedURLException e) { + new DebugException("Fehler im Classpath auf diesem System"); + } + } + // URLClassLoader loader = new URLClassLoader(new URL[0], cl); + // librarys = Arrays.asList(loader.getURLs()); + + this.sourceFiles = sourceFiles; + this.packageCrawler = new PackageCrawler(librarys); + } + + public void addClassesToRegistry(JavaClassRegistry registry, SourceFileContext tree, File sourceFile, JavaTXCompiler compiler) throws ClassNotFoundException, IOException { + Map allNames; + if (tree instanceof SrcfileContext srcfile) { + allNames = GatherNames.getNames((SrcfileContext) tree, packageCrawler, compiler); + for (Class c : loadDefaultPackageClasses(getPackageName(srcfile), sourceFile, compiler)) { + allNames.put(c.getName(), c.getTypeParameters().length); + } + registry.addNames(allNames); + } else { + throw new NotImplementedException(); + } + + } + + public static List loadDefaultPackageClasses(String packageName, File sourceFile, JavaTXCompiler compiler) throws IOException, ClassNotFoundException { + ClassLoader classLoader = compiler.getClassLoader(); + List ret = new ArrayList<>(); + // Set classLoader to include default package for this specific source file + File dir = sourceFile.getAbsoluteFile().getParentFile(); + String dirPath = dir.toString() + "/"; + if (packageName.length() > 0) + dirPath = dirPath.substring(0, dirPath.length() - packageName.length() - 1); + String path = dirPath; + ArrayList defaultPath = Lists.newArrayList(new File(path)); + classLoader = new DirectoryClassLoader(defaultPath, classLoader); + // Gather all names in the default package for this source file (classes that are imported by default) + File[] files = dir.listFiles((dir1, name) -> name.endsWith(".class")); + if (files != null) + for (File classFile : files) { + String className = classFile.getName().substring(0, classFile.getName().length() - 6); + if (className.matches("Fun\\d+\\$\\$.*")) + continue; + ret.add(classLoader.loadClass(packageName + className)); + } + return ret; + } + + private static String getPackageName(SrcfileContext forTree) { + String packageName = ""; + if (forTree.packageDeclaration() != null && !forTree.packageDeclaration().qualifiedName().identifier().isEmpty()) + packageName = forTree.packageDeclaration().qualifiedName().getText(); + return packageName; + } + + public List getAllAvailableClasses() { + List ret = new ArrayList<>(); + for (Class c : new PackageCrawler(librarys).getAllAvailableClasses()) { + ret.add(ASTFactory.createClass(c)); + } + return ret; + } + +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/environment/DirectoryClassLoader.java b/javatx-src/main/java/de/dhbwstuttgart/environment/DirectoryClassLoader.java new file mode 100644 index 0000000..1a47cac --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/environment/DirectoryClassLoader.java @@ -0,0 +1,44 @@ +package de.dhbwstuttgart.environment; + +import java.io.File; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLClassLoader; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.List; +import java.util.stream.Collectors; + +public class DirectoryClassLoader extends URLClassLoader implements IByteArrayClassLoader { + public DirectoryClassLoader(File directory, java.lang.ClassLoader parent) { + super(generateURLArray(dirToURL(directory)), parent); + } + + public DirectoryClassLoader(List directory, java.lang.ClassLoader parent) { + super(directory.stream().map(DirectoryClassLoader::dirToURL).collect(Collectors.toList()).toArray(new URL[0]), parent); + } + + private static URL[] generateURLArray(URL url) { + return new URL[]{url}; + } + + private static URL dirToURL(File url){ + if(!url.isDirectory())throw new RuntimeException(url.toString() + " is not a directory"); + try { + return url.toURI().toURL(); + } catch (MalformedURLException e) { + throw new RuntimeException(e); + } + } + + @Override + public Class _defineClass(String name, byte[] code, int i, int length) throws ClassFormatError { + return defineClass(name, code, i, length); + } + + @Override + public Class findClass(String name) throws ClassNotFoundException { + return super.findClass(name); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/environment/IByteArrayClassLoader.java b/javatx-src/main/java/de/dhbwstuttgart/environment/IByteArrayClassLoader.java new file mode 100644 index 0000000..bd6daa9 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/environment/IByteArrayClassLoader.java @@ -0,0 +1,23 @@ +package de.dhbwstuttgart.environment; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; + +public interface IByteArrayClassLoader { + + Class loadClass(String path) throws ClassNotFoundException; + + default Class loadClass(byte[] code) { + return this._defineClass(null, code, 0, code.length); + } + + default Class loadClass(Path path) throws IOException { + var code = Files.readAllBytes(path); + return this._defineClass(null, code, 0, code.length); + } + + public Class findClass(String name) throws ClassNotFoundException; + + Class _defineClass(String name, byte[] code, int i, int length) throws ClassFormatError; +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/environment/PackageCrawler.java b/javatx-src/main/java/de/dhbwstuttgart/environment/PackageCrawler.java new file mode 100644 index 0000000..646440b --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/environment/PackageCrawler.java @@ -0,0 +1,77 @@ +package de.dhbwstuttgart.environment; + +import java.net.URL; +import java.util.*; + +import org.reflections.Reflections; +import org.reflections.scanners.ResourcesScanner; +import org.reflections.scanners.SubTypesScanner; +import org.reflections.util.ConfigurationBuilder; +import org.reflections.util.FilterBuilder; + +import de.dhbwstuttgart.parser.scope.JavaClassName; +import org.reflections.vfs.SystemDir; + +/** + * Hilft beim Durchsuchen von Packages + * Benutzt die Reflections-Library (https://github.com/ronmamo/reflections) + * Hilfe dazu: http://stackoverflow.com/a/9571146 + */ +public class PackageCrawler { + + final URL[] urls; + public PackageCrawler(List urlList) { + urls = urlList.toArray(new URL[0]); + } + + public Set> getClassesInPackage(String packageName){ + /* + List classLoadersList = new LinkedList(); + classLoadersList.add(Thread.currentThread().getContextClassLoader()); + classLoadersList.add(ClasspathHelper.staticClassLoader()); + classLoadersList.add(Thread.currentThread().getContextClassLoader().getParent()); + classLoadersList.add(DirectoryClassLoader.getSystemClassLoader()); + String bootClassPath = System.getProperty("sun.boot.class.path"); + ArrayList urlList = new ArrayList<>(); + for(String path : bootClassPath.split(";")) { + try { + urlList.add(new URL("file:"+path)); + } catch (MalformedURLException e) { + new DebugException("Fehler im Classpath auf diesem System"); + } + } + URL[] urls = urlList.toArray(new URL[0]); + classLoadersList.add(new URLClassLoader(urls, DirectoryClassLoader.getSystemClassLoader())); + */ + Reflections reflections = new Reflections(new ConfigurationBuilder() + .setScanners(new SubTypesScanner(false /* don't exclude Object.class */), new ResourcesScanner()) + .setUrls(urls) + .filterInputsBy(new FilterBuilder().include(FilterBuilder.prefix(packageName)))); + + Set> classes = reflections.getSubTypesOf(Object.class); + + return classes; + } + + public Set> getAllAvailableClasses(){ + Reflections reflections = new Reflections(new ConfigurationBuilder() + .setScanners(new SubTypesScanner(false /* don't exclude Object.class */), new ResourcesScanner()) + .setUrls(urls)); + + Set> classes = reflections.getSubTypesOf(Object.class); + + return classes; + } + + public Map getClassNames(String packageName){ + Map nameList = new HashMap<>(); + Set> classes = getClassesInPackage(packageName); + if(packageName.equals("java.lang") && ! classes.contains(Object.class)) { + classes.add(Object.class); + } + for(Class c : classes){ + nameList.put(c.getName(), c.getTypeParameters().length); + } + return nameList; + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/exceptions/DebugException.java b/javatx-src/main/java/de/dhbwstuttgart/exceptions/DebugException.java new file mode 100644 index 0000000..8f2b70a --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/exceptions/DebugException.java @@ -0,0 +1,8 @@ +package de.dhbwstuttgart.exceptions; + +public class DebugException extends RuntimeException { + + public DebugException(String message) { + System.err.print(message); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/exceptions/NotImplementedException.java b/javatx-src/main/java/de/dhbwstuttgart/exceptions/NotImplementedException.java new file mode 100644 index 0000000..846567c --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/exceptions/NotImplementedException.java @@ -0,0 +1,11 @@ +package de.dhbwstuttgart.exceptions; + +public class NotImplementedException extends RuntimeException { + + public NotImplementedException() { + } + + public NotImplementedException(String string) { + super(string); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/exceptions/ParserError.java b/javatx-src/main/java/de/dhbwstuttgart/exceptions/ParserError.java new file mode 100644 index 0000000..6541edb --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/exceptions/ParserError.java @@ -0,0 +1,10 @@ +package de.dhbwstuttgart.exceptions; + +import org.antlr.v4.runtime.Token; + +public class ParserError extends TypeinferenceException{ + + public ParserError(Token offset){ + super("Fehler beim Parsen", offset); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/exceptions/TypeinferenceException.java b/javatx-src/main/java/de/dhbwstuttgart/exceptions/TypeinferenceException.java new file mode 100644 index 0000000..41e054b --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/exceptions/TypeinferenceException.java @@ -0,0 +1,46 @@ +package de.dhbwstuttgart.exceptions; + +import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode; +import org.antlr.v4.runtime.Token; + +/** + * Eine RuntimeException, welche bei einem Fehler während des Typinferenzalgorithmus ausgelöst wird. + * Dies wird zum Beispiel durch Programmierfehler in der Java-Eingabedatei ausgelöst. + * @author Andreas Stadelmeier, a10023 + * + */ +//TODO: Diese Klasse muss von Exception erben +public class TypeinferenceException extends RuntimeException { + + /** + * Das Offset im Quelltext bei dem das Problem aufgetaucht ist + */ + private Token offset; + private String message; + + public TypeinferenceException(String message, SyntaxTreeNode problemSource) + { + super(message); + this.message=message; + if(problemSource == null)throw new DebugException("TypinferenzException ohne Offset: "+this.message); + this.offset=problemSource.getOffset(); + } + + public TypeinferenceException(String message, Token offset){ + this.message=message; + this.offset = offset; + } + + /** + * + * @return Der Offset an dem im Quellcode der Fehler aufgetreten ist. + */ + public Token getOffset(){ + return offset; + } + + public String getMessage(){ + return this.message; + } + +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/parser/JavaTXParser.java b/javatx-src/main/java/de/dhbwstuttgart/parser/JavaTXParser.java new file mode 100644 index 0000000..eb5db14 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/parser/JavaTXParser.java @@ -0,0 +1,36 @@ +package de.dhbwstuttgart.parser; + +import de.dhbwstuttgart.environment.CompilationEnvironment; +import de.dhbwstuttgart.parser.SyntaxTreeGenerator.SyntaxTreeGenerator; +import de.dhbwstuttgart.parser.antlr.Java17Lexer; +import de.dhbwstuttgart.parser.antlr.Java17Parser; +import de.dhbwstuttgart.parser.scope.JavaClassRegistry; +import de.dhbwstuttgart.syntaxtree.SourceFile; + +import org.antlr.v4.runtime.CharStream; +import org.antlr.v4.runtime.CharStreams; +import org.antlr.v4.runtime.CommonTokenStream; + +import java.io.*; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; + +public class JavaTXParser { + public static Java17Parser.SourceFileContext parse(File source) throws IOException, java.lang.ClassNotFoundException { + InputStream stream = new FileInputStream(source); + // DEPRECATED: ANTLRInputStream input = new ANTLRInputStream(stream); + CharStream input = CharStreams.fromStream(stream); + Java17Lexer lexer = new Java17Lexer(input); + CommonTokenStream tokens = new CommonTokenStream(lexer); + Java17Parser parser = new Java17Parser(tokens); + return parser.sourceFile(); + /* + * SyntaxTreeGenerator generator = new SyntaxTreeGenerator(environment.getRegistry(source)); return generator.convert(tree); + */ + } + + /* + * Für das Typsystem ist es notwendig, dass sich der Source in einer Datei befindet: public SourceFile parse(String fileContent) throws IOException, java.lang.ClassNotFoundException { return this.parse(new ByteArrayInputStream(fileContent.getBytes(StandardCharsets.UTF_8))); } + */ +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/parser/NullToken.java b/javatx-src/main/java/de/dhbwstuttgart/parser/NullToken.java new file mode 100644 index 0000000..bbc7c7b --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/parser/NullToken.java @@ -0,0 +1,57 @@ +package de.dhbwstuttgart.parser; + +import org.antlr.v4.runtime.CharStream; +import org.antlr.v4.runtime.Token; +import org.antlr.v4.runtime.TokenSource; + +public class NullToken implements Token { + @Override + public String getText() { + return ""; + } + + @Override + public int getType() { + return 0; + } + + @Override + public int getLine() { + return 0; + } + + @Override + public int getCharPositionInLine() { + return 0; + } + + @Override + public int getChannel() { + return 0; + } + + @Override + public int getTokenIndex() { + return 0; + } + + @Override + public int getStartIndex() { + return 0; + } + + @Override + public int getStopIndex() { + return 0; + } + + @Override + public TokenSource getTokenSource() { + return null; + } + + @Override + public CharStream getInputStream() { + return null; + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/parser/SourceLoc.java b/javatx-src/main/java/de/dhbwstuttgart/parser/SourceLoc.java new file mode 100644 index 0000000..4cdd698 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/parser/SourceLoc.java @@ -0,0 +1,4 @@ +package de.dhbwstuttgart.parser; + +public record SourceLoc(String file, int line) { +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/AssignToLocal.java b/javatx-src/main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/AssignToLocal.java new file mode 100644 index 0000000..c505bfb --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/AssignToLocal.java @@ -0,0 +1,20 @@ +package de.dhbwstuttgart.parser.SyntaxTreeGenerator; + +import de.dhbwstuttgart.syntaxtree.StatementVisitor; +import de.dhbwstuttgart.syntaxtree.statement.AssignLeftSide; +import de.dhbwstuttgart.syntaxtree.statement.Expression; +import de.dhbwstuttgart.syntaxtree.statement.LocalVar; + +public class AssignToLocal extends AssignLeftSide { + public final LocalVar localVar; + + public AssignToLocal(LocalVar leftSide) { + super(leftSide.getType(), leftSide.getOffset()); + localVar = leftSide; + } + + @Override + public void accept(StatementVisitor visitor) { + visitor.visit(this); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/FCGenerator.java b/javatx-src/main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/FCGenerator.java new file mode 100644 index 0000000..e864200 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/FCGenerator.java @@ -0,0 +1,203 @@ +package de.dhbwstuttgart.parser.SyntaxTreeGenerator; + +import de.dhbwstuttgart.exceptions.DebugException; +import de.dhbwstuttgart.parser.NullToken; +import de.dhbwstuttgart.parser.scope.JavaClassName; +import de.dhbwstuttgart.syntaxtree.ClassOrInterface; +import de.dhbwstuttgart.syntaxtree.GenericTypeVar; +import de.dhbwstuttgart.syntaxtree.Method; +import de.dhbwstuttgart.syntaxtree.Pattern; +import de.dhbwstuttgart.syntaxtree.factory.ASTFactory; +import de.dhbwstuttgart.syntaxtree.factory.UnifyTypeFactory; +import de.dhbwstuttgart.syntaxtree.type.*; +import de.dhbwstuttgart.typeinference.constraints.Pair; +import de.dhbwstuttgart.typeinference.unify.model.*; + +import java.util.*; +import java.util.stream.Collectors; + +import org.antlr.v4.runtime.Token; + +public class FCGenerator { + /** + * Baut die FiniteClosure aus availableClasses. + * Klassen welche nicht in availableClasses vorkommen werden im Java Classpath nachgeschlagen. + * + * @param availableClasses - Alle geparsten Klassen + */ + public static Set toUnifyFC(Collection availableClasses, ClassLoader classLoader) throws ClassNotFoundException { + return toFC(availableClasses, classLoader).stream().map(t -> UnifyTypeFactory.convert(t)).collect(Collectors.toSet()); + } + + public static Set toFC(Collection availableClasses, ClassLoader classLoader) throws ClassNotFoundException { + HashSet pairs = new HashSet<>(); + //PL 2018-09-18: gtvs vor die for-Schleife gezogen, damit immer die gleichen Typeplaceholder eingesetzt werden. + HashMap gtvs = new HashMap<>(); + for(ClassOrInterface cly : availableClasses){ + List newPairs = getSuperTypes(cly, availableClasses, gtvs, classLoader); + pairs.addAll(newPairs); + + //For all Functional Interfaces FI: FunN$$<... args auf dem Functional Interface ...> <. FI is added to FC + if (isFunctionalInterface(cly)) { + pairs.add(genImplFunType(cly, newPairs.get(0).TA1, gtvs)); + } + } + return pairs; + } + + + private static Boolean isFunctionalInterface(ClassOrInterface cly) { + return (cly.isInterface() && (cly.isFunctionalInterface() || cly.getMethods().size() == 1)); + } + + private static Pair genImplFunType(ClassOrInterface cly, RefTypeOrTPHOrWildcardOrGeneric fIType, HashMap gtvs) { + for(Method m : cly.getMethods()) { + if (!java.lang.reflect.Modifier.isAbstract(m.modifier)) + continue; + List tl = + (m.getParameterList().getFormalparalist() + .stream().map(p -> p.getType().acceptTV(new TypeExchanger(gtvs))) + .collect(Collectors.toList())); + tl.add(m.getReturnType().acceptTV(new TypeExchanger(gtvs))); + return new Pair(new RefType(new JavaClassName("Fun" + (tl.size()-1) + "$$"), tl, new NullToken()), + fIType, PairOperator.SMALLER); + } + return null; //kann nicht passieren, da die Methode nur aufgerufen wird wenn cl Functional Interface ist + } + + + + /** + * Bildet eine Kette vom übergebenen Typ bis hin zum höchsten bekannten Typ + * Als Generics werden TPHs benutzt, welche der Unifikationsalgorithmus korrekt interpretieren muss. + * Die verwendeten TPHs werden in der Kette nach oben gereicht, so erhält der selbe GTV immer den selben TPH + * @param forType + * @return + */ + private static List getSuperTypes(ClassOrInterface forType, Collection availableClasses, ClassLoader classLoader) throws ClassNotFoundException { + return getSuperTypes(forType, availableClasses, new HashMap<>(), classLoader); + } + + /** + * + * @param forType + * @param availableClasses + * @param gtvs + * @return + * @throws ClassNotFoundException + */ + private static List getSuperTypes(ClassOrInterface forType, Collection availableClasses, + HashMap gtvs, ClassLoader classLoader) throws ClassNotFoundException { + List params = new ArrayList<>(); + //Die GTVs, die in forType hinzukommen: + HashMap newGTVs = new HashMap<>(); + //Generics mit gleichem Namen müssen den selben TPH bekommen + for(GenericTypeVar gtv : forType.getGenerics()){ + if(!gtvs.containsKey(gtv.getName())){ + TypePlaceholder replacePlaceholder = TypePlaceholder.fresh(new NullToken()); + gtvs.put(gtv.getName(), replacePlaceholder); + newGTVs.put(gtv.getName(), replacePlaceholder); + } + params.add(gtvs.get(gtv.getName())); + } + + + List superClasses = new ArrayList<>(); + superClasses.add(forType.getSuperClass()); + superClasses.addAll(forType.getSuperInterfaces()); + + List retList = new ArrayList<>(); + for(RefType superType : superClasses){ + Optional hasSuperclass = availableClasses.stream().filter(cl -> superType.getName().equals(cl.getClassName())).findAny(); + ClassOrInterface superClass; + if(!hasSuperclass.isPresent()) //Wenn es die Klasse in den available Klasses nicht gibt wird sie im Classpath gesucht. Ansonsten Exception + { + superClass = ASTFactory.createClass(classLoader.loadClass(superType.getName().toString())); + }else{ + superClass = hasSuperclass.get(); + } + /* + Die Parameter der superklasse müssen jetzt nach den Angaben in der Subklasse + modifiziert werden + Beispie: Matrix extends Vector> + Den ersten Parameter mit Vector austauschen und dort alle Generics zu den Typplaceholdern in gtvs austauschen + */ + //Hier vermerken, welche Typen in der Superklasse ausgetauscht werden müssen + Iterator itGenParams = superClass.getGenerics().iterator(); + Iterator itSetParams = superType.getParaList().iterator(); + while(itSetParams.hasNext()){ + RefTypeOrTPHOrWildcardOrGeneric setType = itSetParams.next(); + //In diesem Typ die GTVs durch TPHs und Einsetzungen austauschen: + RefTypeOrTPHOrWildcardOrGeneric setSetType = setType.acceptTV(new TypeExchanger(gtvs)); + newGTVs.put(itGenParams.next().getName(), setSetType); + } + + //Für den superType kann man nun zum Austauschen der Generics wieder die gtvs nehmen: + //Die newGTVs sind nur für den superClass ClassOrInterface welches möglicherweise per reflection geladen wurde abgestimmt + RefTypeOrTPHOrWildcardOrGeneric superRefType = superType.acceptTV(new TypeExchanger(gtvs)); + + RefTypeOrTPHOrWildcardOrGeneric t1 = new RefType(forType.getClassName(), params, new NullToken()); + RefTypeOrTPHOrWildcardOrGeneric t2 = superRefType; + + Pair ret = new Pair(t1, t2, PairOperator.SMALLER); + + List superTypes; + //Rekursiver Aufruf. Abbruchbedingung ist Object als Superklasse: + if(superClass.getClassName().equals(ASTFactory.createObjectClass().getClassName())){ + superTypes = Arrays.asList(new Pair(ASTFactory.createObjectType(), ASTFactory.createObjectType(), PairOperator.SMALLER)); + }else{ + superTypes = getSuperTypes(superClass, availableClasses, newGTVs, classLoader); + } + + retList.add(ret); + retList.addAll(superTypes); + } + + return retList; + } + + /** + * Tauscht die GTVs in einem Typ gegen die entsprechenden Typen in der übergebenen Map aus. + */ + private static class TypeExchanger implements TypeVisitor{ + + private final HashMap gtvs; + + TypeExchanger(HashMap gtvs){ + this.gtvs = gtvs; + } + + @Override + public RefTypeOrTPHOrWildcardOrGeneric visit(RefType refType) { + List params = new ArrayList<>(); + for(RefTypeOrTPHOrWildcardOrGeneric param : refType.getParaList()){ + params.add(param.acceptTV(this)); + } + RefTypeOrTPHOrWildcardOrGeneric ret = new RefType(refType.getName(), params, new NullToken()); + return ret; + } + + @Override + public RefTypeOrTPHOrWildcardOrGeneric visit(SuperWildcardType superWildcardType) { + throw new DebugException("Dieser Fall darf nicht auftreten"); + } + + @Override + public RefTypeOrTPHOrWildcardOrGeneric visit(TypePlaceholder typePlaceholder) { + throw new DebugException("Dieser Fall darf nicht auftreten"); + } + + @Override + public RefTypeOrTPHOrWildcardOrGeneric visit(ExtendsWildcardType extendsWildcardType) { + throw new DebugException("Dieser Fall darf nicht auftreten"); + } + + @Override + public RefTypeOrTPHOrWildcardOrGeneric visit(GenericRefType genericRefType) { + if(! gtvs.containsKey(genericRefType.getParsedName())) + throw new DebugException("Dieser Fall darf nicht auftreten"); + return gtvs.get(genericRefType.getParsedName()); + } + + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/FieldEntry.java b/javatx-src/main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/FieldEntry.java new file mode 100644 index 0000000..466dc61 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/FieldEntry.java @@ -0,0 +1,6 @@ +package de.dhbwstuttgart.parser.SyntaxTreeGenerator; + +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; + +public record FieldEntry(String name, RefTypeOrTPHOrWildcardOrGeneric type, int modifiers) { +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/GenericContext.java b/javatx-src/main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/GenericContext.java new file mode 100644 index 0000000..0cea06e --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/GenericContext.java @@ -0,0 +1,14 @@ +package de.dhbwstuttgart.parser.SyntaxTreeGenerator; + +import de.dhbwstuttgart.parser.scope.JavaClassName; + +public class GenericContext { + private final String parentMethod; + private final JavaClassName parentClass; + + public GenericContext(JavaClassName parentClass, String parentMethod) { + if(parentMethod == null)parentMethod = ""; + this.parentClass = parentClass; + this.parentMethod = parentMethod; + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/StatementGenerator.java b/javatx-src/main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/StatementGenerator.java new file mode 100644 index 0000000..f2056e3 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/StatementGenerator.java @@ -0,0 +1,1115 @@ +package de.dhbwstuttgart.parser.SyntaxTreeGenerator; + +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import de.dhbwstuttgart.core.JavaTXCompiler; +import de.dhbwstuttgart.syntaxtree.*; +import de.dhbwstuttgart.syntaxtree.statement.*; +import de.dhbwstuttgart.syntaxtree.type.Void; +import org.antlr.v4.runtime.Token; + +import de.dhbwstuttgart.exceptions.NotImplementedException; +import de.dhbwstuttgart.parser.NullToken; +import de.dhbwstuttgart.parser.antlr.Java17Parser; +import de.dhbwstuttgart.parser.antlr.Java17Parser.AndexpressionContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.ArrayaccessexpressionContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.AssertstmtContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.AssignexpressionContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.BitwiseandexpressionContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.BitwiseorexpressionContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.BitwisexorexpressionContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.BlockstmtContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.BoolLiteralContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.BreakstmtContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.CastexpressionContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.CharLiteralContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.ConditionalassignexpressionContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.ConditionalstmtContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.ContinuestmtContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.DottedexpressionContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.DowhileloopContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.EqualityexpressionContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.ExpressionContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.FltLiteralContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.ForloopContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.GPatternContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.GuardedPatternContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.IdentifierContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.InstanceofexpressionContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.IntLiteralContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.LabeledRuleDefaultContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.LabeledRuleExprListContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.LabeledRulePatternContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.LabeledstmtContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.LambdaLVTIParameterContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.LambdaExpression2Context; +import de.dhbwstuttgart.parser.antlr.Java17Parser.MathaddsubexpressionContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.MathmuldivmodexpressionContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.MethodCallContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.MethodcallexpressionContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.NewinstanceexpressionContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.NullLiteralContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.OrexpressionContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.PPatternContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.PatternContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.PostfixexpressionContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.PrefixexpressionContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.PrimaryClassrefContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.PrimaryExpressionContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.PrimaryIdentifierContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.PrimaryLiteralContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.PrimaryPatternContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.PrimarySuperContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.PrimaryThisContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.PrimaryExpression2Context; +import de.dhbwstuttgart.parser.antlr.Java17Parser.RPatternContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.RecordPatternContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.RelationalexpressionContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.ReturnstmtContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.SemistmtContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.ShiftexpressionContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.StmtexpressionContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.StringLiteralContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.SwitchBlockStatementGroupContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.SwitchLabelConstContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.SwitchLabelContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.SwitchLabelDefaultContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.SwitchLabelPatternContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.SwitchLabeledRuleContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.SwitchRuleOutcomeContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.SwitchExpression2Context; +import de.dhbwstuttgart.parser.antlr.Java17Parser.SwitchstmtContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.SynchronizedstmtContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.TPatternContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.ThrowstmtContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.TrycatchblockContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.TrycatchresourceContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.TypePatternContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.WhileloopContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.YieldstmtContext; +import de.dhbwstuttgart.parser.scope.GenericsRegistry; +import de.dhbwstuttgart.parser.scope.JavaClassName; +import de.dhbwstuttgart.parser.scope.JavaClassRegistry; +import de.dhbwstuttgart.syntaxtree.type.RefType; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; +import org.stringtemplate.v4.ST; + +public class StatementGenerator { + + private final JavaClassRegistry reg; + + private final Map fields; // PL 2018-11-01 fields eingefuegt, damit die fields + // immer die gleiche TPH bekommen + private final Map localVars; + private final GenericsRegistry generics; + private final JavaTXCompiler compiler; + + private final RefType superClass; + + // TODO How about instead of passing all of these types we just pass an instance of the SyntaxTreeGenerator? + public StatementGenerator(RefType superType, JavaTXCompiler compiler, JavaClassRegistry reg, GenericsRegistry generics, Map fields, Map localVars) { + this.reg = reg; + this.generics = generics; + this.fields = fields; + this.localVars = localVars; + this.compiler = compiler; + this.superClass = superType; + } + + public ParameterList convert(Java17Parser.FormalParameterListContext formalParameterListContext) { + List ret = new ArrayList<>(); + List fps = new ArrayList<>(); + if (Objects.isNull(formalParameterListContext)) + return new ParameterList(ret, new NullToken()); // Dann ist die Parameterliste leer + if (!Objects.isNull(formalParameterListContext.lastFormalParameter())) { + /* + * Der '...' Operator wird noch nicht unterstützt, da dafür benötigte Typen (List oder Array) nicht vom Typinferenzalgo. verarbeitet werden können + */ + throw new NotImplementedException("Formale Parameter variabler Länge nicht unterstützt."); + } + + fps = formalParameterListContext.formalParameter(); + for (Java17Parser.FormalParameterContext fp : fps) { + if (fp.pattern() != null) { + ret.add(convert(fp.pattern())); + } else { + String paramName = SyntaxTreeGenerator.convert(fp.variableDeclaratorId()); + RefTypeOrTPHOrWildcardOrGeneric type; + if (fp.typeType() != null) { + type = TypeGenerator.convert(fp.typeType(), reg, generics); + } else { + type = TypePlaceholder.fresh(fp.getStart()); + } + ret.add(new FormalParameter(paramName, type, fp.getStart())); + localVars.put(paramName, type); + } + } + return new ParameterList(ret, ret.get(0).getOffset()); + } + + /* + * StatementGeneration: + */ + + private Statement convert(Java17Parser.StatementContext stmt) { + switch (stmt) { + case BlockstmtContext blockstmt: + return convert(blockstmt.block(), false); + case ConditionalstmtContext condition: + return convert(condition); + case WhileloopContext whileloop: + return convert(whileloop); + case DowhileloopContext dowhileloop: + return convert(dowhileloop); + case SwitchstmtContext switchstmt: + return convert(switchstmt); + case ReturnstmtContext returnstmt: + return convert(returnstmt); + case YieldstmtContext yieldstmt: + return convert(yieldstmt); + case StmtexpressionContext stmtexpression: + return convert(stmtexpression); + case AssertstmtContext assertstmt: + return convert(assertstmt); + case ForloopContext forloop: + return convert(forloop); + case TrycatchblockContext trycatchblock: + return convert(trycatchblock); + case TrycatchresourceContext trycatchresource: + return convert(trycatchresource); + case SynchronizedstmtContext synchronizedstmt: + return convert(synchronizedstmt); + case ThrowstmtContext throwstmt: + return convert(throwstmt); + case BreakstmtContext breakstmt: + return convert(breakstmt); + case ContinuestmtContext continuestmt: + return convert(continuestmt); + case SemistmtContext semistmt: + return convert(semistmt); + case LabeledstmtContext labeledstmt: + return convert(labeledstmt); + default: + throw new NotImplementedException(); + } + } + + public Block convert(Java17Parser.BlockContext block, boolean addTrailingReturn) { + List statements = new ArrayList<>(); + if (block.blockStatement().size() > 0) + for (Java17Parser.BlockStatementContext statementContext : block.blockStatement()) { + statements.addAll(convert(statementContext)); + } + if (addTrailingReturn) + statements = SyntacticSugar.addTrailingReturn(statements); + return new Block(statements, block.getStart()); + } + + private List convert(Java17Parser.BlockStatementContext statementContext) { + if (!Objects.isNull(statementContext.localVariableDeclaration())) { + return convert(statementContext.localVariableDeclaration()); + } else if (!Objects.isNull(statementContext.localTypeDeclaration())) { + throw new NotImplementedException(); + } else { + return Arrays.asList(convert(statementContext.statement())); + } + } + + private Statement convert(Java17Parser.LabeledstmtContext labeledStatementContext) { + throw new NotImplementedException(); + // return convert(labeledStatementContext.statement()); + } + + private Statement convert(Java17Parser.StmtexpressionContext stmt) { + ExpressionContext expr = stmt.statementExpression; + Token offset = stmt.getStart(); + switch (expr) { + case DottedexpressionContext dotted: + return convertToStatement(dotted, offset); + case MethodcallexpressionContext methodc: + return convert(methodc.methodCall(), offset); + case NewinstanceexpressionContext newinstance: + return convert(newinstance.creator()); + case AssignexpressionContext assignment: + Statement ret = convert(assignment); + ret.setStatement(); + return ret; + case PostfixexpressionContext postfix: + ret = convert(postfix); + ret.setStatement(); + return ret; + case PrefixexpressionContext prefix: + ret = convert(prefix); + ret.setStatement(); + return ret; + case SwitchExpression2Context switchexpr: + ret = convert(switchexpr); + ret.setStatement(); + return ret; + default: + System.out.println(stmt.getClass()); + throw new NotImplementedException(); + } + } + + private Statement convertToStatement(DottedexpressionContext expr, Token offset) { + if (!Objects.isNull(expr.methodCall())) { + return convert(expr.methodCall(), expr.expression(), offset); + } else if (!Objects.isNull(expr.NEW())) { + return convert(expr.innerCreator()); + } else { + throw new NotImplementedException(); + } + } + + private Statement convert(Java17Parser.CreatorContext creator) { + if (creator.nonWildcardTypeArguments() != null) + throw new NotImplementedException(); + + RefType newclass = convert(creator.createdName()); + + if (!Objects.isNull(creator.classCreatorRest())) { + ArgumentList args = convertArguments(creator.classCreatorRest().arguments().expressionList()); + ArrayList argTypes = args.getArguments().stream().map(x -> TypePlaceholder.fresh(creator.getStart())).collect(Collectors.toCollection(ArrayList::new)); + Statement ret = new NewClass(newclass, args, null, argTypes, creator.getStart()); + ret.setStatement(); + return ret; + } else { + return convert(creator.arrayCreatorRest()); + } + } + + private Statement convert(Java17Parser.ArrayCreatorRestContext expression) { + throw new NotImplementedException(); + } + + private RefType convert(Java17Parser.CreatedNameContext createdname) { + Java17Parser.TypeArgumentsContext genericArgs = null; + genericArgs = null; + if (createdname.typeArgumentsOrDiamond() != null) + genericArgs = createdname.typeArgumentsOrDiamond().typeArguments(); + IdentifierContext identifier = createdname.identifier(); + return (RefType) TypeGenerator.convertTypeName(identifier.getText(), genericArgs, identifier.getStart(), reg, generics); + } + + private Statement convert(Java17Parser.InnerCreatorContext innercreator) { + Java17Parser.NonWildcardTypeArgumentsContext genericArgs = null; + + if (!Objects.isNull(innercreator.nonWildcardTypeArgumentsOrDiamond())) { + genericArgs = innercreator.nonWildcardTypeArgumentsOrDiamond().nonWildcardTypeArguments(); + } + IdentifierContext identifier = innercreator.identifier(); + RefType newclass = (RefType) TypeGenerator.convertTypeName(identifier.getText(), genericArgs, identifier.getStart(), reg, generics); + ArgumentList args = convertArguments(innercreator.classCreatorRest().arguments().expressionList()); + ArrayList argTypes = args.getArguments().stream().map(x -> TypePlaceholder.fresh(innercreator.getStart())).collect(Collectors.toCollection(ArrayList::new)); + Statement ret = new NewClass(newclass, args, null, argTypes, innercreator.getStart()); + ret.setStatement(); + return ret; + + } + + private Statement convert(Java17Parser.ConditionalstmtContext stmt) { + Expression expr = convert(stmt.parExpression().expression()); + Statement thenBlock = convert(stmt.statement(0)); + Statement elseBlock = (stmt.statement().size() >= 2) ? convert(stmt.statement(1)) : null; + return new IfStmt(TypePlaceholder.fresh(stmt.getStart()), expr, thenBlock, elseBlock, stmt.getStart()); + } + + private Statement convert(Java17Parser.AssertstmtContext stmt) { + // TODO + throw new NotImplementedException(); + } + + private Statement convert(Java17Parser.SwitchstmtContext stmt) { + Expression switched = convert(stmt.parExpression().expression()); + List switchBlocks = new ArrayList<>(); + for (SwitchBlockStatementGroupContext blockstmt : stmt.switchBlockStatementGroup()) { + switchBlocks.add(convert(blockstmt)); + } + return new Switch(switched, switchBlocks, TypePlaceholder.fresh(switched.getOffset()), true, stmt.getStart()); + } + + // Um switchExpressions als Statement zu behandeln + private Statement convert(Java17Parser.SwitchExpression2Context switchexpression) { + Expression switchExpr = convert(switchexpression.switchExpression()); + if (switchExpr instanceof Switch s) { + s.setStatement(); + return s; + } else { + // sollte nie vorkommen, da convert(Java17Parser.SwitchExpressionContext switchExpression) eine Instanz von Switch zurückgibt + throw new RuntimeException(); + } + } + + private Expression convert(Java17Parser.SwitchExpressionContext switchExpression) { + Expression switched = convert(switchExpression.parExpression().expression()); + List switchBlocks = new ArrayList<>(); + Token offset = switchExpression.getStart(); + for (SwitchLabeledRuleContext labeledRule : switchExpression.switchLabeledRule()) { + switchBlocks.add(convert(labeledRule)); + } + return new Switch(switched, switchBlocks, TypePlaceholder.fresh(offset), false, offset); + } + + private SwitchBlock convert(SwitchLabeledRuleContext labeledRule) { + Boolean isDefault = false; + List labels = switch (labeledRule.switchLabelCase()) { + case LabeledRuleExprListContext exprList -> { + List labelList = exprList.expressionList().expression().stream().map((exprctx) -> { + Pattern expr = new ExpressionPattern(convert(exprctx), exprList.getStart()); + return new SwitchLabel(expr, expr.getType(), exprList.getStart()); + }).toList(); + yield labelList; + } + case LabeledRulePatternContext pattern -> { + Pattern p = convert(pattern.pattern()); + yield Arrays.asList(new SwitchLabel(p, p.getType(), pattern.getStart())); + } + case LabeledRuleDefaultContext def -> { + isDefault = true; + yield Arrays.asList(new SwitchLabel(new Void(def.getStart()), def.getStart())); + } + default -> throw new NotImplementedException(); + }; + + var isSingleExpression = false; + Token offset = labeledRule.getStart(); + SwitchRuleOutcomeContext outcome = labeledRule.switchRuleOutcome(); + Block block; + if (Objects.isNull(outcome.block())) { + List stmts = new ArrayList<>(); + stmts.add(new Yield(convert(outcome.expression()), outcome.expression().start)); + isSingleExpression = true; + block = new Block(stmts, outcome.expression().getStart()); + } else { + block = convert(outcome.block(), false); + } + return new SwitchBlock(labels, block, isDefault, isSingleExpression, offset); + } + + private Statement convert(Java17Parser.YieldstmtContext yieldstmt) { + return new Yield(convert(yieldstmt.expression()), yieldstmt.getStart()); + } + + private SwitchBlock convert(Java17Parser.SwitchBlockStatementGroupContext stmt) { + List labels = new ArrayList<>(); + stmt.switchLabel().forEach((label) -> { + labels.add(convert(label)); + }); + List block = new ArrayList<>(); + stmt.blockStatement().stream().forEach((blockStmt) -> { + block.addAll(convert(blockStmt)); + }); + return new SwitchBlock(labels, new Block(block, stmt.blockStatement(0).getStart()), false, stmt.getStart()); + } + + private SwitchLabel convert(SwitchLabelContext switchLabel) { + RefTypeOrTPHOrWildcardOrGeneric type = null; + Pattern caseExpression = switch (switchLabel) { + case SwitchLabelConstContext cons -> { + yield new ExpressionPattern(convert(cons.constantExpression), cons.getStart()); + } + case SwitchLabelPatternContext pattern -> { + yield convert(pattern.pattern()); + } + case SwitchLabelDefaultContext def -> { + type = new Void(switchLabel.getStart()); + yield null; + } + default -> throw new NotImplementedException(); + }; + Token offset = switchLabel.getStart(); + if (Objects.isNull(caseExpression)) { + if (type == null) + type = TypePlaceholder.fresh(offset); + return new SwitchLabel(type, offset); + } else { + return new SwitchLabel(caseExpression, caseExpression.getType(), offset); + } + } + + private Pattern convert(PatternContext pattern) { + return switch (pattern) { + case PPatternContext pPattern -> { + yield convert(pPattern.primaryPattern()); + } + case GPatternContext gPattern -> { + GuardedPatternContext guarded = gPattern.guardedPattern(); + Expression condition = convert(guarded.expression()); + yield new GuardedPattern(condition, convert(guarded.primaryPattern()), guarded.getStart()); + } + default -> throw new NotImplementedException(); + }; + } + + private FormalParameter convert(PrimaryPatternContext pPattern) { + switch (pPattern) { + case TPatternContext tPattern: + TypePatternContext typePattern = tPattern.typePattern(); + var text = typePattern.identifier().getText(); + var type = TypeGenerator.convert(typePattern.typeType(), reg, generics); + localVars.put(text, type); + return new FormalParameter(text, type, typePattern.getStart()); + case RPatternContext rPattern: + RecordPatternContext recordPattern = rPattern.recordPattern(); + return convert(recordPattern); + default: + throw new NotImplementedException(); + + } + } + + private RecordPattern convert(RecordPatternContext recordPatternCtx) { + List subPatternCtx = recordPatternCtx.recordStructurePattern().recordComponentPatternList().pattern(); + List subPattern = subPatternCtx.stream().map(this::convert).collect(Collectors.toList()); + IdentifierContext identifierCtx = recordPatternCtx.identifier(); + var text = (identifierCtx != null) ? identifierCtx.getText() : null; + var type = TypeGenerator.convert(recordPatternCtx.typeType(), reg, generics); + if (text != null) localVars.put(text, type); + return new RecordPattern(subPattern, text, type, recordPatternCtx.getStart()); + } + + private Statement convert(Java17Parser.WhileloopContext stmt) { + Expression expr = convert(stmt.parExpression().expression()); + Statement block = convert(stmt.statement()); + return new WhileStmt(expr, block, stmt.getStart()); + } + + private Statement convert(Java17Parser.DowhileloopContext stmt) { + Statement block = convert(stmt.statement()); + Expression expr = convert(stmt.parExpression().expression()); + return new DoStmt(expr, block, stmt.getStart()); + } + + private Statement convert(Java17Parser.ForloopContext stmt) { + var control = stmt.forControl(); + if (control.enhancedForControl() != null) { + var forCtrl = control.enhancedForControl(); + var name = forCtrl.variableDeclaratorId().identifier(); + + RefTypeOrTPHOrWildcardOrGeneric type; + if (Objects.isNull(forCtrl.typeType()) || !Objects.isNull(forCtrl.VAR())) { + type = TypePlaceholder.fresh(forCtrl.getStart()); + } else { + type = TypeGenerator.convert(forCtrl.typeType(), reg, generics); + } + + var vardecl = new LocalVarDecl(name.getText(), type, name.getStart()); + this.localVars.put(name.getText(), type); + + return new ForEachStmt( + stmt.getStart(), + vardecl, + convert(forCtrl.expression()), + convert(stmt.statement()) + ); + } else { + return new ForStmt( + stmt.getStart(), + control.forInit() != null ? convert(control.forInit().localVariableDeclaration()) : List.of(), + control.expression() != null ? convert(control.expression()) : null, + control.forUpdate != null ? control.forUpdate.expression().stream().map(this::convert).toList() : List.of(), + convert(stmt.statement()) + ); + } + } + + private ArgumentList convertArguments(Java17Parser.ExpressionListContext arglist) { + if (arglist == null) + return new ArgumentList(new ArrayList<>(), new NullToken()); + Token offset = new NullToken(); + List arguments = new ArrayList(); + for (ExpressionContext arg : arglist.expression()) { + arguments.add(convert(arg)); + } + if (arguments.size() > 0) + offset = arguments.get(0).getOffset(); + return new ArgumentList(arguments, offset); + } + + private List convert(Java17Parser.LocalVariableDeclarationContext declaration) { + List ret = new ArrayList<>(); + if (declaration.variableModifier() != null && declaration.variableModifier().size() > 0) { + // TODO + throw new NotImplementedException(); + } + RefTypeOrTPHOrWildcardOrGeneric type; + if (Objects.isNull(declaration.typeType()) || !Objects.isNull(declaration.VAR())) { + type = TypePlaceholder.fresh(declaration.getStart()); + } else { + type = TypeGenerator.convert(declaration.typeType(), reg, generics); + } + if (!Objects.isNull(declaration.variableDeclarators())) + ret.addAll(generateLocalVariableAssignments(declaration.variableDeclarators().variableDeclarator(), type)); + return ret; + } + + private List generateLocalVariableAssignments(List varDeclarators, RefTypeOrTPHOrWildcardOrGeneric type) { + List ret = new ArrayList<>(); + for (Java17Parser.VariableDeclaratorContext varDecl : varDeclarators) { + IdentifierContext name = varDecl.variableDeclaratorId().identifier(); + + ret.add(new LocalVarDecl(name.getText(), type, name.getStart())); + this.localVars.put(name.getText(), type); + if (varDecl.variableInitializer() != null) { + Expression initValue; + if (varDecl.variableInitializer().arrayInitializer() != null) { + throw new NotImplementedException(); + } else { + initValue = convert(varDecl.variableInitializer().expression()); + } + ret.add(new Assign(new AssignToLocal(new LocalVar(name.getText(), type, name.getStart())), initValue, name.getStart())); + } + } + return ret; + } + + public Statement generateFieldAssignment(Java17Parser.VariableDeclaratorContext varDecl, RefTypeOrTPHOrWildcardOrGeneric type) { + IdentifierContext name = varDecl.variableDeclaratorId().identifier(); + Expression initValue; + if (varDecl.variableInitializer().arrayInitializer() != null) { + throw new NotImplementedException(); + } else { + initValue = convert(varDecl.variableInitializer().expression()); + } + var fieldEntry = fields.get(name.getText()); + return (new Assign(new AssignToField(new FieldVar(new This(varDecl.getStart()), (fieldEntry.modifiers() & Modifier.STATIC) != 0, name.getText(), type, varDecl.getStart())), initValue, name.getStart())); + } + + private Statement convert(Java17Parser.BreakstmtContext stmt) { + Token offset = stmt.getStart(); + if (!Objects.isNull(stmt.identifier())) { + return new Break(localVars.get(stmt.identifier().getText()), offset); + } else { + return new Break(TypePlaceholder.fresh(offset), offset); + } + + } + + private Statement convert(Java17Parser.ContinuestmtContext stmt) { + // TODO + throw new NotImplementedException(); + } + + private Statement convert(Java17Parser.SemistmtContext stmt) { + // TODO + throw new NotImplementedException(); + } + + private Statement convert(Java17Parser.ReturnstmtContext stmt) { + if (stmt.expression() != null) { + return new Return(convert(stmt.expression()), stmt.getStart()); + } else { + return new ReturnVoid(stmt.getStart()); + } + } + + private Statement convert(Java17Parser.ThrowstmtContext stmt) { + return new Throw(convert(stmt.expression()), stmt.getStart()); + } + + private Statement convert(Java17Parser.SynchronizedstmtContext stmt) { + // TODO + throw new NotImplementedException(); + } + + private Statement convert(Java17Parser.TrycatchblockContext stmt) { + // TODO + throw new NotImplementedException(); + } + + private Statement convert(Java17Parser.TrycatchresourceContext stmt) { + // TODO + throw new NotImplementedException(); + } + + /* + *************** + Expression Conversions: + */ + private Expression convert(Java17Parser.ExpressionContext expression) { + switch (expression) { + case PrimaryExpression2Context primary: + return convert(primary.primary()); + case DottedexpressionContext dotted: + return convert(dotted, expression.getStart()); + case MethodcallexpressionContext methodcall: + return convert(methodcall.methodCall(), methodcall.getStart()); + case NewinstanceexpressionContext newinstance: + return convert(newinstance.creator()); + case CastexpressionContext castexpr: + return convert(castexpr); + case PostfixexpressionContext postfexpr: + return convert(postfexpr); + case PrefixexpressionContext prefexpr: + return convert(prefexpr); + case MathmuldivmodexpressionContext mathexpr: + return convert(mathexpr); + case MathaddsubexpressionContext mathexpr: + return convert(mathexpr); + case RelationalexpressionContext comparison: + return convert(comparison); + case InstanceofexpressionContext instanceOf: + return convert(instanceOf); + case SwitchExpression2Context switchexpression: + return convert(switchexpression.switchExpression()); + case EqualityexpressionContext equal: + return convert(equal); + case AssignexpressionContext assignment: + return convert(assignment); + case LambdaExpression2Context lambdaexpr: + return convert(lambdaexpr.lambdaExpression()); + case ArrayaccessexpressionContext arrayaccess: + return convert(arrayaccess); + case ShiftexpressionContext shiftexpr: + return convert(shiftexpr); + case BitwiseandexpressionContext bitwiseand: + return convert(bitwiseand); + case BitwisexorexpressionContext bitwisexor: + return convert(bitwisexor); + case BitwiseorexpressionContext bitwiseor: + return convert(bitwiseor); + case AndexpressionContext andexpr: + return convert(andexpr); + case OrexpressionContext orexpr: + return convert(orexpr); + case ConditionalassignexpressionContext condassign: + return convert(condassign); + default: + throw new NotImplementedException(); + } + } + + private Expression convert(DottedexpressionContext expr, Token offset) { + if (!Objects.isNull(expr.methodCall())) { + return convert(expr.methodCall(), expr.expression(), offset); + } else if (!Objects.isNull(expr.identifier())) { + return generateLocalOrFieldVarOrClassName(expr.getText(), offset); + } else { + // Für alle anderen Optionen, wie Feldzugriff, Aufrufe von super oder explizite + // generische Invokationen + throw new NotImplementedException(); + } + } + + private MethodCall convert(MethodCallContext expr, Token offset) { + String name = "this"; + Expression receiver = new This(offset); + if (expr.identifier() != null) { + name = expr.identifier().getText(); + } else if (!Objects.isNull(expr.SUPER())) { + // if(methodInvocationContext.Identifier() != null){ + name = expr.SUPER().getText(); + } + + ArgumentList argumentList = convertArguments(expr.expressionList()); + ArrayList signature = argumentList.getArguments().stream().map(x -> (RefTypeOrTPHOrWildcardOrGeneric) TypePlaceholder.fresh(offset)).collect(Collectors.toCollection(ArrayList::new)); + signature.add(TypePlaceholder.fresh(offset)); // return type + + MethodCall ret; + if (expr.SUPER() != null) { + ret = new SuperCall(argumentList, TypePlaceholder.fresh(offset), signature, offset); + } else { + ret = new MethodCall(TypePlaceholder.fresh(offset), getReceiver(receiver), name, argumentList, TypePlaceholder.fresh(offset), signature, offset); + } + + ret.setStatement(); + return ret; + } + + private MethodCall convert(MethodCallContext expr, ExpressionContext receiver, Token offset) { + String name = "this"; + if (expr.identifier() != null) { + name = expr.identifier().getText(); + } else if (!Objects.isNull(expr.SUPER())) { + // if(methodInvocationContext.Identifier() != null){ + name = expr.SUPER().getText(); + } + ArgumentList argumentList = convertArguments(expr.expressionList()); + ArrayList signature = argumentList.getArguments().stream().map(x -> (RefTypeOrTPHOrWildcardOrGeneric) TypePlaceholder.fresh(offset)).collect(Collectors.toCollection(ArrayList::new)); + signature.add(TypePlaceholder.fresh(offset)); // return type + MethodCall ret = new MethodCall(TypePlaceholder.fresh(offset), getReceiver(receiver), name, argumentList, TypePlaceholder.fresh(offset), signature, offset); + ret.setStatement(); + return ret; + } + + public Receiver getReceiver(ExpressionContext expr) { + Expression expression = convert(expr); + /* + * if (expr instanceof PrimaryExpression2Context pc) { expression = convert(pc.primary()); } else { expression = generateLocalOrFieldVarOrClassName(expr.getText(), expr.getStart()); } + */ + return getReceiver(expression); + } + + public Receiver getReceiver(Expression expr) { + if (expr instanceof StaticClassName) { + return (Receiver) expr; + } else { + return new ExpressionReceiver(expr); + } + } + + private StaticClassName generateStaticClassName(String name, Token offset) { + var className = reg.getName(name); + var numberOfGenerics = reg.getNumberOfGenerics(name); + var refType = new RefType(className, Stream.generate(() -> (RefTypeOrTPHOrWildcardOrGeneric) TypePlaceholder.fresh(offset)).limit(numberOfGenerics).toList(), offset); + return new StaticClassName(refType, offset); + } + + /** + * Der Parser kann nicht zwischen einer lokalen Variable, einem Feldzugriff und einer Klassenangabe unterscheiden. + * + * @param expression + * @param offset + * @return + */ + private Expression generateLocalOrFieldVarOrClassName(String expression, Token offset) { + String[] parts = expression.split("\\."); + if (parts.length < 2) { + // Check for localVar: + if (localVars.get(expression) != null) { + return new LocalVar(expression, localVars.get(expression), offset); + } else if (fields.get(expression) != null) {// PL 2018-11-01 fields eingefuegt, damit die fields immer die + // gleiche TPH bekommen + var field = fields.get(expression); + return new FieldVar(new This(offset), Modifier.isStatic(field.modifiers()), expression, fields.get(expression).type(), offset); + } else if (reg.contains(expression)) { + return generateStaticClassName(expression, offset); + } else { + // lokale Variable wurde ohne "var"-Keyword deklariert und direkt mit Wert versehen + localVars.put(expression, TypePlaceholder.fresh(offset)); + return new LocalVar(expression, localVars.get(expression), offset); + } + } + return generateFieldVarOrClassname(expression, offset); + } + + private Expression generateFieldVarOrClassname(String expression, Token offset) { + String[] parts = expression.split("\\."); + String whole = ""; + Expression receiver = null; + for (String part : parts) { + whole += part; + // Check for Classname: + if (reg.contains(whole)) { + receiver = generateStaticClassName(whole, offset); + } + whole += "."; + } + var fieldName = parts[parts.length - 1]; + + var isStatic = false; + if (parts.length < 2 || parts[0].contentEquals("this")) { + receiver = new This(offset); + isStatic = Modifier.isStatic(fields.get(fieldName).modifiers()); + } else if (parts[0].contentEquals("super")) { + receiver = new Super(TypePlaceholder.fresh(offset), offset); + isStatic = Modifier.isStatic(compiler.getClass(new JavaClassName(superClass.getName().toString())).getField(fieldName).orElseThrow().modifier); + } else if (receiver == null) { // Handelt es sich um keinen Statischen Klassennamen: + String part = expression.substring(0, expression.length() - (1 + parts[parts.length - 1].length())); + receiver = generateLocalOrFieldVarOrClassName(part, offset); + } else { + StaticClassName cname = (StaticClassName) receiver; + var javaClassName = reg.getName(cname.getType().toString()); + isStatic = Modifier.isStatic(compiler.getClass(javaClassName).getField(fieldName).orElseThrow().modifier); + } + return new FieldVar(receiver, isStatic, fieldName, TypePlaceholder.fresh(offset), offset); + } + + private Expression convert(Java17Parser.ArrayaccessexpressionContext arrayaccess) { + throw new NotImplementedException(); + } + + private Expression convert(Java17Parser.ConditionalassignexpressionContext expression) { + throw new NotImplementedException(); + } + + private Expression convert(Java17Parser.OrexpressionContext expression) { + if (expression.expression().size() != 2) { + throw new NotImplementedException(); + } else { + return new BoolExpression(BoolExpression.Operator.OR, new RefType(new JavaClassName("java.lang.Boolean"), expression.getStart()), convert(expression.expression(0)), convert(expression.expression(1)), expression.getStart()); + } + } + + private Expression convert(Java17Parser.AndexpressionContext expression) { + if (expression.expression().size() != 2) { + throw new NotImplementedException(); + } else { + return new BoolExpression(BoolExpression.Operator.AND, new RefType(new JavaClassName("java.lang.Boolean"), expression.getStart()), convert(expression.expression(0)), convert(expression.expression(1)), expression.getStart()); + } + } + + private Statement convert(AssignexpressionContext expr) { + switch (expr.bop.getText()) { + case "=": + ExpressionContext leftside = expr.expression(0); + AssignLeftSide leftHandSide = convert(leftside.getText(), leftside.getStart()); + Statement ret = new Assign(leftHandSide, convert(expr.expression(1)), expr.getStart()); + return ret; + case "+=": + case "-=": + case "*=": + case "/=": + case "&=": + case "|=": + case "^=": + case ">>=": + case ">>>=": + case "<<=": + case "%=": + default: + throw new NotImplementedException(); + } + } + + private AssignLeftSide convert(String leftHandSide, Token start) { + Expression leftSide = generateLocalOrFieldVarOrClassName(leftHandSide, start); + if (leftSide instanceof FieldVar) + return new AssignToField((FieldVar) leftSide); + else if (leftSide instanceof LocalVar) + return new AssignToLocal((LocalVar) leftSide); + else + throw new NotImplementedException(); + } + + private Expression convert(Java17Parser.BitwiseorexpressionContext expression) { + throw new NotImplementedException(); + } + + private Expression convert(Java17Parser.BitwisexorexpressionContext expression) { + throw new NotImplementedException(); + } + + private Expression convert(Java17Parser.BitwiseandexpressionContext expression) { + throw new NotImplementedException(); + } + + private Expression convert(Java17Parser.EqualityexpressionContext expression) { + String operator = expression.bop.getText(); + Expression leftSide = convert(expression.expression(0)); + Expression rightSide = convert(expression.expression(1)); + return new BinaryExpr(convertBinaryOperator(operator), TypePlaceholder.fresh(expression.getStart()), leftSide, rightSide, expression.getStart()); + } + + private Expression convert(Java17Parser.RelationalexpressionContext expression) { + String operator = expression.bop.getText(); + return new BinaryExpr(convertBinaryOperator(operator), TypePlaceholder.fresh(expression.getStart()), convert(expression.expression(0)), convert(expression.expression(1)), expression.getStart()); + } + + private Expression convert(Java17Parser.InstanceofexpressionContext expression) { + Expression left = convert(expression.expression()); + Token offset = expression.getStart(); + if (Objects.isNull(expression.pattern())) {; + return new InstanceOf(left, new RefType(reg.getName("java.lang.Boolean"), expression.getStart()), TypeGenerator.convert(expression.typeType(), reg, generics), offset); + } else { + switch (expression.pattern()) { + case PPatternContext primaryPattern: + switch (primaryPattern.primaryPattern()) { + case TPatternContext typePattern: + TypePatternContext typePatternCtx = typePattern.typePattern(); + String localVarName = typePatternCtx.identifier().getText(); + RefTypeOrTPHOrWildcardOrGeneric localVarType = TypeGenerator.convert(typePatternCtx.typeType(), reg, generics); + localVars.put(localVarName, localVarType); + return new InstanceOf(left, new RefType(reg.getName("java.lang.Boolean"), expression.getStart()), new FormalParameter(localVarName, localVarType, typePatternCtx.getStart()), offset); + default: + throw new NotImplementedException(); + } + default: + throw new NotImplementedException(); + } + } + } + + private BinaryExpr.Operator convertBinaryOperator(String operator) { + // return BinaryExpr.Operator.ADD; + if (operator.equals("+")) { + return BinaryExpr.Operator.ADD; + } else if (operator.equals("-")) { + return BinaryExpr.Operator.SUB; + } else if (operator.equals("*")) { + return BinaryExpr.Operator.MUL; + } else if (operator.equals("&")) { + return BinaryExpr.Operator.AND; + } else if (operator.equals("|")) { + return BinaryExpr.Operator.OR; + } else if (operator.equals("/")) { + return BinaryExpr.Operator.DIV; + } else if (operator.equals("<")) { + return BinaryExpr.Operator.LESSTHAN; + } else if (operator.equals(">")) { + return BinaryExpr.Operator.BIGGERTHAN; + } else if (operator.equals(">=")) { + return BinaryExpr.Operator.BIGGEREQUAL; + } else if (operator.equals("<=")) { + return BinaryExpr.Operator.LESSEQUAL; + } else if (operator.equals("==")) { + return BinaryExpr.Operator.EQUAL; + } else if (operator.equals("!=")) { + return BinaryExpr.Operator.NOTEQUAL; + } else { + throw new NotImplementedException(); + } + // throw new NotImplementedException(); + } + + private Expression convert(Java17Parser.ShiftexpressionContext expression) { + throw new NotImplementedException(); + } + + private Expression convert(Java17Parser.MathaddsubexpressionContext expression) { + Expression leftSide = convert(expression.expression(0)); + Expression rightSide = convert(expression.expression(1)); + BinaryExpr.Operator op = convertBinaryOperator(expression.bop.getText()); + Token offset = expression.getStart(); + return new BinaryExpr(op, TypePlaceholder.fresh(expression.getStart()), leftSide, rightSide, offset); + } + + private Expression convert(Java17Parser.MathmuldivmodexpressionContext expression) { + Expression leftSide = convert(expression.expression(0)); + Expression rightSide = convert(expression.expression(1)); + BinaryExpr.Operator op = convertBinaryOperator(expression.bop.getText()); + Token offset = expression.getStart(); + return new BinaryExpr(op, TypePlaceholder.fresh(offset), leftSide, rightSide, offset); + } + + private Statement convert(PrefixexpressionContext prefixexpr) { + Expression expr = convert(prefixexpr.expression()); + Token op = prefixexpr.prefix; + Statement ret; + if (op.getText().equals("++")) { + ret = new UnaryExpr(UnaryExpr.Operation.PREINCREMENT, expr, TypePlaceholder.fresh(op), op); + ret.setStatement(); + return ret; + } else if (op.getText().equals("--")) { + ret = new UnaryExpr(UnaryExpr.Operation.PREDECREMENT, expr, TypePlaceholder.fresh(op), op); + ret.setStatement(); + return ret; + } else { + throw new NotImplementedException(); + } + } + + private Statement convert(Java17Parser.PostfixexpressionContext postfixexpr) { + Expression expr = convert(postfixexpr.expression()); + Token op = postfixexpr.postfix; + switch (op.getText()) { + case "++": + return new UnaryExpr(UnaryExpr.Operation.POSTINCREMENT, expr, TypePlaceholder.fresh(op), op); + case "--": + return new UnaryExpr(UnaryExpr.Operation.POSTDECREMENT, expr, TypePlaceholder.fresh(op), op); + default: + throw new NotImplementedException(); + } + } + + private Expression convert(Java17Parser.CastexpressionContext castexpr) { + ExpressionContext expr = castexpr.expression(); + if (expr instanceof PrefixexpressionContext pfe) { + throw new NotImplementedException(); + } + return new CastExpr(TypeGenerator.convert(castexpr.typeType(0), reg, generics), convert(expr), expr.getStart()); + } + + private Expression convert(Java17Parser.PrimaryContext primary) { + switch (primary) { + case PrimaryExpressionContext primexpression: + return convert(primexpression.expression()); + case PrimaryThisContext primthis: + return new This(primthis.getStart()); + case PrimarySuperContext primsuper: + throw new NotImplementedException(); + case PrimaryLiteralContext primliteral: + return convert(primliteral.literal()); + case PrimaryIdentifierContext primidentifier: + return generateLocalOrFieldVarOrClassName(primidentifier.getText(), primidentifier.getStart()); + case PrimaryClassrefContext primclassref: + throw new NotImplementedException(); + default: + throw new NotImplementedException(); + } + } + + private Expression convert(Java17Parser.LiteralContext literal) { + switch (literal) { + case IntLiteralContext intliteral: + Number value = Integer.parseInt(intliteral.getText()); + return new Literal(TypePlaceholder.fresh(literal.getStart()), value, intliteral.getStart()); + case FltLiteralContext floatliteral: + value = Double.parseDouble(floatliteral.getText()); + return new Literal(TypePlaceholder.fresh(literal.getStart()), value, floatliteral.getStart()); + case CharLiteralContext charliteral: + RefType type = new RefType(reg.getName("java.lang.Character"), charliteral.getStart()); + return new Literal(type, charliteral.getText().charAt(1), charliteral.getStart()); + case StringLiteralContext stringliteral: + type = new RefType(reg.getName("java.lang.String"), stringliteral.getStart()); + return new Literal(type, stringliteral.getText().substring(1, stringliteral.getText().length() - 1), stringliteral.getStart()); + case BoolLiteralContext boolliteral: + type = new RefType(reg.getName("java.lang.Boolean"), boolliteral.getStart()); + return new Literal(type, Boolean.parseBoolean(boolliteral.getText()), boolliteral.getStart()); + case NullLiteralContext nullliteral: + return new Literal(TypePlaceholder.fresh(nullliteral.getStart()), null, nullliteral.getStart()); + default: + throw new NotImplementedException(); + } + } + + private Expression convert(Java17Parser.LambdaExpressionContext expression) { + Java17Parser.LambdaParametersContext lambdaParams = expression.lambdaParameters(); + ParameterList params; + if (lambdaParams.identifier().size() > 0) { + List parameterList = new ArrayList<>(); + for (IdentifierContext identifier : lambdaParams.identifier()) { + Token offset = identifier.getStart(); + parameterList.add(new FormalParameter(identifier.getText(), TypePlaceholder.fresh(offset), offset)); + } + params = new ParameterList(parameterList, lambdaParams.getStart()); + } else if (lambdaParams.formalParameterList() != null) { + params = convert(lambdaParams.formalParameterList()); + // }else if( lambdaParams.inferredFormalParameterList != null){ + } else if (!Objects.isNull(lambdaParams.lambdaLVTIList())) { + List parameterList = new ArrayList<>(); + for (LambdaLVTIParameterContext param : lambdaParams.lambdaLVTIList().lambdaLVTIParameter()) { + Token offset = param.getStart(); + parameterList.add(new FormalParameter(param.identifier().getText(), TypePlaceholder.fresh(offset), offset)); + } + params = new ParameterList(parameterList, lambdaParams.getStart()); + } else { + params = new ParameterList(new ArrayList<>(), expression.getStart()); + } + + HashMap lambdaLocals = new HashMap<>(); + lambdaLocals.putAll(localVars); + for (Pattern param : params.getFormalparalist()) { + if (!(param instanceof FormalParameter fp)) throw new IllegalArgumentException(); + lambdaLocals.put(fp.getName(), fp.getType()); + } + StatementGenerator lambdaGenerator = new StatementGenerator(superClass, compiler, reg, generics, fields, lambdaLocals); + + Block block; + if (expression.lambdaBody().expression() != null) { + List statements = new ArrayList<>(); + statements.add(new Return(lambdaGenerator.convert(expression.lambdaBody().expression()), expression.lambdaBody().expression().getStart())); + block = new Block(statements, expression.lambdaBody().getStart()); + } else { + block = lambdaGenerator.convert(expression.lambdaBody().block(), true); + } + List funNParams = new ArrayList<>(); + funNParams.add(TypePlaceholder.fresh(expression.getStart()));// ret-Type + params.getFormalparalist().forEach(formalParameter -> // Für jeden Parameter einen TPH anfügen: + funNParams.add(TypePlaceholder.fresh(expression.getStart()))); + RefTypeOrTPHOrWildcardOrGeneric lambdaType = TypePlaceholder.fresh(expression.getStart()); + // RefType lambdaType = new + // RefType(reg.getName("Fun"+params.getFormalparalist().size()), + // funNParams, name.getStart()); + return new LambdaExpression(lambdaType, params, block, expression.getStart()); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/SyntacticSugar.java b/javatx-src/main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/SyntacticSugar.java new file mode 100644 index 0000000..a564c49 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/SyntacticSugar.java @@ -0,0 +1,46 @@ +package de.dhbwstuttgart.parser.SyntaxTreeGenerator; + +import de.dhbwstuttgart.exceptions.NotImplementedException; +import de.dhbwstuttgart.parser.NullToken; +import de.dhbwstuttgart.syntaxtree.AbstractASTWalker; +import de.dhbwstuttgart.syntaxtree.Constructor; +import de.dhbwstuttgart.syntaxtree.statement.*; + +import java.util.List; + +public class SyntacticSugar { + + public static List addTrailingReturn(List statements) { + if (statements.size() != 0) { + Statement lastStmt = statements.get(statements.size() - 1); + ReturnFinder hasReturn = new ReturnFinder(); + lastStmt.accept(hasReturn); + if (hasReturn.hasReturn) + return statements; + } + statements.add(new ReturnVoid(new NullToken())); + return statements; + } + + private static class ReturnFinder extends AbstractASTWalker { + public boolean hasReturn = false; + + @Override + public void visit(Return aReturn) { + hasReturn = true; + } + + @Override + public void visit(ReturnVoid aReturn) { + hasReturn = true; + } + } + + private static boolean hasReturn(Block block) { + for (Statement s : block.getStatements()) + if (s instanceof Return) + return true; + return false; + } + +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/SyntaxTreeGenerator.java b/javatx-src/main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/SyntaxTreeGenerator.java new file mode 100644 index 0000000..ce330b4 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/SyntaxTreeGenerator.java @@ -0,0 +1,640 @@ +package de.dhbwstuttgart.parser.SyntaxTreeGenerator; + +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; + +import de.dhbwstuttgart.core.JavaTXCompiler; +import de.dhbwstuttgart.parser.NullToken; +import de.dhbwstuttgart.syntaxtree.*; +import de.dhbwstuttgart.syntaxtree.Record; +import de.dhbwstuttgart.syntaxtree.statement.*; +import org.antlr.v4.runtime.CommonToken; +import org.antlr.v4.runtime.Token; + +import com.google.common.graph.ElementOrder.Type; + +import de.dhbwstuttgart.environment.PackageCrawler; +import de.dhbwstuttgart.exceptions.NotImplementedException; +import de.dhbwstuttgart.exceptions.TypeinferenceException; +import de.dhbwstuttgart.parser.antlr.Java17Parser; +import de.dhbwstuttgart.parser.antlr.Java17Parser.ClassBodyDeclarationContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.ClassOrInterfaceTypeContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.ClassorinterfacedeclContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.ConstructorDeclarationContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.ConstructordeclContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.EmptymethodContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.GenericConstructorDeclarationContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.GenericDeclarationListContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.GenericInterfaceMethodDeclarationContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.GenericconstructorContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.GenericinterfacemethodContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.GenericmethodContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.InterfaceBodyDeclarationContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.InterfaceCommonBodyDeclarationContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.InterfaceMethodDeclarationContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.InterfaceMethodModifierContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.InterfaceconstContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.InterfacememberContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.InterfacemethodContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.MemberclassorinterfaceContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.MemberconstructorContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.MemberdeclContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.MemberfieldContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.MembermethodContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.MethodBodyContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.MethodDeclarationContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.MethodHeaderContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.MethodblockContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.MethoddeclContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.ModifierContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.NoclassorinterfaceContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.RecordComponentContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.RecordDeclarationContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.RefType2Context; +import de.dhbwstuttgart.parser.antlr.Java17Parser.SrcfileContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.TypeArgumentsContext; +import de.dhbwstuttgart.parser.scope.GatherNames; +import de.dhbwstuttgart.parser.scope.GenericsRegistry; +import de.dhbwstuttgart.parser.scope.JavaClassName; +import de.dhbwstuttgart.parser.scope.JavaClassRegistry; +import de.dhbwstuttgart.syntaxtree.factory.ASTFactory; +import de.dhbwstuttgart.syntaxtree.type.RefType; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; +import de.dhbwstuttgart.syntaxtree.type.Void; +import de.dhbwstuttgart.typeinference.constraints.GenericsResolver; +import javassist.compiler.SyntaxError; + +import javax.swing.text.html.Option; + +public class SyntaxTreeGenerator { + private JavaClassRegistry reg; + private final GenericsRegistry globalGenerics; + public String pkgName = ""; + public Set imports = new HashSet<>(); + HashMap allmodifiers = new HashMap<>(); + // PL 2018-11-01 fields eingefuegt, damit die fields immer die gleiche TPH + // bekommen + private final Map fields = new HashMap<>(); + // PL 2019-10-23: Muss für jede Klasse neu initilisiert werden + List fieldInitializations = new ArrayList<>(); + List staticFieldInitializations = new ArrayList<>(); + + private final JavaTXCompiler compiler; + private RefType superClass; + + public final String fileName; + + public SyntaxTreeGenerator(JavaTXCompiler compiler, JavaClassRegistry reg, GenericsRegistry globalGenerics, String fileName) { + // Die Generics müssen während des Bauens des AST erstellt werden, + // da diese mit der Methode oder Klasse, in welcher sie deklariert werden + // verknüpft sein müssen. Dennoch werden die Namen aller Generics in einer + // globalen Datenbank benötigt. + this.globalGenerics = globalGenerics; + this.reg = reg; + this.allmodifiers.put(Modifier.toString(Modifier.PUBLIC), Modifier.PUBLIC); + this.allmodifiers.put(Modifier.toString(Modifier.PRIVATE), Modifier.PRIVATE); + this.allmodifiers.put(Modifier.toString(Modifier.PROTECTED), Modifier.PROTECTED); + this.allmodifiers.put(Modifier.toString(Modifier.ABSTRACT), Modifier.ABSTRACT); + this.allmodifiers.put(Modifier.toString(Modifier.STATIC), Modifier.STATIC); + this.allmodifiers.put(Modifier.toString(Modifier.STRICT), Modifier.STRICT); + this.allmodifiers.put(Modifier.toString(Modifier.FINAL), Modifier.FINAL); + this.allmodifiers.put(Modifier.toString(Modifier.TRANSIENT), Modifier.TRANSIENT); + this.allmodifiers.put(Modifier.toString(Modifier.VOLATILE), Modifier.VOLATILE); + this.allmodifiers.put(Modifier.toString(Modifier.SYNCHRONIZED), Modifier.SYNCHRONIZED); + this.allmodifiers.put(Modifier.toString(Modifier.NATIVE), Modifier.NATIVE); + this.allmodifiers.put(Modifier.toString(Modifier.INTERFACE), Modifier.INTERFACE); + this.allmodifiers.put("sealed", 4096); + this.allmodifiers.put("non-sealed", 8192); + this.allmodifiers.put("default", 16384); + this.allmodifiers.put("strictfp", 32768); + + this.compiler = compiler; + this.fileName = fileName; + } + + public JavaClassRegistry getReg() { + return this.reg; + } + + public String convertQualifiedName(Java17Parser.QualifiedNameContext ctx) { + /* + * String ret = ""; for (Java17Parser.IdentifierContext ident : ctx.identifier()) { ret += ident.getText(); if (ctx.identifier().iterator().hasNext()) { ret += '.'; } } + */ + return ctx.getText(); + } + + public void convert(List classes, Java17Parser.SourceFileContext ctx, PackageCrawler packageCrawler) throws ClassNotFoundException, NotImplementedException { + SrcfileContext srcfile; + if (ctx instanceof Java17Parser.SrcfileContext) { + srcfile = (SrcfileContext) ctx; + } else { + return; + } + if (srcfile.packageDeclaration() != null) + this.pkgName = convert(srcfile.packageDeclaration()); + Map imports = GatherNames.getImports(srcfile, packageCrawler, compiler); + this.imports.addAll(imports.keySet().stream().map(name -> reg.getName(name)).collect(Collectors.toSet())); + + for (Java17Parser.ClassOrInterfaceContext type : srcfile.classOrInterface()) { + ClassorinterfacedeclContext clsoif; + if (type instanceof NoclassorinterfaceContext) { + continue; + } else { + clsoif = (ClassorinterfacedeclContext) type; + } + ClassOrInterface newClass; + int modifiers = 0; + if (!clsoif.classOrInterfaceModifier().isEmpty()) { + for (Java17Parser.ClassOrInterfaceModifierContext mod : clsoif.classOrInterfaceModifier()) { + modifiers += allmodifiers.get(mod.getText()); + } + } + fieldInitializations = new ArrayList<>(); // PL 2019-10-22: muss für jede Klasse neu initilisiert werden + staticFieldInitializations = new ArrayList<>(); + if (!Objects.isNull(clsoif.classDeclaration())) { + newClass = convertClass(clsoif.classDeclaration(), modifiers); + } else if (!Objects.isNull(clsoif.interfaceDeclaration())) { + newClass = convertInterface(clsoif.interfaceDeclaration(), modifiers); + } else if (!Objects.isNull(clsoif.recordDeclaration())) { + newClass = convertRecord(clsoif.recordDeclaration(), modifiers); + } else { + throw new NotImplementedException(); + } + classes.add(newClass); + } + if (classes.isEmpty()) { + throw new NotImplementedException("SourceFile enthält keine Klassen"); + } + } + + private String convert(Java17Parser.PackageDeclarationContext ctx) { + return convertQualifiedName(ctx.qualifiedName()); + } + + private ClassOrInterface convertClass(Java17Parser.ClassDeclarationContext ctx, int modifiers) { + String className = this.pkgName + (this.pkgName.length() > 0 ? "." : "") + ctx.identifier().getText(); + JavaClassName name = reg.getName(className); // Holt den Package Namen mit dazu + if (!name.toString().equals(className)) { // Kommt die Klasse schon in einem anderen Package vor? + throw new TypeinferenceException("Name " + className + " bereits vorhanden in " + reg.getName(className).toString(), ctx.getStart()); + } + GenericsRegistry generics = createGenerics(ctx.genericDeclarationList(), name, "", reg, new GenericsRegistry(globalGenerics)); + Token offset = ctx.getStart(); + GenericDeclarationList genericClassParameters; + if (ctx.genericDeclarationList() == null) { + genericClassParameters = new GenericDeclarationList(new ArrayList<>(), ctx.classBody().getStart()); + } else { + genericClassParameters = TypeGenerator.convert(ctx.genericDeclarationList(), name, "", reg, generics); + } + RefType superClass; + if (ctx.EXTENDS() != null) { + superClass = convertSuperType(ctx.typeType()); + } else { + superClass = new RefType(ASTFactory.createObjectClass().getClassName(), ctx.getStart()); + } + this.superClass = superClass; + List fielddecl = new ArrayList<>(); + List methods = new ArrayList<>(); + List constructors = new ArrayList<>(); + Boolean isInterface = false; + Boolean isFunctionalInterface = false; + List implementedInterfaces = new ArrayList<>(); + List permittedSubtypes = new ArrayList<>(); + for (ClassBodyDeclarationContext clsbodydecl : ctx.classBody().classBodyDeclaration()) { + convert(clsbodydecl, fielddecl, constructors, methods, name, superClass, generics); + } + if (constructors.isEmpty()) { + constructors.add(generateStandardConstructor(ctx.identifier().getText(), name, superClass, genericClassParameters, offset)); + } + if (ctx.IMPLEMENTS() != null) { + implementedInterfaces.addAll(convert(ctx.typeList(0), generics)); + } + // Ist Bit für 'sealed'-Modifier gesetzt + if ((modifiers & 4096) != 0) { + if (!Objects.isNull(ctx.PERMITS())) { + // permitted subtypes sind letzte typeList (siehe Grammatikregel 'classDeclaration') + permittedSubtypes.addAll(convert(ctx.typeList(ctx.typeList().size() - 1), generics)); + } else { + // falls sealed modifier ohne 'permits'-List oder umgekehrt + throw new NotImplementedException("Invalid sealed class declaration"); + } + } + var ctor = Optional.of(this.generatePseudoConstructor(ctx.identifier().getText(), fieldInitializations, genericClassParameters, offset)); + var staticCtor = Optional.of(this.generateStaticConstructor(ctx.identifier().getText(), staticFieldInitializations, genericClassParameters, offset)); + return new ClassOrInterface(modifiers, name, fielddecl, ctor, staticCtor, methods, constructors, genericClassParameters, superClass, isInterface, isFunctionalInterface, implementedInterfaces, permittedSubtypes, offset, fileName); + + } + + private de.dhbwstuttgart.syntaxtree.Record convertRecord(RecordDeclarationContext recordDeclaration, int modifiers) { + this.superClass = new RefType(new JavaClassName("java.lang.Record"), new NullToken()); + String identifier = recordDeclaration.identifier().getText(); + String className = this.pkgName + (this.pkgName.length() > 0 ? "." : "") + identifier; + JavaClassName name = reg.getName(className); // Holt den Package Namen mit dazu + Token offset = recordDeclaration.getStart(); + GenericsRegistry generics = createGenerics(recordDeclaration.genericDeclarationList(), name, "", reg, new GenericsRegistry(globalGenerics)); + if (!name.toString().equals(className)) { // Kommt die Klasse schon in einem anderen Package vor? + throw new TypeinferenceException("Name " + className + " bereits vorhanden in " + reg.getName(className).toString(), recordDeclaration.getStart()); + } + GenericDeclarationList genericClassParameters; + if (recordDeclaration.genericDeclarationList() == null) { + genericClassParameters = new GenericDeclarationList(new ArrayList<>(), recordDeclaration.recordBody().getStart()); + } else { + genericClassParameters = TypeGenerator.convert(recordDeclaration.genericDeclarationList(), name, "", reg, generics); + } + RefType superClass = new RefType(ASTFactory.createClass(java.lang.Record.class).getClassName(), offset); + List fielddecl = new ArrayList<>(); + List methods = new ArrayList<>(); + List constructors = new ArrayList<>(); + Boolean isInterface = false; + List implementedInterfaces = new ArrayList<>(); + List constructorParameters = new ArrayList<>(); + List constructorStatements = new ArrayList<>(); + for (RecordComponentContext component : recordDeclaration.recordHeader().recordComponentList().recordComponent()) { + int fieldmodifiers = allmodifiers.get("private") + allmodifiers.get("final"); + String fieldname = component.identifier().getText(); + Token fieldoffset = component.getStart(); + RefTypeOrTPHOrWildcardOrGeneric fieldtype = null; + if (Objects.isNull(component.typeType())) { + fieldtype = TypePlaceholder.fresh(offset); + } else { + fieldtype = TypeGenerator.convert(component.typeType(), reg, generics); + } + fielddecl.add(new Field(fieldname, fieldtype, fieldmodifiers, fieldoffset)); + constructorParameters.add(new FormalParameter(fieldname, fieldtype, fieldoffset)); + FieldVar fieldvar = new FieldVar(new This(offset), false, fieldname, fieldtype, fieldoffset); + constructorStatements.add(new Assign(new AssignToField(fieldvar), new LocalVar(fieldname, fieldtype, fieldoffset), offset)); + Statement returnStatement = new Return(fieldvar, offset); + methods.add(new Method(allmodifiers.get("public"), fieldname, fieldtype, new ParameterList(new ArrayList<>(), offset), new Block(Arrays.asList(returnStatement), offset), new GenericDeclarationList(new ArrayList<>(), offset), offset)); + } + RefType classType = ClassOrInterface.generateTypeOfClass(reg.getName(className), genericClassParameters, offset); + Constructor implicitConstructor = new Constructor(allmodifiers.get("public"), identifier, classType, new ParameterList(constructorParameters, offset), prepareBlock(new Block(constructorStatements, offset), superClass), genericClassParameters, offset); + //Optional initializations = Optional.of(implicitConstructor); + constructors.add(implicitConstructor); + for (ClassBodyDeclarationContext bodyDeclaration : recordDeclaration.recordBody().classBodyDeclaration()) { + convert(bodyDeclaration, fielddecl, constructors, methods, name, superClass, generics); + } + if (!Objects.isNull(recordDeclaration.IMPLEMENTS())) { + implementedInterfaces.addAll(convert(recordDeclaration.typeList(), generics)); + } + var staticCtor = Optional.of(this.generateStaticConstructor(recordDeclaration.identifier().getText(), staticFieldInitializations, genericClassParameters, offset)); + return new Record(modifiers, name, fielddecl, Optional.empty(), staticCtor, methods, constructors, genericClassParameters, superClass, isInterface, implementedInterfaces, offset, fileName); + } + + private void convert(ClassBodyDeclarationContext classBody, List fields, List constructors, List methods, JavaClassName name, RefType superClass, GenericsRegistry generics) { + MemberdeclContext member; + if (classBody instanceof MemberdeclContext) { + member = (MemberdeclContext) classBody; + Integer membermodifiers = 0; + for (ModifierContext mod : member.modifier()) { + if (mod.classOrInterfaceModifier() != null && mod.classOrInterfaceModifier().annotation() != null) + continue; // TODO don't eat annotations + membermodifiers += allmodifiers.get(mod.getText()); + } + switch (member.memberDeclaration()) { + case MemberclassorinterfaceContext memberclsoif: { + break; + } + case MemberfieldContext memberfield: { + fields.addAll(convert(memberfield.fieldDeclaration(), membermodifiers, generics)); + break; + } + case MembermethodContext membermethod: { + Method convertedMethod = convert(membermodifiers, membermethod.method(), name, superClass, generics); + if (convertedMethod instanceof Constructor constructor) { + constructors.add(constructor); + } else { + methods.add(convertedMethod); + } + break; + } + case MemberconstructorContext memberconstructor: { + constructors.add(convert(membermodifiers, memberconstructor.constructor(), name, superClass, generics)); + break; + } + default: + break; + } + } else if (classBody instanceof Java17Parser.ClassblockContext ctx && ctx.STATIC() != null) { + // Static blocks + var stmtgen = new StatementGenerator(superClass, compiler, reg, generics, this.fields, new HashMap<>()); + var block = stmtgen.convert(((Java17Parser.ClassblockContext) classBody).block(), false); + staticFieldInitializations.addAll(block.statements); + } + } + + private ClassOrInterface convertInterface(Java17Parser.InterfaceDeclarationContext ctx, int modifiers) { + this.superClass = new RefType(new JavaClassName("java.lang.Object"), new NullToken()); + String className = this.pkgName.length() > 0 ? this.pkgName + "." : "" + ctx.identifier().getText(); + JavaClassName name = reg.getName(className); // Holt den Package Namen mit dazu + if (!name.toString().equals(className)) { // Kommt die Klasse schon in einem anderen Package vor? + throw new TypeinferenceException("Name " + className + " bereits vorhanden in " + reg.getName(className).toString(), ctx.getStart()); + } + if (!Modifier.isInterface(modifiers)) + modifiers += Modifier.INTERFACE; + + GenericsRegistry generics = createGenerics(ctx.genericDeclarationList(), name, "", reg, new GenericsRegistry(globalGenerics)); + + GenericDeclarationList genericParams; + if (!Objects.isNull(ctx.genericDeclarationList())) { + genericParams = TypeGenerator.convert(ctx.genericDeclarationList(), name, "", reg, generics); + } else { + genericParams = createEmptyGenericDeclarationList(ctx.identifier().getStart()); + } + RefType superClass = ASTFactory.createObjectType(); + + List fields = new ArrayList<>(); + List methods = new ArrayList<>(); + for (InterfaceBodyDeclarationContext interfacebody : ctx.interfaceBody().interfaceBodyDeclaration()) { + if (interfacebody instanceof Java17Parser.EmptyinterfaceContext) { + continue; + } else { + InterfacememberContext interfacemember = (InterfacememberContext) interfacebody; + int membermodifiers = 0; + for (ModifierContext mod : interfacemember.modifier()) { + membermodifiers += allmodifiers.get(mod.getText()); + } + int methodmodifiers = membermodifiers; + switch (interfacemember.interfaceMemberDeclaration()) { + case InterfaceconstContext constant: + fields.add(convert(constant)); + break; + case InterfacemethodContext method: + InterfaceMethodDeclarationContext declaration = method.interfaceMethodDeclaration(); + for (InterfaceMethodModifierContext mod : declaration.interfaceMethodModifier()) { + methodmodifiers += allmodifiers.get(mod.getText()); + } + InterfaceCommonBodyDeclarationContext commonbody = declaration.interfaceCommonBodyDeclaration(); + methods.add(convert(methodmodifiers, commonbody, new GenericDeclarationList(new ArrayList<>(), commonbody.getStart()), generics)); + break; + case GenericinterfacemethodContext genericmethod: + GenericInterfaceMethodDeclarationContext genericdeclaration = genericmethod.genericInterfaceMethodDeclaration(); + int genericmethodmodifiers = 0; + for (InterfaceMethodModifierContext mod : genericdeclaration.interfaceMethodModifier()) { + genericmethodmodifiers += allmodifiers.get(mod.getText()); + } + commonbody = genericdeclaration.interfaceCommonBodyDeclaration(); + GenericDeclarationList gtv = TypeGenerator.convert(genericdeclaration.genericDeclarationList(), name, commonbody.identifier().getText(), reg, generics); + methods.add(convert(genericmethodmodifiers, commonbody, gtv, generics)); + break; + default: + throw new NotImplementedException(); + } + } + } + List extendedInterfaces = new ArrayList<>(); + if (!Objects.isNull(ctx.EXTENDS())) { + extendedInterfaces.addAll(convert(ctx.typeList(0), generics)); + } + List permittedSubtypes = new ArrayList<>(); + // Ist Bit für 'sealed'-Modifier gesetzt + if ((modifiers & 4096) != 0) { + if (!Objects.isNull(ctx.PERMITS())) { + // permitted subtypes sind letzte typeList (siehe Grammatikregel 'classDeclaration') + permittedSubtypes.addAll(convert(ctx.typeList(ctx.typeList().size() - 1), generics)); + } else { + // falls sealed modifier ohne 'permits'-List oder umgekehrt + throw new NotImplementedException("Invalid sealed class declaration"); + } + } + + var staticCtor = Optional.of(this.generateStaticConstructor(ctx.identifier().getText(), staticFieldInitializations, genericParams, ctx.getStart())); + return new ClassOrInterface(modifiers, name, fields, Optional.empty(), staticCtor, methods, new ArrayList<>(), genericParams, superClass, true, methods.size() == 1 ? true : false, extendedInterfaces, permittedSubtypes, ctx.getStart(), fileName); + } + + private GenericDeclarationList createEmptyGenericDeclarationList(Token classNameIdentifier) { + CommonToken gtvOffset = new CommonToken(classNameIdentifier); + gtvOffset.setCharPositionInLine(gtvOffset.getCharPositionInLine() + classNameIdentifier.getText().length()); + gtvOffset.setStartIndex(gtvOffset.getStopIndex() + 1); + return new GenericDeclarationList(new ArrayList<>(), gtvOffset); + } + + private Field convert(InterfaceconstContext constant) { + // TODO: Erstelle hier ein Feld! + throw new NotImplementedException(); + } + + private Method convert(int modifiers, InterfaceCommonBodyDeclarationContext bodydeclaration, GenericDeclarationList gtvDeclarations, GenericsRegistry generics) { + String name = bodydeclaration.identifier().getText(); + + RefTypeOrTPHOrWildcardOrGeneric retType; + if (Objects.isNull(bodydeclaration.refType())) { + retType = TypePlaceholder.fresh(bodydeclaration.getStart()); + } else { + if (bodydeclaration.refType() instanceof RefType2Context reftype) { + retType = TypeGenerator.convert(reftype.typeType(), reg, generics); + } else { + retType = new Void(bodydeclaration.refType().getStart()); + } + } + StatementGenerator stmtgen = new StatementGenerator(superClass, compiler, reg, generics, fields, new HashMap<>()); + ParameterList paramlist = stmtgen.convert(bodydeclaration.formalParameters().formalParameterList()); + MethodBodyContext body = bodydeclaration.methodBody(); + Block block = null; + if (!(body instanceof EmptymethodContext)) { + MethodblockContext methodblock = (MethodblockContext) body; + block = stmtgen.convert(methodblock.block(), true); + } + else { + modifiers += Modifier.ABSTRACT; + } + return new Method(modifiers, name, retType, paramlist, block, gtvDeclarations, bodydeclaration.getStart()); + } + + protected static Block prepareBlock(Block constructorBlock, RefType superClass) { + List statements = constructorBlock.getStatements(); + if (statements.isEmpty() || !(statements.get(0) instanceof SuperCall)) { + var signature = new ArrayList(); + signature.add(new Void(new NullToken())); + statements.add(0, new SuperCall(superClass, signature, constructorBlock.getOffset())); + } + /* statements.addAll(fieldInitializations); geloescht PL 2018-11-24 */ + return new Block(statements, constructorBlock.getOffset()); + } + + /** + * http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.8.9 + */ + private Constructor generateStandardConstructor(String className, JavaClassName parentClass, RefType superClass, GenericDeclarationList classGenerics, Token offset) { + RefType classType = ClassOrInterface.generateTypeOfClass(reg.getName(className), classGenerics, offset); + ParameterList params = new ParameterList(new ArrayList<>(), offset); + return new Constructor(Modifier.PUBLIC, className, classType, params, prepareBlock(new Block(new ArrayList<>(), offset), superClass), classGenerics, offset); // fieldInitializations // 2018-11-24 + } + + /* + * fieldInitializations werden in einem Psedokonstruktor in der abstrakten Syntax gespeichert + */ + private Constructor generatePseudoConstructor(String className, List initializations, GenericDeclarationList classGenerics, Token offset) { + RefType classType = ClassOrInterface.generateTypeOfClass(reg.getName(className), classGenerics, offset); + ParameterList params = new ParameterList(new ArrayList<>(), offset); + return new Constructor(Modifier.PUBLIC, className, classType, params, new Block(new ArrayList<>(initializations), offset), classGenerics, offset); + } + + private Method generateStaticConstructor(String className, List initializations, GenericDeclarationList classGenerics, Token offset) { + RefType classType = ClassOrInterface.generateTypeOfClass(reg.getName(className), classGenerics, offset); + ParameterList params = new ParameterList(new ArrayList<>(), offset); + Block block = new Block(new ArrayList<>(initializations), offset); + return new Method(Modifier.PUBLIC, className, classType, params, block, classGenerics, offset); + } + + private RefType convertSuperType(Java17Parser.TypeTypeContext typeType) { + ClassOrInterfaceTypeContext supertypecontext = typeType.classOrInterfaceType(); + if (supertypecontext != null && supertypecontext.DOT().size() > 0) { + throw new NotImplementedException(); + } else { + TypeArgumentsContext typeArguments = (typeType.classOrInterfaceType().typeArguments().size() > 0) ? typeType.classOrInterfaceType().typeArguments().get(typeType.classOrInterfaceType().typeArguments().size() - 1) : null; + RefTypeOrTPHOrWildcardOrGeneric ret = TypeGenerator.convertTypeName(typeType.classOrInterfaceType().typeIdentifier().getText(), typeArguments, typeType.getStart(), reg, globalGenerics); + if (ret instanceof RefType) { + return (RefType) ret; + } else { + throw new TypeinferenceException(typeType.getText() + " ist kein gültiger Supertyp", typeType.getStart()); + } + } + } + + private List convert(Java17Parser.TypeListContext ctx, GenericsRegistry generics) { + List ret = new ArrayList<>(); + for (Java17Parser.TypeTypeContext type : ctx.typeType()) { + ret.add((RefType) TypeGenerator.convert(type, reg, generics)); + } + return ret; + } + + public Method convert(int modifiers, Java17Parser.MethodContext methodContext, JavaClassName parentClass, RefType superClass, GenericsRegistry generics) { + GenericsRegistry localgenerics = generics; + MethodDeclarationContext methoddeclaration; + GenericDeclarationListContext genericdeclarations; + GenericDeclarationList gtvDeclarations; + MethodHeaderContext header; + String name; + if (methodContext instanceof GenericmethodContext) { + GenericmethodContext gmc = (GenericmethodContext) methodContext; + genericdeclarations = gmc.genericMethodDeclaration().genericDeclarationList(); + methoddeclaration = gmc.genericMethodDeclaration().methodDeclaration(); + header = methoddeclaration.methodHeader(); + name = header.identifier().getText(); + localgenerics.putAll(createGenerics(genericdeclarations, parentClass, name, reg, generics)); + gtvDeclarations = TypeGenerator.convert(genericdeclarations, parentClass, name, reg, localgenerics); + } else { + MethoddeclContext mdc = (MethoddeclContext) methodContext; + methoddeclaration = mdc.methodDeclaration(); + header = methoddeclaration.methodHeader(); + gtvDeclarations = new GenericDeclarationList(new ArrayList<>(), header.getStart()); + name = header.identifier().getText(); + } + + RefTypeOrTPHOrWildcardOrGeneric retType; + if (Objects.isNull(header.refType())) { + retType = TypePlaceholder.fresh(header.getStart()); + } else { + if (header.refType() instanceof RefType2Context reftype) { + retType = TypeGenerator.convert(reftype.typeType(), reg, generics); + } else { + retType = new Void(header.refType().getStart()); + } + } + StatementGenerator stmtgen = new StatementGenerator(superClass, compiler, reg, localgenerics, fields, new HashMap<>()); + ParameterList paramlist = stmtgen.convert(header.formalParameters().formalParameterList()); + MethodBodyContext body = methoddeclaration.methodBody(); + Block block = null; + if (body instanceof EmptymethodContext emptymethod) { + if (!Modifier.isAbstract(modifiers)) { + // TODO: Error! Abstrakte Methode ohne abstrakt Keyword + } + } else { + MethodblockContext methodblock = (MethodblockContext) body; + block = stmtgen.convert(methodblock.block(), true); + } + if (name.equals(parentClass.getClassName())) { + return new Constructor(modifiers, name, retType, paramlist, prepareBlock(block, superClass), gtvDeclarations, methoddeclaration.getStart()); + } else { + return new Method(modifiers, name, retType, paramlist, block, gtvDeclarations, methoddeclaration.getStart()); + } + } + + public Constructor convert(int modifiers, Java17Parser.ConstructorContext constructorContext, JavaClassName parentClass, RefType superClass, GenericsRegistry generics) { + GenericsRegistry localgenerics = generics; + GenericDeclarationListContext genericdeclarations; + GenericDeclarationList gtvDeclarations; + ConstructorDeclarationContext constructordeclaration; + String name; + if (constructorContext instanceof GenericconstructorContext) { + GenericconstructorContext genericconstructor = (GenericconstructorContext) constructorContext; + GenericConstructorDeclarationContext gcdeclaration = genericconstructor.genericConstructorDeclaration(); + name = gcdeclaration.constructorDeclaration().identifier().getText(); + genericdeclarations = gcdeclaration.genericDeclarationList(); + constructordeclaration = gcdeclaration.constructorDeclaration(); + localgenerics.putAll(createGenerics(genericdeclarations, parentClass, name, reg, generics)); + gtvDeclarations = TypeGenerator.convert(genericdeclarations, parentClass, name, reg, localgenerics); + } else { + ConstructordeclContext constructordeclarationcontext = (ConstructordeclContext) constructorContext; + constructordeclaration = constructordeclarationcontext.constructorDeclaration(); + name = constructordeclaration.identifier().getText(); + gtvDeclarations = new GenericDeclarationList(new ArrayList<>(), constructordeclaration.getStart()); + } + RefTypeOrTPHOrWildcardOrGeneric retType = TypeGenerator.convertTypeName(name, constructordeclaration.getStart(), reg, localgenerics); + StatementGenerator stmtgen = new StatementGenerator(superClass, compiler, reg, localgenerics, fields, new HashMap<>()); + ParameterList paramlist = stmtgen.convert(constructordeclaration.formalParameters().formalParameterList()); + Block block = prepareBlock(stmtgen.convert(constructordeclaration.constructorBody, true), superClass); + return new Constructor(modifiers, name, retType, paramlist, block, gtvDeclarations, constructordeclaration.getStart()); + } + + List convert(Java17Parser.FieldDeclarationContext fieldDeclContext, int modifiers, GenericsRegistry generics) { + List ret = new ArrayList<>(); + RefTypeOrTPHOrWildcardOrGeneric fieldType; + if (fieldDeclContext.typeType() != null) { + fieldType = TypeGenerator.convert(fieldDeclContext.typeType(), reg, generics); + } else { + // PL 2019-12-06: variableDeclaratorList() eingefuegt, um als Token nicht die + // Modifier zu bekommen + fieldType = TypePlaceholder.fresh(fieldDeclContext.variableDeclarators().getStart()); + } + for (Java17Parser.VariableDeclaratorContext varDecl : fieldDeclContext.variableDeclarators().variableDeclarator()) { + String fieldName = varDecl.variableDeclaratorId().getText(); + this.fields.put(fieldName, new FieldEntry(fieldName, fieldType, modifiers)); + if (varDecl.variableInitializer() != null) { + initializeField(varDecl, Modifier.isStatic(modifiers), fieldType, generics); + } + ret.add(new Field(fieldName, fieldType, modifiers, varDecl.getStart())); + } + return ret; + } + + public static String convert(Java17Parser.VariableDeclaratorIdContext variableDeclaratorIdContext) { + return variableDeclaratorIdContext.getText(); + } + + // Initialize a field by creating implicit constructor. + private void initializeField(Java17Parser.VariableDeclaratorContext ctx, boolean isStatic, RefTypeOrTPHOrWildcardOrGeneric typeOfField, GenericsRegistry generics) { + StatementGenerator statementGenerator = new StatementGenerator(superClass, compiler, reg, generics, fields, new HashMap<>()); + var assignment = statementGenerator.generateFieldAssignment(ctx, typeOfField); + if (isStatic) { + staticFieldInitializations.add(assignment); + } + else fieldInitializations.add(assignment); + } + + public int convertModifier(String modifier) { + return allmodifiers.get(modifier); + } + + private GenericsRegistry createGenerics(Java17Parser.GenericDeclarationListContext ctx, JavaClassName parentClass, String parentMethod, JavaClassRegistry reg, GenericsRegistry generics) { + GenericsRegistry ret = new GenericsRegistry(this.globalGenerics); + ret.putAll(generics); + if (ctx == null) + return ret; + for (Java17Parser.GenericTypeVarContext tp : ctx.genericTypeVar()) { + ret.put(tp.identifier().getText(), new GenericContext(parentClass, parentMethod)); + TypeGenerator.convert(tp, parentClass, parentMethod, reg, ret); + } + return ret; + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/TypeGenerator.java b/javatx-src/main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/TypeGenerator.java new file mode 100644 index 0000000..d227c16 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/TypeGenerator.java @@ -0,0 +1,209 @@ +package de.dhbwstuttgart.parser.SyntaxTreeGenerator; + +import de.dhbwstuttgart.exceptions.NotImplementedException; +import de.dhbwstuttgart.exceptions.TypeinferenceException; +import de.dhbwstuttgart.parser.NullToken; +import de.dhbwstuttgart.parser.antlr.Java17Parser; +import de.dhbwstuttgart.parser.antlr.Java17Parser.IdentifierContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.TypeArgumentsContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.TypeTypeContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.WildcardTypeContext; +import de.dhbwstuttgart.parser.scope.GenericsRegistry; +import de.dhbwstuttgart.parser.scope.JavaClassName; +import de.dhbwstuttgart.parser.scope.JavaClassRegistry; +import de.dhbwstuttgart.syntaxtree.GenericDeclarationList; +import de.dhbwstuttgart.syntaxtree.GenericTypeVar; +import de.dhbwstuttgart.syntaxtree.factory.ASTFactory; +import de.dhbwstuttgart.syntaxtree.type.ExtendsWildcardType; +import de.dhbwstuttgart.syntaxtree.type.GenericRefType; +import de.dhbwstuttgart.syntaxtree.type.RefType; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import de.dhbwstuttgart.syntaxtree.type.SuperWildcardType; +import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; +import org.antlr.v4.runtime.Token; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class TypeGenerator { + + public static RefTypeOrTPHOrWildcardOrGeneric convert(Java17Parser.ClassOrInterfaceTypeContext classOrInterfaceTypeContext, JavaClassRegistry reg, GenericsRegistry generics) { + Java17Parser.TypeArgumentsContext arguments = null; + /* + * PL 2019-03-19 auskommentiert ANFANG if(unannClassOrInterfaceTypeContext. unannClassType_lfno_unannClassOrInterfaceType() != null){ arguments = unannClassOrInterfaceTypeContext. unannClassType_lfno_unannClassOrInterfaceType().typeArguments(); }else{// if(unannClassOrInterfaceTypeContext. unannInterfaceType_lfno_unannClassOrInterfaceType() != null){ arguments = unannClassOrInterfaceTypeContext. unannInterfaceType_lfno_unannClassOrInterfaceType(). + * unannClassType_lfno_unannClassOrInterfaceType().typeArguments(); } PL 2019-03-19 auskommentiert ENDE + */ + /** + * Problem sind hier die verschachtelten Typen mit verschachtelten Typargumenten Beispiel: Typ.InnererTyp + */ + if (classOrInterfaceTypeContext.typeArguments().size() > 1) + throw new NotImplementedException(); + + String name = ""; + for (IdentifierContext id : classOrInterfaceTypeContext.identifier()) { + name += id.getText() + '.'; + } + name += classOrInterfaceTypeContext.typeIdentifier().getText(); + if (classOrInterfaceTypeContext.getStop().getText().equals(">")) { + /* + * Fuer Debug-Zwecke unannClassOrInterfaceTypeContext. unannInterfaceType_lfno_unannClassOrInterfaceType(); unannClassOrInterfaceTypeContext. unannClassType_lfno_unannClassOrInterfaceType().getText(); //unannClassOrInterfaceTypeContext. unannInterfaceType_lfno_unannClassOrInterfaceType(). unannClassType_lfno_unannClassOrInterfaceType().typeArguments(); //UnannClassType_lfno_unannClassOrInterfaceTypeContext unannClassOrInterfaceTypeContext.unannClassType_lf_unannClassOrInterfaceType( 0); + * unannClassOrInterfaceTypeContext.unannClassType_lf_unannClassOrInterfaceType( 0).getText(); unannClassOrInterfaceTypeContext.unannClassType_lf_unannClassOrInterfaceType( 1); unannClassOrInterfaceTypeContext.unannClassType_lf_unannClassOrInterfaceType( 1).getText(); unannClassOrInterfaceTypeContext. unannClassType_lfno_unannClassOrInterfaceType().getText(); //unannClassOrInterfaceTypeContext. unannInterfaceType_lf_unannClassOrInterfaceType(); //unannClassOrInterfaceTypeContext. + * unannInterfaceType_lf_unannClassOrInterfaceType(0).getText(); //unannClassOrInterfaceTypeContext. unannInterfaceType_lf_unannClassOrInterfaceType(1).getText(); //unannClassOrInterfaceTypeContext. unannInterfaceType_lfno_unannClassOrInterfaceType().getText(); + */ + List typeargs = classOrInterfaceTypeContext.typeArguments(); + arguments = typeargs.size() != 0 ? classOrInterfaceTypeContext.typeArguments(0) : null; + } + return convertTypeName(name, arguments, classOrInterfaceTypeContext.getStart(), reg, generics); + } + + public static RefTypeOrTPHOrWildcardOrGeneric convert(Java17Parser.TypeTypeContext typeContext, JavaClassRegistry reg, GenericsRegistry genericsRegistry) { + if (typeContext.primitiveType() != null) { + switch (typeContext.primitiveType().getText()) { + case "boolean": + return new RefType(ASTFactory.createClass(Boolean.class).getClassName(), typeContext.getStart()); + case "int": + return new RefType(ASTFactory.createClass(Integer.class).getClassName(), typeContext.getStart()); + case "double": + return new RefType(ASTFactory.createClass(Double.class).getClassName(), typeContext.getStart()); + default: + throw new NotImplementedException(); + } + } else if (!typeContext.LBRACK().isEmpty()) { // ArrayType über eckige Klammer prüfen + // System.out.println(unannTypeContext.getText()); + throw new NotImplementedException(); + } + /* + * else if (typeContext.classOrInterfaceType() != null) { JavaClassName name = reg .getName(typeContext.classOrInterfaceType().typeIdentifier().getText()); return new RefType(name, typeContext.getStart()); } + */ + return TypeGenerator.convert(typeContext.classOrInterfaceType(), reg, genericsRegistry); + } + + public static GenericDeclarationList convert(Java17Parser.GenericDeclarationListContext typeParametersContext, JavaClassName parentClass, String parentMethod, JavaClassRegistry reg, GenericsRegistry generics) { + Token endOffset = typeParametersContext.getStop(); + List typeVars = new ArrayList<>(); + for (Java17Parser.GenericTypeVarContext typeParameter : typeParametersContext.genericTypeVar()) { + typeVars.add(convert(typeParameter, parentClass, parentMethod, reg, generics)); + endOffset = typeParameter.getStop(); + } + return new GenericDeclarationList(typeVars, endOffset); + } + + public static GenericTypeVar convert(Java17Parser.GenericTypeVarContext typeVar, JavaClassName parentClass, String parentMethod, JavaClassRegistry reg, GenericsRegistry generics) { + String name = typeVar.identifier().getText(); + // TODO: Es müssen erst alle GenericTypeVars generiert werden, dann können die + // bounds dieser Generics ermittelt werden + // Problem ist erlaubt, würde aber bei den Bounds von A den + // Generic B nicht als solchen erkennen + List bounds = TypeGenerator.convert(typeVar.typeBound(), reg, generics); + + GenericTypeVar ret = new GenericTypeVar(name, bounds, typeVar.getStart(), typeVar.getStop()); + return ret; + } + + public static List convert(Java17Parser.TypeBoundContext typeBoundContext, JavaClassRegistry reg, GenericsRegistry generics) { + List ret = new ArrayList<>(); + if (Objects.isNull(typeBoundContext)) { + ret.add(ASTFactory.createObjectType()); + return ret; + } + if (typeBoundContext.typeType().size() > 0) { + for (TypeTypeContext tt : typeBoundContext.typeType()) { + ret.add(convert(tt, reg, generics)); + } + return ret; + } + throw new NotImplementedException(); + } + + public static RefTypeOrTPHOrWildcardOrGeneric convert(Java17Parser.WildcardTypeContext wildcardContext, JavaClassRegistry reg, GenericsRegistry generics) { + if (wildcardContext.getChildCount() < 3) { + if (!Objects.isNull(wildcardContext.extendsWildcardType())) { + return new ExtendsWildcardType(convert(wildcardContext.extendsWildcardType().typeType(), reg, generics), wildcardContext.getStart()); + } else if (!Objects.isNull(wildcardContext.superWildcardType())) { + return new SuperWildcardType(convert(wildcardContext.superWildcardType().typeType(), reg, generics), wildcardContext.getStart()); + } else { + return new ExtendsWildcardType(new RefType(new JavaClassName("java.lang.Object"), new NullToken()), wildcardContext.getStart()); + } + } else { + throw new NotImplementedException(); // Wildcard ohne Bound + } + } + + public static RefTypeOrTPHOrWildcardOrGeneric convertTypeName(String name, Token offset, JavaClassRegistry reg, GenericsRegistry generics) { + return convertTypeName(name, (Java17Parser.TypeArgumentsContext) null, offset, reg, generics); + } + + public static RefTypeOrTPHOrWildcardOrGeneric convertTypeName(String name, Java17Parser.TypeArgumentsContext typeArguments, Token offset, JavaClassRegistry reg, GenericsRegistry generics) { + if (!reg.contains(name)) { // Dann könnte es ein generischer Type oder ein FunN$$-Type sein + if (generics.contains(name)) { + return new GenericRefType(name, offset); + } else { + Pattern p = Pattern.compile("Fun(\\d+)[$][$]"); + Matcher m = p.matcher(name); + if (m.matches()) {// es ist FunN$$-Type + return new RefType(new JavaClassName(name), convert(typeArguments, reg, generics), offset); + } else { + throw new TypeinferenceException("Der Typ " + name + " ist nicht vorhanden", offset); + } + } + } + if (typeArguments == null) { + List params = new ArrayList<>(); + for (int i = 0; i < reg.getNumberOfGenerics(name); i++) { + params.add(TypePlaceholder.fresh(offset)); + } + return new RefType(reg.getName(name), params, offset); + } else { + return new RefType(reg.getName(name), convert(typeArguments, reg, generics), offset); + } + } + + public static RefTypeOrTPHOrWildcardOrGeneric convertTypeName(String name, Java17Parser.NonWildcardTypeArgumentsContext typeArguments, Token offset, JavaClassRegistry reg, GenericsRegistry generics) { + if (!reg.contains(name)) { // Dann könnte es ein generischer Type oder ein FunN$$-Type sein + if (generics.contains(name)) { + return new GenericRefType(name, offset); + } else { + Pattern p = Pattern.compile("Fun(\\d+)[$][$]"); + Matcher m = p.matcher(name); + if (m.matches()) {// es ist FunN$$-Type + return new RefType(new JavaClassName(name), convert(typeArguments, reg, generics), offset); + } else { + throw new TypeinferenceException("Der Typ " + name + " ist nicht vorhanden", offset); + } + } + } + if (typeArguments == null) { + List params = new ArrayList<>(); + for (int i = 0; i < reg.getNumberOfGenerics(name); i++) { + params.add(TypePlaceholder.fresh(offset)); + } + return new RefType(reg.getName(name), params, offset); + } else { + return new RefType(reg.getName(name), convert(typeArguments, reg, generics), offset); + } + } + + public static List convert(Java17Parser.TypeArgumentsContext typeArguments, JavaClassRegistry reg, GenericsRegistry generics) { + List ret = new ArrayList<>(); + for (Java17Parser.TypeArgumentContext arg : typeArguments.typeArgument()) { + WildcardTypeContext wc = arg.wildcardType(); + if (!Objects.isNull(wc)) { + ret.add(convert(wc, reg, generics)); + } else { + ret.add(convert(arg.typeType(), reg, generics)); + } + } + return ret; + } + + public static List convert(Java17Parser.NonWildcardTypeArgumentsContext typeArguments, JavaClassRegistry reg, GenericsRegistry generics) { + List ret = new ArrayList<>(); + for (Java17Parser.TypeTypeContext arg : typeArguments.typeList().typeType()) { + ret.add(convert(arg, reg, generics)); + } + return ret; + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/parser/TODO b/javatx-src/main/java/de/dhbwstuttgart/parser/TODO new file mode 100644 index 0000000..165cb56 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/parser/TODO @@ -0,0 +1,5 @@ += Grammatik = + +* Core-Problem: Typinferenz vs. Konstruktoren +* möglicherweise Problem: falsche Return-Expressions + diff --git a/javatx-src/main/java/de/dhbwstuttgart/parser/antlr/Java17Lexer.interp b/javatx-src/main/java/de/dhbwstuttgart/parser/antlr/Java17Lexer.interp new file mode 100644 index 0000000..da9550c --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/parser/antlr/Java17Lexer.interp @@ -0,0 +1,408 @@ +token literal names: +null +'abstract' +'assert' +'boolean' +'break' +'byte' +'case' +'catch' +'char' +'class' +'const' +'continue' +'default' +'do' +'double' +'else' +'enum' +'extends' +'final' +'finally' +'float' +'for' +'if' +'goto' +'implements' +'import' +'instanceof' +'int' +'interface' +'long' +'native' +'new' +'package' +'private' +'protected' +'public' +'return' +'short' +'static' +'strictfp' +'super' +'switch' +'synchronized' +'this' +'throw' +'throws' +'transient' +'try' +'void' +'volatile' +'while' +'module' +'open' +'requires' +'exports' +'opens' +'to' +'uses' +'provides' +'with' +'transitive' +'var' +'yield' +'record' +'sealed' +'permits' +'non-sealed' +null +null +null +null +null +null +null +null +null +null +'null' +'(' +')' +'{' +'}' +'[' +']' +';' +',' +'.' +'=' +'>' +'<' +'!' +'~' +'?' +':' +'==' +'<=' +'>=' +'!=' +'&&' +'||' +'++' +'--' +'+' +'-' +'*' +'/' +'&' +'|' +'^' +'%' +'+=' +'-=' +'*=' +'/=' +'&=' +'|=' +'^=' +'%=' +'<<=' +'>>=' +'>>>=' +'->' +'::' +'@' +'...' +null +null +null +null + +token symbolic names: +null +ABSTRACT +ASSERT +BOOLEAN +BREAK +BYTE +CASE +CATCH +CHAR +CLASS +CONST +CONTINUE +DEFAULT +DO +DOUBLE +ELSE +ENUM +EXTENDS +FINAL +FINALLY +FLOAT +FOR +IF +GOTO +IMPLEMENTS +IMPORT +INSTANCEOF +INT +INTERFACE +LONG +NATIVE +NEW +PACKAGE +PRIVATE +PROTECTED +PUBLIC +RETURN +SHORT +STATIC +STRICTFP +SUPER +SWITCH +SYNCHRONIZED +THIS +THROW +THROWS +TRANSIENT +TRY +VOID +VOLATILE +WHILE +MODULE +OPEN +REQUIRES +EXPORTS +OPENS +TO +USES +PROVIDES +WITH +TRANSITIVE +VAR +YIELD +RECORD +SEALED +PERMITS +NON_SEALED +DECIMAL_LITERAL +HEX_LITERAL +OCT_LITERAL +BINARY_LITERAL +FLOAT_LITERAL +HEX_FLOAT_LITERAL +BOOL_LITERAL +CHAR_LITERAL +STRING_LITERAL +TEXT_BLOCK +NULL_LITERAL +LPAREN +RPAREN +LBRACE +RBRACE +LBRACK +RBRACK +SEMI +COMMA +DOT +ASSIGN +GT +LT +BANG +TILDE +QUESTION +COLON +EQUAL +LE +GE +NOTEQUAL +AND +OR +INC +DEC +ADD +SUB +MUL +DIV +BITAND +BITOR +CARET +MOD +ADD_ASSIGN +SUB_ASSIGN +MUL_ASSIGN +DIV_ASSIGN +AND_ASSIGN +OR_ASSIGN +XOR_ASSIGN +MOD_ASSIGN +LSHIFT_ASSIGN +RSHIFT_ASSIGN +URSHIFT_ASSIGN +ARROW +COLONCOLON +AT +ELLIPSIS +WS +COMMENT +LINE_COMMENT +IDENTIFIER + +rule names: +ABSTRACT +ASSERT +BOOLEAN +BREAK +BYTE +CASE +CATCH +CHAR +CLASS +CONST +CONTINUE +DEFAULT +DO +DOUBLE +ELSE +ENUM +EXTENDS +FINAL +FINALLY +FLOAT +FOR +IF +GOTO +IMPLEMENTS +IMPORT +INSTANCEOF +INT +INTERFACE +LONG +NATIVE +NEW +PACKAGE +PRIVATE +PROTECTED +PUBLIC +RETURN +SHORT +STATIC +STRICTFP +SUPER +SWITCH +SYNCHRONIZED +THIS +THROW +THROWS +TRANSIENT +TRY +VOID +VOLATILE +WHILE +MODULE +OPEN +REQUIRES +EXPORTS +OPENS +TO +USES +PROVIDES +WITH +TRANSITIVE +VAR +YIELD +RECORD +SEALED +PERMITS +NON_SEALED +DECIMAL_LITERAL +HEX_LITERAL +OCT_LITERAL +BINARY_LITERAL +FLOAT_LITERAL +HEX_FLOAT_LITERAL +BOOL_LITERAL +CHAR_LITERAL +STRING_LITERAL +TEXT_BLOCK +NULL_LITERAL +LPAREN +RPAREN +LBRACE +RBRACE +LBRACK +RBRACK +SEMI +COMMA +DOT +ASSIGN +GT +LT +BANG +TILDE +QUESTION +COLON +EQUAL +LE +GE +NOTEQUAL +AND +OR +INC +DEC +ADD +SUB +MUL +DIV +BITAND +BITOR +CARET +MOD +ADD_ASSIGN +SUB_ASSIGN +MUL_ASSIGN +DIV_ASSIGN +AND_ASSIGN +OR_ASSIGN +XOR_ASSIGN +MOD_ASSIGN +LSHIFT_ASSIGN +RSHIFT_ASSIGN +URSHIFT_ASSIGN +ARROW +COLONCOLON +AT +ELLIPSIS +WS +COMMENT +LINE_COMMENT +IDENTIFIER +ExponentPart +EscapeSequence +HexDigits +HexDigit +Digits +LetterOrDigit +Letter + +channel names: +DEFAULT_TOKEN_CHANNEL +HIDDEN + +mode names: +DEFAULT_MODE + +atn: +[4, 0, 128, 1112, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 2, 46, 7, 46, 2, 47, 7, 47, 2, 48, 7, 48, 2, 49, 7, 49, 2, 50, 7, 50, 2, 51, 7, 51, 2, 52, 7, 52, 2, 53, 7, 53, 2, 54, 7, 54, 2, 55, 7, 55, 2, 56, 7, 56, 2, 57, 7, 57, 2, 58, 7, 58, 2, 59, 7, 59, 2, 60, 7, 60, 2, 61, 7, 61, 2, 62, 7, 62, 2, 63, 7, 63, 2, 64, 7, 64, 2, 65, 7, 65, 2, 66, 7, 66, 2, 67, 7, 67, 2, 68, 7, 68, 2, 69, 7, 69, 2, 70, 7, 70, 2, 71, 7, 71, 2, 72, 7, 72, 2, 73, 7, 73, 2, 74, 7, 74, 2, 75, 7, 75, 2, 76, 7, 76, 2, 77, 7, 77, 2, 78, 7, 78, 2, 79, 7, 79, 2, 80, 7, 80, 2, 81, 7, 81, 2, 82, 7, 82, 2, 83, 7, 83, 2, 84, 7, 84, 2, 85, 7, 85, 2, 86, 7, 86, 2, 87, 7, 87, 2, 88, 7, 88, 2, 89, 7, 89, 2, 90, 7, 90, 2, 91, 7, 91, 2, 92, 7, 92, 2, 93, 7, 93, 2, 94, 7, 94, 2, 95, 7, 95, 2, 96, 7, 96, 2, 97, 7, 97, 2, 98, 7, 98, 2, 99, 7, 99, 2, 100, 7, 100, 2, 101, 7, 101, 2, 102, 7, 102, 2, 103, 7, 103, 2, 104, 7, 104, 2, 105, 7, 105, 2, 106, 7, 106, 2, 107, 7, 107, 2, 108, 7, 108, 2, 109, 7, 109, 2, 110, 7, 110, 2, 111, 7, 111, 2, 112, 7, 112, 2, 113, 7, 113, 2, 114, 7, 114, 2, 115, 7, 115, 2, 116, 7, 116, 2, 117, 7, 117, 2, 118, 7, 118, 2, 119, 7, 119, 2, 120, 7, 120, 2, 121, 7, 121, 2, 122, 7, 122, 2, 123, 7, 123, 2, 124, 7, 124, 2, 125, 7, 125, 2, 126, 7, 126, 2, 127, 7, 127, 2, 128, 7, 128, 2, 129, 7, 129, 2, 130, 7, 130, 2, 131, 7, 131, 2, 132, 7, 132, 2, 133, 7, 133, 2, 134, 7, 134, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 20, 1, 20, 1, 20, 1, 20, 1, 21, 1, 21, 1, 21, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 24, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 26, 1, 26, 1, 26, 1, 26, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 27, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 30, 1, 30, 1, 30, 1, 30, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 33, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 36, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 37, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 38, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 39, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 40, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 41, 1, 42, 1, 42, 1, 42, 1, 42, 1, 42, 1, 43, 1, 43, 1, 43, 1, 43, 1, 43, 1, 43, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 46, 1, 46, 1, 46, 1, 46, 1, 47, 1, 47, 1, 47, 1, 47, 1, 47, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 48, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 49, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 50, 1, 51, 1, 51, 1, 51, 1, 51, 1, 51, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 52, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 53, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 54, 1, 55, 1, 55, 1, 55, 1, 56, 1, 56, 1, 56, 1, 56, 1, 56, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 57, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 59, 1, 60, 1, 60, 1, 60, 1, 60, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 61, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 62, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 63, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 64, 1, 65, 1, 65, 1, 65, 1, 65, 1, 65, 1, 65, 1, 65, 1, 65, 1, 65, 1, 65, 1, 65, 1, 66, 1, 66, 1, 66, 3, 66, 725, 8, 66, 1, 66, 4, 66, 728, 8, 66, 11, 66, 12, 66, 729, 1, 66, 3, 66, 733, 8, 66, 3, 66, 735, 8, 66, 1, 66, 3, 66, 738, 8, 66, 1, 67, 1, 67, 1, 67, 1, 67, 5, 67, 744, 8, 67, 10, 67, 12, 67, 747, 9, 67, 1, 67, 3, 67, 750, 8, 67, 1, 67, 3, 67, 753, 8, 67, 1, 68, 1, 68, 5, 68, 757, 8, 68, 10, 68, 12, 68, 760, 9, 68, 1, 68, 1, 68, 5, 68, 764, 8, 68, 10, 68, 12, 68, 767, 9, 68, 1, 68, 3, 68, 770, 8, 68, 1, 68, 3, 68, 773, 8, 68, 1, 69, 1, 69, 1, 69, 1, 69, 5, 69, 779, 8, 69, 10, 69, 12, 69, 782, 9, 69, 1, 69, 3, 69, 785, 8, 69, 1, 69, 3, 69, 788, 8, 69, 1, 70, 1, 70, 1, 70, 3, 70, 793, 8, 70, 1, 70, 1, 70, 3, 70, 797, 8, 70, 1, 70, 3, 70, 800, 8, 70, 1, 70, 3, 70, 803, 8, 70, 1, 70, 1, 70, 1, 70, 3, 70, 808, 8, 70, 1, 70, 3, 70, 811, 8, 70, 3, 70, 813, 8, 70, 1, 71, 1, 71, 1, 71, 1, 71, 3, 71, 819, 8, 71, 1, 71, 3, 71, 822, 8, 71, 1, 71, 1, 71, 3, 71, 826, 8, 71, 1, 71, 1, 71, 3, 71, 830, 8, 71, 1, 71, 1, 71, 3, 71, 834, 8, 71, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 1, 72, 3, 72, 845, 8, 72, 1, 73, 1, 73, 1, 73, 3, 73, 850, 8, 73, 1, 73, 1, 73, 1, 74, 1, 74, 1, 74, 5, 74, 857, 8, 74, 10, 74, 12, 74, 860, 9, 74, 1, 74, 1, 74, 1, 75, 1, 75, 1, 75, 1, 75, 1, 75, 5, 75, 869, 8, 75, 10, 75, 12, 75, 872, 9, 75, 1, 75, 1, 75, 1, 75, 5, 75, 877, 8, 75, 10, 75, 12, 75, 880, 9, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 76, 1, 76, 1, 76, 1, 76, 1, 76, 1, 77, 1, 77, 1, 78, 1, 78, 1, 79, 1, 79, 1, 80, 1, 80, 1, 81, 1, 81, 1, 82, 1, 82, 1, 83, 1, 83, 1, 84, 1, 84, 1, 85, 1, 85, 1, 86, 1, 86, 1, 87, 1, 87, 1, 88, 1, 88, 1, 89, 1, 89, 1, 90, 1, 90, 1, 91, 1, 91, 1, 92, 1, 92, 1, 93, 1, 93, 1, 93, 1, 94, 1, 94, 1, 94, 1, 95, 1, 95, 1, 95, 1, 96, 1, 96, 1, 96, 1, 97, 1, 97, 1, 97, 1, 98, 1, 98, 1, 98, 1, 99, 1, 99, 1, 99, 1, 100, 1, 100, 1, 100, 1, 101, 1, 101, 1, 102, 1, 102, 1, 103, 1, 103, 1, 104, 1, 104, 1, 105, 1, 105, 1, 106, 1, 106, 1, 107, 1, 107, 1, 108, 1, 108, 1, 109, 1, 109, 1, 109, 1, 110, 1, 110, 1, 110, 1, 111, 1, 111, 1, 111, 1, 112, 1, 112, 1, 112, 1, 113, 1, 113, 1, 113, 1, 114, 1, 114, 1, 114, 1, 115, 1, 115, 1, 115, 1, 116, 1, 116, 1, 116, 1, 117, 1, 117, 1, 117, 1, 117, 1, 118, 1, 118, 1, 118, 1, 118, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 120, 1, 120, 1, 120, 1, 121, 1, 121, 1, 121, 1, 122, 1, 122, 1, 123, 1, 123, 1, 123, 1, 123, 1, 124, 4, 124, 1013, 8, 124, 11, 124, 12, 124, 1014, 1, 124, 1, 124, 1, 125, 1, 125, 1, 125, 1, 125, 5, 125, 1023, 8, 125, 10, 125, 12, 125, 1026, 9, 125, 1, 125, 1, 125, 1, 125, 1, 125, 1, 125, 1, 126, 1, 126, 1, 126, 1, 126, 5, 126, 1037, 8, 126, 10, 126, 12, 126, 1040, 9, 126, 1, 126, 1, 126, 1, 127, 1, 127, 5, 127, 1046, 8, 127, 10, 127, 12, 127, 1049, 9, 127, 1, 128, 1, 128, 3, 128, 1053, 8, 128, 1, 128, 1, 128, 1, 129, 1, 129, 1, 129, 1, 129, 3, 129, 1061, 8, 129, 1, 129, 3, 129, 1064, 8, 129, 1, 129, 1, 129, 1, 129, 4, 129, 1069, 8, 129, 11, 129, 12, 129, 1070, 1, 129, 1, 129, 1, 129, 1, 129, 1, 129, 3, 129, 1078, 8, 129, 1, 130, 1, 130, 1, 130, 5, 130, 1083, 8, 130, 10, 130, 12, 130, 1086, 9, 130, 1, 130, 3, 130, 1089, 8, 130, 1, 131, 1, 131, 1, 132, 1, 132, 5, 132, 1095, 8, 132, 10, 132, 12, 132, 1098, 9, 132, 1, 132, 3, 132, 1101, 8, 132, 1, 133, 1, 133, 3, 133, 1105, 8, 133, 1, 134, 1, 134, 1, 134, 1, 134, 3, 134, 1111, 8, 134, 2, 878, 1024, 0, 135, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, 35, 18, 37, 19, 39, 20, 41, 21, 43, 22, 45, 23, 47, 24, 49, 25, 51, 26, 53, 27, 55, 28, 57, 29, 59, 30, 61, 31, 63, 32, 65, 33, 67, 34, 69, 35, 71, 36, 73, 37, 75, 38, 77, 39, 79, 40, 81, 41, 83, 42, 85, 43, 87, 44, 89, 45, 91, 46, 93, 47, 95, 48, 97, 49, 99, 50, 101, 51, 103, 52, 105, 53, 107, 54, 109, 55, 111, 56, 113, 57, 115, 58, 117, 59, 119, 60, 121, 61, 123, 62, 125, 63, 127, 64, 129, 65, 131, 66, 133, 67, 135, 68, 137, 69, 139, 70, 141, 71, 143, 72, 145, 73, 147, 74, 149, 75, 151, 76, 153, 77, 155, 78, 157, 79, 159, 80, 161, 81, 163, 82, 165, 83, 167, 84, 169, 85, 171, 86, 173, 87, 175, 88, 177, 89, 179, 90, 181, 91, 183, 92, 185, 93, 187, 94, 189, 95, 191, 96, 193, 97, 195, 98, 197, 99, 199, 100, 201, 101, 203, 102, 205, 103, 207, 104, 209, 105, 211, 106, 213, 107, 215, 108, 217, 109, 219, 110, 221, 111, 223, 112, 225, 113, 227, 114, 229, 115, 231, 116, 233, 117, 235, 118, 237, 119, 239, 120, 241, 121, 243, 122, 245, 123, 247, 124, 249, 125, 251, 126, 253, 127, 255, 128, 257, 0, 259, 0, 261, 0, 263, 0, 265, 0, 267, 0, 269, 0, 1, 0, 27, 1, 0, 49, 57, 2, 0, 76, 76, 108, 108, 2, 0, 88, 88, 120, 120, 3, 0, 48, 57, 65, 70, 97, 102, 4, 0, 48, 57, 65, 70, 95, 95, 97, 102, 1, 0, 48, 55, 2, 0, 48, 55, 95, 95, 2, 0, 66, 66, 98, 98, 1, 0, 48, 49, 2, 0, 48, 49, 95, 95, 4, 0, 68, 68, 70, 70, 100, 100, 102, 102, 2, 0, 80, 80, 112, 112, 2, 0, 43, 43, 45, 45, 4, 0, 10, 10, 13, 13, 39, 39, 92, 92, 4, 0, 10, 10, 13, 13, 34, 34, 92, 92, 2, 0, 9, 9, 32, 32, 2, 0, 10, 10, 13, 13, 3, 0, 9, 10, 12, 13, 32, 32, 2, 0, 69, 69, 101, 101, 8, 0, 34, 34, 39, 39, 92, 92, 98, 98, 102, 102, 110, 110, 114, 114, 116, 116, 1, 0, 48, 51, 1, 0, 48, 57, 2, 0, 48, 57, 95, 95, 4, 0, 36, 36, 65, 90, 95, 95, 97, 122, 2, 0, 0, 127, 55296, 56319, 1, 0, 55296, 56319, 1, 0, 56320, 57343, 1156, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 35, 1, 0, 0, 0, 0, 37, 1, 0, 0, 0, 0, 39, 1, 0, 0, 0, 0, 41, 1, 0, 0, 0, 0, 43, 1, 0, 0, 0, 0, 45, 1, 0, 0, 0, 0, 47, 1, 0, 0, 0, 0, 49, 1, 0, 0, 0, 0, 51, 1, 0, 0, 0, 0, 53, 1, 0, 0, 0, 0, 55, 1, 0, 0, 0, 0, 57, 1, 0, 0, 0, 0, 59, 1, 0, 0, 0, 0, 61, 1, 0, 0, 0, 0, 63, 1, 0, 0, 0, 0, 65, 1, 0, 0, 0, 0, 67, 1, 0, 0, 0, 0, 69, 1, 0, 0, 0, 0, 71, 1, 0, 0, 0, 0, 73, 1, 0, 0, 0, 0, 75, 1, 0, 0, 0, 0, 77, 1, 0, 0, 0, 0, 79, 1, 0, 0, 0, 0, 81, 1, 0, 0, 0, 0, 83, 1, 0, 0, 0, 0, 85, 1, 0, 0, 0, 0, 87, 1, 0, 0, 0, 0, 89, 1, 0, 0, 0, 0, 91, 1, 0, 0, 0, 0, 93, 1, 0, 0, 0, 0, 95, 1, 0, 0, 0, 0, 97, 1, 0, 0, 0, 0, 99, 1, 0, 0, 0, 0, 101, 1, 0, 0, 0, 0, 103, 1, 0, 0, 0, 0, 105, 1, 0, 0, 0, 0, 107, 1, 0, 0, 0, 0, 109, 1, 0, 0, 0, 0, 111, 1, 0, 0, 0, 0, 113, 1, 0, 0, 0, 0, 115, 1, 0, 0, 0, 0, 117, 1, 0, 0, 0, 0, 119, 1, 0, 0, 0, 0, 121, 1, 0, 0, 0, 0, 123, 1, 0, 0, 0, 0, 125, 1, 0, 0, 0, 0, 127, 1, 0, 0, 0, 0, 129, 1, 0, 0, 0, 0, 131, 1, 0, 0, 0, 0, 133, 1, 0, 0, 0, 0, 135, 1, 0, 0, 0, 0, 137, 1, 0, 0, 0, 0, 139, 1, 0, 0, 0, 0, 141, 1, 0, 0, 0, 0, 143, 1, 0, 0, 0, 0, 145, 1, 0, 0, 0, 0, 147, 1, 0, 0, 0, 0, 149, 1, 0, 0, 0, 0, 151, 1, 0, 0, 0, 0, 153, 1, 0, 0, 0, 0, 155, 1, 0, 0, 0, 0, 157, 1, 0, 0, 0, 0, 159, 1, 0, 0, 0, 0, 161, 1, 0, 0, 0, 0, 163, 1, 0, 0, 0, 0, 165, 1, 0, 0, 0, 0, 167, 1, 0, 0, 0, 0, 169, 1, 0, 0, 0, 0, 171, 1, 0, 0, 0, 0, 173, 1, 0, 0, 0, 0, 175, 1, 0, 0, 0, 0, 177, 1, 0, 0, 0, 0, 179, 1, 0, 0, 0, 0, 181, 1, 0, 0, 0, 0, 183, 1, 0, 0, 0, 0, 185, 1, 0, 0, 0, 0, 187, 1, 0, 0, 0, 0, 189, 1, 0, 0, 0, 0, 191, 1, 0, 0, 0, 0, 193, 1, 0, 0, 0, 0, 195, 1, 0, 0, 0, 0, 197, 1, 0, 0, 0, 0, 199, 1, 0, 0, 0, 0, 201, 1, 0, 0, 0, 0, 203, 1, 0, 0, 0, 0, 205, 1, 0, 0, 0, 0, 207, 1, 0, 0, 0, 0, 209, 1, 0, 0, 0, 0, 211, 1, 0, 0, 0, 0, 213, 1, 0, 0, 0, 0, 215, 1, 0, 0, 0, 0, 217, 1, 0, 0, 0, 0, 219, 1, 0, 0, 0, 0, 221, 1, 0, 0, 0, 0, 223, 1, 0, 0, 0, 0, 225, 1, 0, 0, 0, 0, 227, 1, 0, 0, 0, 0, 229, 1, 0, 0, 0, 0, 231, 1, 0, 0, 0, 0, 233, 1, 0, 0, 0, 0, 235, 1, 0, 0, 0, 0, 237, 1, 0, 0, 0, 0, 239, 1, 0, 0, 0, 0, 241, 1, 0, 0, 0, 0, 243, 1, 0, 0, 0, 0, 245, 1, 0, 0, 0, 0, 247, 1, 0, 0, 0, 0, 249, 1, 0, 0, 0, 0, 251, 1, 0, 0, 0, 0, 253, 1, 0, 0, 0, 0, 255, 1, 0, 0, 0, 1, 271, 1, 0, 0, 0, 3, 280, 1, 0, 0, 0, 5, 287, 1, 0, 0, 0, 7, 295, 1, 0, 0, 0, 9, 301, 1, 0, 0, 0, 11, 306, 1, 0, 0, 0, 13, 311, 1, 0, 0, 0, 15, 317, 1, 0, 0, 0, 17, 322, 1, 0, 0, 0, 19, 328, 1, 0, 0, 0, 21, 334, 1, 0, 0, 0, 23, 343, 1, 0, 0, 0, 25, 351, 1, 0, 0, 0, 27, 354, 1, 0, 0, 0, 29, 361, 1, 0, 0, 0, 31, 366, 1, 0, 0, 0, 33, 371, 1, 0, 0, 0, 35, 379, 1, 0, 0, 0, 37, 385, 1, 0, 0, 0, 39, 393, 1, 0, 0, 0, 41, 399, 1, 0, 0, 0, 43, 403, 1, 0, 0, 0, 45, 406, 1, 0, 0, 0, 47, 411, 1, 0, 0, 0, 49, 422, 1, 0, 0, 0, 51, 429, 1, 0, 0, 0, 53, 440, 1, 0, 0, 0, 55, 444, 1, 0, 0, 0, 57, 454, 1, 0, 0, 0, 59, 459, 1, 0, 0, 0, 61, 466, 1, 0, 0, 0, 63, 470, 1, 0, 0, 0, 65, 478, 1, 0, 0, 0, 67, 486, 1, 0, 0, 0, 69, 496, 1, 0, 0, 0, 71, 503, 1, 0, 0, 0, 73, 510, 1, 0, 0, 0, 75, 516, 1, 0, 0, 0, 77, 523, 1, 0, 0, 0, 79, 532, 1, 0, 0, 0, 81, 538, 1, 0, 0, 0, 83, 545, 1, 0, 0, 0, 85, 558, 1, 0, 0, 0, 87, 563, 1, 0, 0, 0, 89, 569, 1, 0, 0, 0, 91, 576, 1, 0, 0, 0, 93, 586, 1, 0, 0, 0, 95, 590, 1, 0, 0, 0, 97, 595, 1, 0, 0, 0, 99, 604, 1, 0, 0, 0, 101, 610, 1, 0, 0, 0, 103, 617, 1, 0, 0, 0, 105, 622, 1, 0, 0, 0, 107, 631, 1, 0, 0, 0, 109, 639, 1, 0, 0, 0, 111, 645, 1, 0, 0, 0, 113, 648, 1, 0, 0, 0, 115, 653, 1, 0, 0, 0, 117, 662, 1, 0, 0, 0, 119, 667, 1, 0, 0, 0, 121, 678, 1, 0, 0, 0, 123, 682, 1, 0, 0, 0, 125, 688, 1, 0, 0, 0, 127, 695, 1, 0, 0, 0, 129, 702, 1, 0, 0, 0, 131, 710, 1, 0, 0, 0, 133, 734, 1, 0, 0, 0, 135, 739, 1, 0, 0, 0, 137, 754, 1, 0, 0, 0, 139, 774, 1, 0, 0, 0, 141, 812, 1, 0, 0, 0, 143, 814, 1, 0, 0, 0, 145, 844, 1, 0, 0, 0, 147, 846, 1, 0, 0, 0, 149, 853, 1, 0, 0, 0, 151, 863, 1, 0, 0, 0, 153, 885, 1, 0, 0, 0, 155, 890, 1, 0, 0, 0, 157, 892, 1, 0, 0, 0, 159, 894, 1, 0, 0, 0, 161, 896, 1, 0, 0, 0, 163, 898, 1, 0, 0, 0, 165, 900, 1, 0, 0, 0, 167, 902, 1, 0, 0, 0, 169, 904, 1, 0, 0, 0, 171, 906, 1, 0, 0, 0, 173, 908, 1, 0, 0, 0, 175, 910, 1, 0, 0, 0, 177, 912, 1, 0, 0, 0, 179, 914, 1, 0, 0, 0, 181, 916, 1, 0, 0, 0, 183, 918, 1, 0, 0, 0, 185, 920, 1, 0, 0, 0, 187, 922, 1, 0, 0, 0, 189, 925, 1, 0, 0, 0, 191, 928, 1, 0, 0, 0, 193, 931, 1, 0, 0, 0, 195, 934, 1, 0, 0, 0, 197, 937, 1, 0, 0, 0, 199, 940, 1, 0, 0, 0, 201, 943, 1, 0, 0, 0, 203, 946, 1, 0, 0, 0, 205, 948, 1, 0, 0, 0, 207, 950, 1, 0, 0, 0, 209, 952, 1, 0, 0, 0, 211, 954, 1, 0, 0, 0, 213, 956, 1, 0, 0, 0, 215, 958, 1, 0, 0, 0, 217, 960, 1, 0, 0, 0, 219, 962, 1, 0, 0, 0, 221, 965, 1, 0, 0, 0, 223, 968, 1, 0, 0, 0, 225, 971, 1, 0, 0, 0, 227, 974, 1, 0, 0, 0, 229, 977, 1, 0, 0, 0, 231, 980, 1, 0, 0, 0, 233, 983, 1, 0, 0, 0, 235, 986, 1, 0, 0, 0, 237, 990, 1, 0, 0, 0, 239, 994, 1, 0, 0, 0, 241, 999, 1, 0, 0, 0, 243, 1002, 1, 0, 0, 0, 245, 1005, 1, 0, 0, 0, 247, 1007, 1, 0, 0, 0, 249, 1012, 1, 0, 0, 0, 251, 1018, 1, 0, 0, 0, 253, 1032, 1, 0, 0, 0, 255, 1043, 1, 0, 0, 0, 257, 1050, 1, 0, 0, 0, 259, 1077, 1, 0, 0, 0, 261, 1079, 1, 0, 0, 0, 263, 1090, 1, 0, 0, 0, 265, 1092, 1, 0, 0, 0, 267, 1104, 1, 0, 0, 0, 269, 1110, 1, 0, 0, 0, 271, 272, 5, 97, 0, 0, 272, 273, 5, 98, 0, 0, 273, 274, 5, 115, 0, 0, 274, 275, 5, 116, 0, 0, 275, 276, 5, 114, 0, 0, 276, 277, 5, 97, 0, 0, 277, 278, 5, 99, 0, 0, 278, 279, 5, 116, 0, 0, 279, 2, 1, 0, 0, 0, 280, 281, 5, 97, 0, 0, 281, 282, 5, 115, 0, 0, 282, 283, 5, 115, 0, 0, 283, 284, 5, 101, 0, 0, 284, 285, 5, 114, 0, 0, 285, 286, 5, 116, 0, 0, 286, 4, 1, 0, 0, 0, 287, 288, 5, 98, 0, 0, 288, 289, 5, 111, 0, 0, 289, 290, 5, 111, 0, 0, 290, 291, 5, 108, 0, 0, 291, 292, 5, 101, 0, 0, 292, 293, 5, 97, 0, 0, 293, 294, 5, 110, 0, 0, 294, 6, 1, 0, 0, 0, 295, 296, 5, 98, 0, 0, 296, 297, 5, 114, 0, 0, 297, 298, 5, 101, 0, 0, 298, 299, 5, 97, 0, 0, 299, 300, 5, 107, 0, 0, 300, 8, 1, 0, 0, 0, 301, 302, 5, 98, 0, 0, 302, 303, 5, 121, 0, 0, 303, 304, 5, 116, 0, 0, 304, 305, 5, 101, 0, 0, 305, 10, 1, 0, 0, 0, 306, 307, 5, 99, 0, 0, 307, 308, 5, 97, 0, 0, 308, 309, 5, 115, 0, 0, 309, 310, 5, 101, 0, 0, 310, 12, 1, 0, 0, 0, 311, 312, 5, 99, 0, 0, 312, 313, 5, 97, 0, 0, 313, 314, 5, 116, 0, 0, 314, 315, 5, 99, 0, 0, 315, 316, 5, 104, 0, 0, 316, 14, 1, 0, 0, 0, 317, 318, 5, 99, 0, 0, 318, 319, 5, 104, 0, 0, 319, 320, 5, 97, 0, 0, 320, 321, 5, 114, 0, 0, 321, 16, 1, 0, 0, 0, 322, 323, 5, 99, 0, 0, 323, 324, 5, 108, 0, 0, 324, 325, 5, 97, 0, 0, 325, 326, 5, 115, 0, 0, 326, 327, 5, 115, 0, 0, 327, 18, 1, 0, 0, 0, 328, 329, 5, 99, 0, 0, 329, 330, 5, 111, 0, 0, 330, 331, 5, 110, 0, 0, 331, 332, 5, 115, 0, 0, 332, 333, 5, 116, 0, 0, 333, 20, 1, 0, 0, 0, 334, 335, 5, 99, 0, 0, 335, 336, 5, 111, 0, 0, 336, 337, 5, 110, 0, 0, 337, 338, 5, 116, 0, 0, 338, 339, 5, 105, 0, 0, 339, 340, 5, 110, 0, 0, 340, 341, 5, 117, 0, 0, 341, 342, 5, 101, 0, 0, 342, 22, 1, 0, 0, 0, 343, 344, 5, 100, 0, 0, 344, 345, 5, 101, 0, 0, 345, 346, 5, 102, 0, 0, 346, 347, 5, 97, 0, 0, 347, 348, 5, 117, 0, 0, 348, 349, 5, 108, 0, 0, 349, 350, 5, 116, 0, 0, 350, 24, 1, 0, 0, 0, 351, 352, 5, 100, 0, 0, 352, 353, 5, 111, 0, 0, 353, 26, 1, 0, 0, 0, 354, 355, 5, 100, 0, 0, 355, 356, 5, 111, 0, 0, 356, 357, 5, 117, 0, 0, 357, 358, 5, 98, 0, 0, 358, 359, 5, 108, 0, 0, 359, 360, 5, 101, 0, 0, 360, 28, 1, 0, 0, 0, 361, 362, 5, 101, 0, 0, 362, 363, 5, 108, 0, 0, 363, 364, 5, 115, 0, 0, 364, 365, 5, 101, 0, 0, 365, 30, 1, 0, 0, 0, 366, 367, 5, 101, 0, 0, 367, 368, 5, 110, 0, 0, 368, 369, 5, 117, 0, 0, 369, 370, 5, 109, 0, 0, 370, 32, 1, 0, 0, 0, 371, 372, 5, 101, 0, 0, 372, 373, 5, 120, 0, 0, 373, 374, 5, 116, 0, 0, 374, 375, 5, 101, 0, 0, 375, 376, 5, 110, 0, 0, 376, 377, 5, 100, 0, 0, 377, 378, 5, 115, 0, 0, 378, 34, 1, 0, 0, 0, 379, 380, 5, 102, 0, 0, 380, 381, 5, 105, 0, 0, 381, 382, 5, 110, 0, 0, 382, 383, 5, 97, 0, 0, 383, 384, 5, 108, 0, 0, 384, 36, 1, 0, 0, 0, 385, 386, 5, 102, 0, 0, 386, 387, 5, 105, 0, 0, 387, 388, 5, 110, 0, 0, 388, 389, 5, 97, 0, 0, 389, 390, 5, 108, 0, 0, 390, 391, 5, 108, 0, 0, 391, 392, 5, 121, 0, 0, 392, 38, 1, 0, 0, 0, 393, 394, 5, 102, 0, 0, 394, 395, 5, 108, 0, 0, 395, 396, 5, 111, 0, 0, 396, 397, 5, 97, 0, 0, 397, 398, 5, 116, 0, 0, 398, 40, 1, 0, 0, 0, 399, 400, 5, 102, 0, 0, 400, 401, 5, 111, 0, 0, 401, 402, 5, 114, 0, 0, 402, 42, 1, 0, 0, 0, 403, 404, 5, 105, 0, 0, 404, 405, 5, 102, 0, 0, 405, 44, 1, 0, 0, 0, 406, 407, 5, 103, 0, 0, 407, 408, 5, 111, 0, 0, 408, 409, 5, 116, 0, 0, 409, 410, 5, 111, 0, 0, 410, 46, 1, 0, 0, 0, 411, 412, 5, 105, 0, 0, 412, 413, 5, 109, 0, 0, 413, 414, 5, 112, 0, 0, 414, 415, 5, 108, 0, 0, 415, 416, 5, 101, 0, 0, 416, 417, 5, 109, 0, 0, 417, 418, 5, 101, 0, 0, 418, 419, 5, 110, 0, 0, 419, 420, 5, 116, 0, 0, 420, 421, 5, 115, 0, 0, 421, 48, 1, 0, 0, 0, 422, 423, 5, 105, 0, 0, 423, 424, 5, 109, 0, 0, 424, 425, 5, 112, 0, 0, 425, 426, 5, 111, 0, 0, 426, 427, 5, 114, 0, 0, 427, 428, 5, 116, 0, 0, 428, 50, 1, 0, 0, 0, 429, 430, 5, 105, 0, 0, 430, 431, 5, 110, 0, 0, 431, 432, 5, 115, 0, 0, 432, 433, 5, 116, 0, 0, 433, 434, 5, 97, 0, 0, 434, 435, 5, 110, 0, 0, 435, 436, 5, 99, 0, 0, 436, 437, 5, 101, 0, 0, 437, 438, 5, 111, 0, 0, 438, 439, 5, 102, 0, 0, 439, 52, 1, 0, 0, 0, 440, 441, 5, 105, 0, 0, 441, 442, 5, 110, 0, 0, 442, 443, 5, 116, 0, 0, 443, 54, 1, 0, 0, 0, 444, 445, 5, 105, 0, 0, 445, 446, 5, 110, 0, 0, 446, 447, 5, 116, 0, 0, 447, 448, 5, 101, 0, 0, 448, 449, 5, 114, 0, 0, 449, 450, 5, 102, 0, 0, 450, 451, 5, 97, 0, 0, 451, 452, 5, 99, 0, 0, 452, 453, 5, 101, 0, 0, 453, 56, 1, 0, 0, 0, 454, 455, 5, 108, 0, 0, 455, 456, 5, 111, 0, 0, 456, 457, 5, 110, 0, 0, 457, 458, 5, 103, 0, 0, 458, 58, 1, 0, 0, 0, 459, 460, 5, 110, 0, 0, 460, 461, 5, 97, 0, 0, 461, 462, 5, 116, 0, 0, 462, 463, 5, 105, 0, 0, 463, 464, 5, 118, 0, 0, 464, 465, 5, 101, 0, 0, 465, 60, 1, 0, 0, 0, 466, 467, 5, 110, 0, 0, 467, 468, 5, 101, 0, 0, 468, 469, 5, 119, 0, 0, 469, 62, 1, 0, 0, 0, 470, 471, 5, 112, 0, 0, 471, 472, 5, 97, 0, 0, 472, 473, 5, 99, 0, 0, 473, 474, 5, 107, 0, 0, 474, 475, 5, 97, 0, 0, 475, 476, 5, 103, 0, 0, 476, 477, 5, 101, 0, 0, 477, 64, 1, 0, 0, 0, 478, 479, 5, 112, 0, 0, 479, 480, 5, 114, 0, 0, 480, 481, 5, 105, 0, 0, 481, 482, 5, 118, 0, 0, 482, 483, 5, 97, 0, 0, 483, 484, 5, 116, 0, 0, 484, 485, 5, 101, 0, 0, 485, 66, 1, 0, 0, 0, 486, 487, 5, 112, 0, 0, 487, 488, 5, 114, 0, 0, 488, 489, 5, 111, 0, 0, 489, 490, 5, 116, 0, 0, 490, 491, 5, 101, 0, 0, 491, 492, 5, 99, 0, 0, 492, 493, 5, 116, 0, 0, 493, 494, 5, 101, 0, 0, 494, 495, 5, 100, 0, 0, 495, 68, 1, 0, 0, 0, 496, 497, 5, 112, 0, 0, 497, 498, 5, 117, 0, 0, 498, 499, 5, 98, 0, 0, 499, 500, 5, 108, 0, 0, 500, 501, 5, 105, 0, 0, 501, 502, 5, 99, 0, 0, 502, 70, 1, 0, 0, 0, 503, 504, 5, 114, 0, 0, 504, 505, 5, 101, 0, 0, 505, 506, 5, 116, 0, 0, 506, 507, 5, 117, 0, 0, 507, 508, 5, 114, 0, 0, 508, 509, 5, 110, 0, 0, 509, 72, 1, 0, 0, 0, 510, 511, 5, 115, 0, 0, 511, 512, 5, 104, 0, 0, 512, 513, 5, 111, 0, 0, 513, 514, 5, 114, 0, 0, 514, 515, 5, 116, 0, 0, 515, 74, 1, 0, 0, 0, 516, 517, 5, 115, 0, 0, 517, 518, 5, 116, 0, 0, 518, 519, 5, 97, 0, 0, 519, 520, 5, 116, 0, 0, 520, 521, 5, 105, 0, 0, 521, 522, 5, 99, 0, 0, 522, 76, 1, 0, 0, 0, 523, 524, 5, 115, 0, 0, 524, 525, 5, 116, 0, 0, 525, 526, 5, 114, 0, 0, 526, 527, 5, 105, 0, 0, 527, 528, 5, 99, 0, 0, 528, 529, 5, 116, 0, 0, 529, 530, 5, 102, 0, 0, 530, 531, 5, 112, 0, 0, 531, 78, 1, 0, 0, 0, 532, 533, 5, 115, 0, 0, 533, 534, 5, 117, 0, 0, 534, 535, 5, 112, 0, 0, 535, 536, 5, 101, 0, 0, 536, 537, 5, 114, 0, 0, 537, 80, 1, 0, 0, 0, 538, 539, 5, 115, 0, 0, 539, 540, 5, 119, 0, 0, 540, 541, 5, 105, 0, 0, 541, 542, 5, 116, 0, 0, 542, 543, 5, 99, 0, 0, 543, 544, 5, 104, 0, 0, 544, 82, 1, 0, 0, 0, 545, 546, 5, 115, 0, 0, 546, 547, 5, 121, 0, 0, 547, 548, 5, 110, 0, 0, 548, 549, 5, 99, 0, 0, 549, 550, 5, 104, 0, 0, 550, 551, 5, 114, 0, 0, 551, 552, 5, 111, 0, 0, 552, 553, 5, 110, 0, 0, 553, 554, 5, 105, 0, 0, 554, 555, 5, 122, 0, 0, 555, 556, 5, 101, 0, 0, 556, 557, 5, 100, 0, 0, 557, 84, 1, 0, 0, 0, 558, 559, 5, 116, 0, 0, 559, 560, 5, 104, 0, 0, 560, 561, 5, 105, 0, 0, 561, 562, 5, 115, 0, 0, 562, 86, 1, 0, 0, 0, 563, 564, 5, 116, 0, 0, 564, 565, 5, 104, 0, 0, 565, 566, 5, 114, 0, 0, 566, 567, 5, 111, 0, 0, 567, 568, 5, 119, 0, 0, 568, 88, 1, 0, 0, 0, 569, 570, 5, 116, 0, 0, 570, 571, 5, 104, 0, 0, 571, 572, 5, 114, 0, 0, 572, 573, 5, 111, 0, 0, 573, 574, 5, 119, 0, 0, 574, 575, 5, 115, 0, 0, 575, 90, 1, 0, 0, 0, 576, 577, 5, 116, 0, 0, 577, 578, 5, 114, 0, 0, 578, 579, 5, 97, 0, 0, 579, 580, 5, 110, 0, 0, 580, 581, 5, 115, 0, 0, 581, 582, 5, 105, 0, 0, 582, 583, 5, 101, 0, 0, 583, 584, 5, 110, 0, 0, 584, 585, 5, 116, 0, 0, 585, 92, 1, 0, 0, 0, 586, 587, 5, 116, 0, 0, 587, 588, 5, 114, 0, 0, 588, 589, 5, 121, 0, 0, 589, 94, 1, 0, 0, 0, 590, 591, 5, 118, 0, 0, 591, 592, 5, 111, 0, 0, 592, 593, 5, 105, 0, 0, 593, 594, 5, 100, 0, 0, 594, 96, 1, 0, 0, 0, 595, 596, 5, 118, 0, 0, 596, 597, 5, 111, 0, 0, 597, 598, 5, 108, 0, 0, 598, 599, 5, 97, 0, 0, 599, 600, 5, 116, 0, 0, 600, 601, 5, 105, 0, 0, 601, 602, 5, 108, 0, 0, 602, 603, 5, 101, 0, 0, 603, 98, 1, 0, 0, 0, 604, 605, 5, 119, 0, 0, 605, 606, 5, 104, 0, 0, 606, 607, 5, 105, 0, 0, 607, 608, 5, 108, 0, 0, 608, 609, 5, 101, 0, 0, 609, 100, 1, 0, 0, 0, 610, 611, 5, 109, 0, 0, 611, 612, 5, 111, 0, 0, 612, 613, 5, 100, 0, 0, 613, 614, 5, 117, 0, 0, 614, 615, 5, 108, 0, 0, 615, 616, 5, 101, 0, 0, 616, 102, 1, 0, 0, 0, 617, 618, 5, 111, 0, 0, 618, 619, 5, 112, 0, 0, 619, 620, 5, 101, 0, 0, 620, 621, 5, 110, 0, 0, 621, 104, 1, 0, 0, 0, 622, 623, 5, 114, 0, 0, 623, 624, 5, 101, 0, 0, 624, 625, 5, 113, 0, 0, 625, 626, 5, 117, 0, 0, 626, 627, 5, 105, 0, 0, 627, 628, 5, 114, 0, 0, 628, 629, 5, 101, 0, 0, 629, 630, 5, 115, 0, 0, 630, 106, 1, 0, 0, 0, 631, 632, 5, 101, 0, 0, 632, 633, 5, 120, 0, 0, 633, 634, 5, 112, 0, 0, 634, 635, 5, 111, 0, 0, 635, 636, 5, 114, 0, 0, 636, 637, 5, 116, 0, 0, 637, 638, 5, 115, 0, 0, 638, 108, 1, 0, 0, 0, 639, 640, 5, 111, 0, 0, 640, 641, 5, 112, 0, 0, 641, 642, 5, 101, 0, 0, 642, 643, 5, 110, 0, 0, 643, 644, 5, 115, 0, 0, 644, 110, 1, 0, 0, 0, 645, 646, 5, 116, 0, 0, 646, 647, 5, 111, 0, 0, 647, 112, 1, 0, 0, 0, 648, 649, 5, 117, 0, 0, 649, 650, 5, 115, 0, 0, 650, 651, 5, 101, 0, 0, 651, 652, 5, 115, 0, 0, 652, 114, 1, 0, 0, 0, 653, 654, 5, 112, 0, 0, 654, 655, 5, 114, 0, 0, 655, 656, 5, 111, 0, 0, 656, 657, 5, 118, 0, 0, 657, 658, 5, 105, 0, 0, 658, 659, 5, 100, 0, 0, 659, 660, 5, 101, 0, 0, 660, 661, 5, 115, 0, 0, 661, 116, 1, 0, 0, 0, 662, 663, 5, 119, 0, 0, 663, 664, 5, 105, 0, 0, 664, 665, 5, 116, 0, 0, 665, 666, 5, 104, 0, 0, 666, 118, 1, 0, 0, 0, 667, 668, 5, 116, 0, 0, 668, 669, 5, 114, 0, 0, 669, 670, 5, 97, 0, 0, 670, 671, 5, 110, 0, 0, 671, 672, 5, 115, 0, 0, 672, 673, 5, 105, 0, 0, 673, 674, 5, 116, 0, 0, 674, 675, 5, 105, 0, 0, 675, 676, 5, 118, 0, 0, 676, 677, 5, 101, 0, 0, 677, 120, 1, 0, 0, 0, 678, 679, 5, 118, 0, 0, 679, 680, 5, 97, 0, 0, 680, 681, 5, 114, 0, 0, 681, 122, 1, 0, 0, 0, 682, 683, 5, 121, 0, 0, 683, 684, 5, 105, 0, 0, 684, 685, 5, 101, 0, 0, 685, 686, 5, 108, 0, 0, 686, 687, 5, 100, 0, 0, 687, 124, 1, 0, 0, 0, 688, 689, 5, 114, 0, 0, 689, 690, 5, 101, 0, 0, 690, 691, 5, 99, 0, 0, 691, 692, 5, 111, 0, 0, 692, 693, 5, 114, 0, 0, 693, 694, 5, 100, 0, 0, 694, 126, 1, 0, 0, 0, 695, 696, 5, 115, 0, 0, 696, 697, 5, 101, 0, 0, 697, 698, 5, 97, 0, 0, 698, 699, 5, 108, 0, 0, 699, 700, 5, 101, 0, 0, 700, 701, 5, 100, 0, 0, 701, 128, 1, 0, 0, 0, 702, 703, 5, 112, 0, 0, 703, 704, 5, 101, 0, 0, 704, 705, 5, 114, 0, 0, 705, 706, 5, 109, 0, 0, 706, 707, 5, 105, 0, 0, 707, 708, 5, 116, 0, 0, 708, 709, 5, 115, 0, 0, 709, 130, 1, 0, 0, 0, 710, 711, 5, 110, 0, 0, 711, 712, 5, 111, 0, 0, 712, 713, 5, 110, 0, 0, 713, 714, 5, 45, 0, 0, 714, 715, 5, 115, 0, 0, 715, 716, 5, 101, 0, 0, 716, 717, 5, 97, 0, 0, 717, 718, 5, 108, 0, 0, 718, 719, 5, 101, 0, 0, 719, 720, 5, 100, 0, 0, 720, 132, 1, 0, 0, 0, 721, 735, 5, 48, 0, 0, 722, 732, 7, 0, 0, 0, 723, 725, 3, 265, 132, 0, 724, 723, 1, 0, 0, 0, 724, 725, 1, 0, 0, 0, 725, 733, 1, 0, 0, 0, 726, 728, 5, 95, 0, 0, 727, 726, 1, 0, 0, 0, 728, 729, 1, 0, 0, 0, 729, 727, 1, 0, 0, 0, 729, 730, 1, 0, 0, 0, 730, 731, 1, 0, 0, 0, 731, 733, 3, 265, 132, 0, 732, 724, 1, 0, 0, 0, 732, 727, 1, 0, 0, 0, 733, 735, 1, 0, 0, 0, 734, 721, 1, 0, 0, 0, 734, 722, 1, 0, 0, 0, 735, 737, 1, 0, 0, 0, 736, 738, 7, 1, 0, 0, 737, 736, 1, 0, 0, 0, 737, 738, 1, 0, 0, 0, 738, 134, 1, 0, 0, 0, 739, 740, 5, 48, 0, 0, 740, 741, 7, 2, 0, 0, 741, 749, 7, 3, 0, 0, 742, 744, 7, 4, 0, 0, 743, 742, 1, 0, 0, 0, 744, 747, 1, 0, 0, 0, 745, 743, 1, 0, 0, 0, 745, 746, 1, 0, 0, 0, 746, 748, 1, 0, 0, 0, 747, 745, 1, 0, 0, 0, 748, 750, 7, 3, 0, 0, 749, 745, 1, 0, 0, 0, 749, 750, 1, 0, 0, 0, 750, 752, 1, 0, 0, 0, 751, 753, 7, 1, 0, 0, 752, 751, 1, 0, 0, 0, 752, 753, 1, 0, 0, 0, 753, 136, 1, 0, 0, 0, 754, 758, 5, 48, 0, 0, 755, 757, 5, 95, 0, 0, 756, 755, 1, 0, 0, 0, 757, 760, 1, 0, 0, 0, 758, 756, 1, 0, 0, 0, 758, 759, 1, 0, 0, 0, 759, 761, 1, 0, 0, 0, 760, 758, 1, 0, 0, 0, 761, 769, 7, 5, 0, 0, 762, 764, 7, 6, 0, 0, 763, 762, 1, 0, 0, 0, 764, 767, 1, 0, 0, 0, 765, 763, 1, 0, 0, 0, 765, 766, 1, 0, 0, 0, 766, 768, 1, 0, 0, 0, 767, 765, 1, 0, 0, 0, 768, 770, 7, 5, 0, 0, 769, 765, 1, 0, 0, 0, 769, 770, 1, 0, 0, 0, 770, 772, 1, 0, 0, 0, 771, 773, 7, 1, 0, 0, 772, 771, 1, 0, 0, 0, 772, 773, 1, 0, 0, 0, 773, 138, 1, 0, 0, 0, 774, 775, 5, 48, 0, 0, 775, 776, 7, 7, 0, 0, 776, 784, 7, 8, 0, 0, 777, 779, 7, 9, 0, 0, 778, 777, 1, 0, 0, 0, 779, 782, 1, 0, 0, 0, 780, 778, 1, 0, 0, 0, 780, 781, 1, 0, 0, 0, 781, 783, 1, 0, 0, 0, 782, 780, 1, 0, 0, 0, 783, 785, 7, 8, 0, 0, 784, 780, 1, 0, 0, 0, 784, 785, 1, 0, 0, 0, 785, 787, 1, 0, 0, 0, 786, 788, 7, 1, 0, 0, 787, 786, 1, 0, 0, 0, 787, 788, 1, 0, 0, 0, 788, 140, 1, 0, 0, 0, 789, 790, 3, 265, 132, 0, 790, 792, 5, 46, 0, 0, 791, 793, 3, 265, 132, 0, 792, 791, 1, 0, 0, 0, 792, 793, 1, 0, 0, 0, 793, 797, 1, 0, 0, 0, 794, 795, 5, 46, 0, 0, 795, 797, 3, 265, 132, 0, 796, 789, 1, 0, 0, 0, 796, 794, 1, 0, 0, 0, 797, 799, 1, 0, 0, 0, 798, 800, 3, 257, 128, 0, 799, 798, 1, 0, 0, 0, 799, 800, 1, 0, 0, 0, 800, 802, 1, 0, 0, 0, 801, 803, 7, 10, 0, 0, 802, 801, 1, 0, 0, 0, 802, 803, 1, 0, 0, 0, 803, 813, 1, 0, 0, 0, 804, 810, 3, 265, 132, 0, 805, 807, 3, 257, 128, 0, 806, 808, 7, 10, 0, 0, 807, 806, 1, 0, 0, 0, 807, 808, 1, 0, 0, 0, 808, 811, 1, 0, 0, 0, 809, 811, 7, 10, 0, 0, 810, 805, 1, 0, 0, 0, 810, 809, 1, 0, 0, 0, 811, 813, 1, 0, 0, 0, 812, 796, 1, 0, 0, 0, 812, 804, 1, 0, 0, 0, 813, 142, 1, 0, 0, 0, 814, 815, 5, 48, 0, 0, 815, 825, 7, 2, 0, 0, 816, 818, 3, 261, 130, 0, 817, 819, 5, 46, 0, 0, 818, 817, 1, 0, 0, 0, 818, 819, 1, 0, 0, 0, 819, 826, 1, 0, 0, 0, 820, 822, 3, 261, 130, 0, 821, 820, 1, 0, 0, 0, 821, 822, 1, 0, 0, 0, 822, 823, 1, 0, 0, 0, 823, 824, 5, 46, 0, 0, 824, 826, 3, 261, 130, 0, 825, 816, 1, 0, 0, 0, 825, 821, 1, 0, 0, 0, 826, 827, 1, 0, 0, 0, 827, 829, 7, 11, 0, 0, 828, 830, 7, 12, 0, 0, 829, 828, 1, 0, 0, 0, 829, 830, 1, 0, 0, 0, 830, 831, 1, 0, 0, 0, 831, 833, 3, 265, 132, 0, 832, 834, 7, 10, 0, 0, 833, 832, 1, 0, 0, 0, 833, 834, 1, 0, 0, 0, 834, 144, 1, 0, 0, 0, 835, 836, 5, 116, 0, 0, 836, 837, 5, 114, 0, 0, 837, 838, 5, 117, 0, 0, 838, 845, 5, 101, 0, 0, 839, 840, 5, 102, 0, 0, 840, 841, 5, 97, 0, 0, 841, 842, 5, 108, 0, 0, 842, 843, 5, 115, 0, 0, 843, 845, 5, 101, 0, 0, 844, 835, 1, 0, 0, 0, 844, 839, 1, 0, 0, 0, 845, 146, 1, 0, 0, 0, 846, 849, 5, 39, 0, 0, 847, 850, 8, 13, 0, 0, 848, 850, 3, 259, 129, 0, 849, 847, 1, 0, 0, 0, 849, 848, 1, 0, 0, 0, 850, 851, 1, 0, 0, 0, 851, 852, 5, 39, 0, 0, 852, 148, 1, 0, 0, 0, 853, 858, 5, 34, 0, 0, 854, 857, 8, 14, 0, 0, 855, 857, 3, 259, 129, 0, 856, 854, 1, 0, 0, 0, 856, 855, 1, 0, 0, 0, 857, 860, 1, 0, 0, 0, 858, 856, 1, 0, 0, 0, 858, 859, 1, 0, 0, 0, 859, 861, 1, 0, 0, 0, 860, 858, 1, 0, 0, 0, 861, 862, 5, 34, 0, 0, 862, 150, 1, 0, 0, 0, 863, 864, 5, 34, 0, 0, 864, 865, 5, 34, 0, 0, 865, 866, 5, 34, 0, 0, 866, 870, 1, 0, 0, 0, 867, 869, 7, 15, 0, 0, 868, 867, 1, 0, 0, 0, 869, 872, 1, 0, 0, 0, 870, 868, 1, 0, 0, 0, 870, 871, 1, 0, 0, 0, 871, 873, 1, 0, 0, 0, 872, 870, 1, 0, 0, 0, 873, 878, 7, 16, 0, 0, 874, 877, 9, 0, 0, 0, 875, 877, 3, 259, 129, 0, 876, 874, 1, 0, 0, 0, 876, 875, 1, 0, 0, 0, 877, 880, 1, 0, 0, 0, 878, 879, 1, 0, 0, 0, 878, 876, 1, 0, 0, 0, 879, 881, 1, 0, 0, 0, 880, 878, 1, 0, 0, 0, 881, 882, 5, 34, 0, 0, 882, 883, 5, 34, 0, 0, 883, 884, 5, 34, 0, 0, 884, 152, 1, 0, 0, 0, 885, 886, 5, 110, 0, 0, 886, 887, 5, 117, 0, 0, 887, 888, 5, 108, 0, 0, 888, 889, 5, 108, 0, 0, 889, 154, 1, 0, 0, 0, 890, 891, 5, 40, 0, 0, 891, 156, 1, 0, 0, 0, 892, 893, 5, 41, 0, 0, 893, 158, 1, 0, 0, 0, 894, 895, 5, 123, 0, 0, 895, 160, 1, 0, 0, 0, 896, 897, 5, 125, 0, 0, 897, 162, 1, 0, 0, 0, 898, 899, 5, 91, 0, 0, 899, 164, 1, 0, 0, 0, 900, 901, 5, 93, 0, 0, 901, 166, 1, 0, 0, 0, 902, 903, 5, 59, 0, 0, 903, 168, 1, 0, 0, 0, 904, 905, 5, 44, 0, 0, 905, 170, 1, 0, 0, 0, 906, 907, 5, 46, 0, 0, 907, 172, 1, 0, 0, 0, 908, 909, 5, 61, 0, 0, 909, 174, 1, 0, 0, 0, 910, 911, 5, 62, 0, 0, 911, 176, 1, 0, 0, 0, 912, 913, 5, 60, 0, 0, 913, 178, 1, 0, 0, 0, 914, 915, 5, 33, 0, 0, 915, 180, 1, 0, 0, 0, 916, 917, 5, 126, 0, 0, 917, 182, 1, 0, 0, 0, 918, 919, 5, 63, 0, 0, 919, 184, 1, 0, 0, 0, 920, 921, 5, 58, 0, 0, 921, 186, 1, 0, 0, 0, 922, 923, 5, 61, 0, 0, 923, 924, 5, 61, 0, 0, 924, 188, 1, 0, 0, 0, 925, 926, 5, 60, 0, 0, 926, 927, 5, 61, 0, 0, 927, 190, 1, 0, 0, 0, 928, 929, 5, 62, 0, 0, 929, 930, 5, 61, 0, 0, 930, 192, 1, 0, 0, 0, 931, 932, 5, 33, 0, 0, 932, 933, 5, 61, 0, 0, 933, 194, 1, 0, 0, 0, 934, 935, 5, 38, 0, 0, 935, 936, 5, 38, 0, 0, 936, 196, 1, 0, 0, 0, 937, 938, 5, 124, 0, 0, 938, 939, 5, 124, 0, 0, 939, 198, 1, 0, 0, 0, 940, 941, 5, 43, 0, 0, 941, 942, 5, 43, 0, 0, 942, 200, 1, 0, 0, 0, 943, 944, 5, 45, 0, 0, 944, 945, 5, 45, 0, 0, 945, 202, 1, 0, 0, 0, 946, 947, 5, 43, 0, 0, 947, 204, 1, 0, 0, 0, 948, 949, 5, 45, 0, 0, 949, 206, 1, 0, 0, 0, 950, 951, 5, 42, 0, 0, 951, 208, 1, 0, 0, 0, 952, 953, 5, 47, 0, 0, 953, 210, 1, 0, 0, 0, 954, 955, 5, 38, 0, 0, 955, 212, 1, 0, 0, 0, 956, 957, 5, 124, 0, 0, 957, 214, 1, 0, 0, 0, 958, 959, 5, 94, 0, 0, 959, 216, 1, 0, 0, 0, 960, 961, 5, 37, 0, 0, 961, 218, 1, 0, 0, 0, 962, 963, 5, 43, 0, 0, 963, 964, 5, 61, 0, 0, 964, 220, 1, 0, 0, 0, 965, 966, 5, 45, 0, 0, 966, 967, 5, 61, 0, 0, 967, 222, 1, 0, 0, 0, 968, 969, 5, 42, 0, 0, 969, 970, 5, 61, 0, 0, 970, 224, 1, 0, 0, 0, 971, 972, 5, 47, 0, 0, 972, 973, 5, 61, 0, 0, 973, 226, 1, 0, 0, 0, 974, 975, 5, 38, 0, 0, 975, 976, 5, 61, 0, 0, 976, 228, 1, 0, 0, 0, 977, 978, 5, 124, 0, 0, 978, 979, 5, 61, 0, 0, 979, 230, 1, 0, 0, 0, 980, 981, 5, 94, 0, 0, 981, 982, 5, 61, 0, 0, 982, 232, 1, 0, 0, 0, 983, 984, 5, 37, 0, 0, 984, 985, 5, 61, 0, 0, 985, 234, 1, 0, 0, 0, 986, 987, 5, 60, 0, 0, 987, 988, 5, 60, 0, 0, 988, 989, 5, 61, 0, 0, 989, 236, 1, 0, 0, 0, 990, 991, 5, 62, 0, 0, 991, 992, 5, 62, 0, 0, 992, 993, 5, 61, 0, 0, 993, 238, 1, 0, 0, 0, 994, 995, 5, 62, 0, 0, 995, 996, 5, 62, 0, 0, 996, 997, 5, 62, 0, 0, 997, 998, 5, 61, 0, 0, 998, 240, 1, 0, 0, 0, 999, 1000, 5, 45, 0, 0, 1000, 1001, 5, 62, 0, 0, 1001, 242, 1, 0, 0, 0, 1002, 1003, 5, 58, 0, 0, 1003, 1004, 5, 58, 0, 0, 1004, 244, 1, 0, 0, 0, 1005, 1006, 5, 64, 0, 0, 1006, 246, 1, 0, 0, 0, 1007, 1008, 5, 46, 0, 0, 1008, 1009, 5, 46, 0, 0, 1009, 1010, 5, 46, 0, 0, 1010, 248, 1, 0, 0, 0, 1011, 1013, 7, 17, 0, 0, 1012, 1011, 1, 0, 0, 0, 1013, 1014, 1, 0, 0, 0, 1014, 1012, 1, 0, 0, 0, 1014, 1015, 1, 0, 0, 0, 1015, 1016, 1, 0, 0, 0, 1016, 1017, 6, 124, 0, 0, 1017, 250, 1, 0, 0, 0, 1018, 1019, 5, 47, 0, 0, 1019, 1020, 5, 42, 0, 0, 1020, 1024, 1, 0, 0, 0, 1021, 1023, 9, 0, 0, 0, 1022, 1021, 1, 0, 0, 0, 1023, 1026, 1, 0, 0, 0, 1024, 1025, 1, 0, 0, 0, 1024, 1022, 1, 0, 0, 0, 1025, 1027, 1, 0, 0, 0, 1026, 1024, 1, 0, 0, 0, 1027, 1028, 5, 42, 0, 0, 1028, 1029, 5, 47, 0, 0, 1029, 1030, 1, 0, 0, 0, 1030, 1031, 6, 125, 0, 0, 1031, 252, 1, 0, 0, 0, 1032, 1033, 5, 47, 0, 0, 1033, 1034, 5, 47, 0, 0, 1034, 1038, 1, 0, 0, 0, 1035, 1037, 8, 16, 0, 0, 1036, 1035, 1, 0, 0, 0, 1037, 1040, 1, 0, 0, 0, 1038, 1036, 1, 0, 0, 0, 1038, 1039, 1, 0, 0, 0, 1039, 1041, 1, 0, 0, 0, 1040, 1038, 1, 0, 0, 0, 1041, 1042, 6, 126, 0, 0, 1042, 254, 1, 0, 0, 0, 1043, 1047, 3, 269, 134, 0, 1044, 1046, 3, 267, 133, 0, 1045, 1044, 1, 0, 0, 0, 1046, 1049, 1, 0, 0, 0, 1047, 1045, 1, 0, 0, 0, 1047, 1048, 1, 0, 0, 0, 1048, 256, 1, 0, 0, 0, 1049, 1047, 1, 0, 0, 0, 1050, 1052, 7, 18, 0, 0, 1051, 1053, 7, 12, 0, 0, 1052, 1051, 1, 0, 0, 0, 1052, 1053, 1, 0, 0, 0, 1053, 1054, 1, 0, 0, 0, 1054, 1055, 3, 265, 132, 0, 1055, 258, 1, 0, 0, 0, 1056, 1057, 5, 92, 0, 0, 1057, 1078, 7, 19, 0, 0, 1058, 1063, 5, 92, 0, 0, 1059, 1061, 7, 20, 0, 0, 1060, 1059, 1, 0, 0, 0, 1060, 1061, 1, 0, 0, 0, 1061, 1062, 1, 0, 0, 0, 1062, 1064, 7, 5, 0, 0, 1063, 1060, 1, 0, 0, 0, 1063, 1064, 1, 0, 0, 0, 1064, 1065, 1, 0, 0, 0, 1065, 1078, 7, 5, 0, 0, 1066, 1068, 5, 92, 0, 0, 1067, 1069, 5, 117, 0, 0, 1068, 1067, 1, 0, 0, 0, 1069, 1070, 1, 0, 0, 0, 1070, 1068, 1, 0, 0, 0, 1070, 1071, 1, 0, 0, 0, 1071, 1072, 1, 0, 0, 0, 1072, 1073, 3, 263, 131, 0, 1073, 1074, 3, 263, 131, 0, 1074, 1075, 3, 263, 131, 0, 1075, 1076, 3, 263, 131, 0, 1076, 1078, 1, 0, 0, 0, 1077, 1056, 1, 0, 0, 0, 1077, 1058, 1, 0, 0, 0, 1077, 1066, 1, 0, 0, 0, 1078, 260, 1, 0, 0, 0, 1079, 1088, 3, 263, 131, 0, 1080, 1083, 3, 263, 131, 0, 1081, 1083, 5, 95, 0, 0, 1082, 1080, 1, 0, 0, 0, 1082, 1081, 1, 0, 0, 0, 1083, 1086, 1, 0, 0, 0, 1084, 1082, 1, 0, 0, 0, 1084, 1085, 1, 0, 0, 0, 1085, 1087, 1, 0, 0, 0, 1086, 1084, 1, 0, 0, 0, 1087, 1089, 3, 263, 131, 0, 1088, 1084, 1, 0, 0, 0, 1088, 1089, 1, 0, 0, 0, 1089, 262, 1, 0, 0, 0, 1090, 1091, 7, 3, 0, 0, 1091, 264, 1, 0, 0, 0, 1092, 1100, 7, 21, 0, 0, 1093, 1095, 7, 22, 0, 0, 1094, 1093, 1, 0, 0, 0, 1095, 1098, 1, 0, 0, 0, 1096, 1094, 1, 0, 0, 0, 1096, 1097, 1, 0, 0, 0, 1097, 1099, 1, 0, 0, 0, 1098, 1096, 1, 0, 0, 0, 1099, 1101, 7, 21, 0, 0, 1100, 1096, 1, 0, 0, 0, 1100, 1101, 1, 0, 0, 0, 1101, 266, 1, 0, 0, 0, 1102, 1105, 3, 269, 134, 0, 1103, 1105, 7, 21, 0, 0, 1104, 1102, 1, 0, 0, 0, 1104, 1103, 1, 0, 0, 0, 1105, 268, 1, 0, 0, 0, 1106, 1111, 7, 23, 0, 0, 1107, 1111, 8, 24, 0, 0, 1108, 1109, 7, 25, 0, 0, 1109, 1111, 7, 26, 0, 0, 1110, 1106, 1, 0, 0, 0, 1110, 1107, 1, 0, 0, 0, 1110, 1108, 1, 0, 0, 0, 1111, 270, 1, 0, 0, 0, 51, 0, 724, 729, 732, 734, 737, 745, 749, 752, 758, 765, 769, 772, 780, 784, 787, 792, 796, 799, 802, 807, 810, 812, 818, 821, 825, 829, 833, 844, 849, 856, 858, 870, 876, 878, 1014, 1024, 1038, 1047, 1052, 1060, 1063, 1070, 1077, 1082, 1084, 1088, 1096, 1100, 1104, 1110, 1, 0, 1, 0] \ No newline at end of file diff --git a/javatx-src/main/java/de/dhbwstuttgart/parser/antlr/Java17Lexer.java b/javatx-src/main/java/de/dhbwstuttgart/parser/antlr/Java17Lexer.java new file mode 100644 index 0000000..763eecb --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/parser/antlr/Java17Lexer.java @@ -0,0 +1,874 @@ +// Generated from java-escape by ANTLR 4.11.1 +package de.dhbwstuttgart.parser.antlr; +import org.antlr.v4.runtime.Lexer; +import org.antlr.v4.runtime.CharStream; +import org.antlr.v4.runtime.Token; +import org.antlr.v4.runtime.TokenStream; +import org.antlr.v4.runtime.*; +import org.antlr.v4.runtime.atn.*; +import org.antlr.v4.runtime.dfa.DFA; +import org.antlr.v4.runtime.misc.*; + +@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast", "CheckReturnValue"}) +public class Java17Lexer extends Lexer { + static { RuntimeMetaData.checkVersion("4.11.1", RuntimeMetaData.VERSION); } + + protected static final DFA[] _decisionToDFA; + protected static final PredictionContextCache _sharedContextCache = + new PredictionContextCache(); + public static final int + ABSTRACT=1, ASSERT=2, BOOLEAN=3, BREAK=4, BYTE=5, CASE=6, CATCH=7, CHAR=8, + CLASS=9, CONST=10, CONTINUE=11, DEFAULT=12, DO=13, DOUBLE=14, ELSE=15, + ENUM=16, EXTENDS=17, FINAL=18, FINALLY=19, FLOAT=20, FOR=21, IF=22, GOTO=23, + IMPLEMENTS=24, IMPORT=25, INSTANCEOF=26, INT=27, INTERFACE=28, LONG=29, + NATIVE=30, NEW=31, PACKAGE=32, PRIVATE=33, PROTECTED=34, PUBLIC=35, RETURN=36, + SHORT=37, STATIC=38, STRICTFP=39, SUPER=40, SWITCH=41, SYNCHRONIZED=42, + THIS=43, THROW=44, THROWS=45, TRANSIENT=46, TRY=47, VOID=48, VOLATILE=49, + WHILE=50, MODULE=51, OPEN=52, REQUIRES=53, EXPORTS=54, OPENS=55, TO=56, + USES=57, PROVIDES=58, WITH=59, TRANSITIVE=60, VAR=61, YIELD=62, RECORD=63, + SEALED=64, PERMITS=65, NON_SEALED=66, DECIMAL_LITERAL=67, HEX_LITERAL=68, + OCT_LITERAL=69, BINARY_LITERAL=70, FLOAT_LITERAL=71, HEX_FLOAT_LITERAL=72, + BOOL_LITERAL=73, CHAR_LITERAL=74, STRING_LITERAL=75, TEXT_BLOCK=76, NULL_LITERAL=77, + LPAREN=78, RPAREN=79, LBRACE=80, RBRACE=81, LBRACK=82, RBRACK=83, SEMI=84, + COMMA=85, DOT=86, ASSIGN=87, GT=88, LT=89, BANG=90, TILDE=91, QUESTION=92, + COLON=93, EQUAL=94, LE=95, GE=96, NOTEQUAL=97, AND=98, OR=99, INC=100, + DEC=101, ADD=102, SUB=103, MUL=104, DIV=105, BITAND=106, BITOR=107, CARET=108, + MOD=109, ADD_ASSIGN=110, SUB_ASSIGN=111, MUL_ASSIGN=112, DIV_ASSIGN=113, + AND_ASSIGN=114, OR_ASSIGN=115, XOR_ASSIGN=116, MOD_ASSIGN=117, LSHIFT_ASSIGN=118, + RSHIFT_ASSIGN=119, URSHIFT_ASSIGN=120, ARROW=121, COLONCOLON=122, AT=123, + ELLIPSIS=124, WS=125, COMMENT=126, LINE_COMMENT=127, IDENTIFIER=128; + public static String[] channelNames = { + "DEFAULT_TOKEN_CHANNEL", "HIDDEN" + }; + + public static String[] modeNames = { + "DEFAULT_MODE" + }; + + private static String[] makeRuleNames() { + return new String[] { + "ABSTRACT", "ASSERT", "BOOLEAN", "BREAK", "BYTE", "CASE", "CATCH", "CHAR", + "CLASS", "CONST", "CONTINUE", "DEFAULT", "DO", "DOUBLE", "ELSE", "ENUM", + "EXTENDS", "FINAL", "FINALLY", "FLOAT", "FOR", "IF", "GOTO", "IMPLEMENTS", + "IMPORT", "INSTANCEOF", "INT", "INTERFACE", "LONG", "NATIVE", "NEW", + "PACKAGE", "PRIVATE", "PROTECTED", "PUBLIC", "RETURN", "SHORT", "STATIC", + "STRICTFP", "SUPER", "SWITCH", "SYNCHRONIZED", "THIS", "THROW", "THROWS", + "TRANSIENT", "TRY", "VOID", "VOLATILE", "WHILE", "MODULE", "OPEN", "REQUIRES", + "EXPORTS", "OPENS", "TO", "USES", "PROVIDES", "WITH", "TRANSITIVE", "VAR", + "YIELD", "RECORD", "SEALED", "PERMITS", "NON_SEALED", "DECIMAL_LITERAL", + "HEX_LITERAL", "OCT_LITERAL", "BINARY_LITERAL", "FLOAT_LITERAL", "HEX_FLOAT_LITERAL", + "BOOL_LITERAL", "CHAR_LITERAL", "STRING_LITERAL", "TEXT_BLOCK", "NULL_LITERAL", + "LPAREN", "RPAREN", "LBRACE", "RBRACE", "LBRACK", "RBRACK", "SEMI", "COMMA", + "DOT", "ASSIGN", "GT", "LT", "BANG", "TILDE", "QUESTION", "COLON", "EQUAL", + "LE", "GE", "NOTEQUAL", "AND", "OR", "INC", "DEC", "ADD", "SUB", "MUL", + "DIV", "BITAND", "BITOR", "CARET", "MOD", "ADD_ASSIGN", "SUB_ASSIGN", + "MUL_ASSIGN", "DIV_ASSIGN", "AND_ASSIGN", "OR_ASSIGN", "XOR_ASSIGN", + "MOD_ASSIGN", "LSHIFT_ASSIGN", "RSHIFT_ASSIGN", "URSHIFT_ASSIGN", "ARROW", + "COLONCOLON", "AT", "ELLIPSIS", "WS", "COMMENT", "LINE_COMMENT", "IDENTIFIER", + "ExponentPart", "EscapeSequence", "HexDigits", "HexDigit", "Digits", + "LetterOrDigit", "Letter" + }; + } + public static final String[] ruleNames = makeRuleNames(); + + private static String[] makeLiteralNames() { + return new String[] { + null, "'abstract'", "'assert'", "'boolean'", "'break'", "'byte'", "'case'", + "'catch'", "'char'", "'class'", "'const'", "'continue'", "'default'", + "'do'", "'double'", "'else'", "'enum'", "'extends'", "'final'", "'finally'", + "'float'", "'for'", "'if'", "'goto'", "'implements'", "'import'", "'instanceof'", + "'int'", "'interface'", "'long'", "'native'", "'new'", "'package'", "'private'", + "'protected'", "'public'", "'return'", "'short'", "'static'", "'strictfp'", + "'super'", "'switch'", "'synchronized'", "'this'", "'throw'", "'throws'", + "'transient'", "'try'", "'void'", "'volatile'", "'while'", "'module'", + "'open'", "'requires'", "'exports'", "'opens'", "'to'", "'uses'", "'provides'", + "'with'", "'transitive'", "'var'", "'yield'", "'record'", "'sealed'", + "'permits'", "'non-sealed'", null, null, null, null, null, null, null, + null, null, null, "'null'", "'('", "')'", "'{'", "'}'", "'['", "']'", + "';'", "','", "'.'", "'='", "'>'", "'<'", "'!'", "'~'", "'?'", "':'", + "'=='", "'<='", "'>='", "'!='", "'&&'", "'||'", "'++'", "'--'", "'+'", + "'-'", "'*'", "'/'", "'&'", "'|'", "'^'", "'%'", "'+='", "'-='", "'*='", + "'/='", "'&='", "'|='", "'^='", "'%='", "'<<='", "'>>='", "'>>>='", "'->'", + "'::'", "'@'", "'...'" + }; + } + private static final String[] _LITERAL_NAMES = makeLiteralNames(); + private static String[] makeSymbolicNames() { + return new String[] { + null, "ABSTRACT", "ASSERT", "BOOLEAN", "BREAK", "BYTE", "CASE", "CATCH", + "CHAR", "CLASS", "CONST", "CONTINUE", "DEFAULT", "DO", "DOUBLE", "ELSE", + "ENUM", "EXTENDS", "FINAL", "FINALLY", "FLOAT", "FOR", "IF", "GOTO", + "IMPLEMENTS", "IMPORT", "INSTANCEOF", "INT", "INTERFACE", "LONG", "NATIVE", + "NEW", "PACKAGE", "PRIVATE", "PROTECTED", "PUBLIC", "RETURN", "SHORT", + "STATIC", "STRICTFP", "SUPER", "SWITCH", "SYNCHRONIZED", "THIS", "THROW", + "THROWS", "TRANSIENT", "TRY", "VOID", "VOLATILE", "WHILE", "MODULE", + "OPEN", "REQUIRES", "EXPORTS", "OPENS", "TO", "USES", "PROVIDES", "WITH", + "TRANSITIVE", "VAR", "YIELD", "RECORD", "SEALED", "PERMITS", "NON_SEALED", + "DECIMAL_LITERAL", "HEX_LITERAL", "OCT_LITERAL", "BINARY_LITERAL", "FLOAT_LITERAL", + "HEX_FLOAT_LITERAL", "BOOL_LITERAL", "CHAR_LITERAL", "STRING_LITERAL", + "TEXT_BLOCK", "NULL_LITERAL", "LPAREN", "RPAREN", "LBRACE", "RBRACE", + "LBRACK", "RBRACK", "SEMI", "COMMA", "DOT", "ASSIGN", "GT", "LT", "BANG", + "TILDE", "QUESTION", "COLON", "EQUAL", "LE", "GE", "NOTEQUAL", "AND", + "OR", "INC", "DEC", "ADD", "SUB", "MUL", "DIV", "BITAND", "BITOR", "CARET", + "MOD", "ADD_ASSIGN", "SUB_ASSIGN", "MUL_ASSIGN", "DIV_ASSIGN", "AND_ASSIGN", + "OR_ASSIGN", "XOR_ASSIGN", "MOD_ASSIGN", "LSHIFT_ASSIGN", "RSHIFT_ASSIGN", + "URSHIFT_ASSIGN", "ARROW", "COLONCOLON", "AT", "ELLIPSIS", "WS", "COMMENT", + "LINE_COMMENT", "IDENTIFIER" + }; + } + private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames(); + public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES); + + /** + * @deprecated Use {@link #VOCABULARY} instead. + */ + @Deprecated + public static final String[] tokenNames; + static { + tokenNames = new String[_SYMBOLIC_NAMES.length]; + for (int i = 0; i < tokenNames.length; i++) { + tokenNames[i] = VOCABULARY.getLiteralName(i); + if (tokenNames[i] == null) { + tokenNames[i] = VOCABULARY.getSymbolicName(i); + } + + if (tokenNames[i] == null) { + tokenNames[i] = ""; + } + } + } + + @Override + @Deprecated + public String[] getTokenNames() { + return tokenNames; + } + + @Override + + public Vocabulary getVocabulary() { + return VOCABULARY; + } + + + public Java17Lexer(CharStream input) { + super(input); + _interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache); + } + + @Override + public String getGrammarFileName() { return "Java17Lexer.g4"; } + + @Override + public String[] getRuleNames() { return ruleNames; } + + @Override + public String getSerializedATN() { return _serializedATN; } + + @Override + public String[] getChannelNames() { return channelNames; } + + @Override + public String[] getModeNames() { return modeNames; } + + @Override + public ATN getATN() { return _ATN; } + + public static final String _serializedATN = + "\u0004\u0000\u0080\u0458\u0006\uffff\uffff\u0002\u0000\u0007\u0000\u0002"+ + "\u0001\u0007\u0001\u0002\u0002\u0007\u0002\u0002\u0003\u0007\u0003\u0002"+ + "\u0004\u0007\u0004\u0002\u0005\u0007\u0005\u0002\u0006\u0007\u0006\u0002"+ + "\u0007\u0007\u0007\u0002\b\u0007\b\u0002\t\u0007\t\u0002\n\u0007\n\u0002"+ + "\u000b\u0007\u000b\u0002\f\u0007\f\u0002\r\u0007\r\u0002\u000e\u0007\u000e"+ + "\u0002\u000f\u0007\u000f\u0002\u0010\u0007\u0010\u0002\u0011\u0007\u0011"+ + "\u0002\u0012\u0007\u0012\u0002\u0013\u0007\u0013\u0002\u0014\u0007\u0014"+ + "\u0002\u0015\u0007\u0015\u0002\u0016\u0007\u0016\u0002\u0017\u0007\u0017"+ + "\u0002\u0018\u0007\u0018\u0002\u0019\u0007\u0019\u0002\u001a\u0007\u001a"+ + "\u0002\u001b\u0007\u001b\u0002\u001c\u0007\u001c\u0002\u001d\u0007\u001d"+ + "\u0002\u001e\u0007\u001e\u0002\u001f\u0007\u001f\u0002 \u0007 \u0002!"+ + "\u0007!\u0002\"\u0007\"\u0002#\u0007#\u0002$\u0007$\u0002%\u0007%\u0002"+ + "&\u0007&\u0002\'\u0007\'\u0002(\u0007(\u0002)\u0007)\u0002*\u0007*\u0002"+ + "+\u0007+\u0002,\u0007,\u0002-\u0007-\u0002.\u0007.\u0002/\u0007/\u0002"+ + "0\u00070\u00021\u00071\u00022\u00072\u00023\u00073\u00024\u00074\u0002"+ + "5\u00075\u00026\u00076\u00027\u00077\u00028\u00078\u00029\u00079\u0002"+ + ":\u0007:\u0002;\u0007;\u0002<\u0007<\u0002=\u0007=\u0002>\u0007>\u0002"+ + "?\u0007?\u0002@\u0007@\u0002A\u0007A\u0002B\u0007B\u0002C\u0007C\u0002"+ + "D\u0007D\u0002E\u0007E\u0002F\u0007F\u0002G\u0007G\u0002H\u0007H\u0002"+ + "I\u0007I\u0002J\u0007J\u0002K\u0007K\u0002L\u0007L\u0002M\u0007M\u0002"+ + "N\u0007N\u0002O\u0007O\u0002P\u0007P\u0002Q\u0007Q\u0002R\u0007R\u0002"+ + "S\u0007S\u0002T\u0007T\u0002U\u0007U\u0002V\u0007V\u0002W\u0007W\u0002"+ + "X\u0007X\u0002Y\u0007Y\u0002Z\u0007Z\u0002[\u0007[\u0002\\\u0007\\\u0002"+ + "]\u0007]\u0002^\u0007^\u0002_\u0007_\u0002`\u0007`\u0002a\u0007a\u0002"+ + "b\u0007b\u0002c\u0007c\u0002d\u0007d\u0002e\u0007e\u0002f\u0007f\u0002"+ + "g\u0007g\u0002h\u0007h\u0002i\u0007i\u0002j\u0007j\u0002k\u0007k\u0002"+ + "l\u0007l\u0002m\u0007m\u0002n\u0007n\u0002o\u0007o\u0002p\u0007p\u0002"+ + "q\u0007q\u0002r\u0007r\u0002s\u0007s\u0002t\u0007t\u0002u\u0007u\u0002"+ + "v\u0007v\u0002w\u0007w\u0002x\u0007x\u0002y\u0007y\u0002z\u0007z\u0002"+ + "{\u0007{\u0002|\u0007|\u0002}\u0007}\u0002~\u0007~\u0002\u007f\u0007\u007f"+ + "\u0002\u0080\u0007\u0080\u0002\u0081\u0007\u0081\u0002\u0082\u0007\u0082"+ + "\u0002\u0083\u0007\u0083\u0002\u0084\u0007\u0084\u0002\u0085\u0007\u0085"+ + "\u0002\u0086\u0007\u0086\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0000"+ + "\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0001"+ + "\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001"+ + "\u0001\u0002\u0001\u0002\u0001\u0002\u0001\u0002\u0001\u0002\u0001\u0002"+ + "\u0001\u0002\u0001\u0002\u0001\u0003\u0001\u0003\u0001\u0003\u0001\u0003"+ + "\u0001\u0003\u0001\u0003\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0004"+ + "\u0001\u0004\u0001\u0005\u0001\u0005\u0001\u0005\u0001\u0005\u0001\u0005"+ + "\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006"+ + "\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\b\u0001"+ + "\b\u0001\b\u0001\b\u0001\b\u0001\b\u0001\t\u0001\t\u0001\t\u0001\t\u0001"+ + "\t\u0001\t\u0001\n\u0001\n\u0001\n\u0001\n\u0001\n\u0001\n\u0001\n\u0001"+ + "\n\u0001\n\u0001\u000b\u0001\u000b\u0001\u000b\u0001\u000b\u0001\u000b"+ + "\u0001\u000b\u0001\u000b\u0001\u000b\u0001\f\u0001\f\u0001\f\u0001\r\u0001"+ + "\r\u0001\r\u0001\r\u0001\r\u0001\r\u0001\r\u0001\u000e\u0001\u000e\u0001"+ + "\u000e\u0001\u000e\u0001\u000e\u0001\u000f\u0001\u000f\u0001\u000f\u0001"+ + "\u000f\u0001\u000f\u0001\u0010\u0001\u0010\u0001\u0010\u0001\u0010\u0001"+ + "\u0010\u0001\u0010\u0001\u0010\u0001\u0010\u0001\u0011\u0001\u0011\u0001"+ + "\u0011\u0001\u0011\u0001\u0011\u0001\u0011\u0001\u0012\u0001\u0012\u0001"+ + "\u0012\u0001\u0012\u0001\u0012\u0001\u0012\u0001\u0012\u0001\u0012\u0001"+ + "\u0013\u0001\u0013\u0001\u0013\u0001\u0013\u0001\u0013\u0001\u0013\u0001"+ + "\u0014\u0001\u0014\u0001\u0014\u0001\u0014\u0001\u0015\u0001\u0015\u0001"+ + "\u0015\u0001\u0016\u0001\u0016\u0001\u0016\u0001\u0016\u0001\u0016\u0001"+ + "\u0017\u0001\u0017\u0001\u0017\u0001\u0017\u0001\u0017\u0001\u0017\u0001"+ + "\u0017\u0001\u0017\u0001\u0017\u0001\u0017\u0001\u0017\u0001\u0018\u0001"+ + "\u0018\u0001\u0018\u0001\u0018\u0001\u0018\u0001\u0018\u0001\u0018\u0001"+ + "\u0019\u0001\u0019\u0001\u0019\u0001\u0019\u0001\u0019\u0001\u0019\u0001"+ + "\u0019\u0001\u0019\u0001\u0019\u0001\u0019\u0001\u0019\u0001\u001a\u0001"+ + "\u001a\u0001\u001a\u0001\u001a\u0001\u001b\u0001\u001b\u0001\u001b\u0001"+ + "\u001b\u0001\u001b\u0001\u001b\u0001\u001b\u0001\u001b\u0001\u001b\u0001"+ + "\u001b\u0001\u001c\u0001\u001c\u0001\u001c\u0001\u001c\u0001\u001c\u0001"+ + "\u001d\u0001\u001d\u0001\u001d\u0001\u001d\u0001\u001d\u0001\u001d\u0001"+ + "\u001d\u0001\u001e\u0001\u001e\u0001\u001e\u0001\u001e\u0001\u001f\u0001"+ + "\u001f\u0001\u001f\u0001\u001f\u0001\u001f\u0001\u001f\u0001\u001f\u0001"+ + "\u001f\u0001 \u0001 \u0001 \u0001 \u0001 \u0001 \u0001 \u0001 \u0001!"+ + "\u0001!\u0001!\u0001!\u0001!\u0001!\u0001!\u0001!\u0001!\u0001!\u0001"+ + "\"\u0001\"\u0001\"\u0001\"\u0001\"\u0001\"\u0001\"\u0001#\u0001#\u0001"+ + "#\u0001#\u0001#\u0001#\u0001#\u0001$\u0001$\u0001$\u0001$\u0001$\u0001"+ + "$\u0001%\u0001%\u0001%\u0001%\u0001%\u0001%\u0001%\u0001&\u0001&\u0001"+ + "&\u0001&\u0001&\u0001&\u0001&\u0001&\u0001&\u0001\'\u0001\'\u0001\'\u0001"+ + "\'\u0001\'\u0001\'\u0001(\u0001(\u0001(\u0001(\u0001(\u0001(\u0001(\u0001"+ + ")\u0001)\u0001)\u0001)\u0001)\u0001)\u0001)\u0001)\u0001)\u0001)\u0001"+ + ")\u0001)\u0001)\u0001*\u0001*\u0001*\u0001*\u0001*\u0001+\u0001+\u0001"+ + "+\u0001+\u0001+\u0001+\u0001,\u0001,\u0001,\u0001,\u0001,\u0001,\u0001"+ + ",\u0001-\u0001-\u0001-\u0001-\u0001-\u0001-\u0001-\u0001-\u0001-\u0001"+ + "-\u0001.\u0001.\u0001.\u0001.\u0001/\u0001/\u0001/\u0001/\u0001/\u0001"+ + "0\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00010\u00011\u0001"+ + "1\u00011\u00011\u00011\u00011\u00012\u00012\u00012\u00012\u00012\u0001"+ + "2\u00012\u00013\u00013\u00013\u00013\u00013\u00014\u00014\u00014\u0001"+ + "4\u00014\u00014\u00014\u00014\u00014\u00015\u00015\u00015\u00015\u0001"+ + "5\u00015\u00015\u00015\u00016\u00016\u00016\u00016\u00016\u00016\u0001"+ + "7\u00017\u00017\u00018\u00018\u00018\u00018\u00018\u00019\u00019\u0001"+ + "9\u00019\u00019\u00019\u00019\u00019\u00019\u0001:\u0001:\u0001:\u0001"+ + ":\u0001:\u0001;\u0001;\u0001;\u0001;\u0001;\u0001;\u0001;\u0001;\u0001"+ + ";\u0001;\u0001;\u0001<\u0001<\u0001<\u0001<\u0001=\u0001=\u0001=\u0001"+ + "=\u0001=\u0001=\u0001>\u0001>\u0001>\u0001>\u0001>\u0001>\u0001>\u0001"+ + "?\u0001?\u0001?\u0001?\u0001?\u0001?\u0001?\u0001@\u0001@\u0001@\u0001"+ + "@\u0001@\u0001@\u0001@\u0001@\u0001A\u0001A\u0001A\u0001A\u0001A\u0001"+ + "A\u0001A\u0001A\u0001A\u0001A\u0001A\u0001B\u0001B\u0001B\u0003B\u02d5"+ + "\bB\u0001B\u0004B\u02d8\bB\u000bB\fB\u02d9\u0001B\u0003B\u02dd\bB\u0003"+ + "B\u02df\bB\u0001B\u0003B\u02e2\bB\u0001C\u0001C\u0001C\u0001C\u0005C\u02e8"+ + "\bC\nC\fC\u02eb\tC\u0001C\u0003C\u02ee\bC\u0001C\u0003C\u02f1\bC\u0001"+ + "D\u0001D\u0005D\u02f5\bD\nD\fD\u02f8\tD\u0001D\u0001D\u0005D\u02fc\bD"+ + "\nD\fD\u02ff\tD\u0001D\u0003D\u0302\bD\u0001D\u0003D\u0305\bD\u0001E\u0001"+ + "E\u0001E\u0001E\u0005E\u030b\bE\nE\fE\u030e\tE\u0001E\u0003E\u0311\bE"+ + "\u0001E\u0003E\u0314\bE\u0001F\u0001F\u0001F\u0003F\u0319\bF\u0001F\u0001"+ + "F\u0003F\u031d\bF\u0001F\u0003F\u0320\bF\u0001F\u0003F\u0323\bF\u0001"+ + "F\u0001F\u0001F\u0003F\u0328\bF\u0001F\u0003F\u032b\bF\u0003F\u032d\b"+ + "F\u0001G\u0001G\u0001G\u0001G\u0003G\u0333\bG\u0001G\u0003G\u0336\bG\u0001"+ + "G\u0001G\u0003G\u033a\bG\u0001G\u0001G\u0003G\u033e\bG\u0001G\u0001G\u0003"+ + "G\u0342\bG\u0001H\u0001H\u0001H\u0001H\u0001H\u0001H\u0001H\u0001H\u0001"+ + "H\u0003H\u034d\bH\u0001I\u0001I\u0001I\u0003I\u0352\bI\u0001I\u0001I\u0001"+ + "J\u0001J\u0001J\u0005J\u0359\bJ\nJ\fJ\u035c\tJ\u0001J\u0001J\u0001K\u0001"+ + "K\u0001K\u0001K\u0001K\u0005K\u0365\bK\nK\fK\u0368\tK\u0001K\u0001K\u0001"+ + "K\u0005K\u036d\bK\nK\fK\u0370\tK\u0001K\u0001K\u0001K\u0001K\u0001L\u0001"+ + "L\u0001L\u0001L\u0001L\u0001M\u0001M\u0001N\u0001N\u0001O\u0001O\u0001"+ + "P\u0001P\u0001Q\u0001Q\u0001R\u0001R\u0001S\u0001S\u0001T\u0001T\u0001"+ + "U\u0001U\u0001V\u0001V\u0001W\u0001W\u0001X\u0001X\u0001Y\u0001Y\u0001"+ + "Z\u0001Z\u0001[\u0001[\u0001\\\u0001\\\u0001]\u0001]\u0001]\u0001^\u0001"+ + "^\u0001^\u0001_\u0001_\u0001_\u0001`\u0001`\u0001`\u0001a\u0001a\u0001"+ + "a\u0001b\u0001b\u0001b\u0001c\u0001c\u0001c\u0001d\u0001d\u0001d\u0001"+ + "e\u0001e\u0001f\u0001f\u0001g\u0001g\u0001h\u0001h\u0001i\u0001i\u0001"+ + "j\u0001j\u0001k\u0001k\u0001l\u0001l\u0001m\u0001m\u0001m\u0001n\u0001"+ + "n\u0001n\u0001o\u0001o\u0001o\u0001p\u0001p\u0001p\u0001q\u0001q\u0001"+ + "q\u0001r\u0001r\u0001r\u0001s\u0001s\u0001s\u0001t\u0001t\u0001t\u0001"+ + "u\u0001u\u0001u\u0001u\u0001v\u0001v\u0001v\u0001v\u0001w\u0001w\u0001"+ + "w\u0001w\u0001w\u0001x\u0001x\u0001x\u0001y\u0001y\u0001y\u0001z\u0001"+ + "z\u0001{\u0001{\u0001{\u0001{\u0001|\u0004|\u03f5\b|\u000b|\f|\u03f6\u0001"+ + "|\u0001|\u0001}\u0001}\u0001}\u0001}\u0005}\u03ff\b}\n}\f}\u0402\t}\u0001"+ + "}\u0001}\u0001}\u0001}\u0001}\u0001~\u0001~\u0001~\u0001~\u0005~\u040d"+ + "\b~\n~\f~\u0410\t~\u0001~\u0001~\u0001\u007f\u0001\u007f\u0005\u007f\u0416"+ + "\b\u007f\n\u007f\f\u007f\u0419\t\u007f\u0001\u0080\u0001\u0080\u0003\u0080"+ + "\u041d\b\u0080\u0001\u0080\u0001\u0080\u0001\u0081\u0001\u0081\u0001\u0081"+ + "\u0001\u0081\u0003\u0081\u0425\b\u0081\u0001\u0081\u0003\u0081\u0428\b"+ + "\u0081\u0001\u0081\u0001\u0081\u0001\u0081\u0004\u0081\u042d\b\u0081\u000b"+ + "\u0081\f\u0081\u042e\u0001\u0081\u0001\u0081\u0001\u0081\u0001\u0081\u0001"+ + "\u0081\u0003\u0081\u0436\b\u0081\u0001\u0082\u0001\u0082\u0001\u0082\u0005"+ + "\u0082\u043b\b\u0082\n\u0082\f\u0082\u043e\t\u0082\u0001\u0082\u0003\u0082"+ + "\u0441\b\u0082\u0001\u0083\u0001\u0083\u0001\u0084\u0001\u0084\u0005\u0084"+ + "\u0447\b\u0084\n\u0084\f\u0084\u044a\t\u0084\u0001\u0084\u0003\u0084\u044d"+ + "\b\u0084\u0001\u0085\u0001\u0085\u0003\u0085\u0451\b\u0085\u0001\u0086"+ + "\u0001\u0086\u0001\u0086\u0001\u0086\u0003\u0086\u0457\b\u0086\u0002\u036e"+ + "\u0400\u0000\u0087\u0001\u0001\u0003\u0002\u0005\u0003\u0007\u0004\t\u0005"+ + "\u000b\u0006\r\u0007\u000f\b\u0011\t\u0013\n\u0015\u000b\u0017\f\u0019"+ + "\r\u001b\u000e\u001d\u000f\u001f\u0010!\u0011#\u0012%\u0013\'\u0014)\u0015"+ + "+\u0016-\u0017/\u00181\u00193\u001a5\u001b7\u001c9\u001d;\u001e=\u001f"+ + "? A!C\"E#G$I%K&M\'O(Q)S*U+W,Y-[.]/_0a1c2e3g4i5k6m7o8q9s:u;w}?\u007f"+ + "@\u0081A\u0083B\u0085C\u0087D\u0089E\u008bF\u008dG\u008fH\u0091I\u0093"+ + "J\u0095K\u0097L\u0099M\u009bN\u009dO\u009fP\u00a1Q\u00a3R\u00a5S\u00a7"+ + "T\u00a9U\u00abV\u00adW\u00afX\u00b1Y\u00b3Z\u00b5[\u00b7\\\u00b9]\u00bb"+ + "^\u00bd_\u00bf`\u00c1a\u00c3b\u00c5c\u00c7d\u00c9e\u00cbf\u00cdg\u00cf"+ + "h\u00d1i\u00d3j\u00d5k\u00d7l\u00d9m\u00dbn\u00ddo\u00dfp\u00e1q\u00e3"+ + "r\u00e5s\u00e7t\u00e9u\u00ebv\u00edw\u00efx\u00f1y\u00f3z\u00f5{\u00f7"+ + "|\u00f9}\u00fb~\u00fd\u007f\u00ff\u0080\u0101\u0000\u0103\u0000\u0105"+ + "\u0000\u0107\u0000\u0109\u0000\u010b\u0000\u010d\u0000\u0001\u0000\u001b"+ + "\u0001\u000019\u0002\u0000LLll\u0002\u0000XXxx\u0003\u000009AFaf\u0004"+ + "\u000009AF__af\u0001\u000007\u0002\u000007__\u0002\u0000BBbb\u0001\u0000"+ + "01\u0002\u000001__\u0004\u0000DDFFddff\u0002\u0000PPpp\u0002\u0000++-"+ + "-\u0004\u0000\n\n\r\r\'\'\\\\\u0004\u0000\n\n\r\r\"\"\\\\\u0002\u0000"+ + "\t\t \u0002\u0000\n\n\r\r\u0003\u0000\t\n\f\r \u0002\u0000EEee\b\u0000"+ + "\"\"\'\'\\\\bbffnnrrtt\u0001\u000003\u0001\u000009\u0002\u000009__\u0004"+ + "\u0000$$AZ__az\u0002\u0000\u0000\u007f\u8000\ud800\u8000\udbff\u0001\u0000"+ + "\u8000\ud800\u8000\udbff\u0001\u0000\u8000\udc00\u8000\udfff\u0484\u0000"+ + "\u0001\u0001\u0000\u0000\u0000\u0000\u0003\u0001\u0000\u0000\u0000\u0000"+ + "\u0005\u0001\u0000\u0000\u0000\u0000\u0007\u0001\u0000\u0000\u0000\u0000"+ + "\t\u0001\u0000\u0000\u0000\u0000\u000b\u0001\u0000\u0000\u0000\u0000\r"+ + "\u0001\u0000\u0000\u0000\u0000\u000f\u0001\u0000\u0000\u0000\u0000\u0011"+ + "\u0001\u0000\u0000\u0000\u0000\u0013\u0001\u0000\u0000\u0000\u0000\u0015"+ + "\u0001\u0000\u0000\u0000\u0000\u0017\u0001\u0000\u0000\u0000\u0000\u0019"+ + "\u0001\u0000\u0000\u0000\u0000\u001b\u0001\u0000\u0000\u0000\u0000\u001d"+ + "\u0001\u0000\u0000\u0000\u0000\u001f\u0001\u0000\u0000\u0000\u0000!\u0001"+ + "\u0000\u0000\u0000\u0000#\u0001\u0000\u0000\u0000\u0000%\u0001\u0000\u0000"+ + "\u0000\u0000\'\u0001\u0000\u0000\u0000\u0000)\u0001\u0000\u0000\u0000"+ + "\u0000+\u0001\u0000\u0000\u0000\u0000-\u0001\u0000\u0000\u0000\u0000/"+ + "\u0001\u0000\u0000\u0000\u00001\u0001\u0000\u0000\u0000\u00003\u0001\u0000"+ + "\u0000\u0000\u00005\u0001\u0000\u0000\u0000\u00007\u0001\u0000\u0000\u0000"+ + "\u00009\u0001\u0000\u0000\u0000\u0000;\u0001\u0000\u0000\u0000\u0000="+ + "\u0001\u0000\u0000\u0000\u0000?\u0001\u0000\u0000\u0000\u0000A\u0001\u0000"+ + "\u0000\u0000\u0000C\u0001\u0000\u0000\u0000\u0000E\u0001\u0000\u0000\u0000"+ + "\u0000G\u0001\u0000\u0000\u0000\u0000I\u0001\u0000\u0000\u0000\u0000K"+ + "\u0001\u0000\u0000\u0000\u0000M\u0001\u0000\u0000\u0000\u0000O\u0001\u0000"+ + "\u0000\u0000\u0000Q\u0001\u0000\u0000\u0000\u0000S\u0001\u0000\u0000\u0000"+ + "\u0000U\u0001\u0000\u0000\u0000\u0000W\u0001\u0000\u0000\u0000\u0000Y"+ + "\u0001\u0000\u0000\u0000\u0000[\u0001\u0000\u0000\u0000\u0000]\u0001\u0000"+ + "\u0000\u0000\u0000_\u0001\u0000\u0000\u0000\u0000a\u0001\u0000\u0000\u0000"+ + "\u0000c\u0001\u0000\u0000\u0000\u0000e\u0001\u0000\u0000\u0000\u0000g"+ + "\u0001\u0000\u0000\u0000\u0000i\u0001\u0000\u0000\u0000\u0000k\u0001\u0000"+ + "\u0000\u0000\u0000m\u0001\u0000\u0000\u0000\u0000o\u0001\u0000\u0000\u0000"+ + "\u0000q\u0001\u0000\u0000\u0000\u0000s\u0001\u0000\u0000\u0000\u0000u"+ + "\u0001\u0000\u0000\u0000\u0000w\u0001\u0000\u0000\u0000\u0000y\u0001\u0000"+ + "\u0000\u0000\u0000{\u0001\u0000\u0000\u0000\u0000}\u0001\u0000\u0000\u0000"+ + "\u0000\u007f\u0001\u0000\u0000\u0000\u0000\u0081\u0001\u0000\u0000\u0000"+ + "\u0000\u0083\u0001\u0000\u0000\u0000\u0000\u0085\u0001\u0000\u0000\u0000"+ + "\u0000\u0087\u0001\u0000\u0000\u0000\u0000\u0089\u0001\u0000\u0000\u0000"+ + "\u0000\u008b\u0001\u0000\u0000\u0000\u0000\u008d\u0001\u0000\u0000\u0000"+ + "\u0000\u008f\u0001\u0000\u0000\u0000\u0000\u0091\u0001\u0000\u0000\u0000"+ + "\u0000\u0093\u0001\u0000\u0000\u0000\u0000\u0095\u0001\u0000\u0000\u0000"+ + "\u0000\u0097\u0001\u0000\u0000\u0000\u0000\u0099\u0001\u0000\u0000\u0000"+ + "\u0000\u009b\u0001\u0000\u0000\u0000\u0000\u009d\u0001\u0000\u0000\u0000"+ + "\u0000\u009f\u0001\u0000\u0000\u0000\u0000\u00a1\u0001\u0000\u0000\u0000"+ + "\u0000\u00a3\u0001\u0000\u0000\u0000\u0000\u00a5\u0001\u0000\u0000\u0000"+ + "\u0000\u00a7\u0001\u0000\u0000\u0000\u0000\u00a9\u0001\u0000\u0000\u0000"+ + "\u0000\u00ab\u0001\u0000\u0000\u0000\u0000\u00ad\u0001\u0000\u0000\u0000"+ + "\u0000\u00af\u0001\u0000\u0000\u0000\u0000\u00b1\u0001\u0000\u0000\u0000"+ + "\u0000\u00b3\u0001\u0000\u0000\u0000\u0000\u00b5\u0001\u0000\u0000\u0000"+ + "\u0000\u00b7\u0001\u0000\u0000\u0000\u0000\u00b9\u0001\u0000\u0000\u0000"+ + "\u0000\u00bb\u0001\u0000\u0000\u0000\u0000\u00bd\u0001\u0000\u0000\u0000"+ + "\u0000\u00bf\u0001\u0000\u0000\u0000\u0000\u00c1\u0001\u0000\u0000\u0000"+ + "\u0000\u00c3\u0001\u0000\u0000\u0000\u0000\u00c5\u0001\u0000\u0000\u0000"+ + "\u0000\u00c7\u0001\u0000\u0000\u0000\u0000\u00c9\u0001\u0000\u0000\u0000"+ + "\u0000\u00cb\u0001\u0000\u0000\u0000\u0000\u00cd\u0001\u0000\u0000\u0000"+ + "\u0000\u00cf\u0001\u0000\u0000\u0000\u0000\u00d1\u0001\u0000\u0000\u0000"+ + "\u0000\u00d3\u0001\u0000\u0000\u0000\u0000\u00d5\u0001\u0000\u0000\u0000"+ + "\u0000\u00d7\u0001\u0000\u0000\u0000\u0000\u00d9\u0001\u0000\u0000\u0000"+ + "\u0000\u00db\u0001\u0000\u0000\u0000\u0000\u00dd\u0001\u0000\u0000\u0000"+ + "\u0000\u00df\u0001\u0000\u0000\u0000\u0000\u00e1\u0001\u0000\u0000\u0000"+ + "\u0000\u00e3\u0001\u0000\u0000\u0000\u0000\u00e5\u0001\u0000\u0000\u0000"+ + "\u0000\u00e7\u0001\u0000\u0000\u0000\u0000\u00e9\u0001\u0000\u0000\u0000"+ + "\u0000\u00eb\u0001\u0000\u0000\u0000\u0000\u00ed\u0001\u0000\u0000\u0000"+ + "\u0000\u00ef\u0001\u0000\u0000\u0000\u0000\u00f1\u0001\u0000\u0000\u0000"+ + "\u0000\u00f3\u0001\u0000\u0000\u0000\u0000\u00f5\u0001\u0000\u0000\u0000"+ + "\u0000\u00f7\u0001\u0000\u0000\u0000\u0000\u00f9\u0001\u0000\u0000\u0000"+ + "\u0000\u00fb\u0001\u0000\u0000\u0000\u0000\u00fd\u0001\u0000\u0000\u0000"+ + "\u0000\u00ff\u0001\u0000\u0000\u0000\u0001\u010f\u0001\u0000\u0000\u0000"+ + "\u0003\u0118\u0001\u0000\u0000\u0000\u0005\u011f\u0001\u0000\u0000\u0000"+ + "\u0007\u0127\u0001\u0000\u0000\u0000\t\u012d\u0001\u0000\u0000\u0000\u000b"+ + "\u0132\u0001\u0000\u0000\u0000\r\u0137\u0001\u0000\u0000\u0000\u000f\u013d"+ + "\u0001\u0000\u0000\u0000\u0011\u0142\u0001\u0000\u0000\u0000\u0013\u0148"+ + "\u0001\u0000\u0000\u0000\u0015\u014e\u0001\u0000\u0000\u0000\u0017\u0157"+ + "\u0001\u0000\u0000\u0000\u0019\u015f\u0001\u0000\u0000\u0000\u001b\u0162"+ + "\u0001\u0000\u0000\u0000\u001d\u0169\u0001\u0000\u0000\u0000\u001f\u016e"+ + "\u0001\u0000\u0000\u0000!\u0173\u0001\u0000\u0000\u0000#\u017b\u0001\u0000"+ + "\u0000\u0000%\u0181\u0001\u0000\u0000\u0000\'\u0189\u0001\u0000\u0000"+ + "\u0000)\u018f\u0001\u0000\u0000\u0000+\u0193\u0001\u0000\u0000\u0000-"+ + "\u0196\u0001\u0000\u0000\u0000/\u019b\u0001\u0000\u0000\u00001\u01a6\u0001"+ + "\u0000\u0000\u00003\u01ad\u0001\u0000\u0000\u00005\u01b8\u0001\u0000\u0000"+ + "\u00007\u01bc\u0001\u0000\u0000\u00009\u01c6\u0001\u0000\u0000\u0000;"+ + "\u01cb\u0001\u0000\u0000\u0000=\u01d2\u0001\u0000\u0000\u0000?\u01d6\u0001"+ + "\u0000\u0000\u0000A\u01de\u0001\u0000\u0000\u0000C\u01e6\u0001\u0000\u0000"+ + "\u0000E\u01f0\u0001\u0000\u0000\u0000G\u01f7\u0001\u0000\u0000\u0000I"+ + "\u01fe\u0001\u0000\u0000\u0000K\u0204\u0001\u0000\u0000\u0000M\u020b\u0001"+ + "\u0000\u0000\u0000O\u0214\u0001\u0000\u0000\u0000Q\u021a\u0001\u0000\u0000"+ + "\u0000S\u0221\u0001\u0000\u0000\u0000U\u022e\u0001\u0000\u0000\u0000W"+ + "\u0233\u0001\u0000\u0000\u0000Y\u0239\u0001\u0000\u0000\u0000[\u0240\u0001"+ + "\u0000\u0000\u0000]\u024a\u0001\u0000\u0000\u0000_\u024e\u0001\u0000\u0000"+ + "\u0000a\u0253\u0001\u0000\u0000\u0000c\u025c\u0001\u0000\u0000\u0000e"+ + "\u0262\u0001\u0000\u0000\u0000g\u0269\u0001\u0000\u0000\u0000i\u026e\u0001"+ + "\u0000\u0000\u0000k\u0277\u0001\u0000\u0000\u0000m\u027f\u0001\u0000\u0000"+ + "\u0000o\u0285\u0001\u0000\u0000\u0000q\u0288\u0001\u0000\u0000\u0000s"+ + "\u028d\u0001\u0000\u0000\u0000u\u0296\u0001\u0000\u0000\u0000w\u029b\u0001"+ + "\u0000\u0000\u0000y\u02a6\u0001\u0000\u0000\u0000{\u02aa\u0001\u0000\u0000"+ + "\u0000}\u02b0\u0001\u0000\u0000\u0000\u007f\u02b7\u0001\u0000\u0000\u0000"+ + "\u0081\u02be\u0001\u0000\u0000\u0000\u0083\u02c6\u0001\u0000\u0000\u0000"+ + "\u0085\u02de\u0001\u0000\u0000\u0000\u0087\u02e3\u0001\u0000\u0000\u0000"+ + "\u0089\u02f2\u0001\u0000\u0000\u0000\u008b\u0306\u0001\u0000\u0000\u0000"+ + "\u008d\u032c\u0001\u0000\u0000\u0000\u008f\u032e\u0001\u0000\u0000\u0000"+ + "\u0091\u034c\u0001\u0000\u0000\u0000\u0093\u034e\u0001\u0000\u0000\u0000"+ + "\u0095\u0355\u0001\u0000\u0000\u0000\u0097\u035f\u0001\u0000\u0000\u0000"+ + "\u0099\u0375\u0001\u0000\u0000\u0000\u009b\u037a\u0001\u0000\u0000\u0000"+ + "\u009d\u037c\u0001\u0000\u0000\u0000\u009f\u037e\u0001\u0000\u0000\u0000"+ + "\u00a1\u0380\u0001\u0000\u0000\u0000\u00a3\u0382\u0001\u0000\u0000\u0000"+ + "\u00a5\u0384\u0001\u0000\u0000\u0000\u00a7\u0386\u0001\u0000\u0000\u0000"+ + "\u00a9\u0388\u0001\u0000\u0000\u0000\u00ab\u038a\u0001\u0000\u0000\u0000"+ + "\u00ad\u038c\u0001\u0000\u0000\u0000\u00af\u038e\u0001\u0000\u0000\u0000"+ + "\u00b1\u0390\u0001\u0000\u0000\u0000\u00b3\u0392\u0001\u0000\u0000\u0000"+ + "\u00b5\u0394\u0001\u0000\u0000\u0000\u00b7\u0396\u0001\u0000\u0000\u0000"+ + "\u00b9\u0398\u0001\u0000\u0000\u0000\u00bb\u039a\u0001\u0000\u0000\u0000"+ + "\u00bd\u039d\u0001\u0000\u0000\u0000\u00bf\u03a0\u0001\u0000\u0000\u0000"+ + "\u00c1\u03a3\u0001\u0000\u0000\u0000\u00c3\u03a6\u0001\u0000\u0000\u0000"+ + "\u00c5\u03a9\u0001\u0000\u0000\u0000\u00c7\u03ac\u0001\u0000\u0000\u0000"+ + "\u00c9\u03af\u0001\u0000\u0000\u0000\u00cb\u03b2\u0001\u0000\u0000\u0000"+ + "\u00cd\u03b4\u0001\u0000\u0000\u0000\u00cf\u03b6\u0001\u0000\u0000\u0000"+ + "\u00d1\u03b8\u0001\u0000\u0000\u0000\u00d3\u03ba\u0001\u0000\u0000\u0000"+ + "\u00d5\u03bc\u0001\u0000\u0000\u0000\u00d7\u03be\u0001\u0000\u0000\u0000"+ + "\u00d9\u03c0\u0001\u0000\u0000\u0000\u00db\u03c2\u0001\u0000\u0000\u0000"+ + "\u00dd\u03c5\u0001\u0000\u0000\u0000\u00df\u03c8\u0001\u0000\u0000\u0000"+ + "\u00e1\u03cb\u0001\u0000\u0000\u0000\u00e3\u03ce\u0001\u0000\u0000\u0000"+ + "\u00e5\u03d1\u0001\u0000\u0000\u0000\u00e7\u03d4\u0001\u0000\u0000\u0000"+ + "\u00e9\u03d7\u0001\u0000\u0000\u0000\u00eb\u03da\u0001\u0000\u0000\u0000"+ + "\u00ed\u03de\u0001\u0000\u0000\u0000\u00ef\u03e2\u0001\u0000\u0000\u0000"+ + "\u00f1\u03e7\u0001\u0000\u0000\u0000\u00f3\u03ea\u0001\u0000\u0000\u0000"+ + "\u00f5\u03ed\u0001\u0000\u0000\u0000\u00f7\u03ef\u0001\u0000\u0000\u0000"+ + "\u00f9\u03f4\u0001\u0000\u0000\u0000\u00fb\u03fa\u0001\u0000\u0000\u0000"+ + "\u00fd\u0408\u0001\u0000\u0000\u0000\u00ff\u0413\u0001\u0000\u0000\u0000"+ + "\u0101\u041a\u0001\u0000\u0000\u0000\u0103\u0435\u0001\u0000\u0000\u0000"+ + "\u0105\u0437\u0001\u0000\u0000\u0000\u0107\u0442\u0001\u0000\u0000\u0000"+ + "\u0109\u0444\u0001\u0000\u0000\u0000\u010b\u0450\u0001\u0000\u0000\u0000"+ + "\u010d\u0456\u0001\u0000\u0000\u0000\u010f\u0110\u0005a\u0000\u0000\u0110"+ + "\u0111\u0005b\u0000\u0000\u0111\u0112\u0005s\u0000\u0000\u0112\u0113\u0005"+ + "t\u0000\u0000\u0113\u0114\u0005r\u0000\u0000\u0114\u0115\u0005a\u0000"+ + "\u0000\u0115\u0116\u0005c\u0000\u0000\u0116\u0117\u0005t\u0000\u0000\u0117"+ + "\u0002\u0001\u0000\u0000\u0000\u0118\u0119\u0005a\u0000\u0000\u0119\u011a"+ + "\u0005s\u0000\u0000\u011a\u011b\u0005s\u0000\u0000\u011b\u011c\u0005e"+ + "\u0000\u0000\u011c\u011d\u0005r\u0000\u0000\u011d\u011e\u0005t\u0000\u0000"+ + "\u011e\u0004\u0001\u0000\u0000\u0000\u011f\u0120\u0005b\u0000\u0000\u0120"+ + "\u0121\u0005o\u0000\u0000\u0121\u0122\u0005o\u0000\u0000\u0122\u0123\u0005"+ + "l\u0000\u0000\u0123\u0124\u0005e\u0000\u0000\u0124\u0125\u0005a\u0000"+ + "\u0000\u0125\u0126\u0005n\u0000\u0000\u0126\u0006\u0001\u0000\u0000\u0000"+ + "\u0127\u0128\u0005b\u0000\u0000\u0128\u0129\u0005r\u0000\u0000\u0129\u012a"+ + "\u0005e\u0000\u0000\u012a\u012b\u0005a\u0000\u0000\u012b\u012c\u0005k"+ + "\u0000\u0000\u012c\b\u0001\u0000\u0000\u0000\u012d\u012e\u0005b\u0000"+ + "\u0000\u012e\u012f\u0005y\u0000\u0000\u012f\u0130\u0005t\u0000\u0000\u0130"+ + "\u0131\u0005e\u0000\u0000\u0131\n\u0001\u0000\u0000\u0000\u0132\u0133"+ + "\u0005c\u0000\u0000\u0133\u0134\u0005a\u0000\u0000\u0134\u0135\u0005s"+ + "\u0000\u0000\u0135\u0136\u0005e\u0000\u0000\u0136\f\u0001\u0000\u0000"+ + "\u0000\u0137\u0138\u0005c\u0000\u0000\u0138\u0139\u0005a\u0000\u0000\u0139"+ + "\u013a\u0005t\u0000\u0000\u013a\u013b\u0005c\u0000\u0000\u013b\u013c\u0005"+ + "h\u0000\u0000\u013c\u000e\u0001\u0000\u0000\u0000\u013d\u013e\u0005c\u0000"+ + "\u0000\u013e\u013f\u0005h\u0000\u0000\u013f\u0140\u0005a\u0000\u0000\u0140"+ + "\u0141\u0005r\u0000\u0000\u0141\u0010\u0001\u0000\u0000\u0000\u0142\u0143"+ + "\u0005c\u0000\u0000\u0143\u0144\u0005l\u0000\u0000\u0144\u0145\u0005a"+ + "\u0000\u0000\u0145\u0146\u0005s\u0000\u0000\u0146\u0147\u0005s\u0000\u0000"+ + "\u0147\u0012\u0001\u0000\u0000\u0000\u0148\u0149\u0005c\u0000\u0000\u0149"+ + "\u014a\u0005o\u0000\u0000\u014a\u014b\u0005n\u0000\u0000\u014b\u014c\u0005"+ + "s\u0000\u0000\u014c\u014d\u0005t\u0000\u0000\u014d\u0014\u0001\u0000\u0000"+ + "\u0000\u014e\u014f\u0005c\u0000\u0000\u014f\u0150\u0005o\u0000\u0000\u0150"+ + "\u0151\u0005n\u0000\u0000\u0151\u0152\u0005t\u0000\u0000\u0152\u0153\u0005"+ + "i\u0000\u0000\u0153\u0154\u0005n\u0000\u0000\u0154\u0155\u0005u\u0000"+ + "\u0000\u0155\u0156\u0005e\u0000\u0000\u0156\u0016\u0001\u0000\u0000\u0000"+ + "\u0157\u0158\u0005d\u0000\u0000\u0158\u0159\u0005e\u0000\u0000\u0159\u015a"+ + "\u0005f\u0000\u0000\u015a\u015b\u0005a\u0000\u0000\u015b\u015c\u0005u"+ + "\u0000\u0000\u015c\u015d\u0005l\u0000\u0000\u015d\u015e\u0005t\u0000\u0000"+ + "\u015e\u0018\u0001\u0000\u0000\u0000\u015f\u0160\u0005d\u0000\u0000\u0160"+ + "\u0161\u0005o\u0000\u0000\u0161\u001a\u0001\u0000\u0000\u0000\u0162\u0163"+ + "\u0005d\u0000\u0000\u0163\u0164\u0005o\u0000\u0000\u0164\u0165\u0005u"+ + "\u0000\u0000\u0165\u0166\u0005b\u0000\u0000\u0166\u0167\u0005l\u0000\u0000"+ + "\u0167\u0168\u0005e\u0000\u0000\u0168\u001c\u0001\u0000\u0000\u0000\u0169"+ + "\u016a\u0005e\u0000\u0000\u016a\u016b\u0005l\u0000\u0000\u016b\u016c\u0005"+ + "s\u0000\u0000\u016c\u016d\u0005e\u0000\u0000\u016d\u001e\u0001\u0000\u0000"+ + "\u0000\u016e\u016f\u0005e\u0000\u0000\u016f\u0170\u0005n\u0000\u0000\u0170"+ + "\u0171\u0005u\u0000\u0000\u0171\u0172\u0005m\u0000\u0000\u0172 \u0001"+ + "\u0000\u0000\u0000\u0173\u0174\u0005e\u0000\u0000\u0174\u0175\u0005x\u0000"+ + "\u0000\u0175\u0176\u0005t\u0000\u0000\u0176\u0177\u0005e\u0000\u0000\u0177"+ + "\u0178\u0005n\u0000\u0000\u0178\u0179\u0005d\u0000\u0000\u0179\u017a\u0005"+ + "s\u0000\u0000\u017a\"\u0001\u0000\u0000\u0000\u017b\u017c\u0005f\u0000"+ + "\u0000\u017c\u017d\u0005i\u0000\u0000\u017d\u017e\u0005n\u0000\u0000\u017e"+ + "\u017f\u0005a\u0000\u0000\u017f\u0180\u0005l\u0000\u0000\u0180$\u0001"+ + "\u0000\u0000\u0000\u0181\u0182\u0005f\u0000\u0000\u0182\u0183\u0005i\u0000"+ + "\u0000\u0183\u0184\u0005n\u0000\u0000\u0184\u0185\u0005a\u0000\u0000\u0185"+ + "\u0186\u0005l\u0000\u0000\u0186\u0187\u0005l\u0000\u0000\u0187\u0188\u0005"+ + "y\u0000\u0000\u0188&\u0001\u0000\u0000\u0000\u0189\u018a\u0005f\u0000"+ + "\u0000\u018a\u018b\u0005l\u0000\u0000\u018b\u018c\u0005o\u0000\u0000\u018c"+ + "\u018d\u0005a\u0000\u0000\u018d\u018e\u0005t\u0000\u0000\u018e(\u0001"+ + "\u0000\u0000\u0000\u018f\u0190\u0005f\u0000\u0000\u0190\u0191\u0005o\u0000"+ + "\u0000\u0191\u0192\u0005r\u0000\u0000\u0192*\u0001\u0000\u0000\u0000\u0193"+ + "\u0194\u0005i\u0000\u0000\u0194\u0195\u0005f\u0000\u0000\u0195,\u0001"+ + "\u0000\u0000\u0000\u0196\u0197\u0005g\u0000\u0000\u0197\u0198\u0005o\u0000"+ + "\u0000\u0198\u0199\u0005t\u0000\u0000\u0199\u019a\u0005o\u0000\u0000\u019a"+ + ".\u0001\u0000\u0000\u0000\u019b\u019c\u0005i\u0000\u0000\u019c\u019d\u0005"+ + "m\u0000\u0000\u019d\u019e\u0005p\u0000\u0000\u019e\u019f\u0005l\u0000"+ + "\u0000\u019f\u01a0\u0005e\u0000\u0000\u01a0\u01a1\u0005m\u0000\u0000\u01a1"+ + "\u01a2\u0005e\u0000\u0000\u01a2\u01a3\u0005n\u0000\u0000\u01a3\u01a4\u0005"+ + "t\u0000\u0000\u01a4\u01a5\u0005s\u0000\u0000\u01a50\u0001\u0000\u0000"+ + "\u0000\u01a6\u01a7\u0005i\u0000\u0000\u01a7\u01a8\u0005m\u0000\u0000\u01a8"+ + "\u01a9\u0005p\u0000\u0000\u01a9\u01aa\u0005o\u0000\u0000\u01aa\u01ab\u0005"+ + "r\u0000\u0000\u01ab\u01ac\u0005t\u0000\u0000\u01ac2\u0001\u0000\u0000"+ + "\u0000\u01ad\u01ae\u0005i\u0000\u0000\u01ae\u01af\u0005n\u0000\u0000\u01af"+ + "\u01b0\u0005s\u0000\u0000\u01b0\u01b1\u0005t\u0000\u0000\u01b1\u01b2\u0005"+ + "a\u0000\u0000\u01b2\u01b3\u0005n\u0000\u0000\u01b3\u01b4\u0005c\u0000"+ + "\u0000\u01b4\u01b5\u0005e\u0000\u0000\u01b5\u01b6\u0005o\u0000\u0000\u01b6"+ + "\u01b7\u0005f\u0000\u0000\u01b74\u0001\u0000\u0000\u0000\u01b8\u01b9\u0005"+ + "i\u0000\u0000\u01b9\u01ba\u0005n\u0000\u0000\u01ba\u01bb\u0005t\u0000"+ + "\u0000\u01bb6\u0001\u0000\u0000\u0000\u01bc\u01bd\u0005i\u0000\u0000\u01bd"+ + "\u01be\u0005n\u0000\u0000\u01be\u01bf\u0005t\u0000\u0000\u01bf\u01c0\u0005"+ + "e\u0000\u0000\u01c0\u01c1\u0005r\u0000\u0000\u01c1\u01c2\u0005f\u0000"+ + "\u0000\u01c2\u01c3\u0005a\u0000\u0000\u01c3\u01c4\u0005c\u0000\u0000\u01c4"+ + "\u01c5\u0005e\u0000\u0000\u01c58\u0001\u0000\u0000\u0000\u01c6\u01c7\u0005"+ + "l\u0000\u0000\u01c7\u01c8\u0005o\u0000\u0000\u01c8\u01c9\u0005n\u0000"+ + "\u0000\u01c9\u01ca\u0005g\u0000\u0000\u01ca:\u0001\u0000\u0000\u0000\u01cb"+ + "\u01cc\u0005n\u0000\u0000\u01cc\u01cd\u0005a\u0000\u0000\u01cd\u01ce\u0005"+ + "t\u0000\u0000\u01ce\u01cf\u0005i\u0000\u0000\u01cf\u01d0\u0005v\u0000"+ + "\u0000\u01d0\u01d1\u0005e\u0000\u0000\u01d1<\u0001\u0000\u0000\u0000\u01d2"+ + "\u01d3\u0005n\u0000\u0000\u01d3\u01d4\u0005e\u0000\u0000\u01d4\u01d5\u0005"+ + "w\u0000\u0000\u01d5>\u0001\u0000\u0000\u0000\u01d6\u01d7\u0005p\u0000"+ + "\u0000\u01d7\u01d8\u0005a\u0000\u0000\u01d8\u01d9\u0005c\u0000\u0000\u01d9"+ + "\u01da\u0005k\u0000\u0000\u01da\u01db\u0005a\u0000\u0000\u01db\u01dc\u0005"+ + "g\u0000\u0000\u01dc\u01dd\u0005e\u0000\u0000\u01dd@\u0001\u0000\u0000"+ + "\u0000\u01de\u01df\u0005p\u0000\u0000\u01df\u01e0\u0005r\u0000\u0000\u01e0"+ + "\u01e1\u0005i\u0000\u0000\u01e1\u01e2\u0005v\u0000\u0000\u01e2\u01e3\u0005"+ + "a\u0000\u0000\u01e3\u01e4\u0005t\u0000\u0000\u01e4\u01e5\u0005e\u0000"+ + "\u0000\u01e5B\u0001\u0000\u0000\u0000\u01e6\u01e7\u0005p\u0000\u0000\u01e7"+ + "\u01e8\u0005r\u0000\u0000\u01e8\u01e9\u0005o\u0000\u0000\u01e9\u01ea\u0005"+ + "t\u0000\u0000\u01ea\u01eb\u0005e\u0000\u0000\u01eb\u01ec\u0005c\u0000"+ + "\u0000\u01ec\u01ed\u0005t\u0000\u0000\u01ed\u01ee\u0005e\u0000\u0000\u01ee"+ + "\u01ef\u0005d\u0000\u0000\u01efD\u0001\u0000\u0000\u0000\u01f0\u01f1\u0005"+ + "p\u0000\u0000\u01f1\u01f2\u0005u\u0000\u0000\u01f2\u01f3\u0005b\u0000"+ + "\u0000\u01f3\u01f4\u0005l\u0000\u0000\u01f4\u01f5\u0005i\u0000\u0000\u01f5"+ + "\u01f6\u0005c\u0000\u0000\u01f6F\u0001\u0000\u0000\u0000\u01f7\u01f8\u0005"+ + "r\u0000\u0000\u01f8\u01f9\u0005e\u0000\u0000\u01f9\u01fa\u0005t\u0000"+ + "\u0000\u01fa\u01fb\u0005u\u0000\u0000\u01fb\u01fc\u0005r\u0000\u0000\u01fc"+ + "\u01fd\u0005n\u0000\u0000\u01fdH\u0001\u0000\u0000\u0000\u01fe\u01ff\u0005"+ + "s\u0000\u0000\u01ff\u0200\u0005h\u0000\u0000\u0200\u0201\u0005o\u0000"+ + "\u0000\u0201\u0202\u0005r\u0000\u0000\u0202\u0203\u0005t\u0000\u0000\u0203"+ + "J\u0001\u0000\u0000\u0000\u0204\u0205\u0005s\u0000\u0000\u0205\u0206\u0005"+ + "t\u0000\u0000\u0206\u0207\u0005a\u0000\u0000\u0207\u0208\u0005t\u0000"+ + "\u0000\u0208\u0209\u0005i\u0000\u0000\u0209\u020a\u0005c\u0000\u0000\u020a"+ + "L\u0001\u0000\u0000\u0000\u020b\u020c\u0005s\u0000\u0000\u020c\u020d\u0005"+ + "t\u0000\u0000\u020d\u020e\u0005r\u0000\u0000\u020e\u020f\u0005i\u0000"+ + "\u0000\u020f\u0210\u0005c\u0000\u0000\u0210\u0211\u0005t\u0000\u0000\u0211"+ + "\u0212\u0005f\u0000\u0000\u0212\u0213\u0005p\u0000\u0000\u0213N\u0001"+ + "\u0000\u0000\u0000\u0214\u0215\u0005s\u0000\u0000\u0215\u0216\u0005u\u0000"+ + "\u0000\u0216\u0217\u0005p\u0000\u0000\u0217\u0218\u0005e\u0000\u0000\u0218"+ + "\u0219\u0005r\u0000\u0000\u0219P\u0001\u0000\u0000\u0000\u021a\u021b\u0005"+ + "s\u0000\u0000\u021b\u021c\u0005w\u0000\u0000\u021c\u021d\u0005i\u0000"+ + "\u0000\u021d\u021e\u0005t\u0000\u0000\u021e\u021f\u0005c\u0000\u0000\u021f"+ + "\u0220\u0005h\u0000\u0000\u0220R\u0001\u0000\u0000\u0000\u0221\u0222\u0005"+ + "s\u0000\u0000\u0222\u0223\u0005y\u0000\u0000\u0223\u0224\u0005n\u0000"+ + "\u0000\u0224\u0225\u0005c\u0000\u0000\u0225\u0226\u0005h\u0000\u0000\u0226"+ + "\u0227\u0005r\u0000\u0000\u0227\u0228\u0005o\u0000\u0000\u0228\u0229\u0005"+ + "n\u0000\u0000\u0229\u022a\u0005i\u0000\u0000\u022a\u022b\u0005z\u0000"+ + "\u0000\u022b\u022c\u0005e\u0000\u0000\u022c\u022d\u0005d\u0000\u0000\u022d"+ + "T\u0001\u0000\u0000\u0000\u022e\u022f\u0005t\u0000\u0000\u022f\u0230\u0005"+ + "h\u0000\u0000\u0230\u0231\u0005i\u0000\u0000\u0231\u0232\u0005s\u0000"+ + "\u0000\u0232V\u0001\u0000\u0000\u0000\u0233\u0234\u0005t\u0000\u0000\u0234"+ + "\u0235\u0005h\u0000\u0000\u0235\u0236\u0005r\u0000\u0000\u0236\u0237\u0005"+ + "o\u0000\u0000\u0237\u0238\u0005w\u0000\u0000\u0238X\u0001\u0000\u0000"+ + "\u0000\u0239\u023a\u0005t\u0000\u0000\u023a\u023b\u0005h\u0000\u0000\u023b"+ + "\u023c\u0005r\u0000\u0000\u023c\u023d\u0005o\u0000\u0000\u023d\u023e\u0005"+ + "w\u0000\u0000\u023e\u023f\u0005s\u0000\u0000\u023fZ\u0001\u0000\u0000"+ + "\u0000\u0240\u0241\u0005t\u0000\u0000\u0241\u0242\u0005r\u0000\u0000\u0242"+ + "\u0243\u0005a\u0000\u0000\u0243\u0244\u0005n\u0000\u0000\u0244\u0245\u0005"+ + "s\u0000\u0000\u0245\u0246\u0005i\u0000\u0000\u0246\u0247\u0005e\u0000"+ + "\u0000\u0247\u0248\u0005n\u0000\u0000\u0248\u0249\u0005t\u0000\u0000\u0249"+ + "\\\u0001\u0000\u0000\u0000\u024a\u024b\u0005t\u0000\u0000\u024b\u024c"+ + "\u0005r\u0000\u0000\u024c\u024d\u0005y\u0000\u0000\u024d^\u0001\u0000"+ + "\u0000\u0000\u024e\u024f\u0005v\u0000\u0000\u024f\u0250\u0005o\u0000\u0000"+ + "\u0250\u0251\u0005i\u0000\u0000\u0251\u0252\u0005d\u0000\u0000\u0252`"+ + "\u0001\u0000\u0000\u0000\u0253\u0254\u0005v\u0000\u0000\u0254\u0255\u0005"+ + "o\u0000\u0000\u0255\u0256\u0005l\u0000\u0000\u0256\u0257\u0005a\u0000"+ + "\u0000\u0257\u0258\u0005t\u0000\u0000\u0258\u0259\u0005i\u0000\u0000\u0259"+ + "\u025a\u0005l\u0000\u0000\u025a\u025b\u0005e\u0000\u0000\u025bb\u0001"+ + "\u0000\u0000\u0000\u025c\u025d\u0005w\u0000\u0000\u025d\u025e\u0005h\u0000"+ + "\u0000\u025e\u025f\u0005i\u0000\u0000\u025f\u0260\u0005l\u0000\u0000\u0260"+ + "\u0261\u0005e\u0000\u0000\u0261d\u0001\u0000\u0000\u0000\u0262\u0263\u0005"+ + "m\u0000\u0000\u0263\u0264\u0005o\u0000\u0000\u0264\u0265\u0005d\u0000"+ + "\u0000\u0265\u0266\u0005u\u0000\u0000\u0266\u0267\u0005l\u0000\u0000\u0267"+ + "\u0268\u0005e\u0000\u0000\u0268f\u0001\u0000\u0000\u0000\u0269\u026a\u0005"+ + "o\u0000\u0000\u026a\u026b\u0005p\u0000\u0000\u026b\u026c\u0005e\u0000"+ + "\u0000\u026c\u026d\u0005n\u0000\u0000\u026dh\u0001\u0000\u0000\u0000\u026e"+ + "\u026f\u0005r\u0000\u0000\u026f\u0270\u0005e\u0000\u0000\u0270\u0271\u0005"+ + "q\u0000\u0000\u0271\u0272\u0005u\u0000\u0000\u0272\u0273\u0005i\u0000"+ + "\u0000\u0273\u0274\u0005r\u0000\u0000\u0274\u0275\u0005e\u0000\u0000\u0275"+ + "\u0276\u0005s\u0000\u0000\u0276j\u0001\u0000\u0000\u0000\u0277\u0278\u0005"+ + "e\u0000\u0000\u0278\u0279\u0005x\u0000\u0000\u0279\u027a\u0005p\u0000"+ + "\u0000\u027a\u027b\u0005o\u0000\u0000\u027b\u027c\u0005r\u0000\u0000\u027c"+ + "\u027d\u0005t\u0000\u0000\u027d\u027e\u0005s\u0000\u0000\u027el\u0001"+ + "\u0000\u0000\u0000\u027f\u0280\u0005o\u0000\u0000\u0280\u0281\u0005p\u0000"+ + "\u0000\u0281\u0282\u0005e\u0000\u0000\u0282\u0283\u0005n\u0000\u0000\u0283"+ + "\u0284\u0005s\u0000\u0000\u0284n\u0001\u0000\u0000\u0000\u0285\u0286\u0005"+ + "t\u0000\u0000\u0286\u0287\u0005o\u0000\u0000\u0287p\u0001\u0000\u0000"+ + "\u0000\u0288\u0289\u0005u\u0000\u0000\u0289\u028a\u0005s\u0000\u0000\u028a"+ + "\u028b\u0005e\u0000\u0000\u028b\u028c\u0005s\u0000\u0000\u028cr\u0001"+ + "\u0000\u0000\u0000\u028d\u028e\u0005p\u0000\u0000\u028e\u028f\u0005r\u0000"+ + "\u0000\u028f\u0290\u0005o\u0000\u0000\u0290\u0291\u0005v\u0000\u0000\u0291"+ + "\u0292\u0005i\u0000\u0000\u0292\u0293\u0005d\u0000\u0000\u0293\u0294\u0005"+ + "e\u0000\u0000\u0294\u0295\u0005s\u0000\u0000\u0295t\u0001\u0000\u0000"+ + "\u0000\u0296\u0297\u0005w\u0000\u0000\u0297\u0298\u0005i\u0000\u0000\u0298"+ + "\u0299\u0005t\u0000\u0000\u0299\u029a\u0005h\u0000\u0000\u029av\u0001"+ + "\u0000\u0000\u0000\u029b\u029c\u0005t\u0000\u0000\u029c\u029d\u0005r\u0000"+ + "\u0000\u029d\u029e\u0005a\u0000\u0000\u029e\u029f\u0005n\u0000\u0000\u029f"+ + "\u02a0\u0005s\u0000\u0000\u02a0\u02a1\u0005i\u0000\u0000\u02a1\u02a2\u0005"+ + "t\u0000\u0000\u02a2\u02a3\u0005i\u0000\u0000\u02a3\u02a4\u0005v\u0000"+ + "\u0000\u02a4\u02a5\u0005e\u0000\u0000\u02a5x\u0001\u0000\u0000\u0000\u02a6"+ + "\u02a7\u0005v\u0000\u0000\u02a7\u02a8\u0005a\u0000\u0000\u02a8\u02a9\u0005"+ + "r\u0000\u0000\u02a9z\u0001\u0000\u0000\u0000\u02aa\u02ab\u0005y\u0000"+ + "\u0000\u02ab\u02ac\u0005i\u0000\u0000\u02ac\u02ad\u0005e\u0000\u0000\u02ad"+ + "\u02ae\u0005l\u0000\u0000\u02ae\u02af\u0005d\u0000\u0000\u02af|\u0001"+ + "\u0000\u0000\u0000\u02b0\u02b1\u0005r\u0000\u0000\u02b1\u02b2\u0005e\u0000"+ + "\u0000\u02b2\u02b3\u0005c\u0000\u0000\u02b3\u02b4\u0005o\u0000\u0000\u02b4"+ + "\u02b5\u0005r\u0000\u0000\u02b5\u02b6\u0005d\u0000\u0000\u02b6~\u0001"+ + "\u0000\u0000\u0000\u02b7\u02b8\u0005s\u0000\u0000\u02b8\u02b9\u0005e\u0000"+ + "\u0000\u02b9\u02ba\u0005a\u0000\u0000\u02ba\u02bb\u0005l\u0000\u0000\u02bb"+ + "\u02bc\u0005e\u0000\u0000\u02bc\u02bd\u0005d\u0000\u0000\u02bd\u0080\u0001"+ + "\u0000\u0000\u0000\u02be\u02bf\u0005p\u0000\u0000\u02bf\u02c0\u0005e\u0000"+ + "\u0000\u02c0\u02c1\u0005r\u0000\u0000\u02c1\u02c2\u0005m\u0000\u0000\u02c2"+ + "\u02c3\u0005i\u0000\u0000\u02c3\u02c4\u0005t\u0000\u0000\u02c4\u02c5\u0005"+ + "s\u0000\u0000\u02c5\u0082\u0001\u0000\u0000\u0000\u02c6\u02c7\u0005n\u0000"+ + "\u0000\u02c7\u02c8\u0005o\u0000\u0000\u02c8\u02c9\u0005n\u0000\u0000\u02c9"+ + "\u02ca\u0005-\u0000\u0000\u02ca\u02cb\u0005s\u0000\u0000\u02cb\u02cc\u0005"+ + "e\u0000\u0000\u02cc\u02cd\u0005a\u0000\u0000\u02cd\u02ce\u0005l\u0000"+ + "\u0000\u02ce\u02cf\u0005e\u0000\u0000\u02cf\u02d0\u0005d\u0000\u0000\u02d0"+ + "\u0084\u0001\u0000\u0000\u0000\u02d1\u02df\u00050\u0000\u0000\u02d2\u02dc"+ + "\u0007\u0000\u0000\u0000\u02d3\u02d5\u0003\u0109\u0084\u0000\u02d4\u02d3"+ + "\u0001\u0000\u0000\u0000\u02d4\u02d5\u0001\u0000\u0000\u0000\u02d5\u02dd"+ + "\u0001\u0000\u0000\u0000\u02d6\u02d8\u0005_\u0000\u0000\u02d7\u02d6\u0001"+ + "\u0000\u0000\u0000\u02d8\u02d9\u0001\u0000\u0000\u0000\u02d9\u02d7\u0001"+ + "\u0000\u0000\u0000\u02d9\u02da\u0001\u0000\u0000\u0000\u02da\u02db\u0001"+ + "\u0000\u0000\u0000\u02db\u02dd\u0003\u0109\u0084\u0000\u02dc\u02d4\u0001"+ + "\u0000\u0000\u0000\u02dc\u02d7\u0001\u0000\u0000\u0000\u02dd\u02df\u0001"+ + "\u0000\u0000\u0000\u02de\u02d1\u0001\u0000\u0000\u0000\u02de\u02d2\u0001"+ + "\u0000\u0000\u0000\u02df\u02e1\u0001\u0000\u0000\u0000\u02e0\u02e2\u0007"+ + "\u0001\u0000\u0000\u02e1\u02e0\u0001\u0000\u0000\u0000\u02e1\u02e2\u0001"+ + "\u0000\u0000\u0000\u02e2\u0086\u0001\u0000\u0000\u0000\u02e3\u02e4\u0005"+ + "0\u0000\u0000\u02e4\u02e5\u0007\u0002\u0000\u0000\u02e5\u02ed\u0007\u0003"+ + "\u0000\u0000\u02e6\u02e8\u0007\u0004\u0000\u0000\u02e7\u02e6\u0001\u0000"+ + "\u0000\u0000\u02e8\u02eb\u0001\u0000\u0000\u0000\u02e9\u02e7\u0001\u0000"+ + "\u0000\u0000\u02e9\u02ea\u0001\u0000\u0000\u0000\u02ea\u02ec\u0001\u0000"+ + "\u0000\u0000\u02eb\u02e9\u0001\u0000\u0000\u0000\u02ec\u02ee\u0007\u0003"+ + "\u0000\u0000\u02ed\u02e9\u0001\u0000\u0000\u0000\u02ed\u02ee\u0001\u0000"+ + "\u0000\u0000\u02ee\u02f0\u0001\u0000\u0000\u0000\u02ef\u02f1\u0007\u0001"+ + "\u0000\u0000\u02f0\u02ef\u0001\u0000\u0000\u0000\u02f0\u02f1\u0001\u0000"+ + "\u0000\u0000\u02f1\u0088\u0001\u0000\u0000\u0000\u02f2\u02f6\u00050\u0000"+ + "\u0000\u02f3\u02f5\u0005_\u0000\u0000\u02f4\u02f3\u0001\u0000\u0000\u0000"+ + "\u02f5\u02f8\u0001\u0000\u0000\u0000\u02f6\u02f4\u0001\u0000\u0000\u0000"+ + "\u02f6\u02f7\u0001\u0000\u0000\u0000\u02f7\u02f9\u0001\u0000\u0000\u0000"+ + "\u02f8\u02f6\u0001\u0000\u0000\u0000\u02f9\u0301\u0007\u0005\u0000\u0000"+ + "\u02fa\u02fc\u0007\u0006\u0000\u0000\u02fb\u02fa\u0001\u0000\u0000\u0000"+ + "\u02fc\u02ff\u0001\u0000\u0000\u0000\u02fd\u02fb\u0001\u0000\u0000\u0000"+ + "\u02fd\u02fe\u0001\u0000\u0000\u0000\u02fe\u0300\u0001\u0000\u0000\u0000"+ + "\u02ff\u02fd\u0001\u0000\u0000\u0000\u0300\u0302\u0007\u0005\u0000\u0000"+ + "\u0301\u02fd\u0001\u0000\u0000\u0000\u0301\u0302\u0001\u0000\u0000\u0000"+ + "\u0302\u0304\u0001\u0000\u0000\u0000\u0303\u0305\u0007\u0001\u0000\u0000"+ + "\u0304\u0303\u0001\u0000\u0000\u0000\u0304\u0305\u0001\u0000\u0000\u0000"+ + "\u0305\u008a\u0001\u0000\u0000\u0000\u0306\u0307\u00050\u0000\u0000\u0307"+ + "\u0308\u0007\u0007\u0000\u0000\u0308\u0310\u0007\b\u0000\u0000\u0309\u030b"+ + "\u0007\t\u0000\u0000\u030a\u0309\u0001\u0000\u0000\u0000\u030b\u030e\u0001"+ + "\u0000\u0000\u0000\u030c\u030a\u0001\u0000\u0000\u0000\u030c\u030d\u0001"+ + "\u0000\u0000\u0000\u030d\u030f\u0001\u0000\u0000\u0000\u030e\u030c\u0001"+ + "\u0000\u0000\u0000\u030f\u0311\u0007\b\u0000\u0000\u0310\u030c\u0001\u0000"+ + "\u0000\u0000\u0310\u0311\u0001\u0000\u0000\u0000\u0311\u0313\u0001\u0000"+ + "\u0000\u0000\u0312\u0314\u0007\u0001\u0000\u0000\u0313\u0312\u0001\u0000"+ + "\u0000\u0000\u0313\u0314\u0001\u0000\u0000\u0000\u0314\u008c\u0001\u0000"+ + "\u0000\u0000\u0315\u0316\u0003\u0109\u0084\u0000\u0316\u0318\u0005.\u0000"+ + "\u0000\u0317\u0319\u0003\u0109\u0084\u0000\u0318\u0317\u0001\u0000\u0000"+ + "\u0000\u0318\u0319\u0001\u0000\u0000\u0000\u0319\u031d\u0001\u0000\u0000"+ + "\u0000\u031a\u031b\u0005.\u0000\u0000\u031b\u031d\u0003\u0109\u0084\u0000"+ + "\u031c\u0315\u0001\u0000\u0000\u0000\u031c\u031a\u0001\u0000\u0000\u0000"+ + "\u031d\u031f\u0001\u0000\u0000\u0000\u031e\u0320\u0003\u0101\u0080\u0000"+ + "\u031f\u031e\u0001\u0000\u0000\u0000\u031f\u0320\u0001\u0000\u0000\u0000"+ + "\u0320\u0322\u0001\u0000\u0000\u0000\u0321\u0323\u0007\n\u0000\u0000\u0322"+ + "\u0321\u0001\u0000\u0000\u0000\u0322\u0323\u0001\u0000\u0000\u0000\u0323"+ + "\u032d\u0001\u0000\u0000\u0000\u0324\u032a\u0003\u0109\u0084\u0000\u0325"+ + "\u0327\u0003\u0101\u0080\u0000\u0326\u0328\u0007\n\u0000\u0000\u0327\u0326"+ + "\u0001\u0000\u0000\u0000\u0327\u0328\u0001\u0000\u0000\u0000\u0328\u032b"+ + "\u0001\u0000\u0000\u0000\u0329\u032b\u0007\n\u0000\u0000\u032a\u0325\u0001"+ + "\u0000\u0000\u0000\u032a\u0329\u0001\u0000\u0000\u0000\u032b\u032d\u0001"+ + "\u0000\u0000\u0000\u032c\u031c\u0001\u0000\u0000\u0000\u032c\u0324\u0001"+ + "\u0000\u0000\u0000\u032d\u008e\u0001\u0000\u0000\u0000\u032e\u032f\u0005"+ + "0\u0000\u0000\u032f\u0339\u0007\u0002\u0000\u0000\u0330\u0332\u0003\u0105"+ + "\u0082\u0000\u0331\u0333\u0005.\u0000\u0000\u0332\u0331\u0001\u0000\u0000"+ + "\u0000\u0332\u0333\u0001\u0000\u0000\u0000\u0333\u033a\u0001\u0000\u0000"+ + "\u0000\u0334\u0336\u0003\u0105\u0082\u0000\u0335\u0334\u0001\u0000\u0000"+ + "\u0000\u0335\u0336\u0001\u0000\u0000\u0000\u0336\u0337\u0001\u0000\u0000"+ + "\u0000\u0337\u0338\u0005.\u0000\u0000\u0338\u033a\u0003\u0105\u0082\u0000"+ + "\u0339\u0330\u0001\u0000\u0000\u0000\u0339\u0335\u0001\u0000\u0000\u0000"+ + "\u033a\u033b\u0001\u0000\u0000\u0000\u033b\u033d\u0007\u000b\u0000\u0000"+ + "\u033c\u033e\u0007\f\u0000\u0000\u033d\u033c\u0001\u0000\u0000\u0000\u033d"+ + "\u033e\u0001\u0000\u0000\u0000\u033e\u033f\u0001\u0000\u0000\u0000\u033f"+ + "\u0341\u0003\u0109\u0084\u0000\u0340\u0342\u0007\n\u0000\u0000\u0341\u0340"+ + "\u0001\u0000\u0000\u0000\u0341\u0342\u0001\u0000\u0000\u0000\u0342\u0090"+ + "\u0001\u0000\u0000\u0000\u0343\u0344\u0005t\u0000\u0000\u0344\u0345\u0005"+ + "r\u0000\u0000\u0345\u0346\u0005u\u0000\u0000\u0346\u034d\u0005e\u0000"+ + "\u0000\u0347\u0348\u0005f\u0000\u0000\u0348\u0349\u0005a\u0000\u0000\u0349"+ + "\u034a\u0005l\u0000\u0000\u034a\u034b\u0005s\u0000\u0000\u034b\u034d\u0005"+ + "e\u0000\u0000\u034c\u0343\u0001\u0000\u0000\u0000\u034c\u0347\u0001\u0000"+ + "\u0000\u0000\u034d\u0092\u0001\u0000\u0000\u0000\u034e\u0351\u0005\'\u0000"+ + "\u0000\u034f\u0352\b\r\u0000\u0000\u0350\u0352\u0003\u0103\u0081\u0000"+ + "\u0351\u034f\u0001\u0000\u0000\u0000\u0351\u0350\u0001\u0000\u0000\u0000"+ + "\u0352\u0353\u0001\u0000\u0000\u0000\u0353\u0354\u0005\'\u0000\u0000\u0354"+ + "\u0094\u0001\u0000\u0000\u0000\u0355\u035a\u0005\"\u0000\u0000\u0356\u0359"+ + "\b\u000e\u0000\u0000\u0357\u0359\u0003\u0103\u0081\u0000\u0358\u0356\u0001"+ + "\u0000\u0000\u0000\u0358\u0357\u0001\u0000\u0000\u0000\u0359\u035c\u0001"+ + "\u0000\u0000\u0000\u035a\u0358\u0001\u0000\u0000\u0000\u035a\u035b\u0001"+ + "\u0000\u0000\u0000\u035b\u035d\u0001\u0000\u0000\u0000\u035c\u035a\u0001"+ + "\u0000\u0000\u0000\u035d\u035e\u0005\"\u0000\u0000\u035e\u0096\u0001\u0000"+ + "\u0000\u0000\u035f\u0360\u0005\"\u0000\u0000\u0360\u0361\u0005\"\u0000"+ + "\u0000\u0361\u0362\u0005\"\u0000\u0000\u0362\u0366\u0001\u0000\u0000\u0000"+ + "\u0363\u0365\u0007\u000f\u0000\u0000\u0364\u0363\u0001\u0000\u0000\u0000"+ + "\u0365\u0368\u0001\u0000\u0000\u0000\u0366\u0364\u0001\u0000\u0000\u0000"+ + "\u0366\u0367\u0001\u0000\u0000\u0000\u0367\u0369\u0001\u0000\u0000\u0000"+ + "\u0368\u0366\u0001\u0000\u0000\u0000\u0369\u036e\u0007\u0010\u0000\u0000"+ + "\u036a\u036d\t\u0000\u0000\u0000\u036b\u036d\u0003\u0103\u0081\u0000\u036c"+ + "\u036a\u0001\u0000\u0000\u0000\u036c\u036b\u0001\u0000\u0000\u0000\u036d"+ + "\u0370\u0001\u0000\u0000\u0000\u036e\u036f\u0001\u0000\u0000\u0000\u036e"+ + "\u036c\u0001\u0000\u0000\u0000\u036f\u0371\u0001\u0000\u0000\u0000\u0370"+ + "\u036e\u0001\u0000\u0000\u0000\u0371\u0372\u0005\"\u0000\u0000\u0372\u0373"+ + "\u0005\"\u0000\u0000\u0373\u0374\u0005\"\u0000\u0000\u0374\u0098\u0001"+ + "\u0000\u0000\u0000\u0375\u0376\u0005n\u0000\u0000\u0376\u0377\u0005u\u0000"+ + "\u0000\u0377\u0378\u0005l\u0000\u0000\u0378\u0379\u0005l\u0000\u0000\u0379"+ + "\u009a\u0001\u0000\u0000\u0000\u037a\u037b\u0005(\u0000\u0000\u037b\u009c"+ + "\u0001\u0000\u0000\u0000\u037c\u037d\u0005)\u0000\u0000\u037d\u009e\u0001"+ + "\u0000\u0000\u0000\u037e\u037f\u0005{\u0000\u0000\u037f\u00a0\u0001\u0000"+ + "\u0000\u0000\u0380\u0381\u0005}\u0000\u0000\u0381\u00a2\u0001\u0000\u0000"+ + "\u0000\u0382\u0383\u0005[\u0000\u0000\u0383\u00a4\u0001\u0000\u0000\u0000"+ + "\u0384\u0385\u0005]\u0000\u0000\u0385\u00a6\u0001\u0000\u0000\u0000\u0386"+ + "\u0387\u0005;\u0000\u0000\u0387\u00a8\u0001\u0000\u0000\u0000\u0388\u0389"+ + "\u0005,\u0000\u0000\u0389\u00aa\u0001\u0000\u0000\u0000\u038a\u038b\u0005"+ + ".\u0000\u0000\u038b\u00ac\u0001\u0000\u0000\u0000\u038c\u038d\u0005=\u0000"+ + "\u0000\u038d\u00ae\u0001\u0000\u0000\u0000\u038e\u038f\u0005>\u0000\u0000"+ + "\u038f\u00b0\u0001\u0000\u0000\u0000\u0390\u0391\u0005<\u0000\u0000\u0391"+ + "\u00b2\u0001\u0000\u0000\u0000\u0392\u0393\u0005!\u0000\u0000\u0393\u00b4"+ + "\u0001\u0000\u0000\u0000\u0394\u0395\u0005~\u0000\u0000\u0395\u00b6\u0001"+ + "\u0000\u0000\u0000\u0396\u0397\u0005?\u0000\u0000\u0397\u00b8\u0001\u0000"+ + "\u0000\u0000\u0398\u0399\u0005:\u0000\u0000\u0399\u00ba\u0001\u0000\u0000"+ + "\u0000\u039a\u039b\u0005=\u0000\u0000\u039b\u039c\u0005=\u0000\u0000\u039c"+ + "\u00bc\u0001\u0000\u0000\u0000\u039d\u039e\u0005<\u0000\u0000\u039e\u039f"+ + "\u0005=\u0000\u0000\u039f\u00be\u0001\u0000\u0000\u0000\u03a0\u03a1\u0005"+ + ">\u0000\u0000\u03a1\u03a2\u0005=\u0000\u0000\u03a2\u00c0\u0001\u0000\u0000"+ + "\u0000\u03a3\u03a4\u0005!\u0000\u0000\u03a4\u03a5\u0005=\u0000\u0000\u03a5"+ + "\u00c2\u0001\u0000\u0000\u0000\u03a6\u03a7\u0005&\u0000\u0000\u03a7\u03a8"+ + "\u0005&\u0000\u0000\u03a8\u00c4\u0001\u0000\u0000\u0000\u03a9\u03aa\u0005"+ + "|\u0000\u0000\u03aa\u03ab\u0005|\u0000\u0000\u03ab\u00c6\u0001\u0000\u0000"+ + "\u0000\u03ac\u03ad\u0005+\u0000\u0000\u03ad\u03ae\u0005+\u0000\u0000\u03ae"+ + "\u00c8\u0001\u0000\u0000\u0000\u03af\u03b0\u0005-\u0000\u0000\u03b0\u03b1"+ + "\u0005-\u0000\u0000\u03b1\u00ca\u0001\u0000\u0000\u0000\u03b2\u03b3\u0005"+ + "+\u0000\u0000\u03b3\u00cc\u0001\u0000\u0000\u0000\u03b4\u03b5\u0005-\u0000"+ + "\u0000\u03b5\u00ce\u0001\u0000\u0000\u0000\u03b6\u03b7\u0005*\u0000\u0000"+ + "\u03b7\u00d0\u0001\u0000\u0000\u0000\u03b8\u03b9\u0005/\u0000\u0000\u03b9"+ + "\u00d2\u0001\u0000\u0000\u0000\u03ba\u03bb\u0005&\u0000\u0000\u03bb\u00d4"+ + "\u0001\u0000\u0000\u0000\u03bc\u03bd\u0005|\u0000\u0000\u03bd\u00d6\u0001"+ + "\u0000\u0000\u0000\u03be\u03bf\u0005^\u0000\u0000\u03bf\u00d8\u0001\u0000"+ + "\u0000\u0000\u03c0\u03c1\u0005%\u0000\u0000\u03c1\u00da\u0001\u0000\u0000"+ + "\u0000\u03c2\u03c3\u0005+\u0000\u0000\u03c3\u03c4\u0005=\u0000\u0000\u03c4"+ + "\u00dc\u0001\u0000\u0000\u0000\u03c5\u03c6\u0005-\u0000\u0000\u03c6\u03c7"+ + "\u0005=\u0000\u0000\u03c7\u00de\u0001\u0000\u0000\u0000\u03c8\u03c9\u0005"+ + "*\u0000\u0000\u03c9\u03ca\u0005=\u0000\u0000\u03ca\u00e0\u0001\u0000\u0000"+ + "\u0000\u03cb\u03cc\u0005/\u0000\u0000\u03cc\u03cd\u0005=\u0000\u0000\u03cd"+ + "\u00e2\u0001\u0000\u0000\u0000\u03ce\u03cf\u0005&\u0000\u0000\u03cf\u03d0"+ + "\u0005=\u0000\u0000\u03d0\u00e4\u0001\u0000\u0000\u0000\u03d1\u03d2\u0005"+ + "|\u0000\u0000\u03d2\u03d3\u0005=\u0000\u0000\u03d3\u00e6\u0001\u0000\u0000"+ + "\u0000\u03d4\u03d5\u0005^\u0000\u0000\u03d5\u03d6\u0005=\u0000\u0000\u03d6"+ + "\u00e8\u0001\u0000\u0000\u0000\u03d7\u03d8\u0005%\u0000\u0000\u03d8\u03d9"+ + "\u0005=\u0000\u0000\u03d9\u00ea\u0001\u0000\u0000\u0000\u03da\u03db\u0005"+ + "<\u0000\u0000\u03db\u03dc\u0005<\u0000\u0000\u03dc\u03dd\u0005=\u0000"+ + "\u0000\u03dd\u00ec\u0001\u0000\u0000\u0000\u03de\u03df\u0005>\u0000\u0000"+ + "\u03df\u03e0\u0005>\u0000\u0000\u03e0\u03e1\u0005=\u0000\u0000\u03e1\u00ee"+ + "\u0001\u0000\u0000\u0000\u03e2\u03e3\u0005>\u0000\u0000\u03e3\u03e4\u0005"+ + ">\u0000\u0000\u03e4\u03e5\u0005>\u0000\u0000\u03e5\u03e6\u0005=\u0000"+ + "\u0000\u03e6\u00f0\u0001\u0000\u0000\u0000\u03e7\u03e8\u0005-\u0000\u0000"+ + "\u03e8\u03e9\u0005>\u0000\u0000\u03e9\u00f2\u0001\u0000\u0000\u0000\u03ea"+ + "\u03eb\u0005:\u0000\u0000\u03eb\u03ec\u0005:\u0000\u0000\u03ec\u00f4\u0001"+ + "\u0000\u0000\u0000\u03ed\u03ee\u0005@\u0000\u0000\u03ee\u00f6\u0001\u0000"+ + "\u0000\u0000\u03ef\u03f0\u0005.\u0000\u0000\u03f0\u03f1\u0005.\u0000\u0000"+ + "\u03f1\u03f2\u0005.\u0000\u0000\u03f2\u00f8\u0001\u0000\u0000\u0000\u03f3"+ + "\u03f5\u0007\u0011\u0000\u0000\u03f4\u03f3\u0001\u0000\u0000\u0000\u03f5"+ + "\u03f6\u0001\u0000\u0000\u0000\u03f6\u03f4\u0001\u0000\u0000\u0000\u03f6"+ + "\u03f7\u0001\u0000\u0000\u0000\u03f7\u03f8\u0001\u0000\u0000\u0000\u03f8"+ + "\u03f9\u0006|\u0000\u0000\u03f9\u00fa\u0001\u0000\u0000\u0000\u03fa\u03fb"+ + "\u0005/\u0000\u0000\u03fb\u03fc\u0005*\u0000\u0000\u03fc\u0400\u0001\u0000"+ + "\u0000\u0000\u03fd\u03ff\t\u0000\u0000\u0000\u03fe\u03fd\u0001\u0000\u0000"+ + "\u0000\u03ff\u0402\u0001\u0000\u0000\u0000\u0400\u0401\u0001\u0000\u0000"+ + "\u0000\u0400\u03fe\u0001\u0000\u0000\u0000\u0401\u0403\u0001\u0000\u0000"+ + "\u0000\u0402\u0400\u0001\u0000\u0000\u0000\u0403\u0404\u0005*\u0000\u0000"+ + "\u0404\u0405\u0005/\u0000\u0000\u0405\u0406\u0001\u0000\u0000\u0000\u0406"+ + "\u0407\u0006}\u0000\u0000\u0407\u00fc\u0001\u0000\u0000\u0000\u0408\u0409"+ + "\u0005/\u0000\u0000\u0409\u040a\u0005/\u0000\u0000\u040a\u040e\u0001\u0000"+ + "\u0000\u0000\u040b\u040d\b\u0010\u0000\u0000\u040c\u040b\u0001\u0000\u0000"+ + "\u0000\u040d\u0410\u0001\u0000\u0000\u0000\u040e\u040c\u0001\u0000\u0000"+ + "\u0000\u040e\u040f\u0001\u0000\u0000\u0000\u040f\u0411\u0001\u0000\u0000"+ + "\u0000\u0410\u040e\u0001\u0000\u0000\u0000\u0411\u0412\u0006~\u0000\u0000"+ + "\u0412\u00fe\u0001\u0000\u0000\u0000\u0413\u0417\u0003\u010d\u0086\u0000"+ + "\u0414\u0416\u0003\u010b\u0085\u0000\u0415\u0414\u0001\u0000\u0000\u0000"+ + "\u0416\u0419\u0001\u0000\u0000\u0000\u0417\u0415\u0001\u0000\u0000\u0000"+ + "\u0417\u0418\u0001\u0000\u0000\u0000\u0418\u0100\u0001\u0000\u0000\u0000"+ + "\u0419\u0417\u0001\u0000\u0000\u0000\u041a\u041c\u0007\u0012\u0000\u0000"+ + "\u041b\u041d\u0007\f\u0000\u0000\u041c\u041b\u0001\u0000\u0000\u0000\u041c"+ + "\u041d\u0001\u0000\u0000\u0000\u041d\u041e\u0001\u0000\u0000\u0000\u041e"+ + "\u041f\u0003\u0109\u0084\u0000\u041f\u0102\u0001\u0000\u0000\u0000\u0420"+ + "\u0421\u0005\\\u0000\u0000\u0421\u0436\u0007\u0013\u0000\u0000\u0422\u0427"+ + "\u0005\\\u0000\u0000\u0423\u0425\u0007\u0014\u0000\u0000\u0424\u0423\u0001"+ + "\u0000\u0000\u0000\u0424\u0425\u0001\u0000\u0000\u0000\u0425\u0426\u0001"+ + "\u0000\u0000\u0000\u0426\u0428\u0007\u0005\u0000\u0000\u0427\u0424\u0001"+ + "\u0000\u0000\u0000\u0427\u0428\u0001\u0000\u0000\u0000\u0428\u0429\u0001"+ + "\u0000\u0000\u0000\u0429\u0436\u0007\u0005\u0000\u0000\u042a\u042c\u0005"+ + "\\\u0000\u0000\u042b\u042d\u0005u\u0000\u0000\u042c\u042b\u0001\u0000"+ + "\u0000\u0000\u042d\u042e\u0001\u0000\u0000\u0000\u042e\u042c\u0001\u0000"+ + "\u0000\u0000\u042e\u042f\u0001\u0000\u0000\u0000\u042f\u0430\u0001\u0000"+ + "\u0000\u0000\u0430\u0431\u0003\u0107\u0083\u0000\u0431\u0432\u0003\u0107"+ + "\u0083\u0000\u0432\u0433\u0003\u0107\u0083\u0000\u0433\u0434\u0003\u0107"+ + "\u0083\u0000\u0434\u0436\u0001\u0000\u0000\u0000\u0435\u0420\u0001\u0000"+ + "\u0000\u0000\u0435\u0422\u0001\u0000\u0000\u0000\u0435\u042a\u0001\u0000"+ + "\u0000\u0000\u0436\u0104\u0001\u0000\u0000\u0000\u0437\u0440\u0003\u0107"+ + "\u0083\u0000\u0438\u043b\u0003\u0107\u0083\u0000\u0439\u043b\u0005_\u0000"+ + "\u0000\u043a\u0438\u0001\u0000\u0000\u0000\u043a\u0439\u0001\u0000\u0000"+ + "\u0000\u043b\u043e\u0001\u0000\u0000\u0000\u043c\u043a\u0001\u0000\u0000"+ + "\u0000\u043c\u043d\u0001\u0000\u0000\u0000\u043d\u043f\u0001\u0000\u0000"+ + "\u0000\u043e\u043c\u0001\u0000\u0000\u0000\u043f\u0441\u0003\u0107\u0083"+ + "\u0000\u0440\u043c\u0001\u0000\u0000\u0000\u0440\u0441\u0001\u0000\u0000"+ + "\u0000\u0441\u0106\u0001\u0000\u0000\u0000\u0442\u0443\u0007\u0003\u0000"+ + "\u0000\u0443\u0108\u0001\u0000\u0000\u0000\u0444\u044c\u0007\u0015\u0000"+ + "\u0000\u0445\u0447\u0007\u0016\u0000\u0000\u0446\u0445\u0001\u0000\u0000"+ + "\u0000\u0447\u044a\u0001\u0000\u0000\u0000\u0448\u0446\u0001\u0000\u0000"+ + "\u0000\u0448\u0449\u0001\u0000\u0000\u0000\u0449\u044b\u0001\u0000\u0000"+ + "\u0000\u044a\u0448\u0001\u0000\u0000\u0000\u044b\u044d\u0007\u0015\u0000"+ + "\u0000\u044c\u0448\u0001\u0000\u0000\u0000\u044c\u044d\u0001\u0000\u0000"+ + "\u0000\u044d\u010a\u0001\u0000\u0000\u0000\u044e\u0451\u0003\u010d\u0086"+ + "\u0000\u044f\u0451\u0007\u0015\u0000\u0000\u0450\u044e\u0001\u0000\u0000"+ + "\u0000\u0450\u044f\u0001\u0000\u0000\u0000\u0451\u010c\u0001\u0000\u0000"+ + "\u0000\u0452\u0457\u0007\u0017\u0000\u0000\u0453\u0457\b\u0018\u0000\u0000"+ + "\u0454\u0455\u0007\u0019\u0000\u0000\u0455\u0457\u0007\u001a\u0000\u0000"+ + "\u0456\u0452\u0001\u0000\u0000\u0000\u0456\u0453\u0001\u0000\u0000\u0000"+ + "\u0456\u0454\u0001\u0000\u0000\u0000\u0457\u010e\u0001\u0000\u0000\u0000"+ + "3\u0000\u02d4\u02d9\u02dc\u02de\u02e1\u02e9\u02ed\u02f0\u02f6\u02fd\u0301"+ + "\u0304\u030c\u0310\u0313\u0318\u031c\u031f\u0322\u0327\u032a\u032c\u0332"+ + "\u0335\u0339\u033d\u0341\u034c\u0351\u0358\u035a\u0366\u036c\u036e\u03f6"+ + "\u0400\u040e\u0417\u041c\u0424\u0427\u042e\u0435\u043a\u043c\u0440\u0448"+ + "\u044c\u0450\u0456\u0001\u0000\u0001\u0000"; + public static final ATN _ATN = + new ATNDeserializer().deserialize(_serializedATN.toCharArray()); + static { + _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()]; + for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) { + _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); + } + } +} \ No newline at end of file diff --git a/javatx-src/main/java/de/dhbwstuttgart/parser/antlr/Java17Parser.interp b/javatx-src/main/java/de/dhbwstuttgart/parser/antlr/Java17Parser.interp new file mode 100644 index 0000000..56372a5 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/parser/antlr/Java17Parser.interp @@ -0,0 +1,406 @@ +token literal names: +null +'abstract' +'assert' +'boolean' +'break' +'byte' +'case' +'catch' +'char' +'class' +'const' +'continue' +'default' +'do' +'double' +'else' +'enum' +'extends' +'final' +'finally' +'float' +'for' +'if' +'goto' +'implements' +'import' +'instanceof' +'int' +'interface' +'long' +'native' +'new' +'package' +'private' +'protected' +'public' +'return' +'short' +'static' +'strictfp' +'super' +'switch' +'synchronized' +'this' +'throw' +'throws' +'transient' +'try' +'void' +'volatile' +'while' +'module' +'open' +'requires' +'exports' +'opens' +'to' +'uses' +'provides' +'with' +'transitive' +'var' +'yield' +'record' +'sealed' +'permits' +'non-sealed' +null +null +null +null +null +null +null +null +null +null +'null' +'(' +')' +'{' +'}' +'[' +']' +';' +',' +'.' +'=' +'>' +'<' +'!' +'~' +'?' +':' +'==' +'<=' +'>=' +'!=' +'&&' +'||' +'++' +'--' +'+' +'-' +'*' +'/' +'&' +'|' +'^' +'%' +'+=' +'-=' +'*=' +'/=' +'&=' +'|=' +'^=' +'%=' +'<<=' +'>>=' +'>>>=' +'->' +'::' +'@' +'...' +null +null +null +null + +token symbolic names: +null +ABSTRACT +ASSERT +BOOLEAN +BREAK +BYTE +CASE +CATCH +CHAR +CLASS +CONST +CONTINUE +DEFAULT +DO +DOUBLE +ELSE +ENUM +EXTENDS +FINAL +FINALLY +FLOAT +FOR +IF +GOTO +IMPLEMENTS +IMPORT +INSTANCEOF +INT +INTERFACE +LONG +NATIVE +NEW +PACKAGE +PRIVATE +PROTECTED +PUBLIC +RETURN +SHORT +STATIC +STRICTFP +SUPER +SWITCH +SYNCHRONIZED +THIS +THROW +THROWS +TRANSIENT +TRY +VOID +VOLATILE +WHILE +MODULE +OPEN +REQUIRES +EXPORTS +OPENS +TO +USES +PROVIDES +WITH +TRANSITIVE +VAR +YIELD +RECORD +SEALED +PERMITS +NON_SEALED +DECIMAL_LITERAL +HEX_LITERAL +OCT_LITERAL +BINARY_LITERAL +FLOAT_LITERAL +HEX_FLOAT_LITERAL +BOOL_LITERAL +CHAR_LITERAL +STRING_LITERAL +TEXT_BLOCK +NULL_LITERAL +LPAREN +RPAREN +LBRACE +RBRACE +LBRACK +RBRACK +SEMI +COMMA +DOT +ASSIGN +GT +LT +BANG +TILDE +QUESTION +COLON +EQUAL +LE +GE +NOTEQUAL +AND +OR +INC +DEC +ADD +SUB +MUL +DIV +BITAND +BITOR +CARET +MOD +ADD_ASSIGN +SUB_ASSIGN +MUL_ASSIGN +DIV_ASSIGN +AND_ASSIGN +OR_ASSIGN +XOR_ASSIGN +MOD_ASSIGN +LSHIFT_ASSIGN +RSHIFT_ASSIGN +URSHIFT_ASSIGN +ARROW +COLONCOLON +AT +ELLIPSIS +WS +COMMENT +LINE_COMMENT +IDENTIFIER + +rule names: +sourceFile +packageDeclaration +importDeclaration +classOrInterface +modifier +classOrInterfaceModifier +variableModifier +classDeclaration +genericDeclarationList +genericTypeVar +typeBound +enumDeclaration +enumConstants +enumConstant +enumBodyDeclarations +interfaceDeclaration +classBody +interfaceBody +classBodyDeclaration +memberDeclaration +method +methodDeclaration +methodHeader +methodBody +refType +genericMethodDeclaration +constructor +genericConstructorDeclaration +constructorDeclaration +fieldDeclaration +interfaceBodyDeclaration +interfaceMemberDeclaration +constDeclaration +constantDeclarator +interfaceMethodDeclaration +interfaceMethodModifier +genericInterfaceMethodDeclaration +interfaceCommonBodyDeclaration +variableDeclarators +variableDeclarator +variableDeclaratorId +variableInitializer +arrayInitializer +classOrInterfaceType +typeArgument +wildcardType +extendsWildcardType +superWildcardType +qualifiedNameList +exceptionList +formalParameters +receiverParameter +formalParameterList +formalParameter +lastFormalParameter +lambdaLVTIList +lambdaLVTIParameter +qualifiedName +literal +integerLiteral +floatLiteral +altAnnotationQualifiedName +annotation +elementValuePairs +elementValuePair +elementValue +elementValueArrayInitializer +annotationTypeDeclaration +annotationTypeBody +annotationTypeElementDeclaration +annotationTypeElementRest +annotationMethodOrConstantRest +annotationMethodRest +annotationConstantRest +defaultValue +moduleDeclaration +moduleBody +moduleDirective +requiresModifier +recordDeclaration +recordHeader +recordComponentList +recordComponent +recordBody +block +blockStatement +localVariableDeclaration +identifier +typeIdentifier +localTypeDeclaration +statement +catchClause +catchType +finallyBlock +resourceSpecification +resources +resource +switchBlockStatementGroup +switchLabel +forControl +forInit +enhancedForControl +parExpression +expressionList +methodCall +expression +pattern +primaryPattern +recordPattern +typePattern +recordStructurePattern +recordComponentPatternElement +recordComponentPatternList +lambdaExpression +lambdaParameters +lambdaBody +primary +switchExpression +switchLabeledRule +switchLabelCase +guardedPattern +switchRuleOutcome +classType +creator +createdName +innerCreator +arrayCreatorRest +classCreatorRest +explicitGenericInvocation +typeArgumentsOrDiamond +nonWildcardTypeArgumentsOrDiamond +nonWildcardTypeArguments +typeList +typeType +primitiveType +typeArguments +superSuffix +explicitGenericInvocationSuffix +arguments + + +atn: +[4, 1, 128, 1793, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 2, 46, 7, 46, 2, 47, 7, 47, 2, 48, 7, 48, 2, 49, 7, 49, 2, 50, 7, 50, 2, 51, 7, 51, 2, 52, 7, 52, 2, 53, 7, 53, 2, 54, 7, 54, 2, 55, 7, 55, 2, 56, 7, 56, 2, 57, 7, 57, 2, 58, 7, 58, 2, 59, 7, 59, 2, 60, 7, 60, 2, 61, 7, 61, 2, 62, 7, 62, 2, 63, 7, 63, 2, 64, 7, 64, 2, 65, 7, 65, 2, 66, 7, 66, 2, 67, 7, 67, 2, 68, 7, 68, 2, 69, 7, 69, 2, 70, 7, 70, 2, 71, 7, 71, 2, 72, 7, 72, 2, 73, 7, 73, 2, 74, 7, 74, 2, 75, 7, 75, 2, 76, 7, 76, 2, 77, 7, 77, 2, 78, 7, 78, 2, 79, 7, 79, 2, 80, 7, 80, 2, 81, 7, 81, 2, 82, 7, 82, 2, 83, 7, 83, 2, 84, 7, 84, 2, 85, 7, 85, 2, 86, 7, 86, 2, 87, 7, 87, 2, 88, 7, 88, 2, 89, 7, 89, 2, 90, 7, 90, 2, 91, 7, 91, 2, 92, 7, 92, 2, 93, 7, 93, 2, 94, 7, 94, 2, 95, 7, 95, 2, 96, 7, 96, 2, 97, 7, 97, 2, 98, 7, 98, 2, 99, 7, 99, 2, 100, 7, 100, 2, 101, 7, 101, 2, 102, 7, 102, 2, 103, 7, 103, 2, 104, 7, 104, 2, 105, 7, 105, 2, 106, 7, 106, 2, 107, 7, 107, 2, 108, 7, 108, 2, 109, 7, 109, 2, 110, 7, 110, 2, 111, 7, 111, 2, 112, 7, 112, 2, 113, 7, 113, 2, 114, 7, 114, 2, 115, 7, 115, 2, 116, 7, 116, 2, 117, 7, 117, 2, 118, 7, 118, 2, 119, 7, 119, 2, 120, 7, 120, 2, 121, 7, 121, 2, 122, 7, 122, 2, 123, 7, 123, 2, 124, 7, 124, 2, 125, 7, 125, 2, 126, 7, 126, 2, 127, 7, 127, 2, 128, 7, 128, 2, 129, 7, 129, 2, 130, 7, 130, 2, 131, 7, 131, 2, 132, 7, 132, 2, 133, 7, 133, 2, 134, 7, 134, 2, 135, 7, 135, 2, 136, 7, 136, 2, 137, 7, 137, 2, 138, 7, 138, 1, 0, 3, 0, 280, 8, 0, 1, 0, 5, 0, 283, 8, 0, 10, 0, 12, 0, 286, 9, 0, 1, 0, 5, 0, 289, 8, 0, 10, 0, 12, 0, 292, 9, 0, 1, 0, 1, 0, 1, 0, 3, 0, 297, 8, 0, 1, 1, 5, 1, 300, 8, 1, 10, 1, 12, 1, 303, 9, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 3, 2, 311, 8, 2, 1, 2, 1, 2, 1, 2, 3, 2, 316, 8, 2, 1, 2, 1, 2, 1, 3, 5, 3, 321, 8, 3, 10, 3, 12, 3, 324, 9, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 331, 8, 3, 1, 3, 3, 3, 334, 8, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 3, 4, 341, 8, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 353, 8, 5, 1, 6, 1, 6, 3, 6, 357, 8, 6, 1, 7, 1, 7, 1, 7, 3, 7, 362, 8, 7, 1, 7, 1, 7, 3, 7, 366, 8, 7, 1, 7, 1, 7, 3, 7, 370, 8, 7, 1, 7, 1, 7, 3, 7, 374, 8, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 5, 8, 382, 8, 8, 10, 8, 12, 8, 385, 9, 8, 1, 8, 1, 8, 1, 9, 5, 9, 390, 8, 9, 10, 9, 12, 9, 393, 9, 9, 1, 9, 1, 9, 1, 9, 5, 9, 398, 8, 9, 10, 9, 12, 9, 401, 9, 9, 1, 9, 3, 9, 404, 8, 9, 1, 10, 1, 10, 1, 10, 5, 10, 409, 8, 10, 10, 10, 12, 10, 412, 9, 10, 1, 11, 1, 11, 1, 11, 1, 11, 3, 11, 418, 8, 11, 1, 11, 1, 11, 3, 11, 422, 8, 11, 1, 11, 3, 11, 425, 8, 11, 1, 11, 3, 11, 428, 8, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 5, 12, 435, 8, 12, 10, 12, 12, 12, 438, 9, 12, 1, 13, 5, 13, 441, 8, 13, 10, 13, 12, 13, 444, 9, 13, 1, 13, 1, 13, 3, 13, 448, 8, 13, 1, 13, 3, 13, 451, 8, 13, 1, 14, 1, 14, 5, 14, 455, 8, 14, 10, 14, 12, 14, 458, 9, 14, 1, 15, 1, 15, 1, 15, 3, 15, 463, 8, 15, 1, 15, 1, 15, 3, 15, 467, 8, 15, 1, 15, 1, 15, 3, 15, 471, 8, 15, 1, 15, 1, 15, 1, 16, 1, 16, 5, 16, 477, 8, 16, 10, 16, 12, 16, 480, 9, 16, 1, 16, 1, 16, 1, 17, 1, 17, 5, 17, 486, 8, 17, 10, 17, 12, 17, 489, 9, 17, 1, 17, 1, 17, 1, 18, 1, 18, 3, 18, 495, 8, 18, 1, 18, 1, 18, 5, 18, 499, 8, 18, 10, 18, 12, 18, 502, 9, 18, 1, 18, 3, 18, 505, 8, 18, 1, 19, 1, 19, 1, 19, 1, 19, 3, 19, 511, 8, 19, 1, 20, 1, 20, 3, 20, 515, 8, 20, 1, 21, 1, 21, 1, 21, 3, 21, 520, 8, 21, 1, 21, 1, 21, 1, 22, 3, 22, 525, 8, 22, 1, 22, 1, 22, 1, 22, 1, 22, 5, 22, 531, 8, 22, 10, 22, 12, 22, 534, 9, 22, 1, 23, 1, 23, 3, 23, 538, 8, 23, 1, 24, 1, 24, 3, 24, 542, 8, 24, 1, 25, 1, 25, 1, 25, 1, 26, 1, 26, 3, 26, 549, 8, 26, 1, 27, 1, 27, 1, 27, 1, 28, 1, 28, 1, 28, 1, 28, 3, 28, 558, 8, 28, 1, 28, 1, 28, 1, 29, 3, 29, 563, 8, 29, 1, 29, 1, 29, 1, 29, 1, 30, 5, 30, 569, 8, 30, 10, 30, 12, 30, 572, 9, 30, 1, 30, 1, 30, 3, 30, 576, 8, 30, 1, 31, 1, 31, 1, 31, 1, 31, 3, 31, 582, 8, 31, 1, 32, 3, 32, 585, 8, 32, 1, 32, 1, 32, 1, 32, 5, 32, 590, 8, 32, 10, 32, 12, 32, 593, 9, 32, 1, 32, 1, 32, 1, 33, 1, 33, 1, 33, 5, 33, 600, 8, 33, 10, 33, 12, 33, 603, 9, 33, 1, 33, 1, 33, 1, 33, 1, 34, 5, 34, 609, 8, 34, 10, 34, 12, 34, 612, 9, 34, 1, 34, 1, 34, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 1, 35, 3, 35, 622, 8, 35, 1, 36, 5, 36, 625, 8, 36, 10, 36, 12, 36, 628, 9, 36, 1, 36, 1, 36, 1, 36, 1, 37, 5, 37, 634, 8, 37, 10, 37, 12, 37, 637, 9, 37, 1, 37, 3, 37, 640, 8, 37, 1, 37, 1, 37, 1, 37, 1, 37, 5, 37, 646, 8, 37, 10, 37, 12, 37, 649, 9, 37, 1, 37, 1, 37, 3, 37, 653, 8, 37, 1, 37, 1, 37, 1, 38, 1, 38, 1, 38, 5, 38, 660, 8, 38, 10, 38, 12, 38, 663, 9, 38, 1, 39, 1, 39, 1, 39, 3, 39, 668, 8, 39, 1, 40, 1, 40, 1, 40, 5, 40, 673, 8, 40, 10, 40, 12, 40, 676, 9, 40, 1, 41, 1, 41, 3, 41, 680, 8, 41, 1, 42, 1, 42, 1, 42, 1, 42, 5, 42, 686, 8, 42, 10, 42, 12, 42, 689, 9, 42, 1, 42, 3, 42, 692, 8, 42, 3, 42, 694, 8, 42, 1, 42, 1, 42, 1, 43, 1, 43, 3, 43, 700, 8, 43, 1, 43, 1, 43, 5, 43, 704, 8, 43, 10, 43, 12, 43, 707, 9, 43, 1, 43, 1, 43, 3, 43, 711, 8, 43, 1, 44, 1, 44, 3, 44, 715, 8, 44, 1, 45, 5, 45, 718, 8, 45, 10, 45, 12, 45, 721, 9, 45, 1, 45, 1, 45, 1, 45, 3, 45, 726, 8, 45, 1, 46, 1, 46, 1, 46, 1, 47, 1, 47, 1, 47, 1, 48, 1, 48, 1, 48, 5, 48, 737, 8, 48, 10, 48, 12, 48, 740, 9, 48, 1, 49, 1, 49, 1, 50, 1, 50, 3, 50, 746, 8, 50, 1, 50, 1, 50, 1, 50, 3, 50, 751, 8, 50, 1, 50, 3, 50, 754, 8, 50, 3, 50, 756, 8, 50, 1, 50, 1, 50, 1, 51, 3, 51, 761, 8, 51, 1, 51, 1, 51, 1, 51, 5, 51, 766, 8, 51, 10, 51, 12, 51, 769, 9, 51, 1, 51, 1, 51, 1, 52, 1, 52, 1, 52, 5, 52, 776, 8, 52, 10, 52, 12, 52, 779, 9, 52, 1, 52, 1, 52, 3, 52, 783, 8, 52, 1, 52, 3, 52, 786, 8, 52, 1, 53, 5, 53, 789, 8, 53, 10, 53, 12, 53, 792, 9, 53, 1, 53, 3, 53, 795, 8, 53, 1, 53, 1, 53, 3, 53, 799, 8, 53, 1, 54, 5, 54, 802, 8, 54, 10, 54, 12, 54, 805, 9, 54, 1, 54, 3, 54, 808, 8, 54, 1, 54, 5, 54, 811, 8, 54, 10, 54, 12, 54, 814, 9, 54, 1, 54, 1, 54, 1, 54, 1, 55, 1, 55, 1, 55, 5, 55, 822, 8, 55, 10, 55, 12, 55, 825, 9, 55, 1, 56, 5, 56, 828, 8, 56, 10, 56, 12, 56, 831, 9, 56, 1, 56, 1, 56, 1, 56, 1, 57, 1, 57, 1, 57, 5, 57, 839, 8, 57, 10, 57, 12, 57, 842, 9, 57, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 1, 58, 3, 58, 851, 8, 58, 1, 59, 1, 59, 1, 60, 1, 60, 1, 61, 1, 61, 1, 61, 5, 61, 860, 8, 61, 10, 61, 12, 61, 863, 9, 61, 1, 61, 1, 61, 1, 61, 1, 62, 1, 62, 1, 62, 3, 62, 871, 8, 62, 1, 62, 1, 62, 1, 62, 3, 62, 876, 8, 62, 1, 62, 3, 62, 879, 8, 62, 1, 63, 1, 63, 1, 63, 5, 63, 884, 8, 63, 10, 63, 12, 63, 887, 9, 63, 1, 64, 1, 64, 1, 64, 1, 64, 1, 65, 1, 65, 1, 65, 3, 65, 896, 8, 65, 1, 66, 1, 66, 1, 66, 1, 66, 5, 66, 902, 8, 66, 10, 66, 12, 66, 905, 9, 66, 3, 66, 907, 8, 66, 1, 66, 3, 66, 910, 8, 66, 1, 66, 1, 66, 1, 67, 1, 67, 1, 67, 1, 67, 1, 67, 1, 68, 1, 68, 5, 68, 921, 8, 68, 10, 68, 12, 68, 924, 9, 68, 1, 68, 1, 68, 1, 69, 5, 69, 929, 8, 69, 10, 69, 12, 69, 932, 9, 69, 1, 69, 1, 69, 3, 69, 936, 8, 69, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 1, 70, 3, 70, 944, 8, 70, 3, 70, 946, 8, 70, 1, 71, 1, 71, 3, 71, 950, 8, 71, 1, 72, 1, 72, 1, 72, 1, 72, 3, 72, 956, 8, 72, 1, 73, 1, 73, 1, 74, 1, 74, 1, 74, 1, 75, 3, 75, 964, 8, 75, 1, 75, 1, 75, 1, 75, 1, 75, 1, 76, 1, 76, 5, 76, 972, 8, 76, 10, 76, 12, 76, 975, 9, 76, 1, 76, 1, 76, 1, 77, 1, 77, 5, 77, 981, 8, 77, 10, 77, 12, 77, 984, 9, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 3, 77, 993, 8, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 3, 77, 1001, 8, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 1, 77, 3, 77, 1015, 8, 77, 1, 78, 1, 78, 1, 79, 1, 79, 1, 79, 3, 79, 1022, 8, 79, 1, 79, 1, 79, 1, 79, 3, 79, 1027, 8, 79, 1, 79, 1, 79, 1, 80, 1, 80, 3, 80, 1033, 8, 80, 1, 80, 1, 80, 1, 81, 1, 81, 1, 81, 5, 81, 1040, 8, 81, 10, 81, 12, 81, 1043, 9, 81, 1, 82, 3, 82, 1046, 8, 82, 1, 82, 1, 82, 1, 83, 1, 83, 5, 83, 1052, 8, 83, 10, 83, 12, 83, 1055, 9, 83, 1, 83, 1, 83, 1, 84, 1, 84, 5, 84, 1061, 8, 84, 10, 84, 12, 84, 1064, 9, 84, 1, 84, 1, 84, 1, 85, 1, 85, 1, 85, 1, 85, 1, 85, 3, 85, 1073, 8, 85, 1, 86, 5, 86, 1076, 8, 86, 10, 86, 12, 86, 1079, 9, 86, 1, 86, 1, 86, 3, 86, 1083, 8, 86, 1, 86, 1, 86, 1, 87, 1, 87, 1, 88, 1, 88, 1, 89, 5, 89, 1092, 8, 89, 10, 89, 12, 89, 1095, 9, 89, 1, 89, 1, 89, 1, 89, 3, 89, 1100, 8, 89, 1, 89, 3, 89, 1103, 8, 89, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 3, 90, 1110, 8, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 3, 90, 1119, 8, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 4, 90, 1140, 8, 90, 11, 90, 12, 90, 1141, 1, 90, 3, 90, 1145, 8, 90, 1, 90, 3, 90, 1148, 8, 90, 1, 90, 1, 90, 1, 90, 1, 90, 5, 90, 1154, 8, 90, 10, 90, 12, 90, 1157, 9, 90, 1, 90, 3, 90, 1160, 8, 90, 1, 90, 1, 90, 1, 90, 1, 90, 5, 90, 1166, 8, 90, 10, 90, 12, 90, 1169, 9, 90, 1, 90, 5, 90, 1172, 8, 90, 10, 90, 12, 90, 1175, 9, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 3, 90, 1185, 8, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 3, 90, 1194, 8, 90, 1, 90, 1, 90, 1, 90, 3, 90, 1199, 8, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 1, 90, 3, 90, 1214, 8, 90, 1, 91, 1, 91, 1, 91, 5, 91, 1219, 8, 91, 10, 91, 12, 91, 1222, 9, 91, 1, 91, 3, 91, 1225, 8, 91, 1, 91, 1, 91, 1, 91, 1, 91, 1, 92, 1, 92, 1, 92, 5, 92, 1234, 8, 92, 10, 92, 12, 92, 1237, 9, 92, 1, 93, 1, 93, 1, 93, 1, 94, 1, 94, 1, 94, 3, 94, 1245, 8, 94, 1, 94, 1, 94, 1, 95, 1, 95, 1, 95, 5, 95, 1252, 8, 95, 10, 95, 12, 95, 1255, 9, 95, 1, 96, 5, 96, 1258, 8, 96, 10, 96, 12, 96, 1261, 9, 96, 1, 96, 3, 96, 1264, 8, 96, 1, 96, 1, 96, 1, 96, 3, 96, 1269, 8, 96, 1, 96, 1, 96, 1, 96, 1, 96, 3, 96, 1275, 8, 96, 1, 97, 4, 97, 1278, 8, 97, 11, 97, 12, 97, 1279, 1, 97, 4, 97, 1283, 8, 97, 11, 97, 12, 97, 1284, 1, 98, 1, 98, 1, 98, 1, 98, 1, 98, 1, 98, 1, 98, 1, 98, 1, 98, 1, 98, 1, 98, 1, 98, 1, 98, 3, 98, 1300, 8, 98, 1, 99, 1, 99, 3, 99, 1304, 8, 99, 1, 99, 1, 99, 3, 99, 1308, 8, 99, 1, 99, 1, 99, 3, 99, 1312, 8, 99, 3, 99, 1314, 8, 99, 1, 100, 1, 100, 3, 100, 1318, 8, 100, 1, 101, 5, 101, 1321, 8, 101, 10, 101, 12, 101, 1324, 9, 101, 1, 101, 3, 101, 1327, 8, 101, 1, 101, 3, 101, 1330, 8, 101, 1, 101, 1, 101, 1, 101, 1, 101, 1, 102, 1, 102, 1, 102, 1, 102, 1, 103, 1, 103, 1, 103, 5, 103, 1343, 8, 103, 10, 103, 12, 103, 1346, 9, 103, 1, 104, 1, 104, 1, 104, 3, 104, 1351, 8, 104, 1, 104, 1, 104, 1, 104, 1, 104, 1, 104, 3, 104, 1358, 8, 104, 1, 104, 1, 104, 1, 104, 1, 104, 3, 104, 1364, 8, 104, 1, 104, 3, 104, 1367, 8, 104, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 5, 105, 1376, 8, 105, 10, 105, 12, 105, 1379, 9, 105, 1, 105, 1, 105, 1, 105, 5, 105, 1384, 8, 105, 10, 105, 12, 105, 1387, 9, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 3, 105, 1399, 8, 105, 1, 105, 1, 105, 3, 105, 1403, 8, 105, 1, 105, 1, 105, 1, 105, 3, 105, 1408, 8, 105, 1, 105, 1, 105, 3, 105, 1412, 8, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 3, 105, 1428, 8, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 3, 105, 1468, 8, 105, 1, 105, 1, 105, 1, 105, 1, 105, 3, 105, 1474, 8, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 1, 105, 3, 105, 1487, 8, 105, 1, 105, 1, 105, 1, 105, 3, 105, 1492, 8, 105, 1, 105, 5, 105, 1495, 8, 105, 10, 105, 12, 105, 1498, 9, 105, 1, 106, 1, 106, 3, 106, 1502, 8, 106, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 1, 107, 3, 107, 1510, 8, 107, 1, 108, 1, 108, 1, 108, 3, 108, 1515, 8, 108, 1, 109, 5, 109, 1518, 8, 109, 10, 109, 12, 109, 1521, 9, 109, 1, 109, 1, 109, 1, 109, 1, 110, 1, 110, 3, 110, 1528, 8, 110, 1, 110, 1, 110, 1, 111, 1, 111, 3, 111, 1534, 8, 111, 1, 112, 1, 112, 1, 112, 5, 112, 1539, 8, 112, 10, 112, 12, 112, 1542, 9, 112, 1, 113, 1, 113, 1, 113, 1, 113, 1, 114, 1, 114, 1, 114, 3, 114, 1551, 8, 114, 1, 114, 1, 114, 1, 114, 1, 114, 1, 114, 5, 114, 1558, 8, 114, 10, 114, 12, 114, 1561, 9, 114, 1, 114, 1, 114, 1, 114, 1, 114, 3, 114, 1567, 8, 114, 1, 114, 3, 114, 1570, 8, 114, 1, 115, 1, 115, 3, 115, 1574, 8, 115, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 1, 116, 3, 116, 1592, 8, 116, 3, 116, 1594, 8, 116, 1, 117, 1, 117, 1, 117, 1, 117, 5, 117, 1600, 8, 117, 10, 117, 12, 117, 1603, 9, 117, 1, 117, 1, 117, 1, 118, 1, 118, 1, 118, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 1, 119, 3, 119, 1623, 8, 119, 1, 120, 1, 120, 1, 120, 1, 120, 1, 121, 1, 121, 1, 121, 1, 121, 3, 121, 1633, 8, 121, 1, 122, 1, 122, 1, 122, 3, 122, 1638, 8, 122, 1, 122, 5, 122, 1641, 8, 122, 10, 122, 12, 122, 1644, 9, 122, 1, 122, 1, 122, 3, 122, 1648, 8, 122, 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 1, 123, 3, 123, 1657, 8, 123, 3, 123, 1659, 8, 123, 1, 124, 1, 124, 3, 124, 1663, 8, 124, 1, 124, 3, 124, 1666, 8, 124, 1, 125, 1, 125, 3, 125, 1670, 8, 125, 1, 125, 1, 125, 1, 126, 1, 126, 1, 126, 1, 126, 5, 126, 1678, 8, 126, 10, 126, 12, 126, 1681, 9, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 1, 126, 5, 126, 1690, 8, 126, 10, 126, 12, 126, 1693, 9, 126, 1, 126, 1, 126, 5, 126, 1697, 8, 126, 10, 126, 12, 126, 1700, 9, 126, 3, 126, 1702, 8, 126, 1, 127, 1, 127, 3, 127, 1706, 8, 127, 1, 128, 1, 128, 1, 128, 1, 129, 1, 129, 1, 129, 3, 129, 1714, 8, 129, 1, 130, 1, 130, 1, 130, 3, 130, 1719, 8, 130, 1, 131, 1, 131, 1, 131, 1, 131, 1, 132, 1, 132, 1, 132, 5, 132, 1728, 8, 132, 10, 132, 12, 132, 1731, 9, 132, 1, 133, 5, 133, 1734, 8, 133, 10, 133, 12, 133, 1737, 9, 133, 1, 133, 1, 133, 3, 133, 1741, 8, 133, 1, 133, 5, 133, 1744, 8, 133, 10, 133, 12, 133, 1747, 9, 133, 1, 133, 1, 133, 5, 133, 1751, 8, 133, 10, 133, 12, 133, 1754, 9, 133, 1, 134, 1, 134, 1, 135, 1, 135, 1, 135, 1, 135, 5, 135, 1762, 8, 135, 10, 135, 12, 135, 1765, 9, 135, 1, 135, 1, 135, 1, 136, 1, 136, 1, 136, 3, 136, 1772, 8, 136, 1, 136, 1, 136, 3, 136, 1776, 8, 136, 3, 136, 1778, 8, 136, 1, 137, 1, 137, 1, 137, 1, 137, 1, 137, 3, 137, 1785, 8, 137, 1, 138, 1, 138, 3, 138, 1789, 8, 138, 1, 138, 1, 138, 1, 138, 0, 1, 210, 139, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180, 182, 184, 186, 188, 190, 192, 194, 196, 198, 200, 202, 204, 206, 208, 210, 212, 214, 216, 218, 220, 222, 224, 226, 228, 230, 232, 234, 236, 238, 240, 242, 244, 246, 248, 250, 252, 254, 256, 258, 260, 262, 264, 266, 268, 270, 272, 274, 276, 0, 15, 2, 0, 17, 17, 24, 24, 1, 0, 67, 70, 1, 0, 71, 72, 2, 0, 38, 38, 60, 60, 2, 0, 51, 65, 128, 128, 3, 0, 51, 60, 63, 65, 128, 128, 2, 0, 90, 91, 100, 103, 2, 0, 104, 105, 109, 109, 1, 0, 102, 103, 2, 0, 88, 89, 95, 96, 2, 0, 94, 94, 97, 97, 2, 0, 87, 87, 110, 120, 1, 0, 100, 101, 2, 0, 93, 93, 121, 121, 8, 0, 3, 3, 5, 5, 8, 8, 14, 14, 20, 20, 27, 27, 29, 29, 37, 37, 1970, 0, 296, 1, 0, 0, 0, 2, 301, 1, 0, 0, 0, 4, 308, 1, 0, 0, 0, 6, 333, 1, 0, 0, 0, 8, 340, 1, 0, 0, 0, 10, 352, 1, 0, 0, 0, 12, 356, 1, 0, 0, 0, 14, 358, 1, 0, 0, 0, 16, 377, 1, 0, 0, 0, 18, 391, 1, 0, 0, 0, 20, 405, 1, 0, 0, 0, 22, 413, 1, 0, 0, 0, 24, 431, 1, 0, 0, 0, 26, 442, 1, 0, 0, 0, 28, 452, 1, 0, 0, 0, 30, 459, 1, 0, 0, 0, 32, 474, 1, 0, 0, 0, 34, 483, 1, 0, 0, 0, 36, 504, 1, 0, 0, 0, 38, 510, 1, 0, 0, 0, 40, 514, 1, 0, 0, 0, 42, 516, 1, 0, 0, 0, 44, 524, 1, 0, 0, 0, 46, 537, 1, 0, 0, 0, 48, 541, 1, 0, 0, 0, 50, 543, 1, 0, 0, 0, 52, 548, 1, 0, 0, 0, 54, 550, 1, 0, 0, 0, 56, 553, 1, 0, 0, 0, 58, 562, 1, 0, 0, 0, 60, 575, 1, 0, 0, 0, 62, 581, 1, 0, 0, 0, 64, 584, 1, 0, 0, 0, 66, 596, 1, 0, 0, 0, 68, 610, 1, 0, 0, 0, 70, 621, 1, 0, 0, 0, 72, 626, 1, 0, 0, 0, 74, 635, 1, 0, 0, 0, 76, 656, 1, 0, 0, 0, 78, 664, 1, 0, 0, 0, 80, 669, 1, 0, 0, 0, 82, 679, 1, 0, 0, 0, 84, 681, 1, 0, 0, 0, 86, 705, 1, 0, 0, 0, 88, 714, 1, 0, 0, 0, 90, 719, 1, 0, 0, 0, 92, 727, 1, 0, 0, 0, 94, 730, 1, 0, 0, 0, 96, 733, 1, 0, 0, 0, 98, 741, 1, 0, 0, 0, 100, 743, 1, 0, 0, 0, 102, 760, 1, 0, 0, 0, 104, 785, 1, 0, 0, 0, 106, 798, 1, 0, 0, 0, 108, 803, 1, 0, 0, 0, 110, 818, 1, 0, 0, 0, 112, 829, 1, 0, 0, 0, 114, 835, 1, 0, 0, 0, 116, 850, 1, 0, 0, 0, 118, 852, 1, 0, 0, 0, 120, 854, 1, 0, 0, 0, 122, 861, 1, 0, 0, 0, 124, 870, 1, 0, 0, 0, 126, 880, 1, 0, 0, 0, 128, 888, 1, 0, 0, 0, 130, 895, 1, 0, 0, 0, 132, 897, 1, 0, 0, 0, 134, 913, 1, 0, 0, 0, 136, 918, 1, 0, 0, 0, 138, 935, 1, 0, 0, 0, 140, 945, 1, 0, 0, 0, 142, 949, 1, 0, 0, 0, 144, 951, 1, 0, 0, 0, 146, 957, 1, 0, 0, 0, 148, 959, 1, 0, 0, 0, 150, 963, 1, 0, 0, 0, 152, 969, 1, 0, 0, 0, 154, 1014, 1, 0, 0, 0, 156, 1016, 1, 0, 0, 0, 158, 1018, 1, 0, 0, 0, 160, 1030, 1, 0, 0, 0, 162, 1036, 1, 0, 0, 0, 164, 1045, 1, 0, 0, 0, 166, 1049, 1, 0, 0, 0, 168, 1058, 1, 0, 0, 0, 170, 1072, 1, 0, 0, 0, 172, 1077, 1, 0, 0, 0, 174, 1086, 1, 0, 0, 0, 176, 1088, 1, 0, 0, 0, 178, 1102, 1, 0, 0, 0, 180, 1213, 1, 0, 0, 0, 182, 1215, 1, 0, 0, 0, 184, 1230, 1, 0, 0, 0, 186, 1238, 1, 0, 0, 0, 188, 1241, 1, 0, 0, 0, 190, 1248, 1, 0, 0, 0, 192, 1274, 1, 0, 0, 0, 194, 1277, 1, 0, 0, 0, 196, 1299, 1, 0, 0, 0, 198, 1313, 1, 0, 0, 0, 200, 1317, 1, 0, 0, 0, 202, 1322, 1, 0, 0, 0, 204, 1335, 1, 0, 0, 0, 206, 1339, 1, 0, 0, 0, 208, 1366, 1, 0, 0, 0, 210, 1411, 1, 0, 0, 0, 212, 1501, 1, 0, 0, 0, 214, 1509, 1, 0, 0, 0, 216, 1511, 1, 0, 0, 0, 218, 1519, 1, 0, 0, 0, 220, 1525, 1, 0, 0, 0, 222, 1533, 1, 0, 0, 0, 224, 1535, 1, 0, 0, 0, 226, 1543, 1, 0, 0, 0, 228, 1569, 1, 0, 0, 0, 230, 1573, 1, 0, 0, 0, 232, 1593, 1, 0, 0, 0, 234, 1595, 1, 0, 0, 0, 236, 1606, 1, 0, 0, 0, 238, 1622, 1, 0, 0, 0, 240, 1624, 1, 0, 0, 0, 242, 1632, 1, 0, 0, 0, 244, 1637, 1, 0, 0, 0, 246, 1658, 1, 0, 0, 0, 248, 1665, 1, 0, 0, 0, 250, 1667, 1, 0, 0, 0, 252, 1673, 1, 0, 0, 0, 254, 1703, 1, 0, 0, 0, 256, 1707, 1, 0, 0, 0, 258, 1713, 1, 0, 0, 0, 260, 1718, 1, 0, 0, 0, 262, 1720, 1, 0, 0, 0, 264, 1724, 1, 0, 0, 0, 266, 1735, 1, 0, 0, 0, 268, 1755, 1, 0, 0, 0, 270, 1757, 1, 0, 0, 0, 272, 1777, 1, 0, 0, 0, 274, 1784, 1, 0, 0, 0, 276, 1786, 1, 0, 0, 0, 278, 280, 3, 2, 1, 0, 279, 278, 1, 0, 0, 0, 279, 280, 1, 0, 0, 0, 280, 284, 1, 0, 0, 0, 281, 283, 3, 4, 2, 0, 282, 281, 1, 0, 0, 0, 283, 286, 1, 0, 0, 0, 284, 282, 1, 0, 0, 0, 284, 285, 1, 0, 0, 0, 285, 290, 1, 0, 0, 0, 286, 284, 1, 0, 0, 0, 287, 289, 3, 6, 3, 0, 288, 287, 1, 0, 0, 0, 289, 292, 1, 0, 0, 0, 290, 288, 1, 0, 0, 0, 290, 291, 1, 0, 0, 0, 291, 297, 1, 0, 0, 0, 292, 290, 1, 0, 0, 0, 293, 294, 3, 150, 75, 0, 294, 295, 5, 0, 0, 1, 295, 297, 1, 0, 0, 0, 296, 279, 1, 0, 0, 0, 296, 293, 1, 0, 0, 0, 297, 1, 1, 0, 0, 0, 298, 300, 3, 124, 62, 0, 299, 298, 1, 0, 0, 0, 300, 303, 1, 0, 0, 0, 301, 299, 1, 0, 0, 0, 301, 302, 1, 0, 0, 0, 302, 304, 1, 0, 0, 0, 303, 301, 1, 0, 0, 0, 304, 305, 5, 32, 0, 0, 305, 306, 3, 114, 57, 0, 306, 307, 5, 84, 0, 0, 307, 3, 1, 0, 0, 0, 308, 310, 5, 25, 0, 0, 309, 311, 5, 38, 0, 0, 310, 309, 1, 0, 0, 0, 310, 311, 1, 0, 0, 0, 311, 312, 1, 0, 0, 0, 312, 315, 3, 114, 57, 0, 313, 314, 5, 86, 0, 0, 314, 316, 5, 104, 0, 0, 315, 313, 1, 0, 0, 0, 315, 316, 1, 0, 0, 0, 316, 317, 1, 0, 0, 0, 317, 318, 5, 84, 0, 0, 318, 5, 1, 0, 0, 0, 319, 321, 3, 10, 5, 0, 320, 319, 1, 0, 0, 0, 321, 324, 1, 0, 0, 0, 322, 320, 1, 0, 0, 0, 322, 323, 1, 0, 0, 0, 323, 330, 1, 0, 0, 0, 324, 322, 1, 0, 0, 0, 325, 331, 3, 14, 7, 0, 326, 331, 3, 22, 11, 0, 327, 331, 3, 30, 15, 0, 328, 331, 3, 134, 67, 0, 329, 331, 3, 158, 79, 0, 330, 325, 1, 0, 0, 0, 330, 326, 1, 0, 0, 0, 330, 327, 1, 0, 0, 0, 330, 328, 1, 0, 0, 0, 330, 329, 1, 0, 0, 0, 331, 334, 1, 0, 0, 0, 332, 334, 5, 84, 0, 0, 333, 322, 1, 0, 0, 0, 333, 332, 1, 0, 0, 0, 334, 7, 1, 0, 0, 0, 335, 341, 3, 10, 5, 0, 336, 341, 5, 30, 0, 0, 337, 341, 5, 42, 0, 0, 338, 341, 5, 46, 0, 0, 339, 341, 5, 49, 0, 0, 340, 335, 1, 0, 0, 0, 340, 336, 1, 0, 0, 0, 340, 337, 1, 0, 0, 0, 340, 338, 1, 0, 0, 0, 340, 339, 1, 0, 0, 0, 341, 9, 1, 0, 0, 0, 342, 353, 3, 124, 62, 0, 343, 353, 5, 35, 0, 0, 344, 353, 5, 34, 0, 0, 345, 353, 5, 33, 0, 0, 346, 353, 5, 38, 0, 0, 347, 353, 5, 1, 0, 0, 348, 353, 5, 18, 0, 0, 349, 353, 5, 39, 0, 0, 350, 353, 5, 64, 0, 0, 351, 353, 5, 66, 0, 0, 352, 342, 1, 0, 0, 0, 352, 343, 1, 0, 0, 0, 352, 344, 1, 0, 0, 0, 352, 345, 1, 0, 0, 0, 352, 346, 1, 0, 0, 0, 352, 347, 1, 0, 0, 0, 352, 348, 1, 0, 0, 0, 352, 349, 1, 0, 0, 0, 352, 350, 1, 0, 0, 0, 352, 351, 1, 0, 0, 0, 353, 11, 1, 0, 0, 0, 354, 357, 5, 18, 0, 0, 355, 357, 3, 124, 62, 0, 356, 354, 1, 0, 0, 0, 356, 355, 1, 0, 0, 0, 357, 13, 1, 0, 0, 0, 358, 359, 5, 9, 0, 0, 359, 361, 3, 174, 87, 0, 360, 362, 3, 16, 8, 0, 361, 360, 1, 0, 0, 0, 361, 362, 1, 0, 0, 0, 362, 365, 1, 0, 0, 0, 363, 364, 5, 17, 0, 0, 364, 366, 3, 266, 133, 0, 365, 363, 1, 0, 0, 0, 365, 366, 1, 0, 0, 0, 366, 369, 1, 0, 0, 0, 367, 368, 5, 24, 0, 0, 368, 370, 3, 264, 132, 0, 369, 367, 1, 0, 0, 0, 369, 370, 1, 0, 0, 0, 370, 373, 1, 0, 0, 0, 371, 372, 5, 65, 0, 0, 372, 374, 3, 264, 132, 0, 373, 371, 1, 0, 0, 0, 373, 374, 1, 0, 0, 0, 374, 375, 1, 0, 0, 0, 375, 376, 3, 32, 16, 0, 376, 15, 1, 0, 0, 0, 377, 378, 5, 89, 0, 0, 378, 383, 3, 18, 9, 0, 379, 380, 5, 85, 0, 0, 380, 382, 3, 18, 9, 0, 381, 379, 1, 0, 0, 0, 382, 385, 1, 0, 0, 0, 383, 381, 1, 0, 0, 0, 383, 384, 1, 0, 0, 0, 384, 386, 1, 0, 0, 0, 385, 383, 1, 0, 0, 0, 386, 387, 5, 88, 0, 0, 387, 17, 1, 0, 0, 0, 388, 390, 3, 124, 62, 0, 389, 388, 1, 0, 0, 0, 390, 393, 1, 0, 0, 0, 391, 389, 1, 0, 0, 0, 391, 392, 1, 0, 0, 0, 392, 394, 1, 0, 0, 0, 393, 391, 1, 0, 0, 0, 394, 403, 3, 174, 87, 0, 395, 399, 7, 0, 0, 0, 396, 398, 3, 124, 62, 0, 397, 396, 1, 0, 0, 0, 398, 401, 1, 0, 0, 0, 399, 397, 1, 0, 0, 0, 399, 400, 1, 0, 0, 0, 400, 402, 1, 0, 0, 0, 401, 399, 1, 0, 0, 0, 402, 404, 3, 20, 10, 0, 403, 395, 1, 0, 0, 0, 403, 404, 1, 0, 0, 0, 404, 19, 1, 0, 0, 0, 405, 410, 3, 266, 133, 0, 406, 407, 5, 106, 0, 0, 407, 409, 3, 266, 133, 0, 408, 406, 1, 0, 0, 0, 409, 412, 1, 0, 0, 0, 410, 408, 1, 0, 0, 0, 410, 411, 1, 0, 0, 0, 411, 21, 1, 0, 0, 0, 412, 410, 1, 0, 0, 0, 413, 414, 5, 16, 0, 0, 414, 417, 3, 174, 87, 0, 415, 416, 5, 24, 0, 0, 416, 418, 3, 264, 132, 0, 417, 415, 1, 0, 0, 0, 417, 418, 1, 0, 0, 0, 418, 419, 1, 0, 0, 0, 419, 421, 5, 80, 0, 0, 420, 422, 3, 24, 12, 0, 421, 420, 1, 0, 0, 0, 421, 422, 1, 0, 0, 0, 422, 424, 1, 0, 0, 0, 423, 425, 5, 85, 0, 0, 424, 423, 1, 0, 0, 0, 424, 425, 1, 0, 0, 0, 425, 427, 1, 0, 0, 0, 426, 428, 3, 28, 14, 0, 427, 426, 1, 0, 0, 0, 427, 428, 1, 0, 0, 0, 428, 429, 1, 0, 0, 0, 429, 430, 5, 81, 0, 0, 430, 23, 1, 0, 0, 0, 431, 436, 3, 26, 13, 0, 432, 433, 5, 85, 0, 0, 433, 435, 3, 26, 13, 0, 434, 432, 1, 0, 0, 0, 435, 438, 1, 0, 0, 0, 436, 434, 1, 0, 0, 0, 436, 437, 1, 0, 0, 0, 437, 25, 1, 0, 0, 0, 438, 436, 1, 0, 0, 0, 439, 441, 3, 124, 62, 0, 440, 439, 1, 0, 0, 0, 441, 444, 1, 0, 0, 0, 442, 440, 1, 0, 0, 0, 442, 443, 1, 0, 0, 0, 443, 445, 1, 0, 0, 0, 444, 442, 1, 0, 0, 0, 445, 447, 3, 174, 87, 0, 446, 448, 3, 276, 138, 0, 447, 446, 1, 0, 0, 0, 447, 448, 1, 0, 0, 0, 448, 450, 1, 0, 0, 0, 449, 451, 3, 32, 16, 0, 450, 449, 1, 0, 0, 0, 450, 451, 1, 0, 0, 0, 451, 27, 1, 0, 0, 0, 452, 456, 5, 84, 0, 0, 453, 455, 3, 36, 18, 0, 454, 453, 1, 0, 0, 0, 455, 458, 1, 0, 0, 0, 456, 454, 1, 0, 0, 0, 456, 457, 1, 0, 0, 0, 457, 29, 1, 0, 0, 0, 458, 456, 1, 0, 0, 0, 459, 460, 5, 28, 0, 0, 460, 462, 3, 174, 87, 0, 461, 463, 3, 16, 8, 0, 462, 461, 1, 0, 0, 0, 462, 463, 1, 0, 0, 0, 463, 466, 1, 0, 0, 0, 464, 465, 5, 17, 0, 0, 465, 467, 3, 264, 132, 0, 466, 464, 1, 0, 0, 0, 466, 467, 1, 0, 0, 0, 467, 470, 1, 0, 0, 0, 468, 469, 5, 65, 0, 0, 469, 471, 3, 264, 132, 0, 470, 468, 1, 0, 0, 0, 470, 471, 1, 0, 0, 0, 471, 472, 1, 0, 0, 0, 472, 473, 3, 34, 17, 0, 473, 31, 1, 0, 0, 0, 474, 478, 5, 80, 0, 0, 475, 477, 3, 36, 18, 0, 476, 475, 1, 0, 0, 0, 477, 480, 1, 0, 0, 0, 478, 476, 1, 0, 0, 0, 478, 479, 1, 0, 0, 0, 479, 481, 1, 0, 0, 0, 480, 478, 1, 0, 0, 0, 481, 482, 5, 81, 0, 0, 482, 33, 1, 0, 0, 0, 483, 487, 5, 80, 0, 0, 484, 486, 3, 60, 30, 0, 485, 484, 1, 0, 0, 0, 486, 489, 1, 0, 0, 0, 487, 485, 1, 0, 0, 0, 487, 488, 1, 0, 0, 0, 488, 490, 1, 0, 0, 0, 489, 487, 1, 0, 0, 0, 490, 491, 5, 81, 0, 0, 491, 35, 1, 0, 0, 0, 492, 505, 5, 84, 0, 0, 493, 495, 5, 38, 0, 0, 494, 493, 1, 0, 0, 0, 494, 495, 1, 0, 0, 0, 495, 496, 1, 0, 0, 0, 496, 505, 3, 168, 84, 0, 497, 499, 3, 8, 4, 0, 498, 497, 1, 0, 0, 0, 499, 502, 1, 0, 0, 0, 500, 498, 1, 0, 0, 0, 500, 501, 1, 0, 0, 0, 501, 503, 1, 0, 0, 0, 502, 500, 1, 0, 0, 0, 503, 505, 3, 38, 19, 0, 504, 492, 1, 0, 0, 0, 504, 494, 1, 0, 0, 0, 504, 500, 1, 0, 0, 0, 505, 37, 1, 0, 0, 0, 506, 511, 3, 6, 3, 0, 507, 511, 3, 58, 29, 0, 508, 511, 3, 40, 20, 0, 509, 511, 3, 52, 26, 0, 510, 506, 1, 0, 0, 0, 510, 507, 1, 0, 0, 0, 510, 508, 1, 0, 0, 0, 510, 509, 1, 0, 0, 0, 511, 39, 1, 0, 0, 0, 512, 515, 3, 42, 21, 0, 513, 515, 3, 50, 25, 0, 514, 512, 1, 0, 0, 0, 514, 513, 1, 0, 0, 0, 515, 41, 1, 0, 0, 0, 516, 519, 3, 44, 22, 0, 517, 518, 5, 45, 0, 0, 518, 520, 3, 98, 49, 0, 519, 517, 1, 0, 0, 0, 519, 520, 1, 0, 0, 0, 520, 521, 1, 0, 0, 0, 521, 522, 3, 46, 23, 0, 522, 43, 1, 0, 0, 0, 523, 525, 3, 48, 24, 0, 524, 523, 1, 0, 0, 0, 524, 525, 1, 0, 0, 0, 525, 526, 1, 0, 0, 0, 526, 527, 3, 174, 87, 0, 527, 532, 3, 100, 50, 0, 528, 529, 5, 82, 0, 0, 529, 531, 5, 83, 0, 0, 530, 528, 1, 0, 0, 0, 531, 534, 1, 0, 0, 0, 532, 530, 1, 0, 0, 0, 532, 533, 1, 0, 0, 0, 533, 45, 1, 0, 0, 0, 534, 532, 1, 0, 0, 0, 535, 538, 3, 168, 84, 0, 536, 538, 5, 84, 0, 0, 537, 535, 1, 0, 0, 0, 537, 536, 1, 0, 0, 0, 538, 47, 1, 0, 0, 0, 539, 542, 3, 266, 133, 0, 540, 542, 5, 48, 0, 0, 541, 539, 1, 0, 0, 0, 541, 540, 1, 0, 0, 0, 542, 49, 1, 0, 0, 0, 543, 544, 3, 16, 8, 0, 544, 545, 3, 42, 21, 0, 545, 51, 1, 0, 0, 0, 546, 549, 3, 54, 27, 0, 547, 549, 3, 56, 28, 0, 548, 546, 1, 0, 0, 0, 548, 547, 1, 0, 0, 0, 549, 53, 1, 0, 0, 0, 550, 551, 3, 16, 8, 0, 551, 552, 3, 56, 28, 0, 552, 55, 1, 0, 0, 0, 553, 554, 3, 174, 87, 0, 554, 557, 3, 100, 50, 0, 555, 556, 5, 45, 0, 0, 556, 558, 3, 98, 49, 0, 557, 555, 1, 0, 0, 0, 557, 558, 1, 0, 0, 0, 558, 559, 1, 0, 0, 0, 559, 560, 3, 168, 84, 0, 560, 57, 1, 0, 0, 0, 561, 563, 3, 266, 133, 0, 562, 561, 1, 0, 0, 0, 562, 563, 1, 0, 0, 0, 563, 564, 1, 0, 0, 0, 564, 565, 3, 76, 38, 0, 565, 566, 5, 84, 0, 0, 566, 59, 1, 0, 0, 0, 567, 569, 3, 8, 4, 0, 568, 567, 1, 0, 0, 0, 569, 572, 1, 0, 0, 0, 570, 568, 1, 0, 0, 0, 570, 571, 1, 0, 0, 0, 571, 573, 1, 0, 0, 0, 572, 570, 1, 0, 0, 0, 573, 576, 3, 62, 31, 0, 574, 576, 5, 84, 0, 0, 575, 570, 1, 0, 0, 0, 575, 574, 1, 0, 0, 0, 576, 61, 1, 0, 0, 0, 577, 582, 3, 64, 32, 0, 578, 582, 3, 68, 34, 0, 579, 582, 3, 72, 36, 0, 580, 582, 3, 6, 3, 0, 581, 577, 1, 0, 0, 0, 581, 578, 1, 0, 0, 0, 581, 579, 1, 0, 0, 0, 581, 580, 1, 0, 0, 0, 582, 63, 1, 0, 0, 0, 583, 585, 3, 266, 133, 0, 584, 583, 1, 0, 0, 0, 584, 585, 1, 0, 0, 0, 585, 586, 1, 0, 0, 0, 586, 591, 3, 66, 33, 0, 587, 588, 5, 85, 0, 0, 588, 590, 3, 66, 33, 0, 589, 587, 1, 0, 0, 0, 590, 593, 1, 0, 0, 0, 591, 589, 1, 0, 0, 0, 591, 592, 1, 0, 0, 0, 592, 594, 1, 0, 0, 0, 593, 591, 1, 0, 0, 0, 594, 595, 5, 84, 0, 0, 595, 65, 1, 0, 0, 0, 596, 601, 3, 174, 87, 0, 597, 598, 5, 82, 0, 0, 598, 600, 5, 83, 0, 0, 599, 597, 1, 0, 0, 0, 600, 603, 1, 0, 0, 0, 601, 599, 1, 0, 0, 0, 601, 602, 1, 0, 0, 0, 602, 604, 1, 0, 0, 0, 603, 601, 1, 0, 0, 0, 604, 605, 5, 87, 0, 0, 605, 606, 3, 82, 41, 0, 606, 67, 1, 0, 0, 0, 607, 609, 3, 70, 35, 0, 608, 607, 1, 0, 0, 0, 609, 612, 1, 0, 0, 0, 610, 608, 1, 0, 0, 0, 610, 611, 1, 0, 0, 0, 611, 613, 1, 0, 0, 0, 612, 610, 1, 0, 0, 0, 613, 614, 3, 74, 37, 0, 614, 69, 1, 0, 0, 0, 615, 622, 3, 124, 62, 0, 616, 622, 5, 35, 0, 0, 617, 622, 5, 1, 0, 0, 618, 622, 5, 12, 0, 0, 619, 622, 5, 38, 0, 0, 620, 622, 5, 39, 0, 0, 621, 615, 1, 0, 0, 0, 621, 616, 1, 0, 0, 0, 621, 617, 1, 0, 0, 0, 621, 618, 1, 0, 0, 0, 621, 619, 1, 0, 0, 0, 621, 620, 1, 0, 0, 0, 622, 71, 1, 0, 0, 0, 623, 625, 3, 70, 35, 0, 624, 623, 1, 0, 0, 0, 625, 628, 1, 0, 0, 0, 626, 624, 1, 0, 0, 0, 626, 627, 1, 0, 0, 0, 627, 629, 1, 0, 0, 0, 628, 626, 1, 0, 0, 0, 629, 630, 3, 16, 8, 0, 630, 631, 3, 74, 37, 0, 631, 73, 1, 0, 0, 0, 632, 634, 3, 124, 62, 0, 633, 632, 1, 0, 0, 0, 634, 637, 1, 0, 0, 0, 635, 633, 1, 0, 0, 0, 635, 636, 1, 0, 0, 0, 636, 639, 1, 0, 0, 0, 637, 635, 1, 0, 0, 0, 638, 640, 3, 48, 24, 0, 639, 638, 1, 0, 0, 0, 639, 640, 1, 0, 0, 0, 640, 641, 1, 0, 0, 0, 641, 642, 3, 174, 87, 0, 642, 647, 3, 100, 50, 0, 643, 644, 5, 82, 0, 0, 644, 646, 5, 83, 0, 0, 645, 643, 1, 0, 0, 0, 646, 649, 1, 0, 0, 0, 647, 645, 1, 0, 0, 0, 647, 648, 1, 0, 0, 0, 648, 652, 1, 0, 0, 0, 649, 647, 1, 0, 0, 0, 650, 651, 5, 45, 0, 0, 651, 653, 3, 98, 49, 0, 652, 650, 1, 0, 0, 0, 652, 653, 1, 0, 0, 0, 653, 654, 1, 0, 0, 0, 654, 655, 3, 46, 23, 0, 655, 75, 1, 0, 0, 0, 656, 661, 3, 78, 39, 0, 657, 658, 5, 85, 0, 0, 658, 660, 3, 78, 39, 0, 659, 657, 1, 0, 0, 0, 660, 663, 1, 0, 0, 0, 661, 659, 1, 0, 0, 0, 661, 662, 1, 0, 0, 0, 662, 77, 1, 0, 0, 0, 663, 661, 1, 0, 0, 0, 664, 667, 3, 80, 40, 0, 665, 666, 5, 87, 0, 0, 666, 668, 3, 82, 41, 0, 667, 665, 1, 0, 0, 0, 667, 668, 1, 0, 0, 0, 668, 79, 1, 0, 0, 0, 669, 674, 3, 174, 87, 0, 670, 671, 5, 82, 0, 0, 671, 673, 5, 83, 0, 0, 672, 670, 1, 0, 0, 0, 673, 676, 1, 0, 0, 0, 674, 672, 1, 0, 0, 0, 674, 675, 1, 0, 0, 0, 675, 81, 1, 0, 0, 0, 676, 674, 1, 0, 0, 0, 677, 680, 3, 84, 42, 0, 678, 680, 3, 210, 105, 0, 679, 677, 1, 0, 0, 0, 679, 678, 1, 0, 0, 0, 680, 83, 1, 0, 0, 0, 681, 693, 5, 80, 0, 0, 682, 687, 3, 82, 41, 0, 683, 684, 5, 85, 0, 0, 684, 686, 3, 82, 41, 0, 685, 683, 1, 0, 0, 0, 686, 689, 1, 0, 0, 0, 687, 685, 1, 0, 0, 0, 687, 688, 1, 0, 0, 0, 688, 691, 1, 0, 0, 0, 689, 687, 1, 0, 0, 0, 690, 692, 5, 85, 0, 0, 691, 690, 1, 0, 0, 0, 691, 692, 1, 0, 0, 0, 692, 694, 1, 0, 0, 0, 693, 682, 1, 0, 0, 0, 693, 694, 1, 0, 0, 0, 694, 695, 1, 0, 0, 0, 695, 696, 5, 81, 0, 0, 696, 85, 1, 0, 0, 0, 697, 699, 3, 174, 87, 0, 698, 700, 3, 270, 135, 0, 699, 698, 1, 0, 0, 0, 699, 700, 1, 0, 0, 0, 700, 701, 1, 0, 0, 0, 701, 702, 5, 86, 0, 0, 702, 704, 1, 0, 0, 0, 703, 697, 1, 0, 0, 0, 704, 707, 1, 0, 0, 0, 705, 703, 1, 0, 0, 0, 705, 706, 1, 0, 0, 0, 706, 708, 1, 0, 0, 0, 707, 705, 1, 0, 0, 0, 708, 710, 3, 176, 88, 0, 709, 711, 3, 270, 135, 0, 710, 709, 1, 0, 0, 0, 710, 711, 1, 0, 0, 0, 711, 87, 1, 0, 0, 0, 712, 715, 3, 266, 133, 0, 713, 715, 3, 90, 45, 0, 714, 712, 1, 0, 0, 0, 714, 713, 1, 0, 0, 0, 715, 89, 1, 0, 0, 0, 716, 718, 3, 124, 62, 0, 717, 716, 1, 0, 0, 0, 718, 721, 1, 0, 0, 0, 719, 717, 1, 0, 0, 0, 719, 720, 1, 0, 0, 0, 720, 722, 1, 0, 0, 0, 721, 719, 1, 0, 0, 0, 722, 725, 5, 92, 0, 0, 723, 726, 3, 92, 46, 0, 724, 726, 3, 94, 47, 0, 725, 723, 1, 0, 0, 0, 725, 724, 1, 0, 0, 0, 725, 726, 1, 0, 0, 0, 726, 91, 1, 0, 0, 0, 727, 728, 5, 17, 0, 0, 728, 729, 3, 266, 133, 0, 729, 93, 1, 0, 0, 0, 730, 731, 5, 40, 0, 0, 731, 732, 3, 266, 133, 0, 732, 95, 1, 0, 0, 0, 733, 738, 3, 114, 57, 0, 734, 735, 5, 85, 0, 0, 735, 737, 3, 114, 57, 0, 736, 734, 1, 0, 0, 0, 737, 740, 1, 0, 0, 0, 738, 736, 1, 0, 0, 0, 738, 739, 1, 0, 0, 0, 739, 97, 1, 0, 0, 0, 740, 738, 1, 0, 0, 0, 741, 742, 3, 96, 48, 0, 742, 99, 1, 0, 0, 0, 743, 755, 5, 78, 0, 0, 744, 746, 3, 102, 51, 0, 745, 744, 1, 0, 0, 0, 745, 746, 1, 0, 0, 0, 746, 756, 1, 0, 0, 0, 747, 750, 3, 102, 51, 0, 748, 749, 5, 85, 0, 0, 749, 751, 3, 104, 52, 0, 750, 748, 1, 0, 0, 0, 750, 751, 1, 0, 0, 0, 751, 756, 1, 0, 0, 0, 752, 754, 3, 104, 52, 0, 753, 752, 1, 0, 0, 0, 753, 754, 1, 0, 0, 0, 754, 756, 1, 0, 0, 0, 755, 745, 1, 0, 0, 0, 755, 747, 1, 0, 0, 0, 755, 753, 1, 0, 0, 0, 756, 757, 1, 0, 0, 0, 757, 758, 5, 79, 0, 0, 758, 101, 1, 0, 0, 0, 759, 761, 3, 266, 133, 0, 760, 759, 1, 0, 0, 0, 760, 761, 1, 0, 0, 0, 761, 767, 1, 0, 0, 0, 762, 763, 3, 174, 87, 0, 763, 764, 5, 86, 0, 0, 764, 766, 1, 0, 0, 0, 765, 762, 1, 0, 0, 0, 766, 769, 1, 0, 0, 0, 767, 765, 1, 0, 0, 0, 767, 768, 1, 0, 0, 0, 768, 770, 1, 0, 0, 0, 769, 767, 1, 0, 0, 0, 770, 771, 5, 43, 0, 0, 771, 103, 1, 0, 0, 0, 772, 777, 3, 106, 53, 0, 773, 774, 5, 85, 0, 0, 774, 776, 3, 106, 53, 0, 775, 773, 1, 0, 0, 0, 776, 779, 1, 0, 0, 0, 777, 775, 1, 0, 0, 0, 777, 778, 1, 0, 0, 0, 778, 782, 1, 0, 0, 0, 779, 777, 1, 0, 0, 0, 780, 781, 5, 85, 0, 0, 781, 783, 3, 108, 54, 0, 782, 780, 1, 0, 0, 0, 782, 783, 1, 0, 0, 0, 783, 786, 1, 0, 0, 0, 784, 786, 3, 108, 54, 0, 785, 772, 1, 0, 0, 0, 785, 784, 1, 0, 0, 0, 786, 105, 1, 0, 0, 0, 787, 789, 3, 12, 6, 0, 788, 787, 1, 0, 0, 0, 789, 792, 1, 0, 0, 0, 790, 788, 1, 0, 0, 0, 790, 791, 1, 0, 0, 0, 791, 794, 1, 0, 0, 0, 792, 790, 1, 0, 0, 0, 793, 795, 3, 266, 133, 0, 794, 793, 1, 0, 0, 0, 794, 795, 1, 0, 0, 0, 795, 796, 1, 0, 0, 0, 796, 799, 3, 80, 40, 0, 797, 799, 3, 212, 106, 0, 798, 790, 1, 0, 0, 0, 798, 797, 1, 0, 0, 0, 799, 107, 1, 0, 0, 0, 800, 802, 3, 12, 6, 0, 801, 800, 1, 0, 0, 0, 802, 805, 1, 0, 0, 0, 803, 801, 1, 0, 0, 0, 803, 804, 1, 0, 0, 0, 804, 807, 1, 0, 0, 0, 805, 803, 1, 0, 0, 0, 806, 808, 3, 266, 133, 0, 807, 806, 1, 0, 0, 0, 807, 808, 1, 0, 0, 0, 808, 812, 1, 0, 0, 0, 809, 811, 3, 124, 62, 0, 810, 809, 1, 0, 0, 0, 811, 814, 1, 0, 0, 0, 812, 810, 1, 0, 0, 0, 812, 813, 1, 0, 0, 0, 813, 815, 1, 0, 0, 0, 814, 812, 1, 0, 0, 0, 815, 816, 5, 124, 0, 0, 816, 817, 3, 80, 40, 0, 817, 109, 1, 0, 0, 0, 818, 823, 3, 112, 56, 0, 819, 820, 5, 85, 0, 0, 820, 822, 3, 112, 56, 0, 821, 819, 1, 0, 0, 0, 822, 825, 1, 0, 0, 0, 823, 821, 1, 0, 0, 0, 823, 824, 1, 0, 0, 0, 824, 111, 1, 0, 0, 0, 825, 823, 1, 0, 0, 0, 826, 828, 3, 12, 6, 0, 827, 826, 1, 0, 0, 0, 828, 831, 1, 0, 0, 0, 829, 827, 1, 0, 0, 0, 829, 830, 1, 0, 0, 0, 830, 832, 1, 0, 0, 0, 831, 829, 1, 0, 0, 0, 832, 833, 5, 61, 0, 0, 833, 834, 3, 174, 87, 0, 834, 113, 1, 0, 0, 0, 835, 840, 3, 174, 87, 0, 836, 837, 5, 86, 0, 0, 837, 839, 3, 174, 87, 0, 838, 836, 1, 0, 0, 0, 839, 842, 1, 0, 0, 0, 840, 838, 1, 0, 0, 0, 840, 841, 1, 0, 0, 0, 841, 115, 1, 0, 0, 0, 842, 840, 1, 0, 0, 0, 843, 851, 3, 118, 59, 0, 844, 851, 3, 120, 60, 0, 845, 851, 5, 74, 0, 0, 846, 851, 5, 75, 0, 0, 847, 851, 5, 73, 0, 0, 848, 851, 5, 77, 0, 0, 849, 851, 5, 76, 0, 0, 850, 843, 1, 0, 0, 0, 850, 844, 1, 0, 0, 0, 850, 845, 1, 0, 0, 0, 850, 846, 1, 0, 0, 0, 850, 847, 1, 0, 0, 0, 850, 848, 1, 0, 0, 0, 850, 849, 1, 0, 0, 0, 851, 117, 1, 0, 0, 0, 852, 853, 7, 1, 0, 0, 853, 119, 1, 0, 0, 0, 854, 855, 7, 2, 0, 0, 855, 121, 1, 0, 0, 0, 856, 857, 3, 174, 87, 0, 857, 858, 5, 86, 0, 0, 858, 860, 1, 0, 0, 0, 859, 856, 1, 0, 0, 0, 860, 863, 1, 0, 0, 0, 861, 859, 1, 0, 0, 0, 861, 862, 1, 0, 0, 0, 862, 864, 1, 0, 0, 0, 863, 861, 1, 0, 0, 0, 864, 865, 5, 123, 0, 0, 865, 866, 3, 174, 87, 0, 866, 123, 1, 0, 0, 0, 867, 868, 5, 123, 0, 0, 868, 871, 3, 114, 57, 0, 869, 871, 3, 122, 61, 0, 870, 867, 1, 0, 0, 0, 870, 869, 1, 0, 0, 0, 871, 878, 1, 0, 0, 0, 872, 875, 5, 78, 0, 0, 873, 876, 3, 126, 63, 0, 874, 876, 3, 130, 65, 0, 875, 873, 1, 0, 0, 0, 875, 874, 1, 0, 0, 0, 875, 876, 1, 0, 0, 0, 876, 877, 1, 0, 0, 0, 877, 879, 5, 79, 0, 0, 878, 872, 1, 0, 0, 0, 878, 879, 1, 0, 0, 0, 879, 125, 1, 0, 0, 0, 880, 885, 3, 128, 64, 0, 881, 882, 5, 85, 0, 0, 882, 884, 3, 128, 64, 0, 883, 881, 1, 0, 0, 0, 884, 887, 1, 0, 0, 0, 885, 883, 1, 0, 0, 0, 885, 886, 1, 0, 0, 0, 886, 127, 1, 0, 0, 0, 887, 885, 1, 0, 0, 0, 888, 889, 3, 174, 87, 0, 889, 890, 5, 87, 0, 0, 890, 891, 3, 130, 65, 0, 891, 129, 1, 0, 0, 0, 892, 896, 3, 210, 105, 0, 893, 896, 3, 124, 62, 0, 894, 896, 3, 132, 66, 0, 895, 892, 1, 0, 0, 0, 895, 893, 1, 0, 0, 0, 895, 894, 1, 0, 0, 0, 896, 131, 1, 0, 0, 0, 897, 906, 5, 80, 0, 0, 898, 903, 3, 130, 65, 0, 899, 900, 5, 85, 0, 0, 900, 902, 3, 130, 65, 0, 901, 899, 1, 0, 0, 0, 902, 905, 1, 0, 0, 0, 903, 901, 1, 0, 0, 0, 903, 904, 1, 0, 0, 0, 904, 907, 1, 0, 0, 0, 905, 903, 1, 0, 0, 0, 906, 898, 1, 0, 0, 0, 906, 907, 1, 0, 0, 0, 907, 909, 1, 0, 0, 0, 908, 910, 5, 85, 0, 0, 909, 908, 1, 0, 0, 0, 909, 910, 1, 0, 0, 0, 910, 911, 1, 0, 0, 0, 911, 912, 5, 81, 0, 0, 912, 133, 1, 0, 0, 0, 913, 914, 5, 123, 0, 0, 914, 915, 5, 28, 0, 0, 915, 916, 3, 174, 87, 0, 916, 917, 3, 136, 68, 0, 917, 135, 1, 0, 0, 0, 918, 922, 5, 80, 0, 0, 919, 921, 3, 138, 69, 0, 920, 919, 1, 0, 0, 0, 921, 924, 1, 0, 0, 0, 922, 920, 1, 0, 0, 0, 922, 923, 1, 0, 0, 0, 923, 925, 1, 0, 0, 0, 924, 922, 1, 0, 0, 0, 925, 926, 5, 81, 0, 0, 926, 137, 1, 0, 0, 0, 927, 929, 3, 8, 4, 0, 928, 927, 1, 0, 0, 0, 929, 932, 1, 0, 0, 0, 930, 928, 1, 0, 0, 0, 930, 931, 1, 0, 0, 0, 931, 933, 1, 0, 0, 0, 932, 930, 1, 0, 0, 0, 933, 936, 3, 140, 70, 0, 934, 936, 5, 84, 0, 0, 935, 930, 1, 0, 0, 0, 935, 934, 1, 0, 0, 0, 936, 139, 1, 0, 0, 0, 937, 938, 3, 266, 133, 0, 938, 939, 3, 142, 71, 0, 939, 940, 5, 84, 0, 0, 940, 946, 1, 0, 0, 0, 941, 943, 3, 6, 3, 0, 942, 944, 5, 84, 0, 0, 943, 942, 1, 0, 0, 0, 943, 944, 1, 0, 0, 0, 944, 946, 1, 0, 0, 0, 945, 937, 1, 0, 0, 0, 945, 941, 1, 0, 0, 0, 946, 141, 1, 0, 0, 0, 947, 950, 3, 144, 72, 0, 948, 950, 3, 146, 73, 0, 949, 947, 1, 0, 0, 0, 949, 948, 1, 0, 0, 0, 950, 143, 1, 0, 0, 0, 951, 952, 3, 174, 87, 0, 952, 953, 5, 78, 0, 0, 953, 955, 5, 79, 0, 0, 954, 956, 3, 148, 74, 0, 955, 954, 1, 0, 0, 0, 955, 956, 1, 0, 0, 0, 956, 145, 1, 0, 0, 0, 957, 958, 3, 76, 38, 0, 958, 147, 1, 0, 0, 0, 959, 960, 5, 12, 0, 0, 960, 961, 3, 130, 65, 0, 961, 149, 1, 0, 0, 0, 962, 964, 5, 52, 0, 0, 963, 962, 1, 0, 0, 0, 963, 964, 1, 0, 0, 0, 964, 965, 1, 0, 0, 0, 965, 966, 5, 51, 0, 0, 966, 967, 3, 114, 57, 0, 967, 968, 3, 152, 76, 0, 968, 151, 1, 0, 0, 0, 969, 973, 5, 80, 0, 0, 970, 972, 3, 154, 77, 0, 971, 970, 1, 0, 0, 0, 972, 975, 1, 0, 0, 0, 973, 971, 1, 0, 0, 0, 973, 974, 1, 0, 0, 0, 974, 976, 1, 0, 0, 0, 975, 973, 1, 0, 0, 0, 976, 977, 5, 81, 0, 0, 977, 153, 1, 0, 0, 0, 978, 982, 5, 53, 0, 0, 979, 981, 3, 156, 78, 0, 980, 979, 1, 0, 0, 0, 981, 984, 1, 0, 0, 0, 982, 980, 1, 0, 0, 0, 982, 983, 1, 0, 0, 0, 983, 985, 1, 0, 0, 0, 984, 982, 1, 0, 0, 0, 985, 986, 3, 114, 57, 0, 986, 987, 5, 84, 0, 0, 987, 1015, 1, 0, 0, 0, 988, 989, 5, 54, 0, 0, 989, 992, 3, 114, 57, 0, 990, 991, 5, 56, 0, 0, 991, 993, 3, 114, 57, 0, 992, 990, 1, 0, 0, 0, 992, 993, 1, 0, 0, 0, 993, 994, 1, 0, 0, 0, 994, 995, 5, 84, 0, 0, 995, 1015, 1, 0, 0, 0, 996, 997, 5, 55, 0, 0, 997, 1000, 3, 114, 57, 0, 998, 999, 5, 56, 0, 0, 999, 1001, 3, 114, 57, 0, 1000, 998, 1, 0, 0, 0, 1000, 1001, 1, 0, 0, 0, 1001, 1002, 1, 0, 0, 0, 1002, 1003, 5, 84, 0, 0, 1003, 1015, 1, 0, 0, 0, 1004, 1005, 5, 57, 0, 0, 1005, 1006, 3, 114, 57, 0, 1006, 1007, 5, 84, 0, 0, 1007, 1015, 1, 0, 0, 0, 1008, 1009, 5, 58, 0, 0, 1009, 1010, 3, 114, 57, 0, 1010, 1011, 5, 59, 0, 0, 1011, 1012, 3, 114, 57, 0, 1012, 1013, 5, 84, 0, 0, 1013, 1015, 1, 0, 0, 0, 1014, 978, 1, 0, 0, 0, 1014, 988, 1, 0, 0, 0, 1014, 996, 1, 0, 0, 0, 1014, 1004, 1, 0, 0, 0, 1014, 1008, 1, 0, 0, 0, 1015, 155, 1, 0, 0, 0, 1016, 1017, 7, 3, 0, 0, 1017, 157, 1, 0, 0, 0, 1018, 1019, 5, 63, 0, 0, 1019, 1021, 3, 174, 87, 0, 1020, 1022, 3, 16, 8, 0, 1021, 1020, 1, 0, 0, 0, 1021, 1022, 1, 0, 0, 0, 1022, 1023, 1, 0, 0, 0, 1023, 1026, 3, 160, 80, 0, 1024, 1025, 5, 24, 0, 0, 1025, 1027, 3, 264, 132, 0, 1026, 1024, 1, 0, 0, 0, 1026, 1027, 1, 0, 0, 0, 1027, 1028, 1, 0, 0, 0, 1028, 1029, 3, 166, 83, 0, 1029, 159, 1, 0, 0, 0, 1030, 1032, 5, 78, 0, 0, 1031, 1033, 3, 162, 81, 0, 1032, 1031, 1, 0, 0, 0, 1032, 1033, 1, 0, 0, 0, 1033, 1034, 1, 0, 0, 0, 1034, 1035, 5, 79, 0, 0, 1035, 161, 1, 0, 0, 0, 1036, 1041, 3, 164, 82, 0, 1037, 1038, 5, 85, 0, 0, 1038, 1040, 3, 164, 82, 0, 1039, 1037, 1, 0, 0, 0, 1040, 1043, 1, 0, 0, 0, 1041, 1039, 1, 0, 0, 0, 1041, 1042, 1, 0, 0, 0, 1042, 163, 1, 0, 0, 0, 1043, 1041, 1, 0, 0, 0, 1044, 1046, 3, 266, 133, 0, 1045, 1044, 1, 0, 0, 0, 1045, 1046, 1, 0, 0, 0, 1046, 1047, 1, 0, 0, 0, 1047, 1048, 3, 174, 87, 0, 1048, 165, 1, 0, 0, 0, 1049, 1053, 5, 80, 0, 0, 1050, 1052, 3, 36, 18, 0, 1051, 1050, 1, 0, 0, 0, 1052, 1055, 1, 0, 0, 0, 1053, 1051, 1, 0, 0, 0, 1053, 1054, 1, 0, 0, 0, 1054, 1056, 1, 0, 0, 0, 1055, 1053, 1, 0, 0, 0, 1056, 1057, 5, 81, 0, 0, 1057, 167, 1, 0, 0, 0, 1058, 1062, 5, 80, 0, 0, 1059, 1061, 3, 170, 85, 0, 1060, 1059, 1, 0, 0, 0, 1061, 1064, 1, 0, 0, 0, 1062, 1060, 1, 0, 0, 0, 1062, 1063, 1, 0, 0, 0, 1063, 1065, 1, 0, 0, 0, 1064, 1062, 1, 0, 0, 0, 1065, 1066, 5, 81, 0, 0, 1066, 169, 1, 0, 0, 0, 1067, 1068, 3, 172, 86, 0, 1068, 1069, 5, 84, 0, 0, 1069, 1073, 1, 0, 0, 0, 1070, 1073, 3, 178, 89, 0, 1071, 1073, 3, 180, 90, 0, 1072, 1067, 1, 0, 0, 0, 1072, 1070, 1, 0, 0, 0, 1072, 1071, 1, 0, 0, 0, 1073, 171, 1, 0, 0, 0, 1074, 1076, 3, 12, 6, 0, 1075, 1074, 1, 0, 0, 0, 1076, 1079, 1, 0, 0, 0, 1077, 1075, 1, 0, 0, 0, 1077, 1078, 1, 0, 0, 0, 1078, 1082, 1, 0, 0, 0, 1079, 1077, 1, 0, 0, 0, 1080, 1083, 5, 61, 0, 0, 1081, 1083, 3, 266, 133, 0, 1082, 1080, 1, 0, 0, 0, 1082, 1081, 1, 0, 0, 0, 1083, 1084, 1, 0, 0, 0, 1084, 1085, 3, 76, 38, 0, 1085, 173, 1, 0, 0, 0, 1086, 1087, 7, 4, 0, 0, 1087, 175, 1, 0, 0, 0, 1088, 1089, 7, 5, 0, 0, 1089, 177, 1, 0, 0, 0, 1090, 1092, 3, 10, 5, 0, 1091, 1090, 1, 0, 0, 0, 1092, 1095, 1, 0, 0, 0, 1093, 1091, 1, 0, 0, 0, 1093, 1094, 1, 0, 0, 0, 1094, 1099, 1, 0, 0, 0, 1095, 1093, 1, 0, 0, 0, 1096, 1100, 3, 14, 7, 0, 1097, 1100, 3, 30, 15, 0, 1098, 1100, 3, 158, 79, 0, 1099, 1096, 1, 0, 0, 0, 1099, 1097, 1, 0, 0, 0, 1099, 1098, 1, 0, 0, 0, 1100, 1103, 1, 0, 0, 0, 1101, 1103, 5, 84, 0, 0, 1102, 1093, 1, 0, 0, 0, 1102, 1101, 1, 0, 0, 0, 1103, 179, 1, 0, 0, 0, 1104, 1214, 3, 168, 84, 0, 1105, 1106, 5, 2, 0, 0, 1106, 1109, 3, 210, 105, 0, 1107, 1108, 5, 93, 0, 0, 1108, 1110, 3, 210, 105, 0, 1109, 1107, 1, 0, 0, 0, 1109, 1110, 1, 0, 0, 0, 1110, 1111, 1, 0, 0, 0, 1111, 1112, 5, 84, 0, 0, 1112, 1214, 1, 0, 0, 0, 1113, 1114, 5, 22, 0, 0, 1114, 1115, 3, 204, 102, 0, 1115, 1118, 3, 180, 90, 0, 1116, 1117, 5, 15, 0, 0, 1117, 1119, 3, 180, 90, 0, 1118, 1116, 1, 0, 0, 0, 1118, 1119, 1, 0, 0, 0, 1119, 1214, 1, 0, 0, 0, 1120, 1121, 5, 21, 0, 0, 1121, 1122, 5, 78, 0, 0, 1122, 1123, 3, 198, 99, 0, 1123, 1124, 5, 79, 0, 0, 1124, 1125, 3, 180, 90, 0, 1125, 1214, 1, 0, 0, 0, 1126, 1127, 5, 50, 0, 0, 1127, 1128, 3, 204, 102, 0, 1128, 1129, 3, 180, 90, 0, 1129, 1214, 1, 0, 0, 0, 1130, 1131, 5, 13, 0, 0, 1131, 1132, 3, 180, 90, 0, 1132, 1133, 5, 50, 0, 0, 1133, 1134, 3, 204, 102, 0, 1134, 1135, 5, 84, 0, 0, 1135, 1214, 1, 0, 0, 0, 1136, 1137, 5, 47, 0, 0, 1137, 1147, 3, 168, 84, 0, 1138, 1140, 3, 182, 91, 0, 1139, 1138, 1, 0, 0, 0, 1140, 1141, 1, 0, 0, 0, 1141, 1139, 1, 0, 0, 0, 1141, 1142, 1, 0, 0, 0, 1142, 1144, 1, 0, 0, 0, 1143, 1145, 3, 186, 93, 0, 1144, 1143, 1, 0, 0, 0, 1144, 1145, 1, 0, 0, 0, 1145, 1148, 1, 0, 0, 0, 1146, 1148, 3, 186, 93, 0, 1147, 1139, 1, 0, 0, 0, 1147, 1146, 1, 0, 0, 0, 1148, 1214, 1, 0, 0, 0, 1149, 1150, 5, 47, 0, 0, 1150, 1151, 3, 188, 94, 0, 1151, 1155, 3, 168, 84, 0, 1152, 1154, 3, 182, 91, 0, 1153, 1152, 1, 0, 0, 0, 1154, 1157, 1, 0, 0, 0, 1155, 1153, 1, 0, 0, 0, 1155, 1156, 1, 0, 0, 0, 1156, 1159, 1, 0, 0, 0, 1157, 1155, 1, 0, 0, 0, 1158, 1160, 3, 186, 93, 0, 1159, 1158, 1, 0, 0, 0, 1159, 1160, 1, 0, 0, 0, 1160, 1214, 1, 0, 0, 0, 1161, 1162, 5, 41, 0, 0, 1162, 1163, 3, 204, 102, 0, 1163, 1167, 5, 80, 0, 0, 1164, 1166, 3, 194, 97, 0, 1165, 1164, 1, 0, 0, 0, 1166, 1169, 1, 0, 0, 0, 1167, 1165, 1, 0, 0, 0, 1167, 1168, 1, 0, 0, 0, 1168, 1173, 1, 0, 0, 0, 1169, 1167, 1, 0, 0, 0, 1170, 1172, 3, 196, 98, 0, 1171, 1170, 1, 0, 0, 0, 1172, 1175, 1, 0, 0, 0, 1173, 1171, 1, 0, 0, 0, 1173, 1174, 1, 0, 0, 0, 1174, 1176, 1, 0, 0, 0, 1175, 1173, 1, 0, 0, 0, 1176, 1177, 5, 81, 0, 0, 1177, 1214, 1, 0, 0, 0, 1178, 1179, 5, 42, 0, 0, 1179, 1180, 3, 204, 102, 0, 1180, 1181, 3, 168, 84, 0, 1181, 1214, 1, 0, 0, 0, 1182, 1184, 5, 36, 0, 0, 1183, 1185, 3, 210, 105, 0, 1184, 1183, 1, 0, 0, 0, 1184, 1185, 1, 0, 0, 0, 1185, 1186, 1, 0, 0, 0, 1186, 1214, 5, 84, 0, 0, 1187, 1188, 5, 44, 0, 0, 1188, 1189, 3, 210, 105, 0, 1189, 1190, 5, 84, 0, 0, 1190, 1214, 1, 0, 0, 0, 1191, 1193, 5, 4, 0, 0, 1192, 1194, 3, 174, 87, 0, 1193, 1192, 1, 0, 0, 0, 1193, 1194, 1, 0, 0, 0, 1194, 1195, 1, 0, 0, 0, 1195, 1214, 5, 84, 0, 0, 1196, 1198, 5, 11, 0, 0, 1197, 1199, 3, 174, 87, 0, 1198, 1197, 1, 0, 0, 0, 1198, 1199, 1, 0, 0, 0, 1199, 1200, 1, 0, 0, 0, 1200, 1214, 5, 84, 0, 0, 1201, 1202, 5, 62, 0, 0, 1202, 1203, 3, 210, 105, 0, 1203, 1204, 5, 84, 0, 0, 1204, 1214, 1, 0, 0, 0, 1205, 1214, 5, 84, 0, 0, 1206, 1207, 3, 210, 105, 0, 1207, 1208, 5, 84, 0, 0, 1208, 1214, 1, 0, 0, 0, 1209, 1210, 3, 174, 87, 0, 1210, 1211, 5, 93, 0, 0, 1211, 1212, 3, 180, 90, 0, 1212, 1214, 1, 0, 0, 0, 1213, 1104, 1, 0, 0, 0, 1213, 1105, 1, 0, 0, 0, 1213, 1113, 1, 0, 0, 0, 1213, 1120, 1, 0, 0, 0, 1213, 1126, 1, 0, 0, 0, 1213, 1130, 1, 0, 0, 0, 1213, 1136, 1, 0, 0, 0, 1213, 1149, 1, 0, 0, 0, 1213, 1161, 1, 0, 0, 0, 1213, 1178, 1, 0, 0, 0, 1213, 1182, 1, 0, 0, 0, 1213, 1187, 1, 0, 0, 0, 1213, 1191, 1, 0, 0, 0, 1213, 1196, 1, 0, 0, 0, 1213, 1201, 1, 0, 0, 0, 1213, 1205, 1, 0, 0, 0, 1213, 1206, 1, 0, 0, 0, 1213, 1209, 1, 0, 0, 0, 1214, 181, 1, 0, 0, 0, 1215, 1216, 5, 7, 0, 0, 1216, 1220, 5, 78, 0, 0, 1217, 1219, 3, 12, 6, 0, 1218, 1217, 1, 0, 0, 0, 1219, 1222, 1, 0, 0, 0, 1220, 1218, 1, 0, 0, 0, 1220, 1221, 1, 0, 0, 0, 1221, 1224, 1, 0, 0, 0, 1222, 1220, 1, 0, 0, 0, 1223, 1225, 3, 184, 92, 0, 1224, 1223, 1, 0, 0, 0, 1224, 1225, 1, 0, 0, 0, 1225, 1226, 1, 0, 0, 0, 1226, 1227, 3, 174, 87, 0, 1227, 1228, 5, 79, 0, 0, 1228, 1229, 3, 168, 84, 0, 1229, 183, 1, 0, 0, 0, 1230, 1235, 3, 114, 57, 0, 1231, 1232, 5, 107, 0, 0, 1232, 1234, 3, 114, 57, 0, 1233, 1231, 1, 0, 0, 0, 1234, 1237, 1, 0, 0, 0, 1235, 1233, 1, 0, 0, 0, 1235, 1236, 1, 0, 0, 0, 1236, 185, 1, 0, 0, 0, 1237, 1235, 1, 0, 0, 0, 1238, 1239, 5, 19, 0, 0, 1239, 1240, 3, 168, 84, 0, 1240, 187, 1, 0, 0, 0, 1241, 1242, 5, 78, 0, 0, 1242, 1244, 3, 190, 95, 0, 1243, 1245, 5, 84, 0, 0, 1244, 1243, 1, 0, 0, 0, 1244, 1245, 1, 0, 0, 0, 1245, 1246, 1, 0, 0, 0, 1246, 1247, 5, 79, 0, 0, 1247, 189, 1, 0, 0, 0, 1248, 1253, 3, 192, 96, 0, 1249, 1250, 5, 84, 0, 0, 1250, 1252, 3, 192, 96, 0, 1251, 1249, 1, 0, 0, 0, 1252, 1255, 1, 0, 0, 0, 1253, 1251, 1, 0, 0, 0, 1253, 1254, 1, 0, 0, 0, 1254, 191, 1, 0, 0, 0, 1255, 1253, 1, 0, 0, 0, 1256, 1258, 3, 12, 6, 0, 1257, 1256, 1, 0, 0, 0, 1258, 1261, 1, 0, 0, 0, 1259, 1257, 1, 0, 0, 0, 1259, 1260, 1, 0, 0, 0, 1260, 1268, 1, 0, 0, 0, 1261, 1259, 1, 0, 0, 0, 1262, 1264, 3, 86, 43, 0, 1263, 1262, 1, 0, 0, 0, 1263, 1264, 1, 0, 0, 0, 1264, 1265, 1, 0, 0, 0, 1265, 1269, 3, 80, 40, 0, 1266, 1267, 5, 61, 0, 0, 1267, 1269, 3, 174, 87, 0, 1268, 1263, 1, 0, 0, 0, 1268, 1266, 1, 0, 0, 0, 1269, 1270, 1, 0, 0, 0, 1270, 1271, 5, 87, 0, 0, 1271, 1272, 3, 210, 105, 0, 1272, 1275, 1, 0, 0, 0, 1273, 1275, 3, 174, 87, 0, 1274, 1259, 1, 0, 0, 0, 1274, 1273, 1, 0, 0, 0, 1275, 193, 1, 0, 0, 0, 1276, 1278, 3, 196, 98, 0, 1277, 1276, 1, 0, 0, 0, 1278, 1279, 1, 0, 0, 0, 1279, 1277, 1, 0, 0, 0, 1279, 1280, 1, 0, 0, 0, 1280, 1282, 1, 0, 0, 0, 1281, 1283, 3, 170, 85, 0, 1282, 1281, 1, 0, 0, 0, 1283, 1284, 1, 0, 0, 0, 1284, 1282, 1, 0, 0, 0, 1284, 1285, 1, 0, 0, 0, 1285, 195, 1, 0, 0, 0, 1286, 1287, 5, 6, 0, 0, 1287, 1288, 3, 210, 105, 0, 1288, 1289, 5, 93, 0, 0, 1289, 1300, 1, 0, 0, 0, 1290, 1291, 5, 6, 0, 0, 1291, 1292, 5, 128, 0, 0, 1292, 1300, 5, 93, 0, 0, 1293, 1294, 5, 6, 0, 0, 1294, 1295, 3, 212, 106, 0, 1295, 1296, 5, 93, 0, 0, 1296, 1300, 1, 0, 0, 0, 1297, 1298, 5, 12, 0, 0, 1298, 1300, 5, 93, 0, 0, 1299, 1286, 1, 0, 0, 0, 1299, 1290, 1, 0, 0, 0, 1299, 1293, 1, 0, 0, 0, 1299, 1297, 1, 0, 0, 0, 1300, 197, 1, 0, 0, 0, 1301, 1314, 3, 202, 101, 0, 1302, 1304, 3, 200, 100, 0, 1303, 1302, 1, 0, 0, 0, 1303, 1304, 1, 0, 0, 0, 1304, 1305, 1, 0, 0, 0, 1305, 1307, 5, 84, 0, 0, 1306, 1308, 3, 210, 105, 0, 1307, 1306, 1, 0, 0, 0, 1307, 1308, 1, 0, 0, 0, 1308, 1309, 1, 0, 0, 0, 1309, 1311, 5, 84, 0, 0, 1310, 1312, 3, 206, 103, 0, 1311, 1310, 1, 0, 0, 0, 1311, 1312, 1, 0, 0, 0, 1312, 1314, 1, 0, 0, 0, 1313, 1301, 1, 0, 0, 0, 1313, 1303, 1, 0, 0, 0, 1314, 199, 1, 0, 0, 0, 1315, 1318, 3, 172, 86, 0, 1316, 1318, 3, 206, 103, 0, 1317, 1315, 1, 0, 0, 0, 1317, 1316, 1, 0, 0, 0, 1318, 201, 1, 0, 0, 0, 1319, 1321, 3, 12, 6, 0, 1320, 1319, 1, 0, 0, 0, 1321, 1324, 1, 0, 0, 0, 1322, 1320, 1, 0, 0, 0, 1322, 1323, 1, 0, 0, 0, 1323, 1329, 1, 0, 0, 0, 1324, 1322, 1, 0, 0, 0, 1325, 1327, 3, 266, 133, 0, 1326, 1325, 1, 0, 0, 0, 1326, 1327, 1, 0, 0, 0, 1327, 1330, 1, 0, 0, 0, 1328, 1330, 5, 61, 0, 0, 1329, 1326, 1, 0, 0, 0, 1329, 1328, 1, 0, 0, 0, 1330, 1331, 1, 0, 0, 0, 1331, 1332, 3, 80, 40, 0, 1332, 1333, 5, 93, 0, 0, 1333, 1334, 3, 210, 105, 0, 1334, 203, 1, 0, 0, 0, 1335, 1336, 5, 78, 0, 0, 1336, 1337, 3, 210, 105, 0, 1337, 1338, 5, 79, 0, 0, 1338, 205, 1, 0, 0, 0, 1339, 1344, 3, 210, 105, 0, 1340, 1341, 5, 85, 0, 0, 1341, 1343, 3, 210, 105, 0, 1342, 1340, 1, 0, 0, 0, 1343, 1346, 1, 0, 0, 0, 1344, 1342, 1, 0, 0, 0, 1344, 1345, 1, 0, 0, 0, 1345, 207, 1, 0, 0, 0, 1346, 1344, 1, 0, 0, 0, 1347, 1348, 3, 174, 87, 0, 1348, 1350, 5, 78, 0, 0, 1349, 1351, 3, 206, 103, 0, 1350, 1349, 1, 0, 0, 0, 1350, 1351, 1, 0, 0, 0, 1351, 1352, 1, 0, 0, 0, 1352, 1353, 5, 79, 0, 0, 1353, 1367, 1, 0, 0, 0, 1354, 1355, 5, 43, 0, 0, 1355, 1357, 5, 78, 0, 0, 1356, 1358, 3, 206, 103, 0, 1357, 1356, 1, 0, 0, 0, 1357, 1358, 1, 0, 0, 0, 1358, 1359, 1, 0, 0, 0, 1359, 1367, 5, 79, 0, 0, 1360, 1361, 5, 40, 0, 0, 1361, 1363, 5, 78, 0, 0, 1362, 1364, 3, 206, 103, 0, 1363, 1362, 1, 0, 0, 0, 1363, 1364, 1, 0, 0, 0, 1364, 1365, 1, 0, 0, 0, 1365, 1367, 5, 79, 0, 0, 1366, 1347, 1, 0, 0, 0, 1366, 1354, 1, 0, 0, 0, 1366, 1360, 1, 0, 0, 0, 1367, 209, 1, 0, 0, 0, 1368, 1369, 6, 105, -1, 0, 1369, 1412, 3, 232, 116, 0, 1370, 1412, 3, 208, 104, 0, 1371, 1372, 5, 31, 0, 0, 1372, 1412, 3, 246, 123, 0, 1373, 1377, 5, 78, 0, 0, 1374, 1376, 3, 124, 62, 0, 1375, 1374, 1, 0, 0, 0, 1376, 1379, 1, 0, 0, 0, 1377, 1375, 1, 0, 0, 0, 1377, 1378, 1, 0, 0, 0, 1378, 1380, 1, 0, 0, 0, 1379, 1377, 1, 0, 0, 0, 1380, 1385, 3, 266, 133, 0, 1381, 1382, 5, 106, 0, 0, 1382, 1384, 3, 266, 133, 0, 1383, 1381, 1, 0, 0, 0, 1384, 1387, 1, 0, 0, 0, 1385, 1383, 1, 0, 0, 0, 1385, 1386, 1, 0, 0, 0, 1386, 1388, 1, 0, 0, 0, 1387, 1385, 1, 0, 0, 0, 1388, 1389, 5, 79, 0, 0, 1389, 1390, 3, 210, 105, 21, 1390, 1412, 1, 0, 0, 0, 1391, 1392, 7, 6, 0, 0, 1392, 1412, 3, 210, 105, 19, 1393, 1412, 3, 226, 113, 0, 1394, 1412, 3, 234, 117, 0, 1395, 1396, 3, 266, 133, 0, 1396, 1402, 5, 122, 0, 0, 1397, 1399, 3, 270, 135, 0, 1398, 1397, 1, 0, 0, 0, 1398, 1399, 1, 0, 0, 0, 1399, 1400, 1, 0, 0, 0, 1400, 1403, 3, 174, 87, 0, 1401, 1403, 5, 31, 0, 0, 1402, 1398, 1, 0, 0, 0, 1402, 1401, 1, 0, 0, 0, 1403, 1412, 1, 0, 0, 0, 1404, 1405, 3, 244, 122, 0, 1405, 1407, 5, 122, 0, 0, 1406, 1408, 3, 270, 135, 0, 1407, 1406, 1, 0, 0, 0, 1407, 1408, 1, 0, 0, 0, 1408, 1409, 1, 0, 0, 0, 1409, 1410, 5, 31, 0, 0, 1410, 1412, 1, 0, 0, 0, 1411, 1368, 1, 0, 0, 0, 1411, 1370, 1, 0, 0, 0, 1411, 1371, 1, 0, 0, 0, 1411, 1373, 1, 0, 0, 0, 1411, 1391, 1, 0, 0, 0, 1411, 1393, 1, 0, 0, 0, 1411, 1394, 1, 0, 0, 0, 1411, 1395, 1, 0, 0, 0, 1411, 1404, 1, 0, 0, 0, 1412, 1496, 1, 0, 0, 0, 1413, 1414, 10, 18, 0, 0, 1414, 1415, 7, 7, 0, 0, 1415, 1495, 3, 210, 105, 19, 1416, 1417, 10, 17, 0, 0, 1417, 1418, 7, 8, 0, 0, 1418, 1495, 3, 210, 105, 18, 1419, 1427, 10, 16, 0, 0, 1420, 1421, 5, 89, 0, 0, 1421, 1428, 5, 89, 0, 0, 1422, 1423, 5, 88, 0, 0, 1423, 1424, 5, 88, 0, 0, 1424, 1428, 5, 88, 0, 0, 1425, 1426, 5, 88, 0, 0, 1426, 1428, 5, 88, 0, 0, 1427, 1420, 1, 0, 0, 0, 1427, 1422, 1, 0, 0, 0, 1427, 1425, 1, 0, 0, 0, 1428, 1429, 1, 0, 0, 0, 1429, 1495, 3, 210, 105, 17, 1430, 1431, 10, 15, 0, 0, 1431, 1432, 7, 9, 0, 0, 1432, 1495, 3, 210, 105, 16, 1433, 1434, 10, 13, 0, 0, 1434, 1435, 7, 10, 0, 0, 1435, 1495, 3, 210, 105, 14, 1436, 1437, 10, 12, 0, 0, 1437, 1438, 5, 106, 0, 0, 1438, 1495, 3, 210, 105, 13, 1439, 1440, 10, 11, 0, 0, 1440, 1441, 5, 108, 0, 0, 1441, 1495, 3, 210, 105, 12, 1442, 1443, 10, 10, 0, 0, 1443, 1444, 5, 107, 0, 0, 1444, 1495, 3, 210, 105, 11, 1445, 1446, 10, 9, 0, 0, 1446, 1447, 5, 98, 0, 0, 1447, 1495, 3, 210, 105, 10, 1448, 1449, 10, 8, 0, 0, 1449, 1450, 5, 99, 0, 0, 1450, 1495, 3, 210, 105, 9, 1451, 1452, 10, 7, 0, 0, 1452, 1453, 5, 92, 0, 0, 1453, 1454, 3, 210, 105, 0, 1454, 1455, 5, 93, 0, 0, 1455, 1456, 3, 210, 105, 7, 1456, 1495, 1, 0, 0, 0, 1457, 1458, 10, 6, 0, 0, 1458, 1459, 7, 11, 0, 0, 1459, 1495, 3, 210, 105, 6, 1460, 1461, 10, 25, 0, 0, 1461, 1473, 5, 86, 0, 0, 1462, 1474, 3, 174, 87, 0, 1463, 1474, 3, 208, 104, 0, 1464, 1474, 5, 43, 0, 0, 1465, 1467, 5, 31, 0, 0, 1466, 1468, 3, 262, 131, 0, 1467, 1466, 1, 0, 0, 0, 1467, 1468, 1, 0, 0, 0, 1468, 1469, 1, 0, 0, 0, 1469, 1474, 3, 250, 125, 0, 1470, 1471, 5, 40, 0, 0, 1471, 1474, 3, 272, 136, 0, 1472, 1474, 3, 256, 128, 0, 1473, 1462, 1, 0, 0, 0, 1473, 1463, 1, 0, 0, 0, 1473, 1464, 1, 0, 0, 0, 1473, 1465, 1, 0, 0, 0, 1473, 1470, 1, 0, 0, 0, 1473, 1472, 1, 0, 0, 0, 1474, 1495, 1, 0, 0, 0, 1475, 1476, 10, 24, 0, 0, 1476, 1477, 5, 82, 0, 0, 1477, 1478, 3, 210, 105, 0, 1478, 1479, 5, 83, 0, 0, 1479, 1495, 1, 0, 0, 0, 1480, 1481, 10, 20, 0, 0, 1481, 1495, 7, 12, 0, 0, 1482, 1483, 10, 14, 0, 0, 1483, 1486, 5, 26, 0, 0, 1484, 1487, 3, 266, 133, 0, 1485, 1487, 3, 212, 106, 0, 1486, 1484, 1, 0, 0, 0, 1486, 1485, 1, 0, 0, 0, 1487, 1495, 1, 0, 0, 0, 1488, 1489, 10, 3, 0, 0, 1489, 1491, 5, 122, 0, 0, 1490, 1492, 3, 270, 135, 0, 1491, 1490, 1, 0, 0, 0, 1491, 1492, 1, 0, 0, 0, 1492, 1493, 1, 0, 0, 0, 1493, 1495, 3, 174, 87, 0, 1494, 1413, 1, 0, 0, 0, 1494, 1416, 1, 0, 0, 0, 1494, 1419, 1, 0, 0, 0, 1494, 1430, 1, 0, 0, 0, 1494, 1433, 1, 0, 0, 0, 1494, 1436, 1, 0, 0, 0, 1494, 1439, 1, 0, 0, 0, 1494, 1442, 1, 0, 0, 0, 1494, 1445, 1, 0, 0, 0, 1494, 1448, 1, 0, 0, 0, 1494, 1451, 1, 0, 0, 0, 1494, 1457, 1, 0, 0, 0, 1494, 1460, 1, 0, 0, 0, 1494, 1475, 1, 0, 0, 0, 1494, 1480, 1, 0, 0, 0, 1494, 1482, 1, 0, 0, 0, 1494, 1488, 1, 0, 0, 0, 1495, 1498, 1, 0, 0, 0, 1496, 1494, 1, 0, 0, 0, 1496, 1497, 1, 0, 0, 0, 1497, 211, 1, 0, 0, 0, 1498, 1496, 1, 0, 0, 0, 1499, 1502, 3, 214, 107, 0, 1500, 1502, 3, 240, 120, 0, 1501, 1499, 1, 0, 0, 0, 1501, 1500, 1, 0, 0, 0, 1502, 213, 1, 0, 0, 0, 1503, 1510, 3, 218, 109, 0, 1504, 1510, 3, 216, 108, 0, 1505, 1506, 5, 78, 0, 0, 1506, 1507, 3, 212, 106, 0, 1507, 1508, 5, 79, 0, 0, 1508, 1510, 1, 0, 0, 0, 1509, 1503, 1, 0, 0, 0, 1509, 1504, 1, 0, 0, 0, 1509, 1505, 1, 0, 0, 0, 1510, 215, 1, 0, 0, 0, 1511, 1512, 3, 266, 133, 0, 1512, 1514, 3, 220, 110, 0, 1513, 1515, 3, 174, 87, 0, 1514, 1513, 1, 0, 0, 0, 1514, 1515, 1, 0, 0, 0, 1515, 217, 1, 0, 0, 0, 1516, 1518, 3, 12, 6, 0, 1517, 1516, 1, 0, 0, 0, 1518, 1521, 1, 0, 0, 0, 1519, 1517, 1, 0, 0, 0, 1519, 1520, 1, 0, 0, 0, 1520, 1522, 1, 0, 0, 0, 1521, 1519, 1, 0, 0, 0, 1522, 1523, 3, 266, 133, 0, 1523, 1524, 3, 174, 87, 0, 1524, 219, 1, 0, 0, 0, 1525, 1527, 5, 78, 0, 0, 1526, 1528, 3, 224, 112, 0, 1527, 1526, 1, 0, 0, 0, 1527, 1528, 1, 0, 0, 0, 1528, 1529, 1, 0, 0, 0, 1529, 1530, 5, 79, 0, 0, 1530, 221, 1, 0, 0, 0, 1531, 1534, 3, 212, 106, 0, 1532, 1534, 3, 174, 87, 0, 1533, 1531, 1, 0, 0, 0, 1533, 1532, 1, 0, 0, 0, 1534, 223, 1, 0, 0, 0, 1535, 1540, 3, 212, 106, 0, 1536, 1537, 5, 85, 0, 0, 1537, 1539, 3, 212, 106, 0, 1538, 1536, 1, 0, 0, 0, 1539, 1542, 1, 0, 0, 0, 1540, 1538, 1, 0, 0, 0, 1540, 1541, 1, 0, 0, 0, 1541, 225, 1, 0, 0, 0, 1542, 1540, 1, 0, 0, 0, 1543, 1544, 3, 228, 114, 0, 1544, 1545, 5, 121, 0, 0, 1545, 1546, 3, 230, 115, 0, 1546, 227, 1, 0, 0, 0, 1547, 1570, 3, 174, 87, 0, 1548, 1550, 5, 78, 0, 0, 1549, 1551, 3, 104, 52, 0, 1550, 1549, 1, 0, 0, 0, 1550, 1551, 1, 0, 0, 0, 1551, 1552, 1, 0, 0, 0, 1552, 1570, 5, 79, 0, 0, 1553, 1554, 5, 78, 0, 0, 1554, 1559, 3, 174, 87, 0, 1555, 1556, 5, 85, 0, 0, 1556, 1558, 3, 174, 87, 0, 1557, 1555, 1, 0, 0, 0, 1558, 1561, 1, 0, 0, 0, 1559, 1557, 1, 0, 0, 0, 1559, 1560, 1, 0, 0, 0, 1560, 1562, 1, 0, 0, 0, 1561, 1559, 1, 0, 0, 0, 1562, 1563, 5, 79, 0, 0, 1563, 1570, 1, 0, 0, 0, 1564, 1566, 5, 78, 0, 0, 1565, 1567, 3, 110, 55, 0, 1566, 1565, 1, 0, 0, 0, 1566, 1567, 1, 0, 0, 0, 1567, 1568, 1, 0, 0, 0, 1568, 1570, 5, 79, 0, 0, 1569, 1547, 1, 0, 0, 0, 1569, 1548, 1, 0, 0, 0, 1569, 1553, 1, 0, 0, 0, 1569, 1564, 1, 0, 0, 0, 1570, 229, 1, 0, 0, 0, 1571, 1574, 3, 210, 105, 0, 1572, 1574, 3, 168, 84, 0, 1573, 1571, 1, 0, 0, 0, 1573, 1572, 1, 0, 0, 0, 1574, 231, 1, 0, 0, 0, 1575, 1576, 5, 78, 0, 0, 1576, 1577, 3, 210, 105, 0, 1577, 1578, 5, 79, 0, 0, 1578, 1594, 1, 0, 0, 0, 1579, 1594, 5, 43, 0, 0, 1580, 1594, 5, 40, 0, 0, 1581, 1594, 3, 116, 58, 0, 1582, 1594, 3, 174, 87, 0, 1583, 1584, 3, 48, 24, 0, 1584, 1585, 5, 86, 0, 0, 1585, 1586, 5, 9, 0, 0, 1586, 1594, 1, 0, 0, 0, 1587, 1591, 3, 262, 131, 0, 1588, 1592, 3, 274, 137, 0, 1589, 1590, 5, 43, 0, 0, 1590, 1592, 3, 276, 138, 0, 1591, 1588, 1, 0, 0, 0, 1591, 1589, 1, 0, 0, 0, 1592, 1594, 1, 0, 0, 0, 1593, 1575, 1, 0, 0, 0, 1593, 1579, 1, 0, 0, 0, 1593, 1580, 1, 0, 0, 0, 1593, 1581, 1, 0, 0, 0, 1593, 1582, 1, 0, 0, 0, 1593, 1583, 1, 0, 0, 0, 1593, 1587, 1, 0, 0, 0, 1594, 233, 1, 0, 0, 0, 1595, 1596, 5, 41, 0, 0, 1596, 1597, 3, 204, 102, 0, 1597, 1601, 5, 80, 0, 0, 1598, 1600, 3, 236, 118, 0, 1599, 1598, 1, 0, 0, 0, 1600, 1603, 1, 0, 0, 0, 1601, 1599, 1, 0, 0, 0, 1601, 1602, 1, 0, 0, 0, 1602, 1604, 1, 0, 0, 0, 1603, 1601, 1, 0, 0, 0, 1604, 1605, 5, 81, 0, 0, 1605, 235, 1, 0, 0, 0, 1606, 1607, 3, 238, 119, 0, 1607, 1608, 3, 242, 121, 0, 1608, 237, 1, 0, 0, 0, 1609, 1610, 5, 6, 0, 0, 1610, 1611, 3, 206, 103, 0, 1611, 1612, 7, 13, 0, 0, 1612, 1623, 1, 0, 0, 0, 1613, 1614, 5, 6, 0, 0, 1614, 1615, 5, 77, 0, 0, 1615, 1623, 7, 13, 0, 0, 1616, 1617, 5, 6, 0, 0, 1617, 1618, 3, 212, 106, 0, 1618, 1619, 7, 13, 0, 0, 1619, 1623, 1, 0, 0, 0, 1620, 1621, 5, 12, 0, 0, 1621, 1623, 7, 13, 0, 0, 1622, 1609, 1, 0, 0, 0, 1622, 1613, 1, 0, 0, 0, 1622, 1616, 1, 0, 0, 0, 1622, 1620, 1, 0, 0, 0, 1623, 239, 1, 0, 0, 0, 1624, 1625, 3, 214, 107, 0, 1625, 1626, 5, 59, 0, 0, 1626, 1627, 3, 210, 105, 0, 1627, 241, 1, 0, 0, 0, 1628, 1633, 3, 168, 84, 0, 1629, 1630, 3, 210, 105, 0, 1630, 1631, 5, 84, 0, 0, 1631, 1633, 1, 0, 0, 0, 1632, 1628, 1, 0, 0, 0, 1632, 1629, 1, 0, 0, 0, 1633, 243, 1, 0, 0, 0, 1634, 1635, 3, 86, 43, 0, 1635, 1636, 5, 86, 0, 0, 1636, 1638, 1, 0, 0, 0, 1637, 1634, 1, 0, 0, 0, 1637, 1638, 1, 0, 0, 0, 1638, 1642, 1, 0, 0, 0, 1639, 1641, 3, 124, 62, 0, 1640, 1639, 1, 0, 0, 0, 1641, 1644, 1, 0, 0, 0, 1642, 1640, 1, 0, 0, 0, 1642, 1643, 1, 0, 0, 0, 1643, 1645, 1, 0, 0, 0, 1644, 1642, 1, 0, 0, 0, 1645, 1647, 3, 174, 87, 0, 1646, 1648, 3, 270, 135, 0, 1647, 1646, 1, 0, 0, 0, 1647, 1648, 1, 0, 0, 0, 1648, 245, 1, 0, 0, 0, 1649, 1650, 3, 262, 131, 0, 1650, 1651, 3, 248, 124, 0, 1651, 1652, 3, 254, 127, 0, 1652, 1659, 1, 0, 0, 0, 1653, 1656, 3, 248, 124, 0, 1654, 1657, 3, 252, 126, 0, 1655, 1657, 3, 254, 127, 0, 1656, 1654, 1, 0, 0, 0, 1656, 1655, 1, 0, 0, 0, 1657, 1659, 1, 0, 0, 0, 1658, 1649, 1, 0, 0, 0, 1658, 1653, 1, 0, 0, 0, 1659, 247, 1, 0, 0, 0, 1660, 1662, 3, 174, 87, 0, 1661, 1663, 3, 258, 129, 0, 1662, 1661, 1, 0, 0, 0, 1662, 1663, 1, 0, 0, 0, 1663, 1666, 1, 0, 0, 0, 1664, 1666, 3, 268, 134, 0, 1665, 1660, 1, 0, 0, 0, 1665, 1664, 1, 0, 0, 0, 1666, 249, 1, 0, 0, 0, 1667, 1669, 3, 174, 87, 0, 1668, 1670, 3, 260, 130, 0, 1669, 1668, 1, 0, 0, 0, 1669, 1670, 1, 0, 0, 0, 1670, 1671, 1, 0, 0, 0, 1671, 1672, 3, 254, 127, 0, 1672, 251, 1, 0, 0, 0, 1673, 1701, 5, 82, 0, 0, 1674, 1679, 5, 83, 0, 0, 1675, 1676, 5, 82, 0, 0, 1676, 1678, 5, 83, 0, 0, 1677, 1675, 1, 0, 0, 0, 1678, 1681, 1, 0, 0, 0, 1679, 1677, 1, 0, 0, 0, 1679, 1680, 1, 0, 0, 0, 1680, 1682, 1, 0, 0, 0, 1681, 1679, 1, 0, 0, 0, 1682, 1702, 3, 84, 42, 0, 1683, 1684, 3, 210, 105, 0, 1684, 1691, 5, 83, 0, 0, 1685, 1686, 5, 82, 0, 0, 1686, 1687, 3, 210, 105, 0, 1687, 1688, 5, 83, 0, 0, 1688, 1690, 1, 0, 0, 0, 1689, 1685, 1, 0, 0, 0, 1690, 1693, 1, 0, 0, 0, 1691, 1689, 1, 0, 0, 0, 1691, 1692, 1, 0, 0, 0, 1692, 1698, 1, 0, 0, 0, 1693, 1691, 1, 0, 0, 0, 1694, 1695, 5, 82, 0, 0, 1695, 1697, 5, 83, 0, 0, 1696, 1694, 1, 0, 0, 0, 1697, 1700, 1, 0, 0, 0, 1698, 1696, 1, 0, 0, 0, 1698, 1699, 1, 0, 0, 0, 1699, 1702, 1, 0, 0, 0, 1700, 1698, 1, 0, 0, 0, 1701, 1674, 1, 0, 0, 0, 1701, 1683, 1, 0, 0, 0, 1702, 253, 1, 0, 0, 0, 1703, 1705, 3, 276, 138, 0, 1704, 1706, 3, 32, 16, 0, 1705, 1704, 1, 0, 0, 0, 1705, 1706, 1, 0, 0, 0, 1706, 255, 1, 0, 0, 0, 1707, 1708, 3, 262, 131, 0, 1708, 1709, 3, 274, 137, 0, 1709, 257, 1, 0, 0, 0, 1710, 1711, 5, 89, 0, 0, 1711, 1714, 5, 88, 0, 0, 1712, 1714, 3, 270, 135, 0, 1713, 1710, 1, 0, 0, 0, 1713, 1712, 1, 0, 0, 0, 1714, 259, 1, 0, 0, 0, 1715, 1716, 5, 89, 0, 0, 1716, 1719, 5, 88, 0, 0, 1717, 1719, 3, 262, 131, 0, 1718, 1715, 1, 0, 0, 0, 1718, 1717, 1, 0, 0, 0, 1719, 261, 1, 0, 0, 0, 1720, 1721, 5, 89, 0, 0, 1721, 1722, 3, 264, 132, 0, 1722, 1723, 5, 88, 0, 0, 1723, 263, 1, 0, 0, 0, 1724, 1729, 3, 266, 133, 0, 1725, 1726, 5, 85, 0, 0, 1726, 1728, 3, 266, 133, 0, 1727, 1725, 1, 0, 0, 0, 1728, 1731, 1, 0, 0, 0, 1729, 1727, 1, 0, 0, 0, 1729, 1730, 1, 0, 0, 0, 1730, 265, 1, 0, 0, 0, 1731, 1729, 1, 0, 0, 0, 1732, 1734, 3, 124, 62, 0, 1733, 1732, 1, 0, 0, 0, 1734, 1737, 1, 0, 0, 0, 1735, 1733, 1, 0, 0, 0, 1735, 1736, 1, 0, 0, 0, 1736, 1740, 1, 0, 0, 0, 1737, 1735, 1, 0, 0, 0, 1738, 1741, 3, 86, 43, 0, 1739, 1741, 3, 268, 134, 0, 1740, 1738, 1, 0, 0, 0, 1740, 1739, 1, 0, 0, 0, 1741, 1752, 1, 0, 0, 0, 1742, 1744, 3, 124, 62, 0, 1743, 1742, 1, 0, 0, 0, 1744, 1747, 1, 0, 0, 0, 1745, 1743, 1, 0, 0, 0, 1745, 1746, 1, 0, 0, 0, 1746, 1748, 1, 0, 0, 0, 1747, 1745, 1, 0, 0, 0, 1748, 1749, 5, 82, 0, 0, 1749, 1751, 5, 83, 0, 0, 1750, 1745, 1, 0, 0, 0, 1751, 1754, 1, 0, 0, 0, 1752, 1750, 1, 0, 0, 0, 1752, 1753, 1, 0, 0, 0, 1753, 267, 1, 0, 0, 0, 1754, 1752, 1, 0, 0, 0, 1755, 1756, 7, 14, 0, 0, 1756, 269, 1, 0, 0, 0, 1757, 1758, 5, 89, 0, 0, 1758, 1763, 3, 88, 44, 0, 1759, 1760, 5, 85, 0, 0, 1760, 1762, 3, 88, 44, 0, 1761, 1759, 1, 0, 0, 0, 1762, 1765, 1, 0, 0, 0, 1763, 1761, 1, 0, 0, 0, 1763, 1764, 1, 0, 0, 0, 1764, 1766, 1, 0, 0, 0, 1765, 1763, 1, 0, 0, 0, 1766, 1767, 5, 88, 0, 0, 1767, 271, 1, 0, 0, 0, 1768, 1778, 3, 276, 138, 0, 1769, 1771, 5, 86, 0, 0, 1770, 1772, 3, 270, 135, 0, 1771, 1770, 1, 0, 0, 0, 1771, 1772, 1, 0, 0, 0, 1772, 1773, 1, 0, 0, 0, 1773, 1775, 3, 174, 87, 0, 1774, 1776, 3, 276, 138, 0, 1775, 1774, 1, 0, 0, 0, 1775, 1776, 1, 0, 0, 0, 1776, 1778, 1, 0, 0, 0, 1777, 1768, 1, 0, 0, 0, 1777, 1769, 1, 0, 0, 0, 1778, 273, 1, 0, 0, 0, 1779, 1780, 5, 40, 0, 0, 1780, 1785, 3, 272, 136, 0, 1781, 1782, 3, 174, 87, 0, 1782, 1783, 3, 276, 138, 0, 1783, 1785, 1, 0, 0, 0, 1784, 1779, 1, 0, 0, 0, 1784, 1781, 1, 0, 0, 0, 1785, 275, 1, 0, 0, 0, 1786, 1788, 5, 78, 0, 0, 1787, 1789, 3, 206, 103, 0, 1788, 1787, 1, 0, 0, 0, 1788, 1789, 1, 0, 0, 0, 1789, 1790, 1, 0, 0, 0, 1790, 1791, 5, 79, 0, 0, 1791, 277, 1, 0, 0, 0, 224, 279, 284, 290, 296, 301, 310, 315, 322, 330, 333, 340, 352, 356, 361, 365, 369, 373, 383, 391, 399, 403, 410, 417, 421, 424, 427, 436, 442, 447, 450, 456, 462, 466, 470, 478, 487, 494, 500, 504, 510, 514, 519, 524, 532, 537, 541, 548, 557, 562, 570, 575, 581, 584, 591, 601, 610, 621, 626, 635, 639, 647, 652, 661, 667, 674, 679, 687, 691, 693, 699, 705, 710, 714, 719, 725, 738, 745, 750, 753, 755, 760, 767, 777, 782, 785, 790, 794, 798, 803, 807, 812, 823, 829, 840, 850, 861, 870, 875, 878, 885, 895, 903, 906, 909, 922, 930, 935, 943, 945, 949, 955, 963, 973, 982, 992, 1000, 1014, 1021, 1026, 1032, 1041, 1045, 1053, 1062, 1072, 1077, 1082, 1093, 1099, 1102, 1109, 1118, 1141, 1144, 1147, 1155, 1159, 1167, 1173, 1184, 1193, 1198, 1213, 1220, 1224, 1235, 1244, 1253, 1259, 1263, 1268, 1274, 1279, 1284, 1299, 1303, 1307, 1311, 1313, 1317, 1322, 1326, 1329, 1344, 1350, 1357, 1363, 1366, 1377, 1385, 1398, 1402, 1407, 1411, 1427, 1467, 1473, 1486, 1491, 1494, 1496, 1501, 1509, 1514, 1519, 1527, 1533, 1540, 1550, 1559, 1566, 1569, 1573, 1591, 1593, 1601, 1622, 1632, 1637, 1642, 1647, 1656, 1658, 1662, 1665, 1669, 1679, 1691, 1698, 1701, 1705, 1713, 1718, 1729, 1735, 1740, 1745, 1752, 1763, 1771, 1775, 1777, 1784, 1788] \ No newline at end of file diff --git a/javatx-src/main/java/de/dhbwstuttgart/parser/antlr/Java17Parser.java b/javatx-src/main/java/de/dhbwstuttgart/parser/antlr/Java17Parser.java new file mode 100644 index 0000000..56292a9 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/parser/antlr/Java17Parser.java @@ -0,0 +1,14500 @@ +// Generated from java-escape by ANTLR 4.11.1 +package de.dhbwstuttgart.parser.antlr; +import org.antlr.v4.runtime.atn.*; +import org.antlr.v4.runtime.dfa.DFA; +import org.antlr.v4.runtime.*; +import org.antlr.v4.runtime.misc.*; +import org.antlr.v4.runtime.tree.*; +import java.util.List; +import java.util.Iterator; +import java.util.ArrayList; + +@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast", "CheckReturnValue"}) +public class Java17Parser extends Parser { + static { RuntimeMetaData.checkVersion("4.11.1", RuntimeMetaData.VERSION); } + + protected static final DFA[] _decisionToDFA; + protected static final PredictionContextCache _sharedContextCache = + new PredictionContextCache(); + public static final int + ABSTRACT=1, ASSERT=2, BOOLEAN=3, BREAK=4, BYTE=5, CASE=6, CATCH=7, CHAR=8, + CLASS=9, CONST=10, CONTINUE=11, DEFAULT=12, DO=13, DOUBLE=14, ELSE=15, + ENUM=16, EXTENDS=17, FINAL=18, FINALLY=19, FLOAT=20, FOR=21, IF=22, GOTO=23, + IMPLEMENTS=24, IMPORT=25, INSTANCEOF=26, INT=27, INTERFACE=28, LONG=29, + NATIVE=30, NEW=31, PACKAGE=32, PRIVATE=33, PROTECTED=34, PUBLIC=35, RETURN=36, + SHORT=37, STATIC=38, STRICTFP=39, SUPER=40, SWITCH=41, SYNCHRONIZED=42, + THIS=43, THROW=44, THROWS=45, TRANSIENT=46, TRY=47, VOID=48, VOLATILE=49, + WHILE=50, MODULE=51, OPEN=52, REQUIRES=53, EXPORTS=54, OPENS=55, TO=56, + USES=57, PROVIDES=58, WITH=59, TRANSITIVE=60, VAR=61, YIELD=62, RECORD=63, + SEALED=64, PERMITS=65, NON_SEALED=66, DECIMAL_LITERAL=67, HEX_LITERAL=68, + OCT_LITERAL=69, BINARY_LITERAL=70, FLOAT_LITERAL=71, HEX_FLOAT_LITERAL=72, + BOOL_LITERAL=73, CHAR_LITERAL=74, STRING_LITERAL=75, TEXT_BLOCK=76, NULL_LITERAL=77, + LPAREN=78, RPAREN=79, LBRACE=80, RBRACE=81, LBRACK=82, RBRACK=83, SEMI=84, + COMMA=85, DOT=86, ASSIGN=87, GT=88, LT=89, BANG=90, TILDE=91, QUESTION=92, + COLON=93, EQUAL=94, LE=95, GE=96, NOTEQUAL=97, AND=98, OR=99, INC=100, + DEC=101, ADD=102, SUB=103, MUL=104, DIV=105, BITAND=106, BITOR=107, CARET=108, + MOD=109, ADD_ASSIGN=110, SUB_ASSIGN=111, MUL_ASSIGN=112, DIV_ASSIGN=113, + AND_ASSIGN=114, OR_ASSIGN=115, XOR_ASSIGN=116, MOD_ASSIGN=117, LSHIFT_ASSIGN=118, + RSHIFT_ASSIGN=119, URSHIFT_ASSIGN=120, ARROW=121, COLONCOLON=122, AT=123, + ELLIPSIS=124, WS=125, COMMENT=126, LINE_COMMENT=127, IDENTIFIER=128; + public static final int + RULE_sourceFile = 0, RULE_packageDeclaration = 1, RULE_importDeclaration = 2, + RULE_classOrInterface = 3, RULE_modifier = 4, RULE_classOrInterfaceModifier = 5, + RULE_variableModifier = 6, RULE_classDeclaration = 7, RULE_genericDeclarationList = 8, + RULE_genericTypeVar = 9, RULE_typeBound = 10, RULE_enumDeclaration = 11, + RULE_enumConstants = 12, RULE_enumConstant = 13, RULE_enumBodyDeclarations = 14, + RULE_interfaceDeclaration = 15, RULE_classBody = 16, RULE_interfaceBody = 17, + RULE_classBodyDeclaration = 18, RULE_memberDeclaration = 19, RULE_method = 20, + RULE_methodDeclaration = 21, RULE_methodHeader = 22, RULE_methodBody = 23, + RULE_refType = 24, RULE_genericMethodDeclaration = 25, RULE_constructor = 26, + RULE_genericConstructorDeclaration = 27, RULE_constructorDeclaration = 28, + RULE_fieldDeclaration = 29, RULE_interfaceBodyDeclaration = 30, RULE_interfaceMemberDeclaration = 31, + RULE_constDeclaration = 32, RULE_constantDeclarator = 33, RULE_interfaceMethodDeclaration = 34, + RULE_interfaceMethodModifier = 35, RULE_genericInterfaceMethodDeclaration = 36, + RULE_interfaceCommonBodyDeclaration = 37, RULE_variableDeclarators = 38, + RULE_variableDeclarator = 39, RULE_variableDeclaratorId = 40, RULE_variableInitializer = 41, + RULE_arrayInitializer = 42, RULE_classOrInterfaceType = 43, RULE_typeArgument = 44, + RULE_wildcardType = 45, RULE_extendsWildcardType = 46, RULE_superWildcardType = 47, + RULE_qualifiedNameList = 48, RULE_exceptionList = 49, RULE_formalParameters = 50, + RULE_receiverParameter = 51, RULE_formalParameterList = 52, RULE_formalParameter = 53, + RULE_lastFormalParameter = 54, RULE_lambdaLVTIList = 55, RULE_lambdaLVTIParameter = 56, + RULE_qualifiedName = 57, RULE_literal = 58, RULE_integerLiteral = 59, + RULE_floatLiteral = 60, RULE_altAnnotationQualifiedName = 61, RULE_annotation = 62, + RULE_elementValuePairs = 63, RULE_elementValuePair = 64, RULE_elementValue = 65, + RULE_elementValueArrayInitializer = 66, RULE_annotationTypeDeclaration = 67, + RULE_annotationTypeBody = 68, RULE_annotationTypeElementDeclaration = 69, + RULE_annotationTypeElementRest = 70, RULE_annotationMethodOrConstantRest = 71, + RULE_annotationMethodRest = 72, RULE_annotationConstantRest = 73, RULE_defaultValue = 74, + RULE_moduleDeclaration = 75, RULE_moduleBody = 76, RULE_moduleDirective = 77, + RULE_requiresModifier = 78, RULE_recordDeclaration = 79, RULE_recordHeader = 80, + RULE_recordComponentList = 81, RULE_recordComponent = 82, RULE_recordBody = 83, + RULE_block = 84, RULE_blockStatement = 85, RULE_localVariableDeclaration = 86, + RULE_identifier = 87, RULE_typeIdentifier = 88, RULE_localTypeDeclaration = 89, + RULE_statement = 90, RULE_catchClause = 91, RULE_catchType = 92, RULE_finallyBlock = 93, + RULE_resourceSpecification = 94, RULE_resources = 95, RULE_resource = 96, + RULE_switchBlockStatementGroup = 97, RULE_switchLabel = 98, RULE_forControl = 99, + RULE_forInit = 100, RULE_enhancedForControl = 101, RULE_parExpression = 102, + RULE_expressionList = 103, RULE_methodCall = 104, RULE_expression = 105, + RULE_pattern = 106, RULE_primaryPattern = 107, RULE_recordPattern = 108, + RULE_typePattern = 109, RULE_recordStructurePattern = 110, RULE_recordComponentPatternElement = 111, + RULE_recordComponentPatternList = 112, RULE_lambdaExpression = 113, RULE_lambdaParameters = 114, + RULE_lambdaBody = 115, RULE_primary = 116, RULE_switchExpression = 117, + RULE_switchLabeledRule = 118, RULE_switchLabelCase = 119, RULE_guardedPattern = 120, + RULE_switchRuleOutcome = 121, RULE_classType = 122, RULE_creator = 123, + RULE_createdName = 124, RULE_innerCreator = 125, RULE_arrayCreatorRest = 126, + RULE_classCreatorRest = 127, RULE_explicitGenericInvocation = 128, RULE_typeArgumentsOrDiamond = 129, + RULE_nonWildcardTypeArgumentsOrDiamond = 130, RULE_nonWildcardTypeArguments = 131, + RULE_typeList = 132, RULE_typeType = 133, RULE_primitiveType = 134, RULE_typeArguments = 135, + RULE_superSuffix = 136, RULE_explicitGenericInvocationSuffix = 137, RULE_arguments = 138; + private static String[] makeRuleNames() { + return new String[] { + "sourceFile", "packageDeclaration", "importDeclaration", "classOrInterface", + "modifier", "classOrInterfaceModifier", "variableModifier", "classDeclaration", + "genericDeclarationList", "genericTypeVar", "typeBound", "enumDeclaration", + "enumConstants", "enumConstant", "enumBodyDeclarations", "interfaceDeclaration", + "classBody", "interfaceBody", "classBodyDeclaration", "memberDeclaration", + "method", "methodDeclaration", "methodHeader", "methodBody", "refType", + "genericMethodDeclaration", "constructor", "genericConstructorDeclaration", + "constructorDeclaration", "fieldDeclaration", "interfaceBodyDeclaration", + "interfaceMemberDeclaration", "constDeclaration", "constantDeclarator", + "interfaceMethodDeclaration", "interfaceMethodModifier", "genericInterfaceMethodDeclaration", + "interfaceCommonBodyDeclaration", "variableDeclarators", "variableDeclarator", + "variableDeclaratorId", "variableInitializer", "arrayInitializer", "classOrInterfaceType", + "typeArgument", "wildcardType", "extendsWildcardType", "superWildcardType", + "qualifiedNameList", "exceptionList", "formalParameters", "receiverParameter", + "formalParameterList", "formalParameter", "lastFormalParameter", "lambdaLVTIList", + "lambdaLVTIParameter", "qualifiedName", "literal", "integerLiteral", + "floatLiteral", "altAnnotationQualifiedName", "annotation", "elementValuePairs", + "elementValuePair", "elementValue", "elementValueArrayInitializer", "annotationTypeDeclaration", + "annotationTypeBody", "annotationTypeElementDeclaration", "annotationTypeElementRest", + "annotationMethodOrConstantRest", "annotationMethodRest", "annotationConstantRest", + "defaultValue", "moduleDeclaration", "moduleBody", "moduleDirective", + "requiresModifier", "recordDeclaration", "recordHeader", "recordComponentList", + "recordComponent", "recordBody", "block", "blockStatement", "localVariableDeclaration", + "identifier", "typeIdentifier", "localTypeDeclaration", "statement", + "catchClause", "catchType", "finallyBlock", "resourceSpecification", + "resources", "resource", "switchBlockStatementGroup", "switchLabel", + "forControl", "forInit", "enhancedForControl", "parExpression", "expressionList", + "methodCall", "expression", "pattern", "primaryPattern", "recordPattern", + "typePattern", "recordStructurePattern", "recordComponentPatternElement", + "recordComponentPatternList", "lambdaExpression", "lambdaParameters", + "lambdaBody", "primary", "switchExpression", "switchLabeledRule", "switchLabelCase", + "guardedPattern", "switchRuleOutcome", "classType", "creator", "createdName", + "innerCreator", "arrayCreatorRest", "classCreatorRest", "explicitGenericInvocation", + "typeArgumentsOrDiamond", "nonWildcardTypeArgumentsOrDiamond", "nonWildcardTypeArguments", + "typeList", "typeType", "primitiveType", "typeArguments", "superSuffix", + "explicitGenericInvocationSuffix", "arguments" + }; + } + public static final String[] ruleNames = makeRuleNames(); + + private static String[] makeLiteralNames() { + return new String[] { + null, "'abstract'", "'assert'", "'boolean'", "'break'", "'byte'", "'case'", + "'catch'", "'char'", "'class'", "'const'", "'continue'", "'default'", + "'do'", "'double'", "'else'", "'enum'", "'extends'", "'final'", "'finally'", + "'float'", "'for'", "'if'", "'goto'", "'implements'", "'import'", "'instanceof'", + "'int'", "'interface'", "'long'", "'native'", "'new'", "'package'", "'private'", + "'protected'", "'public'", "'return'", "'short'", "'static'", "'strictfp'", + "'super'", "'switch'", "'synchronized'", "'this'", "'throw'", "'throws'", + "'transient'", "'try'", "'void'", "'volatile'", "'while'", "'module'", + "'open'", "'requires'", "'exports'", "'opens'", "'to'", "'uses'", "'provides'", + "'with'", "'transitive'", "'var'", "'yield'", "'record'", "'sealed'", + "'permits'", "'non-sealed'", null, null, null, null, null, null, null, + null, null, null, "'null'", "'('", "')'", "'{'", "'}'", "'['", "']'", + "';'", "','", "'.'", "'='", "'>'", "'<'", "'!'", "'~'", "'?'", "':'", + "'=='", "'<='", "'>='", "'!='", "'&&'", "'||'", "'++'", "'--'", "'+'", + "'-'", "'*'", "'/'", "'&'", "'|'", "'^'", "'%'", "'+='", "'-='", "'*='", + "'/='", "'&='", "'|='", "'^='", "'%='", "'<<='", "'>>='", "'>>>='", "'->'", + "'::'", "'@'", "'...'" + }; + } + private static final String[] _LITERAL_NAMES = makeLiteralNames(); + private static String[] makeSymbolicNames() { + return new String[] { + null, "ABSTRACT", "ASSERT", "BOOLEAN", "BREAK", "BYTE", "CASE", "CATCH", + "CHAR", "CLASS", "CONST", "CONTINUE", "DEFAULT", "DO", "DOUBLE", "ELSE", + "ENUM", "EXTENDS", "FINAL", "FINALLY", "FLOAT", "FOR", "IF", "GOTO", + "IMPLEMENTS", "IMPORT", "INSTANCEOF", "INT", "INTERFACE", "LONG", "NATIVE", + "NEW", "PACKAGE", "PRIVATE", "PROTECTED", "PUBLIC", "RETURN", "SHORT", + "STATIC", "STRICTFP", "SUPER", "SWITCH", "SYNCHRONIZED", "THIS", "THROW", + "THROWS", "TRANSIENT", "TRY", "VOID", "VOLATILE", "WHILE", "MODULE", + "OPEN", "REQUIRES", "EXPORTS", "OPENS", "TO", "USES", "PROVIDES", "WITH", + "TRANSITIVE", "VAR", "YIELD", "RECORD", "SEALED", "PERMITS", "NON_SEALED", + "DECIMAL_LITERAL", "HEX_LITERAL", "OCT_LITERAL", "BINARY_LITERAL", "FLOAT_LITERAL", + "HEX_FLOAT_LITERAL", "BOOL_LITERAL", "CHAR_LITERAL", "STRING_LITERAL", + "TEXT_BLOCK", "NULL_LITERAL", "LPAREN", "RPAREN", "LBRACE", "RBRACE", + "LBRACK", "RBRACK", "SEMI", "COMMA", "DOT", "ASSIGN", "GT", "LT", "BANG", + "TILDE", "QUESTION", "COLON", "EQUAL", "LE", "GE", "NOTEQUAL", "AND", + "OR", "INC", "DEC", "ADD", "SUB", "MUL", "DIV", "BITAND", "BITOR", "CARET", + "MOD", "ADD_ASSIGN", "SUB_ASSIGN", "MUL_ASSIGN", "DIV_ASSIGN", "AND_ASSIGN", + "OR_ASSIGN", "XOR_ASSIGN", "MOD_ASSIGN", "LSHIFT_ASSIGN", "RSHIFT_ASSIGN", + "URSHIFT_ASSIGN", "ARROW", "COLONCOLON", "AT", "ELLIPSIS", "WS", "COMMENT", + "LINE_COMMENT", "IDENTIFIER" + }; + } + private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames(); + public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES); + + /** + * @deprecated Use {@link #VOCABULARY} instead. + */ + @Deprecated + public static final String[] tokenNames; + static { + tokenNames = new String[_SYMBOLIC_NAMES.length]; + for (int i = 0; i < tokenNames.length; i++) { + tokenNames[i] = VOCABULARY.getLiteralName(i); + if (tokenNames[i] == null) { + tokenNames[i] = VOCABULARY.getSymbolicName(i); + } + + if (tokenNames[i] == null) { + tokenNames[i] = ""; + } + } + } + + @Override + @Deprecated + public String[] getTokenNames() { + return tokenNames; + } + + @Override + + public Vocabulary getVocabulary() { + return VOCABULARY; + } + + @Override + public String getGrammarFileName() { return "java-escape"; } + + @Override + public String[] getRuleNames() { return ruleNames; } + + @Override + public String getSerializedATN() { return _serializedATN; } + + @Override + public ATN getATN() { return _ATN; } + + public Java17Parser(TokenStream input) { + super(input); + _interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache); + } + + @SuppressWarnings("CheckReturnValue") + public static class SourceFileContext extends ParserRuleContext { + public SourceFileContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_sourceFile; } + + public SourceFileContext() { } + public void copyFrom(SourceFileContext ctx) { + super.copyFrom(ctx); + } + } + @SuppressWarnings("CheckReturnValue") + public static class SrcfileContext extends SourceFileContext { + public PackageDeclarationContext packageDeclaration() { + return getRuleContext(PackageDeclarationContext.class,0); + } + public List importDeclaration() { + return getRuleContexts(ImportDeclarationContext.class); + } + public ImportDeclarationContext importDeclaration(int i) { + return getRuleContext(ImportDeclarationContext.class,i); + } + public List classOrInterface() { + return getRuleContexts(ClassOrInterfaceContext.class); + } + public ClassOrInterfaceContext classOrInterface(int i) { + return getRuleContext(ClassOrInterfaceContext.class,i); + } + public SrcfileContext(SourceFileContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterSrcfile(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitSrcfile(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class ModuledeclContext extends SourceFileContext { + public ModuleDeclarationContext moduleDeclaration() { + return getRuleContext(ModuleDeclarationContext.class,0); + } + public TerminalNode EOF() { return getToken(Java17Parser.EOF, 0); } + public ModuledeclContext(SourceFileContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterModuledecl(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitModuledecl(this); + } + } + + public final SourceFileContext sourceFile() throws RecognitionException { + SourceFileContext _localctx = new SourceFileContext(_ctx, getState()); + enterRule(_localctx, 0, RULE_sourceFile); + int _la; + try { + setState(296); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,3,_ctx) ) { + case 1: + _localctx = new SrcfileContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(279); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,0,_ctx) ) { + case 1: + { + setState(278); + packageDeclaration(); + } + break; + } + setState(284); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==IMPORT) { + { + { + setState(281); + importDeclaration(); + } + } + setState(286); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(290); + _errHandler.sync(this); + _la = _input.LA(1); + while ((((_la - 1)) & ~0x3f) == 0 && ((1L << (_la - 1)) & -1125457390829311L) != 0 || (((_la - 65)) & ~0x3f) == 0 && ((1L << (_la - 65)) & -8935141660702539773L) != 0) { + { + { + setState(287); + classOrInterface(); + } + } + setState(292); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + break; + case 2: + _localctx = new ModuledeclContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(293); + moduleDeclaration(); + setState(294); + match(EOF); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class PackageDeclarationContext extends ParserRuleContext { + public TerminalNode PACKAGE() { return getToken(Java17Parser.PACKAGE, 0); } + public QualifiedNameContext qualifiedName() { + return getRuleContext(QualifiedNameContext.class,0); + } + public TerminalNode SEMI() { return getToken(Java17Parser.SEMI, 0); } + public List annotation() { + return getRuleContexts(AnnotationContext.class); + } + public AnnotationContext annotation(int i) { + return getRuleContext(AnnotationContext.class,i); + } + public PackageDeclarationContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_packageDeclaration; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterPackageDeclaration(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitPackageDeclaration(this); + } + } + + public final PackageDeclarationContext packageDeclaration() throws RecognitionException { + PackageDeclarationContext _localctx = new PackageDeclarationContext(_ctx, getState()); + enterRule(_localctx, 2, RULE_packageDeclaration); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(301); + _errHandler.sync(this); + _la = _input.LA(1); + while ((((_la - 51)) & ~0x3f) == 0 && ((1L << (_la - 51)) & 32767L) != 0 || _la==AT || _la==IDENTIFIER) { + { + { + setState(298); + annotation(); + } + } + setState(303); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(304); + match(PACKAGE); + setState(305); + qualifiedName(); + setState(306); + match(SEMI); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ImportDeclarationContext extends ParserRuleContext { + public TerminalNode IMPORT() { return getToken(Java17Parser.IMPORT, 0); } + public QualifiedNameContext qualifiedName() { + return getRuleContext(QualifiedNameContext.class,0); + } + public TerminalNode SEMI() { return getToken(Java17Parser.SEMI, 0); } + public TerminalNode STATIC() { return getToken(Java17Parser.STATIC, 0); } + public TerminalNode DOT() { return getToken(Java17Parser.DOT, 0); } + public TerminalNode MUL() { return getToken(Java17Parser.MUL, 0); } + public ImportDeclarationContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_importDeclaration; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterImportDeclaration(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitImportDeclaration(this); + } + } + + public final ImportDeclarationContext importDeclaration() throws RecognitionException { + ImportDeclarationContext _localctx = new ImportDeclarationContext(_ctx, getState()); + enterRule(_localctx, 4, RULE_importDeclaration); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(308); + match(IMPORT); + setState(310); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==STATIC) { + { + setState(309); + match(STATIC); + } + } + + setState(312); + qualifiedName(); + setState(315); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==DOT) { + { + setState(313); + match(DOT); + setState(314); + match(MUL); + } + } + + setState(317); + match(SEMI); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ClassOrInterfaceContext extends ParserRuleContext { + public ClassOrInterfaceContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_classOrInterface; } + + public ClassOrInterfaceContext() { } + public void copyFrom(ClassOrInterfaceContext ctx) { + super.copyFrom(ctx); + } + } + @SuppressWarnings("CheckReturnValue") + public static class NoclassorinterfaceContext extends ClassOrInterfaceContext { + public TerminalNode SEMI() { return getToken(Java17Parser.SEMI, 0); } + public NoclassorinterfaceContext(ClassOrInterfaceContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterNoclassorinterface(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitNoclassorinterface(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class ClassorinterfacedeclContext extends ClassOrInterfaceContext { + public ClassDeclarationContext classDeclaration() { + return getRuleContext(ClassDeclarationContext.class,0); + } + public EnumDeclarationContext enumDeclaration() { + return getRuleContext(EnumDeclarationContext.class,0); + } + public InterfaceDeclarationContext interfaceDeclaration() { + return getRuleContext(InterfaceDeclarationContext.class,0); + } + public AnnotationTypeDeclarationContext annotationTypeDeclaration() { + return getRuleContext(AnnotationTypeDeclarationContext.class,0); + } + public RecordDeclarationContext recordDeclaration() { + return getRuleContext(RecordDeclarationContext.class,0); + } + public List classOrInterfaceModifier() { + return getRuleContexts(ClassOrInterfaceModifierContext.class); + } + public ClassOrInterfaceModifierContext classOrInterfaceModifier(int i) { + return getRuleContext(ClassOrInterfaceModifierContext.class,i); + } + public ClassorinterfacedeclContext(ClassOrInterfaceContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterClassorinterfacedecl(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitClassorinterfacedecl(this); + } + } + + public final ClassOrInterfaceContext classOrInterface() throws RecognitionException { + ClassOrInterfaceContext _localctx = new ClassOrInterfaceContext(_ctx, getState()); + enterRule(_localctx, 6, RULE_classOrInterface); + try { + int _alt; + setState(333); + _errHandler.sync(this); + switch (_input.LA(1)) { + case ABSTRACT: + case CLASS: + case ENUM: + case FINAL: + case INTERFACE: + case PRIVATE: + case PROTECTED: + case PUBLIC: + case STATIC: + case STRICTFP: + case MODULE: + case OPEN: + case REQUIRES: + case EXPORTS: + case OPENS: + case TO: + case USES: + case PROVIDES: + case WITH: + case TRANSITIVE: + case VAR: + case YIELD: + case RECORD: + case SEALED: + case PERMITS: + case NON_SEALED: + case AT: + case IDENTIFIER: + _localctx = new ClassorinterfacedeclContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(322); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,7,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + setState(319); + classOrInterfaceModifier(); + } + } + } + setState(324); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,7,_ctx); + } + setState(330); + _errHandler.sync(this); + switch (_input.LA(1)) { + case CLASS: + { + setState(325); + classDeclaration(); + } + break; + case ENUM: + { + setState(326); + enumDeclaration(); + } + break; + case INTERFACE: + { + setState(327); + interfaceDeclaration(); + } + break; + case AT: + { + setState(328); + annotationTypeDeclaration(); + } + break; + case RECORD: + { + setState(329); + recordDeclaration(); + } + break; + default: + throw new NoViableAltException(this); + } + } + break; + case SEMI: + _localctx = new NoclassorinterfaceContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(332); + match(SEMI); + } + break; + default: + throw new NoViableAltException(this); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ModifierContext extends ParserRuleContext { + public ClassOrInterfaceModifierContext classOrInterfaceModifier() { + return getRuleContext(ClassOrInterfaceModifierContext.class,0); + } + public TerminalNode NATIVE() { return getToken(Java17Parser.NATIVE, 0); } + public TerminalNode SYNCHRONIZED() { return getToken(Java17Parser.SYNCHRONIZED, 0); } + public TerminalNode TRANSIENT() { return getToken(Java17Parser.TRANSIENT, 0); } + public TerminalNode VOLATILE() { return getToken(Java17Parser.VOLATILE, 0); } + public ModifierContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_modifier; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterModifier(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitModifier(this); + } + } + + public final ModifierContext modifier() throws RecognitionException { + ModifierContext _localctx = new ModifierContext(_ctx, getState()); + enterRule(_localctx, 8, RULE_modifier); + try { + setState(340); + _errHandler.sync(this); + switch (_input.LA(1)) { + case ABSTRACT: + case FINAL: + case PRIVATE: + case PROTECTED: + case PUBLIC: + case STATIC: + case STRICTFP: + case MODULE: + case OPEN: + case REQUIRES: + case EXPORTS: + case OPENS: + case TO: + case USES: + case PROVIDES: + case WITH: + case TRANSITIVE: + case VAR: + case YIELD: + case RECORD: + case SEALED: + case PERMITS: + case NON_SEALED: + case AT: + case IDENTIFIER: + enterOuterAlt(_localctx, 1); + { + setState(335); + classOrInterfaceModifier(); + } + break; + case NATIVE: + enterOuterAlt(_localctx, 2); + { + setState(336); + match(NATIVE); + } + break; + case SYNCHRONIZED: + enterOuterAlt(_localctx, 3); + { + setState(337); + match(SYNCHRONIZED); + } + break; + case TRANSIENT: + enterOuterAlt(_localctx, 4); + { + setState(338); + match(TRANSIENT); + } + break; + case VOLATILE: + enterOuterAlt(_localctx, 5); + { + setState(339); + match(VOLATILE); + } + break; + default: + throw new NoViableAltException(this); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ClassOrInterfaceModifierContext extends ParserRuleContext { + public AnnotationContext annotation() { + return getRuleContext(AnnotationContext.class,0); + } + public TerminalNode PUBLIC() { return getToken(Java17Parser.PUBLIC, 0); } + public TerminalNode PROTECTED() { return getToken(Java17Parser.PROTECTED, 0); } + public TerminalNode PRIVATE() { return getToken(Java17Parser.PRIVATE, 0); } + public TerminalNode STATIC() { return getToken(Java17Parser.STATIC, 0); } + public TerminalNode ABSTRACT() { return getToken(Java17Parser.ABSTRACT, 0); } + public TerminalNode FINAL() { return getToken(Java17Parser.FINAL, 0); } + public TerminalNode STRICTFP() { return getToken(Java17Parser.STRICTFP, 0); } + public TerminalNode SEALED() { return getToken(Java17Parser.SEALED, 0); } + public TerminalNode NON_SEALED() { return getToken(Java17Parser.NON_SEALED, 0); } + public ClassOrInterfaceModifierContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_classOrInterfaceModifier; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterClassOrInterfaceModifier(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitClassOrInterfaceModifier(this); + } + } + + public final ClassOrInterfaceModifierContext classOrInterfaceModifier() throws RecognitionException { + ClassOrInterfaceModifierContext _localctx = new ClassOrInterfaceModifierContext(_ctx, getState()); + enterRule(_localctx, 10, RULE_classOrInterfaceModifier); + try { + setState(352); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,11,_ctx) ) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(342); + annotation(); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(343); + match(PUBLIC); + } + break; + case 3: + enterOuterAlt(_localctx, 3); + { + setState(344); + match(PROTECTED); + } + break; + case 4: + enterOuterAlt(_localctx, 4); + { + setState(345); + match(PRIVATE); + } + break; + case 5: + enterOuterAlt(_localctx, 5); + { + setState(346); + match(STATIC); + } + break; + case 6: + enterOuterAlt(_localctx, 6); + { + setState(347); + match(ABSTRACT); + } + break; + case 7: + enterOuterAlt(_localctx, 7); + { + setState(348); + match(FINAL); + } + break; + case 8: + enterOuterAlt(_localctx, 8); + { + setState(349); + match(STRICTFP); + } + break; + case 9: + enterOuterAlt(_localctx, 9); + { + setState(350); + match(SEALED); + } + break; + case 10: + enterOuterAlt(_localctx, 10); + { + setState(351); + match(NON_SEALED); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class VariableModifierContext extends ParserRuleContext { + public VariableModifierContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_variableModifier; } + + public VariableModifierContext() { } + public void copyFrom(VariableModifierContext ctx) { + super.copyFrom(ctx); + } + } + @SuppressWarnings("CheckReturnValue") + public static class FinalvarmodContext extends VariableModifierContext { + public TerminalNode FINAL() { return getToken(Java17Parser.FINAL, 0); } + public FinalvarmodContext(VariableModifierContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterFinalvarmod(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitFinalvarmod(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class AnnotationvarmodContext extends VariableModifierContext { + public AnnotationContext annotation() { + return getRuleContext(AnnotationContext.class,0); + } + public AnnotationvarmodContext(VariableModifierContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterAnnotationvarmod(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitAnnotationvarmod(this); + } + } + + public final VariableModifierContext variableModifier() throws RecognitionException { + VariableModifierContext _localctx = new VariableModifierContext(_ctx, getState()); + enterRule(_localctx, 12, RULE_variableModifier); + try { + setState(356); + _errHandler.sync(this); + switch (_input.LA(1)) { + case FINAL: + _localctx = new FinalvarmodContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(354); + match(FINAL); + } + break; + case MODULE: + case OPEN: + case REQUIRES: + case EXPORTS: + case OPENS: + case TO: + case USES: + case PROVIDES: + case WITH: + case TRANSITIVE: + case VAR: + case YIELD: + case RECORD: + case SEALED: + case PERMITS: + case AT: + case IDENTIFIER: + _localctx = new AnnotationvarmodContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(355); + annotation(); + } + break; + default: + throw new NoViableAltException(this); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ClassDeclarationContext extends ParserRuleContext { + public TerminalNode CLASS() { return getToken(Java17Parser.CLASS, 0); } + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public ClassBodyContext classBody() { + return getRuleContext(ClassBodyContext.class,0); + } + public GenericDeclarationListContext genericDeclarationList() { + return getRuleContext(GenericDeclarationListContext.class,0); + } + public TerminalNode EXTENDS() { return getToken(Java17Parser.EXTENDS, 0); } + public TypeTypeContext typeType() { + return getRuleContext(TypeTypeContext.class,0); + } + public TerminalNode IMPLEMENTS() { return getToken(Java17Parser.IMPLEMENTS, 0); } + public List typeList() { + return getRuleContexts(TypeListContext.class); + } + public TypeListContext typeList(int i) { + return getRuleContext(TypeListContext.class,i); + } + public TerminalNode PERMITS() { return getToken(Java17Parser.PERMITS, 0); } + public ClassDeclarationContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_classDeclaration; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterClassDeclaration(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitClassDeclaration(this); + } + } + + public final ClassDeclarationContext classDeclaration() throws RecognitionException { + ClassDeclarationContext _localctx = new ClassDeclarationContext(_ctx, getState()); + enterRule(_localctx, 14, RULE_classDeclaration); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(358); + match(CLASS); + setState(359); + identifier(); + setState(361); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==LT) { + { + setState(360); + genericDeclarationList(); + } + } + + setState(365); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==EXTENDS) { + { + setState(363); + match(EXTENDS); + setState(364); + typeType(); + } + } + + setState(369); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==IMPLEMENTS) { + { + setState(367); + match(IMPLEMENTS); + setState(368); + typeList(); + } + } + + setState(373); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==PERMITS) { + { + setState(371); + match(PERMITS); + setState(372); + typeList(); + } + } + + setState(375); + classBody(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class GenericDeclarationListContext extends ParserRuleContext { + public TerminalNode LT() { return getToken(Java17Parser.LT, 0); } + public List genericTypeVar() { + return getRuleContexts(GenericTypeVarContext.class); + } + public GenericTypeVarContext genericTypeVar(int i) { + return getRuleContext(GenericTypeVarContext.class,i); + } + public TerminalNode GT() { return getToken(Java17Parser.GT, 0); } + public List COMMA() { return getTokens(Java17Parser.COMMA); } + public TerminalNode COMMA(int i) { + return getToken(Java17Parser.COMMA, i); + } + public GenericDeclarationListContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_genericDeclarationList; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterGenericDeclarationList(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitGenericDeclarationList(this); + } + } + + public final GenericDeclarationListContext genericDeclarationList() throws RecognitionException { + GenericDeclarationListContext _localctx = new GenericDeclarationListContext(_ctx, getState()); + enterRule(_localctx, 16, RULE_genericDeclarationList); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(377); + match(LT); + setState(378); + genericTypeVar(); + setState(383); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==COMMA) { + { + { + setState(379); + match(COMMA); + setState(380); + genericTypeVar(); + } + } + setState(385); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(386); + match(GT); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class GenericTypeVarContext extends ParserRuleContext { + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public List annotation() { + return getRuleContexts(AnnotationContext.class); + } + public AnnotationContext annotation(int i) { + return getRuleContext(AnnotationContext.class,i); + } + public TypeBoundContext typeBound() { + return getRuleContext(TypeBoundContext.class,0); + } + public TerminalNode EXTENDS() { return getToken(Java17Parser.EXTENDS, 0); } + public TerminalNode IMPLEMENTS() { return getToken(Java17Parser.IMPLEMENTS, 0); } + public GenericTypeVarContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_genericTypeVar; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterGenericTypeVar(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitGenericTypeVar(this); + } + } + + public final GenericTypeVarContext genericTypeVar() throws RecognitionException { + GenericTypeVarContext _localctx = new GenericTypeVarContext(_ctx, getState()); + enterRule(_localctx, 18, RULE_genericTypeVar); + int _la; + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(391); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,18,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + setState(388); + annotation(); + } + } + } + setState(393); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,18,_ctx); + } + setState(394); + identifier(); + setState(403); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==EXTENDS || _la==IMPLEMENTS) { + { + setState(395); + _la = _input.LA(1); + if ( !(_la==EXTENDS || _la==IMPLEMENTS) ) { + _errHandler.recoverInline(this); + } + else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + setState(399); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,19,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + setState(396); + annotation(); + } + } + } + setState(401); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,19,_ctx); + } + setState(402); + typeBound(); + } + } + + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class TypeBoundContext extends ParserRuleContext { + public List typeType() { + return getRuleContexts(TypeTypeContext.class); + } + public TypeTypeContext typeType(int i) { + return getRuleContext(TypeTypeContext.class,i); + } + public List BITAND() { return getTokens(Java17Parser.BITAND); } + public TerminalNode BITAND(int i) { + return getToken(Java17Parser.BITAND, i); + } + public TypeBoundContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_typeBound; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterTypeBound(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitTypeBound(this); + } + } + + public final TypeBoundContext typeBound() throws RecognitionException { + TypeBoundContext _localctx = new TypeBoundContext(_ctx, getState()); + enterRule(_localctx, 20, RULE_typeBound); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(405); + typeType(); + setState(410); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==BITAND) { + { + { + setState(406); + match(BITAND); + setState(407); + typeType(); + } + } + setState(412); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class EnumDeclarationContext extends ParserRuleContext { + public TerminalNode ENUM() { return getToken(Java17Parser.ENUM, 0); } + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public TerminalNode LBRACE() { return getToken(Java17Parser.LBRACE, 0); } + public TerminalNode RBRACE() { return getToken(Java17Parser.RBRACE, 0); } + public TerminalNode IMPLEMENTS() { return getToken(Java17Parser.IMPLEMENTS, 0); } + public TypeListContext typeList() { + return getRuleContext(TypeListContext.class,0); + } + public EnumConstantsContext enumConstants() { + return getRuleContext(EnumConstantsContext.class,0); + } + public TerminalNode COMMA() { return getToken(Java17Parser.COMMA, 0); } + public EnumBodyDeclarationsContext enumBodyDeclarations() { + return getRuleContext(EnumBodyDeclarationsContext.class,0); + } + public EnumDeclarationContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_enumDeclaration; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterEnumDeclaration(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitEnumDeclaration(this); + } + } + + public final EnumDeclarationContext enumDeclaration() throws RecognitionException { + EnumDeclarationContext _localctx = new EnumDeclarationContext(_ctx, getState()); + enterRule(_localctx, 22, RULE_enumDeclaration); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(413); + match(ENUM); + setState(414); + identifier(); + setState(417); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==IMPLEMENTS) { + { + setState(415); + match(IMPLEMENTS); + setState(416); + typeList(); + } + } + + setState(419); + match(LBRACE); + setState(421); + _errHandler.sync(this); + _la = _input.LA(1); + if ((((_la - 51)) & ~0x3f) == 0 && ((1L << (_la - 51)) & 32767L) != 0 || _la==AT || _la==IDENTIFIER) { + { + setState(420); + enumConstants(); + } + } + + setState(424); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==COMMA) { + { + setState(423); + match(COMMA); + } + } + + setState(427); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==SEMI) { + { + setState(426); + enumBodyDeclarations(); + } + } + + setState(429); + match(RBRACE); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class EnumConstantsContext extends ParserRuleContext { + public List enumConstant() { + return getRuleContexts(EnumConstantContext.class); + } + public EnumConstantContext enumConstant(int i) { + return getRuleContext(EnumConstantContext.class,i); + } + public List COMMA() { return getTokens(Java17Parser.COMMA); } + public TerminalNode COMMA(int i) { + return getToken(Java17Parser.COMMA, i); + } + public EnumConstantsContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_enumConstants; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterEnumConstants(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitEnumConstants(this); + } + } + + public final EnumConstantsContext enumConstants() throws RecognitionException { + EnumConstantsContext _localctx = new EnumConstantsContext(_ctx, getState()); + enterRule(_localctx, 24, RULE_enumConstants); + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(431); + enumConstant(); + setState(436); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,26,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + setState(432); + match(COMMA); + setState(433); + enumConstant(); + } + } + } + setState(438); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,26,_ctx); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class EnumConstantContext extends ParserRuleContext { + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public List annotation() { + return getRuleContexts(AnnotationContext.class); + } + public AnnotationContext annotation(int i) { + return getRuleContext(AnnotationContext.class,i); + } + public ArgumentsContext arguments() { + return getRuleContext(ArgumentsContext.class,0); + } + public ClassBodyContext classBody() { + return getRuleContext(ClassBodyContext.class,0); + } + public EnumConstantContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_enumConstant; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterEnumConstant(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitEnumConstant(this); + } + } + + public final EnumConstantContext enumConstant() throws RecognitionException { + EnumConstantContext _localctx = new EnumConstantContext(_ctx, getState()); + enterRule(_localctx, 26, RULE_enumConstant); + int _la; + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(442); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,27,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + setState(439); + annotation(); + } + } + } + setState(444); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,27,_ctx); + } + setState(445); + identifier(); + setState(447); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==LPAREN) { + { + setState(446); + arguments(); + } + } + + setState(450); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==LBRACE) { + { + setState(449); + classBody(); + } + } + + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class EnumBodyDeclarationsContext extends ParserRuleContext { + public TerminalNode SEMI() { return getToken(Java17Parser.SEMI, 0); } + public List classBodyDeclaration() { + return getRuleContexts(ClassBodyDeclarationContext.class); + } + public ClassBodyDeclarationContext classBodyDeclaration(int i) { + return getRuleContext(ClassBodyDeclarationContext.class,i); + } + public EnumBodyDeclarationsContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_enumBodyDeclarations; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterEnumBodyDeclarations(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitEnumBodyDeclarations(this); + } + } + + public final EnumBodyDeclarationsContext enumBodyDeclarations() throws RecognitionException { + EnumBodyDeclarationsContext _localctx = new EnumBodyDeclarationsContext(_ctx, getState()); + enterRule(_localctx, 28, RULE_enumBodyDeclarations); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(452); + match(SEMI); + setState(456); + _errHandler.sync(this); + _la = _input.LA(1); + while ((((_la - 1)) & ~0x3f) == 0 && ((1L << (_la - 1)) & -665791937994347L) != 0 || (((_la - 65)) & ~0x3f) == 0 && ((1L << (_la - 65)) & -8935141660685729789L) != 0) { + { + { + setState(453); + classBodyDeclaration(); + } + } + setState(458); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class InterfaceDeclarationContext extends ParserRuleContext { + public TerminalNode INTERFACE() { return getToken(Java17Parser.INTERFACE, 0); } + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public InterfaceBodyContext interfaceBody() { + return getRuleContext(InterfaceBodyContext.class,0); + } + public GenericDeclarationListContext genericDeclarationList() { + return getRuleContext(GenericDeclarationListContext.class,0); + } + public TerminalNode EXTENDS() { return getToken(Java17Parser.EXTENDS, 0); } + public List typeList() { + return getRuleContexts(TypeListContext.class); + } + public TypeListContext typeList(int i) { + return getRuleContext(TypeListContext.class,i); + } + public TerminalNode PERMITS() { return getToken(Java17Parser.PERMITS, 0); } + public InterfaceDeclarationContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_interfaceDeclaration; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterInterfaceDeclaration(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitInterfaceDeclaration(this); + } + } + + public final InterfaceDeclarationContext interfaceDeclaration() throws RecognitionException { + InterfaceDeclarationContext _localctx = new InterfaceDeclarationContext(_ctx, getState()); + enterRule(_localctx, 30, RULE_interfaceDeclaration); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(459); + match(INTERFACE); + setState(460); + identifier(); + setState(462); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==LT) { + { + setState(461); + genericDeclarationList(); + } + } + + setState(466); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==EXTENDS) { + { + setState(464); + match(EXTENDS); + setState(465); + typeList(); + } + } + + setState(470); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==PERMITS) { + { + setState(468); + match(PERMITS); + setState(469); + typeList(); + } + } + + setState(472); + interfaceBody(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ClassBodyContext extends ParserRuleContext { + public TerminalNode LBRACE() { return getToken(Java17Parser.LBRACE, 0); } + public TerminalNode RBRACE() { return getToken(Java17Parser.RBRACE, 0); } + public List classBodyDeclaration() { + return getRuleContexts(ClassBodyDeclarationContext.class); + } + public ClassBodyDeclarationContext classBodyDeclaration(int i) { + return getRuleContext(ClassBodyDeclarationContext.class,i); + } + public ClassBodyContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_classBody; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterClassBody(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitClassBody(this); + } + } + + public final ClassBodyContext classBody() throws RecognitionException { + ClassBodyContext _localctx = new ClassBodyContext(_ctx, getState()); + enterRule(_localctx, 32, RULE_classBody); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(474); + match(LBRACE); + setState(478); + _errHandler.sync(this); + _la = _input.LA(1); + while ((((_la - 1)) & ~0x3f) == 0 && ((1L << (_la - 1)) & -665791937994347L) != 0 || (((_la - 65)) & ~0x3f) == 0 && ((1L << (_la - 65)) & -8935141660685729789L) != 0) { + { + { + setState(475); + classBodyDeclaration(); + } + } + setState(480); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(481); + match(RBRACE); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class InterfaceBodyContext extends ParserRuleContext { + public TerminalNode LBRACE() { return getToken(Java17Parser.LBRACE, 0); } + public TerminalNode RBRACE() { return getToken(Java17Parser.RBRACE, 0); } + public List interfaceBodyDeclaration() { + return getRuleContexts(InterfaceBodyDeclarationContext.class); + } + public InterfaceBodyDeclarationContext interfaceBodyDeclaration(int i) { + return getRuleContext(InterfaceBodyDeclarationContext.class,i); + } + public InterfaceBodyContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_interfaceBody; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterInterfaceBody(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitInterfaceBody(this); + } + } + + public final InterfaceBodyContext interfaceBody() throws RecognitionException { + InterfaceBodyContext _localctx = new InterfaceBodyContext(_ctx, getState()); + enterRule(_localctx, 34, RULE_interfaceBody); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(483); + match(LBRACE); + setState(487); + _errHandler.sync(this); + _la = _input.LA(1); + while ((((_la - 1)) & ~0x3f) == 0 && ((1L << (_la - 1)) & -665791937992299L) != 0 || (((_la - 65)) & ~0x3f) == 0 && ((1L << (_la - 65)) & -8935141660685762557L) != 0) { + { + { + setState(484); + interfaceBodyDeclaration(); + } + } + setState(489); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(490); + match(RBRACE); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ClassBodyDeclarationContext extends ParserRuleContext { + public ClassBodyDeclarationContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_classBodyDeclaration; } + + public ClassBodyDeclarationContext() { } + public void copyFrom(ClassBodyDeclarationContext ctx) { + super.copyFrom(ctx); + } + } + @SuppressWarnings("CheckReturnValue") + public static class EmptyclassbodyContext extends ClassBodyDeclarationContext { + public TerminalNode SEMI() { return getToken(Java17Parser.SEMI, 0); } + public EmptyclassbodyContext(ClassBodyDeclarationContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterEmptyclassbody(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitEmptyclassbody(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class MemberdeclContext extends ClassBodyDeclarationContext { + public MemberDeclarationContext memberDeclaration() { + return getRuleContext(MemberDeclarationContext.class,0); + } + public List modifier() { + return getRuleContexts(ModifierContext.class); + } + public ModifierContext modifier(int i) { + return getRuleContext(ModifierContext.class,i); + } + public MemberdeclContext(ClassBodyDeclarationContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterMemberdecl(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitMemberdecl(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class ClassblockContext extends ClassBodyDeclarationContext { + public BlockContext block() { + return getRuleContext(BlockContext.class,0); + } + public TerminalNode STATIC() { return getToken(Java17Parser.STATIC, 0); } + public ClassblockContext(ClassBodyDeclarationContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterClassblock(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitClassblock(this); + } + } + + public final ClassBodyDeclarationContext classBodyDeclaration() throws RecognitionException { + ClassBodyDeclarationContext _localctx = new ClassBodyDeclarationContext(_ctx, getState()); + enterRule(_localctx, 36, RULE_classBodyDeclaration); + int _la; + try { + int _alt; + setState(504); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,38,_ctx) ) { + case 1: + _localctx = new EmptyclassbodyContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(492); + match(SEMI); + } + break; + case 2: + _localctx = new ClassblockContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(494); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==STATIC) { + { + setState(493); + match(STATIC); + } + } + + setState(496); + block(); + } + break; + case 3: + _localctx = new MemberdeclContext(_localctx); + enterOuterAlt(_localctx, 3); + { + setState(500); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,37,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + setState(497); + modifier(); + } + } + } + setState(502); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,37,_ctx); + } + setState(503); + memberDeclaration(); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class MemberDeclarationContext extends ParserRuleContext { + public MemberDeclarationContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_memberDeclaration; } + + public MemberDeclarationContext() { } + public void copyFrom(MemberDeclarationContext ctx) { + super.copyFrom(ctx); + } + } + @SuppressWarnings("CheckReturnValue") + public static class MembermethodContext extends MemberDeclarationContext { + public MethodContext method() { + return getRuleContext(MethodContext.class,0); + } + public MembermethodContext(MemberDeclarationContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterMembermethod(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitMembermethod(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class MemberconstructorContext extends MemberDeclarationContext { + public ConstructorContext constructor() { + return getRuleContext(ConstructorContext.class,0); + } + public MemberconstructorContext(MemberDeclarationContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterMemberconstructor(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitMemberconstructor(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class MemberclassorinterfaceContext extends MemberDeclarationContext { + public ClassOrInterfaceContext classOrInterface() { + return getRuleContext(ClassOrInterfaceContext.class,0); + } + public MemberclassorinterfaceContext(MemberDeclarationContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterMemberclassorinterface(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitMemberclassorinterface(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class MemberfieldContext extends MemberDeclarationContext { + public FieldDeclarationContext fieldDeclaration() { + return getRuleContext(FieldDeclarationContext.class,0); + } + public MemberfieldContext(MemberDeclarationContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterMemberfield(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitMemberfield(this); + } + } + + public final MemberDeclarationContext memberDeclaration() throws RecognitionException { + MemberDeclarationContext _localctx = new MemberDeclarationContext(_ctx, getState()); + enterRule(_localctx, 38, RULE_memberDeclaration); + try { + setState(510); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,39,_ctx) ) { + case 1: + _localctx = new MemberclassorinterfaceContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(506); + classOrInterface(); + } + break; + case 2: + _localctx = new MemberfieldContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(507); + fieldDeclaration(); + } + break; + case 3: + _localctx = new MembermethodContext(_localctx); + enterOuterAlt(_localctx, 3); + { + setState(508); + method(); + } + break; + case 4: + _localctx = new MemberconstructorContext(_localctx); + enterOuterAlt(_localctx, 4); + { + setState(509); + constructor(); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class MethodContext extends ParserRuleContext { + public MethodContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_method; } + + public MethodContext() { } + public void copyFrom(MethodContext ctx) { + super.copyFrom(ctx); + } + } + @SuppressWarnings("CheckReturnValue") + public static class MethoddeclContext extends MethodContext { + public MethodDeclarationContext methodDeclaration() { + return getRuleContext(MethodDeclarationContext.class,0); + } + public MethoddeclContext(MethodContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterMethoddecl(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitMethoddecl(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class GenericmethodContext extends MethodContext { + public GenericMethodDeclarationContext genericMethodDeclaration() { + return getRuleContext(GenericMethodDeclarationContext.class,0); + } + public GenericmethodContext(MethodContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterGenericmethod(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitGenericmethod(this); + } + } + + public final MethodContext method() throws RecognitionException { + MethodContext _localctx = new MethodContext(_ctx, getState()); + enterRule(_localctx, 40, RULE_method); + try { + setState(514); + _errHandler.sync(this); + switch (_input.LA(1)) { + case BOOLEAN: + case BYTE: + case CHAR: + case DOUBLE: + case FLOAT: + case INT: + case LONG: + case SHORT: + case VOID: + case MODULE: + case OPEN: + case REQUIRES: + case EXPORTS: + case OPENS: + case TO: + case USES: + case PROVIDES: + case WITH: + case TRANSITIVE: + case VAR: + case YIELD: + case RECORD: + case SEALED: + case PERMITS: + case AT: + case IDENTIFIER: + _localctx = new MethoddeclContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(512); + methodDeclaration(); + } + break; + case LT: + _localctx = new GenericmethodContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(513); + genericMethodDeclaration(); + } + break; + default: + throw new NoViableAltException(this); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class MethodDeclarationContext extends ParserRuleContext { + public MethodHeaderContext methodHeader() { + return getRuleContext(MethodHeaderContext.class,0); + } + public MethodBodyContext methodBody() { + return getRuleContext(MethodBodyContext.class,0); + } + public TerminalNode THROWS() { return getToken(Java17Parser.THROWS, 0); } + public ExceptionListContext exceptionList() { + return getRuleContext(ExceptionListContext.class,0); + } + public MethodDeclarationContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_methodDeclaration; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterMethodDeclaration(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitMethodDeclaration(this); + } + } + + public final MethodDeclarationContext methodDeclaration() throws RecognitionException { + MethodDeclarationContext _localctx = new MethodDeclarationContext(_ctx, getState()); + enterRule(_localctx, 42, RULE_methodDeclaration); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(516); + methodHeader(); + setState(519); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==THROWS) { + { + setState(517); + match(THROWS); + setState(518); + exceptionList(); + } + } + + setState(521); + methodBody(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class MethodHeaderContext extends ParserRuleContext { + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public FormalParametersContext formalParameters() { + return getRuleContext(FormalParametersContext.class,0); + } + public RefTypeContext refType() { + return getRuleContext(RefTypeContext.class,0); + } + public List LBRACK() { return getTokens(Java17Parser.LBRACK); } + public TerminalNode LBRACK(int i) { + return getToken(Java17Parser.LBRACK, i); + } + public List RBRACK() { return getTokens(Java17Parser.RBRACK); } + public TerminalNode RBRACK(int i) { + return getToken(Java17Parser.RBRACK, i); + } + public MethodHeaderContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_methodHeader; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterMethodHeader(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitMethodHeader(this); + } + } + + public final MethodHeaderContext methodHeader() throws RecognitionException { + MethodHeaderContext _localctx = new MethodHeaderContext(_ctx, getState()); + enterRule(_localctx, 44, RULE_methodHeader); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(524); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,42,_ctx) ) { + case 1: + { + setState(523); + refType(); + } + break; + } + setState(526); + identifier(); + setState(527); + formalParameters(); + setState(532); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==LBRACK) { + { + { + setState(528); + match(LBRACK); + setState(529); + match(RBRACK); + } + } + setState(534); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class MethodBodyContext extends ParserRuleContext { + public MethodBodyContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_methodBody; } + + public MethodBodyContext() { } + public void copyFrom(MethodBodyContext ctx) { + super.copyFrom(ctx); + } + } + @SuppressWarnings("CheckReturnValue") + public static class MethodblockContext extends MethodBodyContext { + public BlockContext block() { + return getRuleContext(BlockContext.class,0); + } + public MethodblockContext(MethodBodyContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterMethodblock(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitMethodblock(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class EmptymethodContext extends MethodBodyContext { + public TerminalNode SEMI() { return getToken(Java17Parser.SEMI, 0); } + public EmptymethodContext(MethodBodyContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterEmptymethod(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitEmptymethod(this); + } + } + + public final MethodBodyContext methodBody() throws RecognitionException { + MethodBodyContext _localctx = new MethodBodyContext(_ctx, getState()); + enterRule(_localctx, 46, RULE_methodBody); + try { + setState(537); + _errHandler.sync(this); + switch (_input.LA(1)) { + case LBRACE: + _localctx = new MethodblockContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(535); + block(); + } + break; + case SEMI: + _localctx = new EmptymethodContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(536); + match(SEMI); + } + break; + default: + throw new NoViableAltException(this); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class RefTypeContext extends ParserRuleContext { + public RefTypeContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_refType; } + + public RefTypeContext() { } + public void copyFrom(RefTypeContext ctx) { + super.copyFrom(ctx); + } + } + @SuppressWarnings("CheckReturnValue") + public static class RefvoidContext extends RefTypeContext { + public TerminalNode VOID() { return getToken(Java17Parser.VOID, 0); } + public RefvoidContext(RefTypeContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterRefvoid(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitRefvoid(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class RefType2Context extends RefTypeContext { + public TypeTypeContext typeType() { + return getRuleContext(TypeTypeContext.class,0); + } + public RefType2Context(RefTypeContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterRefType2(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitRefType2(this); + } + } + + public final RefTypeContext refType() throws RecognitionException { + RefTypeContext _localctx = new RefTypeContext(_ctx, getState()); + enterRule(_localctx, 48, RULE_refType); + try { + setState(541); + _errHandler.sync(this); + switch (_input.LA(1)) { + case BOOLEAN: + case BYTE: + case CHAR: + case DOUBLE: + case FLOAT: + case INT: + case LONG: + case SHORT: + case MODULE: + case OPEN: + case REQUIRES: + case EXPORTS: + case OPENS: + case TO: + case USES: + case PROVIDES: + case WITH: + case TRANSITIVE: + case VAR: + case YIELD: + case RECORD: + case SEALED: + case PERMITS: + case AT: + case IDENTIFIER: + _localctx = new RefType2Context(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(539); + typeType(); + } + break; + case VOID: + _localctx = new RefvoidContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(540); + match(VOID); + } + break; + default: + throw new NoViableAltException(this); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class GenericMethodDeclarationContext extends ParserRuleContext { + public GenericDeclarationListContext genericDeclarationList() { + return getRuleContext(GenericDeclarationListContext.class,0); + } + public MethodDeclarationContext methodDeclaration() { + return getRuleContext(MethodDeclarationContext.class,0); + } + public GenericMethodDeclarationContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_genericMethodDeclaration; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterGenericMethodDeclaration(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitGenericMethodDeclaration(this); + } + } + + public final GenericMethodDeclarationContext genericMethodDeclaration() throws RecognitionException { + GenericMethodDeclarationContext _localctx = new GenericMethodDeclarationContext(_ctx, getState()); + enterRule(_localctx, 50, RULE_genericMethodDeclaration); + try { + enterOuterAlt(_localctx, 1); + { + setState(543); + genericDeclarationList(); + setState(544); + methodDeclaration(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ConstructorContext extends ParserRuleContext { + public ConstructorContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_constructor; } + + public ConstructorContext() { } + public void copyFrom(ConstructorContext ctx) { + super.copyFrom(ctx); + } + } + @SuppressWarnings("CheckReturnValue") + public static class ConstructordeclContext extends ConstructorContext { + public ConstructorDeclarationContext constructorDeclaration() { + return getRuleContext(ConstructorDeclarationContext.class,0); + } + public ConstructordeclContext(ConstructorContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterConstructordecl(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitConstructordecl(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class GenericconstructorContext extends ConstructorContext { + public GenericConstructorDeclarationContext genericConstructorDeclaration() { + return getRuleContext(GenericConstructorDeclarationContext.class,0); + } + public GenericconstructorContext(ConstructorContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterGenericconstructor(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitGenericconstructor(this); + } + } + + public final ConstructorContext constructor() throws RecognitionException { + ConstructorContext _localctx = new ConstructorContext(_ctx, getState()); + enterRule(_localctx, 52, RULE_constructor); + try { + setState(548); + _errHandler.sync(this); + switch (_input.LA(1)) { + case LT: + _localctx = new GenericconstructorContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(546); + genericConstructorDeclaration(); + } + break; + case MODULE: + case OPEN: + case REQUIRES: + case EXPORTS: + case OPENS: + case TO: + case USES: + case PROVIDES: + case WITH: + case TRANSITIVE: + case VAR: + case YIELD: + case RECORD: + case SEALED: + case PERMITS: + case IDENTIFIER: + _localctx = new ConstructordeclContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(547); + constructorDeclaration(); + } + break; + default: + throw new NoViableAltException(this); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class GenericConstructorDeclarationContext extends ParserRuleContext { + public GenericDeclarationListContext genericDeclarationList() { + return getRuleContext(GenericDeclarationListContext.class,0); + } + public ConstructorDeclarationContext constructorDeclaration() { + return getRuleContext(ConstructorDeclarationContext.class,0); + } + public GenericConstructorDeclarationContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_genericConstructorDeclaration; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterGenericConstructorDeclaration(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitGenericConstructorDeclaration(this); + } + } + + public final GenericConstructorDeclarationContext genericConstructorDeclaration() throws RecognitionException { + GenericConstructorDeclarationContext _localctx = new GenericConstructorDeclarationContext(_ctx, getState()); + enterRule(_localctx, 54, RULE_genericConstructorDeclaration); + try { + enterOuterAlt(_localctx, 1); + { + setState(550); + genericDeclarationList(); + setState(551); + constructorDeclaration(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ConstructorDeclarationContext extends ParserRuleContext { + public BlockContext constructorBody; + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public FormalParametersContext formalParameters() { + return getRuleContext(FormalParametersContext.class,0); + } + public BlockContext block() { + return getRuleContext(BlockContext.class,0); + } + public TerminalNode THROWS() { return getToken(Java17Parser.THROWS, 0); } + public ExceptionListContext exceptionList() { + return getRuleContext(ExceptionListContext.class,0); + } + public ConstructorDeclarationContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_constructorDeclaration; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterConstructorDeclaration(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitConstructorDeclaration(this); + } + } + + public final ConstructorDeclarationContext constructorDeclaration() throws RecognitionException { + ConstructorDeclarationContext _localctx = new ConstructorDeclarationContext(_ctx, getState()); + enterRule(_localctx, 56, RULE_constructorDeclaration); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(553); + identifier(); + setState(554); + formalParameters(); + setState(557); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==THROWS) { + { + setState(555); + match(THROWS); + setState(556); + exceptionList(); + } + } + + setState(559); + ((ConstructorDeclarationContext)_localctx).constructorBody = block(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class FieldDeclarationContext extends ParserRuleContext { + public VariableDeclaratorsContext variableDeclarators() { + return getRuleContext(VariableDeclaratorsContext.class,0); + } + public TerminalNode SEMI() { return getToken(Java17Parser.SEMI, 0); } + public TypeTypeContext typeType() { + return getRuleContext(TypeTypeContext.class,0); + } + public FieldDeclarationContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_fieldDeclaration; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterFieldDeclaration(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitFieldDeclaration(this); + } + } + + public final FieldDeclarationContext fieldDeclaration() throws RecognitionException { + FieldDeclarationContext _localctx = new FieldDeclarationContext(_ctx, getState()); + enterRule(_localctx, 58, RULE_fieldDeclaration); + try { + enterOuterAlt(_localctx, 1); + { + setState(562); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,48,_ctx) ) { + case 1: + { + setState(561); + typeType(); + } + break; + } + setState(564); + variableDeclarators(); + setState(565); + match(SEMI); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class InterfaceBodyDeclarationContext extends ParserRuleContext { + public InterfaceBodyDeclarationContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_interfaceBodyDeclaration; } + + public InterfaceBodyDeclarationContext() { } + public void copyFrom(InterfaceBodyDeclarationContext ctx) { + super.copyFrom(ctx); + } + } + @SuppressWarnings("CheckReturnValue") + public static class EmptyinterfaceContext extends InterfaceBodyDeclarationContext { + public TerminalNode SEMI() { return getToken(Java17Parser.SEMI, 0); } + public EmptyinterfaceContext(InterfaceBodyDeclarationContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterEmptyinterface(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitEmptyinterface(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class InterfacememberContext extends InterfaceBodyDeclarationContext { + public InterfaceMemberDeclarationContext interfaceMemberDeclaration() { + return getRuleContext(InterfaceMemberDeclarationContext.class,0); + } + public List modifier() { + return getRuleContexts(ModifierContext.class); + } + public ModifierContext modifier(int i) { + return getRuleContext(ModifierContext.class,i); + } + public InterfacememberContext(InterfaceBodyDeclarationContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterInterfacemember(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitInterfacemember(this); + } + } + + public final InterfaceBodyDeclarationContext interfaceBodyDeclaration() throws RecognitionException { + InterfaceBodyDeclarationContext _localctx = new InterfaceBodyDeclarationContext(_ctx, getState()); + enterRule(_localctx, 60, RULE_interfaceBodyDeclaration); + try { + int _alt; + setState(575); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,50,_ctx) ) { + case 1: + _localctx = new InterfacememberContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(570); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,49,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + setState(567); + modifier(); + } + } + } + setState(572); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,49,_ctx); + } + setState(573); + interfaceMemberDeclaration(); + } + break; + case 2: + _localctx = new EmptyinterfaceContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(574); + match(SEMI); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class InterfaceMemberDeclarationContext extends ParserRuleContext { + public InterfaceMemberDeclarationContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_interfaceMemberDeclaration; } + + public InterfaceMemberDeclarationContext() { } + public void copyFrom(InterfaceMemberDeclarationContext ctx) { + super.copyFrom(ctx); + } + } + @SuppressWarnings("CheckReturnValue") + public static class InterfacemethodContext extends InterfaceMemberDeclarationContext { + public InterfaceMethodDeclarationContext interfaceMethodDeclaration() { + return getRuleContext(InterfaceMethodDeclarationContext.class,0); + } + public InterfacemethodContext(InterfaceMemberDeclarationContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterInterfacemethod(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitInterfacemethod(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class SubclassorinterfaceContext extends InterfaceMemberDeclarationContext { + public ClassOrInterfaceContext classOrInterface() { + return getRuleContext(ClassOrInterfaceContext.class,0); + } + public SubclassorinterfaceContext(InterfaceMemberDeclarationContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterSubclassorinterface(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitSubclassorinterface(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class InterfaceconstContext extends InterfaceMemberDeclarationContext { + public ConstDeclarationContext constDeclaration() { + return getRuleContext(ConstDeclarationContext.class,0); + } + public InterfaceconstContext(InterfaceMemberDeclarationContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterInterfaceconst(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitInterfaceconst(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class GenericinterfacemethodContext extends InterfaceMemberDeclarationContext { + public GenericInterfaceMethodDeclarationContext genericInterfaceMethodDeclaration() { + return getRuleContext(GenericInterfaceMethodDeclarationContext.class,0); + } + public GenericinterfacemethodContext(InterfaceMemberDeclarationContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterGenericinterfacemethod(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitGenericinterfacemethod(this); + } + } + + public final InterfaceMemberDeclarationContext interfaceMemberDeclaration() throws RecognitionException { + InterfaceMemberDeclarationContext _localctx = new InterfaceMemberDeclarationContext(_ctx, getState()); + enterRule(_localctx, 62, RULE_interfaceMemberDeclaration); + try { + setState(581); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,51,_ctx) ) { + case 1: + _localctx = new InterfaceconstContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(577); + constDeclaration(); + } + break; + case 2: + _localctx = new InterfacemethodContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(578); + interfaceMethodDeclaration(); + } + break; + case 3: + _localctx = new GenericinterfacemethodContext(_localctx); + enterOuterAlt(_localctx, 3); + { + setState(579); + genericInterfaceMethodDeclaration(); + } + break; + case 4: + _localctx = new SubclassorinterfaceContext(_localctx); + enterOuterAlt(_localctx, 4); + { + setState(580); + classOrInterface(); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ConstDeclarationContext extends ParserRuleContext { + public List constantDeclarator() { + return getRuleContexts(ConstantDeclaratorContext.class); + } + public ConstantDeclaratorContext constantDeclarator(int i) { + return getRuleContext(ConstantDeclaratorContext.class,i); + } + public TerminalNode SEMI() { return getToken(Java17Parser.SEMI, 0); } + public TypeTypeContext typeType() { + return getRuleContext(TypeTypeContext.class,0); + } + public List COMMA() { return getTokens(Java17Parser.COMMA); } + public TerminalNode COMMA(int i) { + return getToken(Java17Parser.COMMA, i); + } + public ConstDeclarationContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_constDeclaration; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterConstDeclaration(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitConstDeclaration(this); + } + } + + public final ConstDeclarationContext constDeclaration() throws RecognitionException { + ConstDeclarationContext _localctx = new ConstDeclarationContext(_ctx, getState()); + enterRule(_localctx, 64, RULE_constDeclaration); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(584); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,52,_ctx) ) { + case 1: + { + setState(583); + typeType(); + } + break; + } + setState(586); + constantDeclarator(); + setState(591); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==COMMA) { + { + { + setState(587); + match(COMMA); + setState(588); + constantDeclarator(); + } + } + setState(593); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(594); + match(SEMI); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ConstantDeclaratorContext extends ParserRuleContext { + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public TerminalNode ASSIGN() { return getToken(Java17Parser.ASSIGN, 0); } + public VariableInitializerContext variableInitializer() { + return getRuleContext(VariableInitializerContext.class,0); + } + public List LBRACK() { return getTokens(Java17Parser.LBRACK); } + public TerminalNode LBRACK(int i) { + return getToken(Java17Parser.LBRACK, i); + } + public List RBRACK() { return getTokens(Java17Parser.RBRACK); } + public TerminalNode RBRACK(int i) { + return getToken(Java17Parser.RBRACK, i); + } + public ConstantDeclaratorContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_constantDeclarator; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterConstantDeclarator(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitConstantDeclarator(this); + } + } + + public final ConstantDeclaratorContext constantDeclarator() throws RecognitionException { + ConstantDeclaratorContext _localctx = new ConstantDeclaratorContext(_ctx, getState()); + enterRule(_localctx, 66, RULE_constantDeclarator); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(596); + identifier(); + setState(601); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==LBRACK) { + { + { + setState(597); + match(LBRACK); + setState(598); + match(RBRACK); + } + } + setState(603); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(604); + match(ASSIGN); + setState(605); + variableInitializer(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class InterfaceMethodDeclarationContext extends ParserRuleContext { + public InterfaceCommonBodyDeclarationContext interfaceCommonBodyDeclaration() { + return getRuleContext(InterfaceCommonBodyDeclarationContext.class,0); + } + public List interfaceMethodModifier() { + return getRuleContexts(InterfaceMethodModifierContext.class); + } + public InterfaceMethodModifierContext interfaceMethodModifier(int i) { + return getRuleContext(InterfaceMethodModifierContext.class,i); + } + public InterfaceMethodDeclarationContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_interfaceMethodDeclaration; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterInterfaceMethodDeclaration(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitInterfaceMethodDeclaration(this); + } + } + + public final InterfaceMethodDeclarationContext interfaceMethodDeclaration() throws RecognitionException { + InterfaceMethodDeclarationContext _localctx = new InterfaceMethodDeclarationContext(_ctx, getState()); + enterRule(_localctx, 68, RULE_interfaceMethodDeclaration); + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(610); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,55,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + setState(607); + interfaceMethodModifier(); + } + } + } + setState(612); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,55,_ctx); + } + setState(613); + interfaceCommonBodyDeclaration(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class InterfaceMethodModifierContext extends ParserRuleContext { + public AnnotationContext annotation() { + return getRuleContext(AnnotationContext.class,0); + } + public TerminalNode PUBLIC() { return getToken(Java17Parser.PUBLIC, 0); } + public TerminalNode ABSTRACT() { return getToken(Java17Parser.ABSTRACT, 0); } + public TerminalNode DEFAULT() { return getToken(Java17Parser.DEFAULT, 0); } + public TerminalNode STATIC() { return getToken(Java17Parser.STATIC, 0); } + public TerminalNode STRICTFP() { return getToken(Java17Parser.STRICTFP, 0); } + public InterfaceMethodModifierContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_interfaceMethodModifier; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterInterfaceMethodModifier(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitInterfaceMethodModifier(this); + } + } + + public final InterfaceMethodModifierContext interfaceMethodModifier() throws RecognitionException { + InterfaceMethodModifierContext _localctx = new InterfaceMethodModifierContext(_ctx, getState()); + enterRule(_localctx, 70, RULE_interfaceMethodModifier); + try { + setState(621); + _errHandler.sync(this); + switch (_input.LA(1)) { + case MODULE: + case OPEN: + case REQUIRES: + case EXPORTS: + case OPENS: + case TO: + case USES: + case PROVIDES: + case WITH: + case TRANSITIVE: + case VAR: + case YIELD: + case RECORD: + case SEALED: + case PERMITS: + case AT: + case IDENTIFIER: + enterOuterAlt(_localctx, 1); + { + setState(615); + annotation(); + } + break; + case PUBLIC: + enterOuterAlt(_localctx, 2); + { + setState(616); + match(PUBLIC); + } + break; + case ABSTRACT: + enterOuterAlt(_localctx, 3); + { + setState(617); + match(ABSTRACT); + } + break; + case DEFAULT: + enterOuterAlt(_localctx, 4); + { + setState(618); + match(DEFAULT); + } + break; + case STATIC: + enterOuterAlt(_localctx, 5); + { + setState(619); + match(STATIC); + } + break; + case STRICTFP: + enterOuterAlt(_localctx, 6); + { + setState(620); + match(STRICTFP); + } + break; + default: + throw new NoViableAltException(this); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class GenericInterfaceMethodDeclarationContext extends ParserRuleContext { + public GenericDeclarationListContext genericDeclarationList() { + return getRuleContext(GenericDeclarationListContext.class,0); + } + public InterfaceCommonBodyDeclarationContext interfaceCommonBodyDeclaration() { + return getRuleContext(InterfaceCommonBodyDeclarationContext.class,0); + } + public List interfaceMethodModifier() { + return getRuleContexts(InterfaceMethodModifierContext.class); + } + public InterfaceMethodModifierContext interfaceMethodModifier(int i) { + return getRuleContext(InterfaceMethodModifierContext.class,i); + } + public GenericInterfaceMethodDeclarationContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_genericInterfaceMethodDeclaration; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterGenericInterfaceMethodDeclaration(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitGenericInterfaceMethodDeclaration(this); + } + } + + public final GenericInterfaceMethodDeclarationContext genericInterfaceMethodDeclaration() throws RecognitionException { + GenericInterfaceMethodDeclarationContext _localctx = new GenericInterfaceMethodDeclarationContext(_ctx, getState()); + enterRule(_localctx, 72, RULE_genericInterfaceMethodDeclaration); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(626); + _errHandler.sync(this); + _la = _input.LA(1); + while ((((_la - 1)) & ~0x3f) == 0 && ((1L << (_la - 1)) & -1125470410110975L) != 0 || (((_la - 65)) & ~0x3f) == 0 && ((1L << (_la - 65)) & -8935141660703064063L) != 0) { + { + { + setState(623); + interfaceMethodModifier(); + } + } + setState(628); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(629); + genericDeclarationList(); + setState(630); + interfaceCommonBodyDeclaration(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class InterfaceCommonBodyDeclarationContext extends ParserRuleContext { + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public FormalParametersContext formalParameters() { + return getRuleContext(FormalParametersContext.class,0); + } + public MethodBodyContext methodBody() { + return getRuleContext(MethodBodyContext.class,0); + } + public List annotation() { + return getRuleContexts(AnnotationContext.class); + } + public AnnotationContext annotation(int i) { + return getRuleContext(AnnotationContext.class,i); + } + public RefTypeContext refType() { + return getRuleContext(RefTypeContext.class,0); + } + public List LBRACK() { return getTokens(Java17Parser.LBRACK); } + public TerminalNode LBRACK(int i) { + return getToken(Java17Parser.LBRACK, i); + } + public List RBRACK() { return getTokens(Java17Parser.RBRACK); } + public TerminalNode RBRACK(int i) { + return getToken(Java17Parser.RBRACK, i); + } + public TerminalNode THROWS() { return getToken(Java17Parser.THROWS, 0); } + public ExceptionListContext exceptionList() { + return getRuleContext(ExceptionListContext.class,0); + } + public InterfaceCommonBodyDeclarationContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_interfaceCommonBodyDeclaration; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterInterfaceCommonBodyDeclaration(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitInterfaceCommonBodyDeclaration(this); + } + } + + public final InterfaceCommonBodyDeclarationContext interfaceCommonBodyDeclaration() throws RecognitionException { + InterfaceCommonBodyDeclarationContext _localctx = new InterfaceCommonBodyDeclarationContext(_ctx, getState()); + enterRule(_localctx, 74, RULE_interfaceCommonBodyDeclaration); + int _la; + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(635); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,58,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + setState(632); + annotation(); + } + } + } + setState(637); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,58,_ctx); + } + setState(639); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,59,_ctx) ) { + case 1: + { + setState(638); + refType(); + } + break; + } + setState(641); + identifier(); + setState(642); + formalParameters(); + setState(647); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==LBRACK) { + { + { + setState(643); + match(LBRACK); + setState(644); + match(RBRACK); + } + } + setState(649); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(652); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==THROWS) { + { + setState(650); + match(THROWS); + setState(651); + exceptionList(); + } + } + + setState(654); + methodBody(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class VariableDeclaratorsContext extends ParserRuleContext { + public List variableDeclarator() { + return getRuleContexts(VariableDeclaratorContext.class); + } + public VariableDeclaratorContext variableDeclarator(int i) { + return getRuleContext(VariableDeclaratorContext.class,i); + } + public List COMMA() { return getTokens(Java17Parser.COMMA); } + public TerminalNode COMMA(int i) { + return getToken(Java17Parser.COMMA, i); + } + public VariableDeclaratorsContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_variableDeclarators; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterVariableDeclarators(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitVariableDeclarators(this); + } + } + + public final VariableDeclaratorsContext variableDeclarators() throws RecognitionException { + VariableDeclaratorsContext _localctx = new VariableDeclaratorsContext(_ctx, getState()); + enterRule(_localctx, 76, RULE_variableDeclarators); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(656); + variableDeclarator(); + setState(661); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==COMMA) { + { + { + setState(657); + match(COMMA); + setState(658); + variableDeclarator(); + } + } + setState(663); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class VariableDeclaratorContext extends ParserRuleContext { + public VariableDeclaratorIdContext variableDeclaratorId() { + return getRuleContext(VariableDeclaratorIdContext.class,0); + } + public TerminalNode ASSIGN() { return getToken(Java17Parser.ASSIGN, 0); } + public VariableInitializerContext variableInitializer() { + return getRuleContext(VariableInitializerContext.class,0); + } + public VariableDeclaratorContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_variableDeclarator; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterVariableDeclarator(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitVariableDeclarator(this); + } + } + + public final VariableDeclaratorContext variableDeclarator() throws RecognitionException { + VariableDeclaratorContext _localctx = new VariableDeclaratorContext(_ctx, getState()); + enterRule(_localctx, 78, RULE_variableDeclarator); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(664); + variableDeclaratorId(); + setState(667); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==ASSIGN) { + { + setState(665); + match(ASSIGN); + setState(666); + variableInitializer(); + } + } + + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class VariableDeclaratorIdContext extends ParserRuleContext { + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public List LBRACK() { return getTokens(Java17Parser.LBRACK); } + public TerminalNode LBRACK(int i) { + return getToken(Java17Parser.LBRACK, i); + } + public List RBRACK() { return getTokens(Java17Parser.RBRACK); } + public TerminalNode RBRACK(int i) { + return getToken(Java17Parser.RBRACK, i); + } + public VariableDeclaratorIdContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_variableDeclaratorId; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterVariableDeclaratorId(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitVariableDeclaratorId(this); + } + } + + public final VariableDeclaratorIdContext variableDeclaratorId() throws RecognitionException { + VariableDeclaratorIdContext _localctx = new VariableDeclaratorIdContext(_ctx, getState()); + enterRule(_localctx, 80, RULE_variableDeclaratorId); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(669); + identifier(); + setState(674); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==LBRACK) { + { + { + setState(670); + match(LBRACK); + setState(671); + match(RBRACK); + } + } + setState(676); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class VariableInitializerContext extends ParserRuleContext { + public ArrayInitializerContext arrayInitializer() { + return getRuleContext(ArrayInitializerContext.class,0); + } + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class,0); + } + public VariableInitializerContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_variableInitializer; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterVariableInitializer(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitVariableInitializer(this); + } + } + + public final VariableInitializerContext variableInitializer() throws RecognitionException { + VariableInitializerContext _localctx = new VariableInitializerContext(_ctx, getState()); + enterRule(_localctx, 82, RULE_variableInitializer); + try { + setState(679); + _errHandler.sync(this); + switch (_input.LA(1)) { + case LBRACE: + enterOuterAlt(_localctx, 1); + { + setState(677); + arrayInitializer(); + } + break; + case BOOLEAN: + case BYTE: + case CHAR: + case DOUBLE: + case FLOAT: + case INT: + case LONG: + case NEW: + case SHORT: + case SUPER: + case SWITCH: + case THIS: + case VOID: + case MODULE: + case OPEN: + case REQUIRES: + case EXPORTS: + case OPENS: + case TO: + case USES: + case PROVIDES: + case WITH: + case TRANSITIVE: + case VAR: + case YIELD: + case RECORD: + case SEALED: + case PERMITS: + case DECIMAL_LITERAL: + case HEX_LITERAL: + case OCT_LITERAL: + case BINARY_LITERAL: + case FLOAT_LITERAL: + case HEX_FLOAT_LITERAL: + case BOOL_LITERAL: + case CHAR_LITERAL: + case STRING_LITERAL: + case TEXT_BLOCK: + case NULL_LITERAL: + case LPAREN: + case LT: + case BANG: + case TILDE: + case INC: + case DEC: + case ADD: + case SUB: + case AT: + case IDENTIFIER: + enterOuterAlt(_localctx, 2); + { + setState(678); + expression(0); + } + break; + default: + throw new NoViableAltException(this); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ArrayInitializerContext extends ParserRuleContext { + public TerminalNode LBRACE() { return getToken(Java17Parser.LBRACE, 0); } + public TerminalNode RBRACE() { return getToken(Java17Parser.RBRACE, 0); } + public List variableInitializer() { + return getRuleContexts(VariableInitializerContext.class); + } + public VariableInitializerContext variableInitializer(int i) { + return getRuleContext(VariableInitializerContext.class,i); + } + public List COMMA() { return getTokens(Java17Parser.COMMA); } + public TerminalNode COMMA(int i) { + return getToken(Java17Parser.COMMA, i); + } + public ArrayInitializerContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_arrayInitializer; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterArrayInitializer(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitArrayInitializer(this); + } + } + + public final ArrayInitializerContext arrayInitializer() throws RecognitionException { + ArrayInitializerContext _localctx = new ArrayInitializerContext(_ctx, getState()); + enterRule(_localctx, 84, RULE_arrayInitializer); + int _la; + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(681); + match(LBRACE); + setState(693); + _errHandler.sync(this); + _la = _input.LA(1); + if ((((_la - 3)) & ~0x3f) == 0 && ((1L << (_la - 3)) & 9223127275610966053L) != 0 || (((_la - 67)) & ~0x3f) == 0 && ((1L << (_la - 67)) & 2377900732130013183L) != 0) { + { + setState(682); + variableInitializer(); + setState(687); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,66,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + setState(683); + match(COMMA); + setState(684); + variableInitializer(); + } + } + } + setState(689); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,66,_ctx); + } + setState(691); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==COMMA) { + { + setState(690); + match(COMMA); + } + } + + } + } + + setState(695); + match(RBRACE); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ClassOrInterfaceTypeContext extends ParserRuleContext { + public TypeIdentifierContext typeIdentifier() { + return getRuleContext(TypeIdentifierContext.class,0); + } + public List identifier() { + return getRuleContexts(IdentifierContext.class); + } + public IdentifierContext identifier(int i) { + return getRuleContext(IdentifierContext.class,i); + } + public List DOT() { return getTokens(Java17Parser.DOT); } + public TerminalNode DOT(int i) { + return getToken(Java17Parser.DOT, i); + } + public List typeArguments() { + return getRuleContexts(TypeArgumentsContext.class); + } + public TypeArgumentsContext typeArguments(int i) { + return getRuleContext(TypeArgumentsContext.class,i); + } + public ClassOrInterfaceTypeContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_classOrInterfaceType; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterClassOrInterfaceType(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitClassOrInterfaceType(this); + } + } + + public final ClassOrInterfaceTypeContext classOrInterfaceType() throws RecognitionException { + ClassOrInterfaceTypeContext _localctx = new ClassOrInterfaceTypeContext(_ctx, getState()); + enterRule(_localctx, 86, RULE_classOrInterfaceType); + int _la; + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(705); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,70,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + setState(697); + identifier(); + setState(699); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==LT) { + { + setState(698); + typeArguments(); + } + } + + setState(701); + match(DOT); + } + } + } + setState(707); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,70,_ctx); + } + setState(708); + typeIdentifier(); + setState(710); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,71,_ctx) ) { + case 1: + { + setState(709); + typeArguments(); + } + break; + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class TypeArgumentContext extends ParserRuleContext { + public TypeTypeContext typeType() { + return getRuleContext(TypeTypeContext.class,0); + } + public WildcardTypeContext wildcardType() { + return getRuleContext(WildcardTypeContext.class,0); + } + public TypeArgumentContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_typeArgument; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterTypeArgument(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitTypeArgument(this); + } + } + + public final TypeArgumentContext typeArgument() throws RecognitionException { + TypeArgumentContext _localctx = new TypeArgumentContext(_ctx, getState()); + enterRule(_localctx, 88, RULE_typeArgument); + try { + setState(714); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,72,_ctx) ) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(712); + typeType(); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(713); + wildcardType(); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class WildcardTypeContext extends ParserRuleContext { + public TerminalNode QUESTION() { return getToken(Java17Parser.QUESTION, 0); } + public List annotation() { + return getRuleContexts(AnnotationContext.class); + } + public AnnotationContext annotation(int i) { + return getRuleContext(AnnotationContext.class,i); + } + public ExtendsWildcardTypeContext extendsWildcardType() { + return getRuleContext(ExtendsWildcardTypeContext.class,0); + } + public SuperWildcardTypeContext superWildcardType() { + return getRuleContext(SuperWildcardTypeContext.class,0); + } + public WildcardTypeContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_wildcardType; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterWildcardType(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitWildcardType(this); + } + } + + public final WildcardTypeContext wildcardType() throws RecognitionException { + WildcardTypeContext _localctx = new WildcardTypeContext(_ctx, getState()); + enterRule(_localctx, 90, RULE_wildcardType); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(719); + _errHandler.sync(this); + _la = _input.LA(1); + while ((((_la - 51)) & ~0x3f) == 0 && ((1L << (_la - 51)) & 32767L) != 0 || _la==AT || _la==IDENTIFIER) { + { + { + setState(716); + annotation(); + } + } + setState(721); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(722); + match(QUESTION); + setState(725); + _errHandler.sync(this); + switch (_input.LA(1)) { + case EXTENDS: + { + setState(723); + extendsWildcardType(); + } + break; + case SUPER: + { + setState(724); + superWildcardType(); + } + break; + case COMMA: + case GT: + break; + default: + break; + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ExtendsWildcardTypeContext extends ParserRuleContext { + public TerminalNode EXTENDS() { return getToken(Java17Parser.EXTENDS, 0); } + public TypeTypeContext typeType() { + return getRuleContext(TypeTypeContext.class,0); + } + public ExtendsWildcardTypeContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_extendsWildcardType; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterExtendsWildcardType(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitExtendsWildcardType(this); + } + } + + public final ExtendsWildcardTypeContext extendsWildcardType() throws RecognitionException { + ExtendsWildcardTypeContext _localctx = new ExtendsWildcardTypeContext(_ctx, getState()); + enterRule(_localctx, 92, RULE_extendsWildcardType); + try { + enterOuterAlt(_localctx, 1); + { + setState(727); + match(EXTENDS); + setState(728); + typeType(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class SuperWildcardTypeContext extends ParserRuleContext { + public TerminalNode SUPER() { return getToken(Java17Parser.SUPER, 0); } + public TypeTypeContext typeType() { + return getRuleContext(TypeTypeContext.class,0); + } + public SuperWildcardTypeContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_superWildcardType; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterSuperWildcardType(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitSuperWildcardType(this); + } + } + + public final SuperWildcardTypeContext superWildcardType() throws RecognitionException { + SuperWildcardTypeContext _localctx = new SuperWildcardTypeContext(_ctx, getState()); + enterRule(_localctx, 94, RULE_superWildcardType); + try { + enterOuterAlt(_localctx, 1); + { + setState(730); + match(SUPER); + setState(731); + typeType(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class QualifiedNameListContext extends ParserRuleContext { + public List qualifiedName() { + return getRuleContexts(QualifiedNameContext.class); + } + public QualifiedNameContext qualifiedName(int i) { + return getRuleContext(QualifiedNameContext.class,i); + } + public List COMMA() { return getTokens(Java17Parser.COMMA); } + public TerminalNode COMMA(int i) { + return getToken(Java17Parser.COMMA, i); + } + public QualifiedNameListContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_qualifiedNameList; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterQualifiedNameList(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitQualifiedNameList(this); + } + } + + public final QualifiedNameListContext qualifiedNameList() throws RecognitionException { + QualifiedNameListContext _localctx = new QualifiedNameListContext(_ctx, getState()); + enterRule(_localctx, 96, RULE_qualifiedNameList); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(733); + qualifiedName(); + setState(738); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==COMMA) { + { + { + setState(734); + match(COMMA); + setState(735); + qualifiedName(); + } + } + setState(740); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ExceptionListContext extends ParserRuleContext { + public QualifiedNameListContext qualifiedNameList() { + return getRuleContext(QualifiedNameListContext.class,0); + } + public ExceptionListContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_exceptionList; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterExceptionList(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitExceptionList(this); + } + } + + public final ExceptionListContext exceptionList() throws RecognitionException { + ExceptionListContext _localctx = new ExceptionListContext(_ctx, getState()); + enterRule(_localctx, 98, RULE_exceptionList); + try { + enterOuterAlt(_localctx, 1); + { + setState(741); + qualifiedNameList(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class FormalParametersContext extends ParserRuleContext { + public TerminalNode LPAREN() { return getToken(Java17Parser.LPAREN, 0); } + public TerminalNode RPAREN() { return getToken(Java17Parser.RPAREN, 0); } + public ReceiverParameterContext receiverParameter() { + return getRuleContext(ReceiverParameterContext.class,0); + } + public TerminalNode COMMA() { return getToken(Java17Parser.COMMA, 0); } + public FormalParameterListContext formalParameterList() { + return getRuleContext(FormalParameterListContext.class,0); + } + public FormalParametersContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_formalParameters; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterFormalParameters(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitFormalParameters(this); + } + } + + public final FormalParametersContext formalParameters() throws RecognitionException { + FormalParametersContext _localctx = new FormalParametersContext(_ctx, getState()); + enterRule(_localctx, 100, RULE_formalParameters); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(743); + match(LPAREN); + setState(755); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,79,_ctx) ) { + case 1: + { + setState(745); + _errHandler.sync(this); + _la = _input.LA(1); + if ((((_la - 3)) & ~0x3f) == 0 && ((1L << (_la - 3)) & 9223091678653581349L) != 0 || _la==AT || _la==IDENTIFIER) { + { + setState(744); + receiverParameter(); + } + } + + } + break; + case 2: + { + setState(747); + receiverParameter(); + setState(750); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==COMMA) { + { + setState(748); + match(COMMA); + setState(749); + formalParameterList(); + } + } + + } + break; + case 3: + { + setState(753); + _errHandler.sync(this); + _la = _input.LA(1); + if ((((_la - 3)) & ~0x3f) == 0 && ((1L << (_la - 3)) & 9223090579141986341L) != 0 || (((_la - 78)) & ~0x3f) == 0 && ((1L << (_la - 78)) & 1231453023109121L) != 0) { + { + setState(752); + formalParameterList(); + } + } + + } + break; + } + setState(757); + match(RPAREN); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ReceiverParameterContext extends ParserRuleContext { + public TerminalNode THIS() { return getToken(Java17Parser.THIS, 0); } + public TypeTypeContext typeType() { + return getRuleContext(TypeTypeContext.class,0); + } + public List identifier() { + return getRuleContexts(IdentifierContext.class); + } + public IdentifierContext identifier(int i) { + return getRuleContext(IdentifierContext.class,i); + } + public List DOT() { return getTokens(Java17Parser.DOT); } + public TerminalNode DOT(int i) { + return getToken(Java17Parser.DOT, i); + } + public ReceiverParameterContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_receiverParameter; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterReceiverParameter(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitReceiverParameter(this); + } + } + + public final ReceiverParameterContext receiverParameter() throws RecognitionException { + ReceiverParameterContext _localctx = new ReceiverParameterContext(_ctx, getState()); + enterRule(_localctx, 102, RULE_receiverParameter); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(760); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,80,_ctx) ) { + case 1: + { + setState(759); + typeType(); + } + break; + } + setState(767); + _errHandler.sync(this); + _la = _input.LA(1); + while ((((_la - 51)) & ~0x3f) == 0 && ((1L << (_la - 51)) & 32767L) != 0 || _la==IDENTIFIER) { + { + { + setState(762); + identifier(); + setState(763); + match(DOT); + } + } + setState(769); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(770); + match(THIS); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class FormalParameterListContext extends ParserRuleContext { + public List formalParameter() { + return getRuleContexts(FormalParameterContext.class); + } + public FormalParameterContext formalParameter(int i) { + return getRuleContext(FormalParameterContext.class,i); + } + public List COMMA() { return getTokens(Java17Parser.COMMA); } + public TerminalNode COMMA(int i) { + return getToken(Java17Parser.COMMA, i); + } + public LastFormalParameterContext lastFormalParameter() { + return getRuleContext(LastFormalParameterContext.class,0); + } + public FormalParameterListContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_formalParameterList; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterFormalParameterList(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitFormalParameterList(this); + } + } + + public final FormalParameterListContext formalParameterList() throws RecognitionException { + FormalParameterListContext _localctx = new FormalParameterListContext(_ctx, getState()); + enterRule(_localctx, 104, RULE_formalParameterList); + int _la; + try { + int _alt; + setState(785); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,84,_ctx) ) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(772); + formalParameter(); + setState(777); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,82,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + setState(773); + match(COMMA); + setState(774); + formalParameter(); + } + } + } + setState(779); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,82,_ctx); + } + setState(782); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==COMMA) { + { + setState(780); + match(COMMA); + setState(781); + lastFormalParameter(); + } + } + + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(784); + lastFormalParameter(); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class FormalParameterContext extends ParserRuleContext { + public VariableDeclaratorIdContext variableDeclaratorId() { + return getRuleContext(VariableDeclaratorIdContext.class,0); + } + public List variableModifier() { + return getRuleContexts(VariableModifierContext.class); + } + public VariableModifierContext variableModifier(int i) { + return getRuleContext(VariableModifierContext.class,i); + } + public TypeTypeContext typeType() { + return getRuleContext(TypeTypeContext.class,0); + } + public PatternContext pattern() { + return getRuleContext(PatternContext.class,0); + } + public FormalParameterContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_formalParameter; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterFormalParameter(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitFormalParameter(this); + } + } + + public final FormalParameterContext formalParameter() throws RecognitionException { + FormalParameterContext _localctx = new FormalParameterContext(_ctx, getState()); + enterRule(_localctx, 106, RULE_formalParameter); + try { + int _alt; + setState(798); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,87,_ctx) ) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(790); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,85,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + setState(787); + variableModifier(); + } + } + } + setState(792); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,85,_ctx); + } + setState(794); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,86,_ctx) ) { + case 1: + { + setState(793); + typeType(); + } + break; + } + setState(796); + variableDeclaratorId(); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(797); + pattern(); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class LastFormalParameterContext extends ParserRuleContext { + public TerminalNode ELLIPSIS() { return getToken(Java17Parser.ELLIPSIS, 0); } + public VariableDeclaratorIdContext variableDeclaratorId() { + return getRuleContext(VariableDeclaratorIdContext.class,0); + } + public List variableModifier() { + return getRuleContexts(VariableModifierContext.class); + } + public VariableModifierContext variableModifier(int i) { + return getRuleContext(VariableModifierContext.class,i); + } + public TypeTypeContext typeType() { + return getRuleContext(TypeTypeContext.class,0); + } + public List annotation() { + return getRuleContexts(AnnotationContext.class); + } + public AnnotationContext annotation(int i) { + return getRuleContext(AnnotationContext.class,i); + } + public LastFormalParameterContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_lastFormalParameter; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterLastFormalParameter(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitLastFormalParameter(this); + } + } + + public final LastFormalParameterContext lastFormalParameter() throws RecognitionException { + LastFormalParameterContext _localctx = new LastFormalParameterContext(_ctx, getState()); + enterRule(_localctx, 108, RULE_lastFormalParameter); + int _la; + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(803); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,88,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + setState(800); + variableModifier(); + } + } + } + setState(805); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,88,_ctx); + } + setState(807); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,89,_ctx) ) { + case 1: + { + setState(806); + typeType(); + } + break; + } + setState(812); + _errHandler.sync(this); + _la = _input.LA(1); + while ((((_la - 51)) & ~0x3f) == 0 && ((1L << (_la - 51)) & 32767L) != 0 || _la==AT || _la==IDENTIFIER) { + { + { + setState(809); + annotation(); + } + } + setState(814); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(815); + match(ELLIPSIS); + setState(816); + variableDeclaratorId(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class LambdaLVTIListContext extends ParserRuleContext { + public List lambdaLVTIParameter() { + return getRuleContexts(LambdaLVTIParameterContext.class); + } + public LambdaLVTIParameterContext lambdaLVTIParameter(int i) { + return getRuleContext(LambdaLVTIParameterContext.class,i); + } + public List COMMA() { return getTokens(Java17Parser.COMMA); } + public TerminalNode COMMA(int i) { + return getToken(Java17Parser.COMMA, i); + } + public LambdaLVTIListContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_lambdaLVTIList; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterLambdaLVTIList(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitLambdaLVTIList(this); + } + } + + public final LambdaLVTIListContext lambdaLVTIList() throws RecognitionException { + LambdaLVTIListContext _localctx = new LambdaLVTIListContext(_ctx, getState()); + enterRule(_localctx, 110, RULE_lambdaLVTIList); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(818); + lambdaLVTIParameter(); + setState(823); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==COMMA) { + { + { + setState(819); + match(COMMA); + setState(820); + lambdaLVTIParameter(); + } + } + setState(825); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class LambdaLVTIParameterContext extends ParserRuleContext { + public TerminalNode VAR() { return getToken(Java17Parser.VAR, 0); } + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public List variableModifier() { + return getRuleContexts(VariableModifierContext.class); + } + public VariableModifierContext variableModifier(int i) { + return getRuleContext(VariableModifierContext.class,i); + } + public LambdaLVTIParameterContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_lambdaLVTIParameter; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterLambdaLVTIParameter(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitLambdaLVTIParameter(this); + } + } + + public final LambdaLVTIParameterContext lambdaLVTIParameter() throws RecognitionException { + LambdaLVTIParameterContext _localctx = new LambdaLVTIParameterContext(_ctx, getState()); + enterRule(_localctx, 112, RULE_lambdaLVTIParameter); + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(829); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,92,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + setState(826); + variableModifier(); + } + } + } + setState(831); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,92,_ctx); + } + setState(832); + match(VAR); + setState(833); + identifier(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class QualifiedNameContext extends ParserRuleContext { + public List identifier() { + return getRuleContexts(IdentifierContext.class); + } + public IdentifierContext identifier(int i) { + return getRuleContext(IdentifierContext.class,i); + } + public List DOT() { return getTokens(Java17Parser.DOT); } + public TerminalNode DOT(int i) { + return getToken(Java17Parser.DOT, i); + } + public QualifiedNameContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_qualifiedName; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterQualifiedName(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitQualifiedName(this); + } + } + + public final QualifiedNameContext qualifiedName() throws RecognitionException { + QualifiedNameContext _localctx = new QualifiedNameContext(_ctx, getState()); + enterRule(_localctx, 114, RULE_qualifiedName); + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(835); + identifier(); + setState(840); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,93,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + setState(836); + match(DOT); + setState(837); + identifier(); + } + } + } + setState(842); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,93,_ctx); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class LiteralContext extends ParserRuleContext { + public LiteralContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_literal; } + + public LiteralContext() { } + public void copyFrom(LiteralContext ctx) { + super.copyFrom(ctx); + } + } + @SuppressWarnings("CheckReturnValue") + public static class FltLiteralContext extends LiteralContext { + public FloatLiteralContext floatLiteral() { + return getRuleContext(FloatLiteralContext.class,0); + } + public FltLiteralContext(LiteralContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterFltLiteral(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitFltLiteral(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class NullLiteralContext extends LiteralContext { + public TerminalNode NULL_LITERAL() { return getToken(Java17Parser.NULL_LITERAL, 0); } + public NullLiteralContext(LiteralContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterNullLiteral(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitNullLiteral(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class StringLiteralContext extends LiteralContext { + public TerminalNode STRING_LITERAL() { return getToken(Java17Parser.STRING_LITERAL, 0); } + public StringLiteralContext(LiteralContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterStringLiteral(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitStringLiteral(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class IntLiteralContext extends LiteralContext { + public IntegerLiteralContext integerLiteral() { + return getRuleContext(IntegerLiteralContext.class,0); + } + public IntLiteralContext(LiteralContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterIntLiteral(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitIntLiteral(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class CharLiteralContext extends LiteralContext { + public TerminalNode CHAR_LITERAL() { return getToken(Java17Parser.CHAR_LITERAL, 0); } + public CharLiteralContext(LiteralContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterCharLiteral(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitCharLiteral(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class TextBlockContext extends LiteralContext { + public TerminalNode TEXT_BLOCK() { return getToken(Java17Parser.TEXT_BLOCK, 0); } + public TextBlockContext(LiteralContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterTextBlock(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitTextBlock(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class BoolLiteralContext extends LiteralContext { + public TerminalNode BOOL_LITERAL() { return getToken(Java17Parser.BOOL_LITERAL, 0); } + public BoolLiteralContext(LiteralContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterBoolLiteral(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitBoolLiteral(this); + } + } + + public final LiteralContext literal() throws RecognitionException { + LiteralContext _localctx = new LiteralContext(_ctx, getState()); + enterRule(_localctx, 116, RULE_literal); + try { + setState(850); + _errHandler.sync(this); + switch (_input.LA(1)) { + case DECIMAL_LITERAL: + case HEX_LITERAL: + case OCT_LITERAL: + case BINARY_LITERAL: + _localctx = new IntLiteralContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(843); + integerLiteral(); + } + break; + case FLOAT_LITERAL: + case HEX_FLOAT_LITERAL: + _localctx = new FltLiteralContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(844); + floatLiteral(); + } + break; + case CHAR_LITERAL: + _localctx = new CharLiteralContext(_localctx); + enterOuterAlt(_localctx, 3); + { + setState(845); + match(CHAR_LITERAL); + } + break; + case STRING_LITERAL: + _localctx = new StringLiteralContext(_localctx); + enterOuterAlt(_localctx, 4); + { + setState(846); + match(STRING_LITERAL); + } + break; + case BOOL_LITERAL: + _localctx = new BoolLiteralContext(_localctx); + enterOuterAlt(_localctx, 5); + { + setState(847); + match(BOOL_LITERAL); + } + break; + case NULL_LITERAL: + _localctx = new NullLiteralContext(_localctx); + enterOuterAlt(_localctx, 6); + { + setState(848); + match(NULL_LITERAL); + } + break; + case TEXT_BLOCK: + _localctx = new TextBlockContext(_localctx); + enterOuterAlt(_localctx, 7); + { + setState(849); + match(TEXT_BLOCK); + } + break; + default: + throw new NoViableAltException(this); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class IntegerLiteralContext extends ParserRuleContext { + public TerminalNode DECIMAL_LITERAL() { return getToken(Java17Parser.DECIMAL_LITERAL, 0); } + public TerminalNode HEX_LITERAL() { return getToken(Java17Parser.HEX_LITERAL, 0); } + public TerminalNode OCT_LITERAL() { return getToken(Java17Parser.OCT_LITERAL, 0); } + public TerminalNode BINARY_LITERAL() { return getToken(Java17Parser.BINARY_LITERAL, 0); } + public IntegerLiteralContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_integerLiteral; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterIntegerLiteral(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitIntegerLiteral(this); + } + } + + public final IntegerLiteralContext integerLiteral() throws RecognitionException { + IntegerLiteralContext _localctx = new IntegerLiteralContext(_ctx, getState()); + enterRule(_localctx, 118, RULE_integerLiteral); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(852); + _la = _input.LA(1); + if ( !((((_la - 67)) & ~0x3f) == 0 && ((1L << (_la - 67)) & 15L) != 0) ) { + _errHandler.recoverInline(this); + } + else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class FloatLiteralContext extends ParserRuleContext { + public TerminalNode FLOAT_LITERAL() { return getToken(Java17Parser.FLOAT_LITERAL, 0); } + public TerminalNode HEX_FLOAT_LITERAL() { return getToken(Java17Parser.HEX_FLOAT_LITERAL, 0); } + public FloatLiteralContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_floatLiteral; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterFloatLiteral(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitFloatLiteral(this); + } + } + + public final FloatLiteralContext floatLiteral() throws RecognitionException { + FloatLiteralContext _localctx = new FloatLiteralContext(_ctx, getState()); + enterRule(_localctx, 120, RULE_floatLiteral); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(854); + _la = _input.LA(1); + if ( !(_la==FLOAT_LITERAL || _la==HEX_FLOAT_LITERAL) ) { + _errHandler.recoverInline(this); + } + else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class AltAnnotationQualifiedNameContext extends ParserRuleContext { + public TerminalNode AT() { return getToken(Java17Parser.AT, 0); } + public List identifier() { + return getRuleContexts(IdentifierContext.class); + } + public IdentifierContext identifier(int i) { + return getRuleContext(IdentifierContext.class,i); + } + public List DOT() { return getTokens(Java17Parser.DOT); } + public TerminalNode DOT(int i) { + return getToken(Java17Parser.DOT, i); + } + public AltAnnotationQualifiedNameContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_altAnnotationQualifiedName; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterAltAnnotationQualifiedName(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitAltAnnotationQualifiedName(this); + } + } + + public final AltAnnotationQualifiedNameContext altAnnotationQualifiedName() throws RecognitionException { + AltAnnotationQualifiedNameContext _localctx = new AltAnnotationQualifiedNameContext(_ctx, getState()); + enterRule(_localctx, 122, RULE_altAnnotationQualifiedName); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(861); + _errHandler.sync(this); + _la = _input.LA(1); + while ((((_la - 51)) & ~0x3f) == 0 && ((1L << (_la - 51)) & 32767L) != 0 || _la==IDENTIFIER) { + { + { + setState(856); + identifier(); + setState(857); + match(DOT); + } + } + setState(863); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(864); + match(AT); + setState(865); + identifier(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class AnnotationContext extends ParserRuleContext { + public TerminalNode AT() { return getToken(Java17Parser.AT, 0); } + public QualifiedNameContext qualifiedName() { + return getRuleContext(QualifiedNameContext.class,0); + } + public AltAnnotationQualifiedNameContext altAnnotationQualifiedName() { + return getRuleContext(AltAnnotationQualifiedNameContext.class,0); + } + public TerminalNode LPAREN() { return getToken(Java17Parser.LPAREN, 0); } + public TerminalNode RPAREN() { return getToken(Java17Parser.RPAREN, 0); } + public ElementValuePairsContext elementValuePairs() { + return getRuleContext(ElementValuePairsContext.class,0); + } + public ElementValueContext elementValue() { + return getRuleContext(ElementValueContext.class,0); + } + public AnnotationContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_annotation; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterAnnotation(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitAnnotation(this); + } + } + + public final AnnotationContext annotation() throws RecognitionException { + AnnotationContext _localctx = new AnnotationContext(_ctx, getState()); + enterRule(_localctx, 124, RULE_annotation); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(870); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,96,_ctx) ) { + case 1: + { + setState(867); + match(AT); + setState(868); + qualifiedName(); + } + break; + case 2: + { + setState(869); + altAnnotationQualifiedName(); + } + break; + } + setState(878); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==LPAREN) { + { + setState(872); + match(LPAREN); + setState(875); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,97,_ctx) ) { + case 1: + { + setState(873); + elementValuePairs(); + } + break; + case 2: + { + setState(874); + elementValue(); + } + break; + } + setState(877); + match(RPAREN); + } + } + + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ElementValuePairsContext extends ParserRuleContext { + public List elementValuePair() { + return getRuleContexts(ElementValuePairContext.class); + } + public ElementValuePairContext elementValuePair(int i) { + return getRuleContext(ElementValuePairContext.class,i); + } + public List COMMA() { return getTokens(Java17Parser.COMMA); } + public TerminalNode COMMA(int i) { + return getToken(Java17Parser.COMMA, i); + } + public ElementValuePairsContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_elementValuePairs; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterElementValuePairs(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitElementValuePairs(this); + } + } + + public final ElementValuePairsContext elementValuePairs() throws RecognitionException { + ElementValuePairsContext _localctx = new ElementValuePairsContext(_ctx, getState()); + enterRule(_localctx, 126, RULE_elementValuePairs); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(880); + elementValuePair(); + setState(885); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==COMMA) { + { + { + setState(881); + match(COMMA); + setState(882); + elementValuePair(); + } + } + setState(887); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ElementValuePairContext extends ParserRuleContext { + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public TerminalNode ASSIGN() { return getToken(Java17Parser.ASSIGN, 0); } + public ElementValueContext elementValue() { + return getRuleContext(ElementValueContext.class,0); + } + public ElementValuePairContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_elementValuePair; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterElementValuePair(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitElementValuePair(this); + } + } + + public final ElementValuePairContext elementValuePair() throws RecognitionException { + ElementValuePairContext _localctx = new ElementValuePairContext(_ctx, getState()); + enterRule(_localctx, 128, RULE_elementValuePair); + try { + enterOuterAlt(_localctx, 1); + { + setState(888); + identifier(); + setState(889); + match(ASSIGN); + setState(890); + elementValue(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ElementValueContext extends ParserRuleContext { + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class,0); + } + public AnnotationContext annotation() { + return getRuleContext(AnnotationContext.class,0); + } + public ElementValueArrayInitializerContext elementValueArrayInitializer() { + return getRuleContext(ElementValueArrayInitializerContext.class,0); + } + public ElementValueContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_elementValue; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterElementValue(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitElementValue(this); + } + } + + public final ElementValueContext elementValue() throws RecognitionException { + ElementValueContext _localctx = new ElementValueContext(_ctx, getState()); + enterRule(_localctx, 130, RULE_elementValue); + try { + setState(895); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,100,_ctx) ) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(892); + expression(0); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(893); + annotation(); + } + break; + case 3: + enterOuterAlt(_localctx, 3); + { + setState(894); + elementValueArrayInitializer(); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ElementValueArrayInitializerContext extends ParserRuleContext { + public TerminalNode LBRACE() { return getToken(Java17Parser.LBRACE, 0); } + public TerminalNode RBRACE() { return getToken(Java17Parser.RBRACE, 0); } + public List elementValue() { + return getRuleContexts(ElementValueContext.class); + } + public ElementValueContext elementValue(int i) { + return getRuleContext(ElementValueContext.class,i); + } + public List COMMA() { return getTokens(Java17Parser.COMMA); } + public TerminalNode COMMA(int i) { + return getToken(Java17Parser.COMMA, i); + } + public ElementValueArrayInitializerContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_elementValueArrayInitializer; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterElementValueArrayInitializer(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitElementValueArrayInitializer(this); + } + } + + public final ElementValueArrayInitializerContext elementValueArrayInitializer() throws RecognitionException { + ElementValueArrayInitializerContext _localctx = new ElementValueArrayInitializerContext(_ctx, getState()); + enterRule(_localctx, 132, RULE_elementValueArrayInitializer); + int _la; + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(897); + match(LBRACE); + setState(906); + _errHandler.sync(this); + _la = _input.LA(1); + if ((((_la - 3)) & ~0x3f) == 0 && ((1L << (_la - 3)) & 9223127275610966053L) != 0 || (((_la - 67)) & ~0x3f) == 0 && ((1L << (_la - 67)) & 2377900732130013183L) != 0) { + { + setState(898); + elementValue(); + setState(903); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,101,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + setState(899); + match(COMMA); + setState(900); + elementValue(); + } + } + } + setState(905); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,101,_ctx); + } + } + } + + setState(909); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==COMMA) { + { + setState(908); + match(COMMA); + } + } + + setState(911); + match(RBRACE); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class AnnotationTypeDeclarationContext extends ParserRuleContext { + public TerminalNode AT() { return getToken(Java17Parser.AT, 0); } + public TerminalNode INTERFACE() { return getToken(Java17Parser.INTERFACE, 0); } + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public AnnotationTypeBodyContext annotationTypeBody() { + return getRuleContext(AnnotationTypeBodyContext.class,0); + } + public AnnotationTypeDeclarationContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_annotationTypeDeclaration; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterAnnotationTypeDeclaration(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitAnnotationTypeDeclaration(this); + } + } + + public final AnnotationTypeDeclarationContext annotationTypeDeclaration() throws RecognitionException { + AnnotationTypeDeclarationContext _localctx = new AnnotationTypeDeclarationContext(_ctx, getState()); + enterRule(_localctx, 134, RULE_annotationTypeDeclaration); + try { + enterOuterAlt(_localctx, 1); + { + setState(913); + match(AT); + setState(914); + match(INTERFACE); + setState(915); + identifier(); + setState(916); + annotationTypeBody(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class AnnotationTypeBodyContext extends ParserRuleContext { + public TerminalNode LBRACE() { return getToken(Java17Parser.LBRACE, 0); } + public TerminalNode RBRACE() { return getToken(Java17Parser.RBRACE, 0); } + public List annotationTypeElementDeclaration() { + return getRuleContexts(AnnotationTypeElementDeclarationContext.class); + } + public AnnotationTypeElementDeclarationContext annotationTypeElementDeclaration(int i) { + return getRuleContext(AnnotationTypeElementDeclarationContext.class,i); + } + public AnnotationTypeBodyContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_annotationTypeBody; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterAnnotationTypeBody(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitAnnotationTypeBody(this); + } + } + + public final AnnotationTypeBodyContext annotationTypeBody() throws RecognitionException { + AnnotationTypeBodyContext _localctx = new AnnotationTypeBodyContext(_ctx, getState()); + enterRule(_localctx, 136, RULE_annotationTypeBody); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(918); + match(LBRACE); + setState(922); + _errHandler.sync(this); + _la = _input.LA(1); + while ((((_la - 1)) & ~0x3f) == 0 && ((1L << (_la - 1)) & -806529426349675L) != 0 || (((_la - 65)) & ~0x3f) == 0 && ((1L << (_la - 65)) & -8935141660702539773L) != 0) { + { + { + setState(919); + annotationTypeElementDeclaration(); + } + } + setState(924); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(925); + match(RBRACE); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class AnnotationTypeElementDeclarationContext extends ParserRuleContext { + public AnnotationTypeElementRestContext annotationTypeElementRest() { + return getRuleContext(AnnotationTypeElementRestContext.class,0); + } + public List modifier() { + return getRuleContexts(ModifierContext.class); + } + public ModifierContext modifier(int i) { + return getRuleContext(ModifierContext.class,i); + } + public TerminalNode SEMI() { return getToken(Java17Parser.SEMI, 0); } + public AnnotationTypeElementDeclarationContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_annotationTypeElementDeclaration; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterAnnotationTypeElementDeclaration(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitAnnotationTypeElementDeclaration(this); + } + } + + public final AnnotationTypeElementDeclarationContext annotationTypeElementDeclaration() throws RecognitionException { + AnnotationTypeElementDeclarationContext _localctx = new AnnotationTypeElementDeclarationContext(_ctx, getState()); + enterRule(_localctx, 138, RULE_annotationTypeElementDeclaration); + try { + int _alt; + setState(935); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,106,_ctx) ) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(930); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,105,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + setState(927); + modifier(); + } + } + } + setState(932); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,105,_ctx); + } + setState(933); + annotationTypeElementRest(); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(934); + match(SEMI); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class AnnotationTypeElementRestContext extends ParserRuleContext { + public TypeTypeContext typeType() { + return getRuleContext(TypeTypeContext.class,0); + } + public AnnotationMethodOrConstantRestContext annotationMethodOrConstantRest() { + return getRuleContext(AnnotationMethodOrConstantRestContext.class,0); + } + public TerminalNode SEMI() { return getToken(Java17Parser.SEMI, 0); } + public ClassOrInterfaceContext classOrInterface() { + return getRuleContext(ClassOrInterfaceContext.class,0); + } + public AnnotationTypeElementRestContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_annotationTypeElementRest; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterAnnotationTypeElementRest(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitAnnotationTypeElementRest(this); + } + } + + public final AnnotationTypeElementRestContext annotationTypeElementRest() throws RecognitionException { + AnnotationTypeElementRestContext _localctx = new AnnotationTypeElementRestContext(_ctx, getState()); + enterRule(_localctx, 140, RULE_annotationTypeElementRest); + try { + setState(945); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,108,_ctx) ) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(937); + typeType(); + setState(938); + annotationMethodOrConstantRest(); + setState(939); + match(SEMI); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(941); + classOrInterface(); + setState(943); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,107,_ctx) ) { + case 1: + { + setState(942); + match(SEMI); + } + break; + } + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class AnnotationMethodOrConstantRestContext extends ParserRuleContext { + public AnnotationMethodRestContext annotationMethodRest() { + return getRuleContext(AnnotationMethodRestContext.class,0); + } + public AnnotationConstantRestContext annotationConstantRest() { + return getRuleContext(AnnotationConstantRestContext.class,0); + } + public AnnotationMethodOrConstantRestContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_annotationMethodOrConstantRest; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterAnnotationMethodOrConstantRest(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitAnnotationMethodOrConstantRest(this); + } + } + + public final AnnotationMethodOrConstantRestContext annotationMethodOrConstantRest() throws RecognitionException { + AnnotationMethodOrConstantRestContext _localctx = new AnnotationMethodOrConstantRestContext(_ctx, getState()); + enterRule(_localctx, 142, RULE_annotationMethodOrConstantRest); + try { + setState(949); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,109,_ctx) ) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(947); + annotationMethodRest(); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(948); + annotationConstantRest(); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class AnnotationMethodRestContext extends ParserRuleContext { + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public TerminalNode LPAREN() { return getToken(Java17Parser.LPAREN, 0); } + public TerminalNode RPAREN() { return getToken(Java17Parser.RPAREN, 0); } + public DefaultValueContext defaultValue() { + return getRuleContext(DefaultValueContext.class,0); + } + public AnnotationMethodRestContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_annotationMethodRest; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterAnnotationMethodRest(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitAnnotationMethodRest(this); + } + } + + public final AnnotationMethodRestContext annotationMethodRest() throws RecognitionException { + AnnotationMethodRestContext _localctx = new AnnotationMethodRestContext(_ctx, getState()); + enterRule(_localctx, 144, RULE_annotationMethodRest); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(951); + identifier(); + setState(952); + match(LPAREN); + setState(953); + match(RPAREN); + setState(955); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==DEFAULT) { + { + setState(954); + defaultValue(); + } + } + + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class AnnotationConstantRestContext extends ParserRuleContext { + public VariableDeclaratorsContext variableDeclarators() { + return getRuleContext(VariableDeclaratorsContext.class,0); + } + public AnnotationConstantRestContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_annotationConstantRest; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterAnnotationConstantRest(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitAnnotationConstantRest(this); + } + } + + public final AnnotationConstantRestContext annotationConstantRest() throws RecognitionException { + AnnotationConstantRestContext _localctx = new AnnotationConstantRestContext(_ctx, getState()); + enterRule(_localctx, 146, RULE_annotationConstantRest); + try { + enterOuterAlt(_localctx, 1); + { + setState(957); + variableDeclarators(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class DefaultValueContext extends ParserRuleContext { + public TerminalNode DEFAULT() { return getToken(Java17Parser.DEFAULT, 0); } + public ElementValueContext elementValue() { + return getRuleContext(ElementValueContext.class,0); + } + public DefaultValueContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_defaultValue; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterDefaultValue(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitDefaultValue(this); + } + } + + public final DefaultValueContext defaultValue() throws RecognitionException { + DefaultValueContext _localctx = new DefaultValueContext(_ctx, getState()); + enterRule(_localctx, 148, RULE_defaultValue); + try { + enterOuterAlt(_localctx, 1); + { + setState(959); + match(DEFAULT); + setState(960); + elementValue(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ModuleDeclarationContext extends ParserRuleContext { + public TerminalNode MODULE() { return getToken(Java17Parser.MODULE, 0); } + public QualifiedNameContext qualifiedName() { + return getRuleContext(QualifiedNameContext.class,0); + } + public ModuleBodyContext moduleBody() { + return getRuleContext(ModuleBodyContext.class,0); + } + public TerminalNode OPEN() { return getToken(Java17Parser.OPEN, 0); } + public ModuleDeclarationContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_moduleDeclaration; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterModuleDeclaration(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitModuleDeclaration(this); + } + } + + public final ModuleDeclarationContext moduleDeclaration() throws RecognitionException { + ModuleDeclarationContext _localctx = new ModuleDeclarationContext(_ctx, getState()); + enterRule(_localctx, 150, RULE_moduleDeclaration); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(963); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==OPEN) { + { + setState(962); + match(OPEN); + } + } + + setState(965); + match(MODULE); + setState(966); + qualifiedName(); + setState(967); + moduleBody(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ModuleBodyContext extends ParserRuleContext { + public TerminalNode LBRACE() { return getToken(Java17Parser.LBRACE, 0); } + public TerminalNode RBRACE() { return getToken(Java17Parser.RBRACE, 0); } + public List moduleDirective() { + return getRuleContexts(ModuleDirectiveContext.class); + } + public ModuleDirectiveContext moduleDirective(int i) { + return getRuleContext(ModuleDirectiveContext.class,i); + } + public ModuleBodyContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_moduleBody; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterModuleBody(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitModuleBody(this); + } + } + + public final ModuleBodyContext moduleBody() throws RecognitionException { + ModuleBodyContext _localctx = new ModuleBodyContext(_ctx, getState()); + enterRule(_localctx, 152, RULE_moduleBody); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(969); + match(LBRACE); + setState(973); + _errHandler.sync(this); + _la = _input.LA(1); + while (((_la) & ~0x3f) == 0 && ((1L << _la) & 495395959010754560L) != 0) { + { + { + setState(970); + moduleDirective(); + } + } + setState(975); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(976); + match(RBRACE); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ModuleDirectiveContext extends ParserRuleContext { + public TerminalNode REQUIRES() { return getToken(Java17Parser.REQUIRES, 0); } + public List qualifiedName() { + return getRuleContexts(QualifiedNameContext.class); + } + public QualifiedNameContext qualifiedName(int i) { + return getRuleContext(QualifiedNameContext.class,i); + } + public TerminalNode SEMI() { return getToken(Java17Parser.SEMI, 0); } + public List requiresModifier() { + return getRuleContexts(RequiresModifierContext.class); + } + public RequiresModifierContext requiresModifier(int i) { + return getRuleContext(RequiresModifierContext.class,i); + } + public TerminalNode EXPORTS() { return getToken(Java17Parser.EXPORTS, 0); } + public TerminalNode TO() { return getToken(Java17Parser.TO, 0); } + public TerminalNode OPENS() { return getToken(Java17Parser.OPENS, 0); } + public TerminalNode USES() { return getToken(Java17Parser.USES, 0); } + public TerminalNode PROVIDES() { return getToken(Java17Parser.PROVIDES, 0); } + public TerminalNode WITH() { return getToken(Java17Parser.WITH, 0); } + public ModuleDirectiveContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_moduleDirective; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterModuleDirective(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitModuleDirective(this); + } + } + + public final ModuleDirectiveContext moduleDirective() throws RecognitionException { + ModuleDirectiveContext _localctx = new ModuleDirectiveContext(_ctx, getState()); + enterRule(_localctx, 154, RULE_moduleDirective); + int _la; + try { + int _alt; + setState(1014); + _errHandler.sync(this); + switch (_input.LA(1)) { + case REQUIRES: + enterOuterAlt(_localctx, 1); + { + setState(978); + match(REQUIRES); + setState(982); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,113,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + setState(979); + requiresModifier(); + } + } + } + setState(984); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,113,_ctx); + } + setState(985); + qualifiedName(); + setState(986); + match(SEMI); + } + break; + case EXPORTS: + enterOuterAlt(_localctx, 2); + { + setState(988); + match(EXPORTS); + setState(989); + qualifiedName(); + setState(992); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==TO) { + { + setState(990); + match(TO); + setState(991); + qualifiedName(); + } + } + + setState(994); + match(SEMI); + } + break; + case OPENS: + enterOuterAlt(_localctx, 3); + { + setState(996); + match(OPENS); + setState(997); + qualifiedName(); + setState(1000); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==TO) { + { + setState(998); + match(TO); + setState(999); + qualifiedName(); + } + } + + setState(1002); + match(SEMI); + } + break; + case USES: + enterOuterAlt(_localctx, 4); + { + setState(1004); + match(USES); + setState(1005); + qualifiedName(); + setState(1006); + match(SEMI); + } + break; + case PROVIDES: + enterOuterAlt(_localctx, 5); + { + setState(1008); + match(PROVIDES); + setState(1009); + qualifiedName(); + setState(1010); + match(WITH); + setState(1011); + qualifiedName(); + setState(1012); + match(SEMI); + } + break; + default: + throw new NoViableAltException(this); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class RequiresModifierContext extends ParserRuleContext { + public TerminalNode TRANSITIVE() { return getToken(Java17Parser.TRANSITIVE, 0); } + public TerminalNode STATIC() { return getToken(Java17Parser.STATIC, 0); } + public RequiresModifierContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_requiresModifier; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterRequiresModifier(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitRequiresModifier(this); + } + } + + public final RequiresModifierContext requiresModifier() throws RecognitionException { + RequiresModifierContext _localctx = new RequiresModifierContext(_ctx, getState()); + enterRule(_localctx, 156, RULE_requiresModifier); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1016); + _la = _input.LA(1); + if ( !(_la==STATIC || _la==TRANSITIVE) ) { + _errHandler.recoverInline(this); + } + else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class RecordDeclarationContext extends ParserRuleContext { + public TerminalNode RECORD() { return getToken(Java17Parser.RECORD, 0); } + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public RecordHeaderContext recordHeader() { + return getRuleContext(RecordHeaderContext.class,0); + } + public RecordBodyContext recordBody() { + return getRuleContext(RecordBodyContext.class,0); + } + public GenericDeclarationListContext genericDeclarationList() { + return getRuleContext(GenericDeclarationListContext.class,0); + } + public TerminalNode IMPLEMENTS() { return getToken(Java17Parser.IMPLEMENTS, 0); } + public TypeListContext typeList() { + return getRuleContext(TypeListContext.class,0); + } + public RecordDeclarationContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_recordDeclaration; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterRecordDeclaration(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitRecordDeclaration(this); + } + } + + public final RecordDeclarationContext recordDeclaration() throws RecognitionException { + RecordDeclarationContext _localctx = new RecordDeclarationContext(_ctx, getState()); + enterRule(_localctx, 158, RULE_recordDeclaration); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1018); + match(RECORD); + setState(1019); + identifier(); + setState(1021); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==LT) { + { + setState(1020); + genericDeclarationList(); + } + } + + setState(1023); + recordHeader(); + setState(1026); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==IMPLEMENTS) { + { + setState(1024); + match(IMPLEMENTS); + setState(1025); + typeList(); + } + } + + setState(1028); + recordBody(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class RecordHeaderContext extends ParserRuleContext { + public TerminalNode LPAREN() { return getToken(Java17Parser.LPAREN, 0); } + public TerminalNode RPAREN() { return getToken(Java17Parser.RPAREN, 0); } + public RecordComponentListContext recordComponentList() { + return getRuleContext(RecordComponentListContext.class,0); + } + public RecordHeaderContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_recordHeader; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterRecordHeader(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitRecordHeader(this); + } + } + + public final RecordHeaderContext recordHeader() throws RecognitionException { + RecordHeaderContext _localctx = new RecordHeaderContext(_ctx, getState()); + enterRule(_localctx, 160, RULE_recordHeader); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1030); + match(LPAREN); + setState(1032); + _errHandler.sync(this); + _la = _input.LA(1); + if ((((_la - 3)) & ~0x3f) == 0 && ((1L << (_la - 3)) & 9223090579141953573L) != 0 || _la==AT || _la==IDENTIFIER) { + { + setState(1031); + recordComponentList(); + } + } + + setState(1034); + match(RPAREN); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class RecordComponentListContext extends ParserRuleContext { + public List recordComponent() { + return getRuleContexts(RecordComponentContext.class); + } + public RecordComponentContext recordComponent(int i) { + return getRuleContext(RecordComponentContext.class,i); + } + public List COMMA() { return getTokens(Java17Parser.COMMA); } + public TerminalNode COMMA(int i) { + return getToken(Java17Parser.COMMA, i); + } + public RecordComponentListContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_recordComponentList; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterRecordComponentList(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitRecordComponentList(this); + } + } + + public final RecordComponentListContext recordComponentList() throws RecognitionException { + RecordComponentListContext _localctx = new RecordComponentListContext(_ctx, getState()); + enterRule(_localctx, 162, RULE_recordComponentList); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1036); + recordComponent(); + setState(1041); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==COMMA) { + { + { + setState(1037); + match(COMMA); + setState(1038); + recordComponent(); + } + } + setState(1043); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class RecordComponentContext extends ParserRuleContext { + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public TypeTypeContext typeType() { + return getRuleContext(TypeTypeContext.class,0); + } + public RecordComponentContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_recordComponent; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterRecordComponent(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitRecordComponent(this); + } + } + + public final RecordComponentContext recordComponent() throws RecognitionException { + RecordComponentContext _localctx = new RecordComponentContext(_ctx, getState()); + enterRule(_localctx, 164, RULE_recordComponent); + try { + enterOuterAlt(_localctx, 1); + { + setState(1045); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,121,_ctx) ) { + case 1: + { + setState(1044); + typeType(); + } + break; + } + setState(1047); + identifier(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class RecordBodyContext extends ParserRuleContext { + public TerminalNode LBRACE() { return getToken(Java17Parser.LBRACE, 0); } + public TerminalNode RBRACE() { return getToken(Java17Parser.RBRACE, 0); } + public List classBodyDeclaration() { + return getRuleContexts(ClassBodyDeclarationContext.class); + } + public ClassBodyDeclarationContext classBodyDeclaration(int i) { + return getRuleContext(ClassBodyDeclarationContext.class,i); + } + public RecordBodyContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_recordBody; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterRecordBody(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitRecordBody(this); + } + } + + public final RecordBodyContext recordBody() throws RecognitionException { + RecordBodyContext _localctx = new RecordBodyContext(_ctx, getState()); + enterRule(_localctx, 166, RULE_recordBody); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1049); + match(LBRACE); + setState(1053); + _errHandler.sync(this); + _la = _input.LA(1); + while ((((_la - 1)) & ~0x3f) == 0 && ((1L << (_la - 1)) & -665791937994347L) != 0 || (((_la - 65)) & ~0x3f) == 0 && ((1L << (_la - 65)) & -8935141660685729789L) != 0) { + { + { + setState(1050); + classBodyDeclaration(); + } + } + setState(1055); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(1056); + match(RBRACE); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class BlockContext extends ParserRuleContext { + public TerminalNode LBRACE() { return getToken(Java17Parser.LBRACE, 0); } + public TerminalNode RBRACE() { return getToken(Java17Parser.RBRACE, 0); } + public List blockStatement() { + return getRuleContexts(BlockStatementContext.class); + } + public BlockStatementContext blockStatement(int i) { + return getRuleContext(BlockStatementContext.class,i); + } + public BlockContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_block; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterBlock(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitBlock(this); + } + } + + public final BlockContext block() throws RecognitionException { + BlockContext _localctx = new BlockContext(_ctx, getState()); + enterRule(_localctx, 168, RULE_block); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1058); + match(LBRACE); + setState(1062); + _errHandler.sync(this); + _la = _input.LA(1); + while ((((_la - 1)) & ~0x3f) == 0 && ((1L << (_la - 1)) & -334254282492513L) != 0 || (((_la - 65)) & ~0x3f) == 0 && ((1L << (_la - 65)) & -8935141145188974593L) != 0) { + { + { + setState(1059); + blockStatement(); + } + } + setState(1064); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(1065); + match(RBRACE); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class BlockStatementContext extends ParserRuleContext { + public LocalVariableDeclarationContext localVariableDeclaration() { + return getRuleContext(LocalVariableDeclarationContext.class,0); + } + public TerminalNode SEMI() { return getToken(Java17Parser.SEMI, 0); } + public LocalTypeDeclarationContext localTypeDeclaration() { + return getRuleContext(LocalTypeDeclarationContext.class,0); + } + public StatementContext statement() { + return getRuleContext(StatementContext.class,0); + } + public BlockStatementContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_blockStatement; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterBlockStatement(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitBlockStatement(this); + } + } + + public final BlockStatementContext blockStatement() throws RecognitionException { + BlockStatementContext _localctx = new BlockStatementContext(_ctx, getState()); + enterRule(_localctx, 170, RULE_blockStatement); + try { + setState(1072); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,124,_ctx) ) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(1067); + localVariableDeclaration(); + setState(1068); + match(SEMI); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(1070); + localTypeDeclaration(); + } + break; + case 3: + enterOuterAlt(_localctx, 3); + { + setState(1071); + statement(); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class LocalVariableDeclarationContext extends ParserRuleContext { + public VariableDeclaratorsContext variableDeclarators() { + return getRuleContext(VariableDeclaratorsContext.class,0); + } + public TerminalNode VAR() { return getToken(Java17Parser.VAR, 0); } + public TypeTypeContext typeType() { + return getRuleContext(TypeTypeContext.class,0); + } + public List variableModifier() { + return getRuleContexts(VariableModifierContext.class); + } + public VariableModifierContext variableModifier(int i) { + return getRuleContext(VariableModifierContext.class,i); + } + public LocalVariableDeclarationContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_localVariableDeclaration; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterLocalVariableDeclaration(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitLocalVariableDeclaration(this); + } + } + + public final LocalVariableDeclarationContext localVariableDeclaration() throws RecognitionException { + LocalVariableDeclarationContext _localctx = new LocalVariableDeclarationContext(_ctx, getState()); + enterRule(_localctx, 172, RULE_localVariableDeclaration); + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(1077); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,125,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + setState(1074); + variableModifier(); + } + } + } + setState(1079); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,125,_ctx); + } + setState(1082); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,126,_ctx) ) { + case 1: + { + setState(1080); + match(VAR); + } + break; + case 2: + { + setState(1081); + typeType(); + } + break; + } + setState(1084); + variableDeclarators(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class IdentifierContext extends ParserRuleContext { + public TerminalNode IDENTIFIER() { return getToken(Java17Parser.IDENTIFIER, 0); } + public TerminalNode MODULE() { return getToken(Java17Parser.MODULE, 0); } + public TerminalNode OPEN() { return getToken(Java17Parser.OPEN, 0); } + public TerminalNode REQUIRES() { return getToken(Java17Parser.REQUIRES, 0); } + public TerminalNode EXPORTS() { return getToken(Java17Parser.EXPORTS, 0); } + public TerminalNode OPENS() { return getToken(Java17Parser.OPENS, 0); } + public TerminalNode TO() { return getToken(Java17Parser.TO, 0); } + public TerminalNode USES() { return getToken(Java17Parser.USES, 0); } + public TerminalNode PROVIDES() { return getToken(Java17Parser.PROVIDES, 0); } + public TerminalNode WITH() { return getToken(Java17Parser.WITH, 0); } + public TerminalNode TRANSITIVE() { return getToken(Java17Parser.TRANSITIVE, 0); } + public TerminalNode YIELD() { return getToken(Java17Parser.YIELD, 0); } + public TerminalNode SEALED() { return getToken(Java17Parser.SEALED, 0); } + public TerminalNode PERMITS() { return getToken(Java17Parser.PERMITS, 0); } + public TerminalNode RECORD() { return getToken(Java17Parser.RECORD, 0); } + public TerminalNode VAR() { return getToken(Java17Parser.VAR, 0); } + public IdentifierContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_identifier; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterIdentifier(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitIdentifier(this); + } + } + + public final IdentifierContext identifier() throws RecognitionException { + IdentifierContext _localctx = new IdentifierContext(_ctx, getState()); + enterRule(_localctx, 174, RULE_identifier); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1086); + _la = _input.LA(1); + if ( !((((_la - 51)) & ~0x3f) == 0 && ((1L << (_la - 51)) & 32767L) != 0 || _la==IDENTIFIER) ) { + _errHandler.recoverInline(this); + } + else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class TypeIdentifierContext extends ParserRuleContext { + public TerminalNode IDENTIFIER() { return getToken(Java17Parser.IDENTIFIER, 0); } + public TerminalNode MODULE() { return getToken(Java17Parser.MODULE, 0); } + public TerminalNode OPEN() { return getToken(Java17Parser.OPEN, 0); } + public TerminalNode REQUIRES() { return getToken(Java17Parser.REQUIRES, 0); } + public TerminalNode EXPORTS() { return getToken(Java17Parser.EXPORTS, 0); } + public TerminalNode OPENS() { return getToken(Java17Parser.OPENS, 0); } + public TerminalNode TO() { return getToken(Java17Parser.TO, 0); } + public TerminalNode USES() { return getToken(Java17Parser.USES, 0); } + public TerminalNode PROVIDES() { return getToken(Java17Parser.PROVIDES, 0); } + public TerminalNode WITH() { return getToken(Java17Parser.WITH, 0); } + public TerminalNode TRANSITIVE() { return getToken(Java17Parser.TRANSITIVE, 0); } + public TerminalNode SEALED() { return getToken(Java17Parser.SEALED, 0); } + public TerminalNode PERMITS() { return getToken(Java17Parser.PERMITS, 0); } + public TerminalNode RECORD() { return getToken(Java17Parser.RECORD, 0); } + public TypeIdentifierContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_typeIdentifier; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterTypeIdentifier(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitTypeIdentifier(this); + } + } + + public final TypeIdentifierContext typeIdentifier() throws RecognitionException { + TypeIdentifierContext _localctx = new TypeIdentifierContext(_ctx, getState()); + enterRule(_localctx, 176, RULE_typeIdentifier); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1088); + _la = _input.LA(1); + if ( !((((_la - 51)) & ~0x3f) == 0 && ((1L << (_la - 51)) & 29695L) != 0 || _la==IDENTIFIER) ) { + _errHandler.recoverInline(this); + } + else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class LocalTypeDeclarationContext extends ParserRuleContext { + public ClassDeclarationContext classDeclaration() { + return getRuleContext(ClassDeclarationContext.class,0); + } + public InterfaceDeclarationContext interfaceDeclaration() { + return getRuleContext(InterfaceDeclarationContext.class,0); + } + public RecordDeclarationContext recordDeclaration() { + return getRuleContext(RecordDeclarationContext.class,0); + } + public List classOrInterfaceModifier() { + return getRuleContexts(ClassOrInterfaceModifierContext.class); + } + public ClassOrInterfaceModifierContext classOrInterfaceModifier(int i) { + return getRuleContext(ClassOrInterfaceModifierContext.class,i); + } + public TerminalNode SEMI() { return getToken(Java17Parser.SEMI, 0); } + public LocalTypeDeclarationContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_localTypeDeclaration; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterLocalTypeDeclaration(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitLocalTypeDeclaration(this); + } + } + + public final LocalTypeDeclarationContext localTypeDeclaration() throws RecognitionException { + LocalTypeDeclarationContext _localctx = new LocalTypeDeclarationContext(_ctx, getState()); + enterRule(_localctx, 178, RULE_localTypeDeclaration); + try { + int _alt; + setState(1102); + _errHandler.sync(this); + switch (_input.LA(1)) { + case ABSTRACT: + case CLASS: + case FINAL: + case INTERFACE: + case PRIVATE: + case PROTECTED: + case PUBLIC: + case STATIC: + case STRICTFP: + case MODULE: + case OPEN: + case REQUIRES: + case EXPORTS: + case OPENS: + case TO: + case USES: + case PROVIDES: + case WITH: + case TRANSITIVE: + case VAR: + case YIELD: + case RECORD: + case SEALED: + case PERMITS: + case NON_SEALED: + case AT: + case IDENTIFIER: + enterOuterAlt(_localctx, 1); + { + setState(1093); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,127,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + setState(1090); + classOrInterfaceModifier(); + } + } + } + setState(1095); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,127,_ctx); + } + setState(1099); + _errHandler.sync(this); + switch (_input.LA(1)) { + case CLASS: + { + setState(1096); + classDeclaration(); + } + break; + case INTERFACE: + { + setState(1097); + interfaceDeclaration(); + } + break; + case RECORD: + { + setState(1098); + recordDeclaration(); + } + break; + default: + throw new NoViableAltException(this); + } + } + break; + case SEMI: + enterOuterAlt(_localctx, 2); + { + setState(1101); + match(SEMI); + } + break; + default: + throw new NoViableAltException(this); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class StatementContext extends ParserRuleContext { + public StatementContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_statement; } + + public StatementContext() { } + public void copyFrom(StatementContext ctx) { + super.copyFrom(ctx); + } + } + @SuppressWarnings("CheckReturnValue") + public static class StmtexpressionContext extends StatementContext { + public ExpressionContext statementExpression; + public TerminalNode SEMI() { return getToken(Java17Parser.SEMI, 0); } + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class,0); + } + public StmtexpressionContext(StatementContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterStmtexpression(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitStmtexpression(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class AssertstmtContext extends StatementContext { + public TerminalNode ASSERT() { return getToken(Java17Parser.ASSERT, 0); } + public List expression() { + return getRuleContexts(ExpressionContext.class); + } + public ExpressionContext expression(int i) { + return getRuleContext(ExpressionContext.class,i); + } + public TerminalNode SEMI() { return getToken(Java17Parser.SEMI, 0); } + public TerminalNode COLON() { return getToken(Java17Parser.COLON, 0); } + public AssertstmtContext(StatementContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterAssertstmt(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitAssertstmt(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class ThrowstmtContext extends StatementContext { + public TerminalNode THROW() { return getToken(Java17Parser.THROW, 0); } + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class,0); + } + public TerminalNode SEMI() { return getToken(Java17Parser.SEMI, 0); } + public ThrowstmtContext(StatementContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterThrowstmt(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitThrowstmt(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class TrycatchblockContext extends StatementContext { + public TerminalNode TRY() { return getToken(Java17Parser.TRY, 0); } + public BlockContext block() { + return getRuleContext(BlockContext.class,0); + } + public FinallyBlockContext finallyBlock() { + return getRuleContext(FinallyBlockContext.class,0); + } + public List catchClause() { + return getRuleContexts(CatchClauseContext.class); + } + public CatchClauseContext catchClause(int i) { + return getRuleContext(CatchClauseContext.class,i); + } + public TrycatchblockContext(StatementContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterTrycatchblock(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitTrycatchblock(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class SynchronizedstmtContext extends StatementContext { + public TerminalNode SYNCHRONIZED() { return getToken(Java17Parser.SYNCHRONIZED, 0); } + public ParExpressionContext parExpression() { + return getRuleContext(ParExpressionContext.class,0); + } + public BlockContext block() { + return getRuleContext(BlockContext.class,0); + } + public SynchronizedstmtContext(StatementContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterSynchronizedstmt(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitSynchronizedstmt(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class SwitchstmtContext extends StatementContext { + public TerminalNode SWITCH() { return getToken(Java17Parser.SWITCH, 0); } + public ParExpressionContext parExpression() { + return getRuleContext(ParExpressionContext.class,0); + } + public TerminalNode LBRACE() { return getToken(Java17Parser.LBRACE, 0); } + public TerminalNode RBRACE() { return getToken(Java17Parser.RBRACE, 0); } + public List switchBlockStatementGroup() { + return getRuleContexts(SwitchBlockStatementGroupContext.class); + } + public SwitchBlockStatementGroupContext switchBlockStatementGroup(int i) { + return getRuleContext(SwitchBlockStatementGroupContext.class,i); + } + public List switchLabel() { + return getRuleContexts(SwitchLabelContext.class); + } + public SwitchLabelContext switchLabel(int i) { + return getRuleContext(SwitchLabelContext.class,i); + } + public SwitchstmtContext(StatementContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterSwitchstmt(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitSwitchstmt(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class BreakstmtContext extends StatementContext { + public TerminalNode BREAK() { return getToken(Java17Parser.BREAK, 0); } + public TerminalNode SEMI() { return getToken(Java17Parser.SEMI, 0); } + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public BreakstmtContext(StatementContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterBreakstmt(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitBreakstmt(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class SemistmtContext extends StatementContext { + public TerminalNode SEMI() { return getToken(Java17Parser.SEMI, 0); } + public SemistmtContext(StatementContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterSemistmt(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitSemistmt(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class ContinuestmtContext extends StatementContext { + public TerminalNode CONTINUE() { return getToken(Java17Parser.CONTINUE, 0); } + public TerminalNode SEMI() { return getToken(Java17Parser.SEMI, 0); } + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public ContinuestmtContext(StatementContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterContinuestmt(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitContinuestmt(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class WhileloopContext extends StatementContext { + public TerminalNode WHILE() { return getToken(Java17Parser.WHILE, 0); } + public ParExpressionContext parExpression() { + return getRuleContext(ParExpressionContext.class,0); + } + public StatementContext statement() { + return getRuleContext(StatementContext.class,0); + } + public WhileloopContext(StatementContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterWhileloop(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitWhileloop(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class LabeledstmtContext extends StatementContext { + public IdentifierContext identifierLabel; + public TerminalNode COLON() { return getToken(Java17Parser.COLON, 0); } + public StatementContext statement() { + return getRuleContext(StatementContext.class,0); + } + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public LabeledstmtContext(StatementContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterLabeledstmt(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitLabeledstmt(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class ForloopContext extends StatementContext { + public TerminalNode FOR() { return getToken(Java17Parser.FOR, 0); } + public TerminalNode LPAREN() { return getToken(Java17Parser.LPAREN, 0); } + public ForControlContext forControl() { + return getRuleContext(ForControlContext.class,0); + } + public TerminalNode RPAREN() { return getToken(Java17Parser.RPAREN, 0); } + public StatementContext statement() { + return getRuleContext(StatementContext.class,0); + } + public ForloopContext(StatementContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterForloop(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitForloop(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class TrycatchresourceContext extends StatementContext { + public TerminalNode TRY() { return getToken(Java17Parser.TRY, 0); } + public ResourceSpecificationContext resourceSpecification() { + return getRuleContext(ResourceSpecificationContext.class,0); + } + public BlockContext block() { + return getRuleContext(BlockContext.class,0); + } + public List catchClause() { + return getRuleContexts(CatchClauseContext.class); + } + public CatchClauseContext catchClause(int i) { + return getRuleContext(CatchClauseContext.class,i); + } + public FinallyBlockContext finallyBlock() { + return getRuleContext(FinallyBlockContext.class,0); + } + public TrycatchresourceContext(StatementContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterTrycatchresource(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitTrycatchresource(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class ConditionalstmtContext extends StatementContext { + public TerminalNode IF() { return getToken(Java17Parser.IF, 0); } + public ParExpressionContext parExpression() { + return getRuleContext(ParExpressionContext.class,0); + } + public List statement() { + return getRuleContexts(StatementContext.class); + } + public StatementContext statement(int i) { + return getRuleContext(StatementContext.class,i); + } + public TerminalNode ELSE() { return getToken(Java17Parser.ELSE, 0); } + public ConditionalstmtContext(StatementContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterConditionalstmt(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitConditionalstmt(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class DowhileloopContext extends StatementContext { + public TerminalNode DO() { return getToken(Java17Parser.DO, 0); } + public StatementContext statement() { + return getRuleContext(StatementContext.class,0); + } + public TerminalNode WHILE() { return getToken(Java17Parser.WHILE, 0); } + public ParExpressionContext parExpression() { + return getRuleContext(ParExpressionContext.class,0); + } + public TerminalNode SEMI() { return getToken(Java17Parser.SEMI, 0); } + public DowhileloopContext(StatementContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterDowhileloop(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitDowhileloop(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class ReturnstmtContext extends StatementContext { + public TerminalNode RETURN() { return getToken(Java17Parser.RETURN, 0); } + public TerminalNode SEMI() { return getToken(Java17Parser.SEMI, 0); } + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class,0); + } + public ReturnstmtContext(StatementContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterReturnstmt(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitReturnstmt(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class BlockstmtContext extends StatementContext { + public BlockContext blockLabel; + public BlockContext block() { + return getRuleContext(BlockContext.class,0); + } + public BlockstmtContext(StatementContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterBlockstmt(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitBlockstmt(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class YieldstmtContext extends StatementContext { + public TerminalNode YIELD() { return getToken(Java17Parser.YIELD, 0); } + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class,0); + } + public TerminalNode SEMI() { return getToken(Java17Parser.SEMI, 0); } + public YieldstmtContext(StatementContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterYieldstmt(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitYieldstmt(this); + } + } + + public final StatementContext statement() throws RecognitionException { + StatementContext _localctx = new StatementContext(_ctx, getState()); + enterRule(_localctx, 180, RULE_statement); + int _la; + try { + int _alt; + setState(1213); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,142,_ctx) ) { + case 1: + _localctx = new BlockstmtContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(1104); + ((BlockstmtContext)_localctx).blockLabel = block(); + } + break; + case 2: + _localctx = new AssertstmtContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(1105); + match(ASSERT); + setState(1106); + expression(0); + setState(1109); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==COLON) { + { + setState(1107); + match(COLON); + setState(1108); + expression(0); + } + } + + setState(1111); + match(SEMI); + } + break; + case 3: + _localctx = new ConditionalstmtContext(_localctx); + enterOuterAlt(_localctx, 3); + { + setState(1113); + match(IF); + setState(1114); + parExpression(); + setState(1115); + statement(); + setState(1118); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,131,_ctx) ) { + case 1: + { + setState(1116); + match(ELSE); + setState(1117); + statement(); + } + break; + } + } + break; + case 4: + _localctx = new ForloopContext(_localctx); + enterOuterAlt(_localctx, 4); + { + setState(1120); + match(FOR); + setState(1121); + match(LPAREN); + setState(1122); + forControl(); + setState(1123); + match(RPAREN); + setState(1124); + statement(); + } + break; + case 5: + _localctx = new WhileloopContext(_localctx); + enterOuterAlt(_localctx, 5); + { + setState(1126); + match(WHILE); + setState(1127); + parExpression(); + setState(1128); + statement(); + } + break; + case 6: + _localctx = new DowhileloopContext(_localctx); + enterOuterAlt(_localctx, 6); + { + setState(1130); + match(DO); + setState(1131); + statement(); + setState(1132); + match(WHILE); + setState(1133); + parExpression(); + setState(1134); + match(SEMI); + } + break; + case 7: + _localctx = new TrycatchblockContext(_localctx); + enterOuterAlt(_localctx, 7); + { + setState(1136); + match(TRY); + setState(1137); + block(); + setState(1147); + _errHandler.sync(this); + switch (_input.LA(1)) { + case CATCH: + { + setState(1139); + _errHandler.sync(this); + _la = _input.LA(1); + do { + { + { + setState(1138); + catchClause(); + } + } + setState(1141); + _errHandler.sync(this); + _la = _input.LA(1); + } while ( _la==CATCH ); + setState(1144); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==FINALLY) { + { + setState(1143); + finallyBlock(); + } + } + + } + break; + case FINALLY: + { + setState(1146); + finallyBlock(); + } + break; + default: + throw new NoViableAltException(this); + } + } + break; + case 8: + _localctx = new TrycatchresourceContext(_localctx); + enterOuterAlt(_localctx, 8); + { + setState(1149); + match(TRY); + setState(1150); + resourceSpecification(); + setState(1151); + block(); + setState(1155); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==CATCH) { + { + { + setState(1152); + catchClause(); + } + } + setState(1157); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(1159); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==FINALLY) { + { + setState(1158); + finallyBlock(); + } + } + + } + break; + case 9: + _localctx = new SwitchstmtContext(_localctx); + enterOuterAlt(_localctx, 9); + { + setState(1161); + match(SWITCH); + setState(1162); + parExpression(); + setState(1163); + match(LBRACE); + setState(1167); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,137,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + setState(1164); + switchBlockStatementGroup(); + } + } + } + setState(1169); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,137,_ctx); + } + setState(1173); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==CASE || _la==DEFAULT) { + { + { + setState(1170); + switchLabel(); + } + } + setState(1175); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(1176); + match(RBRACE); + } + break; + case 10: + _localctx = new SynchronizedstmtContext(_localctx); + enterOuterAlt(_localctx, 10); + { + setState(1178); + match(SYNCHRONIZED); + setState(1179); + parExpression(); + setState(1180); + block(); + } + break; + case 11: + _localctx = new ReturnstmtContext(_localctx); + enterOuterAlt(_localctx, 11); + { + setState(1182); + match(RETURN); + setState(1184); + _errHandler.sync(this); + _la = _input.LA(1); + if ((((_la - 3)) & ~0x3f) == 0 && ((1L << (_la - 3)) & 9223127275610966053L) != 0 || (((_la - 67)) & ~0x3f) == 0 && ((1L << (_la - 67)) & 2377900732130004991L) != 0) { + { + setState(1183); + expression(0); + } + } + + setState(1186); + match(SEMI); + } + break; + case 12: + _localctx = new ThrowstmtContext(_localctx); + enterOuterAlt(_localctx, 12); + { + setState(1187); + match(THROW); + setState(1188); + expression(0); + setState(1189); + match(SEMI); + } + break; + case 13: + _localctx = new BreakstmtContext(_localctx); + enterOuterAlt(_localctx, 13); + { + setState(1191); + match(BREAK); + setState(1193); + _errHandler.sync(this); + _la = _input.LA(1); + if ((((_la - 51)) & ~0x3f) == 0 && ((1L << (_la - 51)) & 32767L) != 0 || _la==IDENTIFIER) { + { + setState(1192); + identifier(); + } + } + + setState(1195); + match(SEMI); + } + break; + case 14: + _localctx = new ContinuestmtContext(_localctx); + enterOuterAlt(_localctx, 14); + { + setState(1196); + match(CONTINUE); + setState(1198); + _errHandler.sync(this); + _la = _input.LA(1); + if ((((_la - 51)) & ~0x3f) == 0 && ((1L << (_la - 51)) & 32767L) != 0 || _la==IDENTIFIER) { + { + setState(1197); + identifier(); + } + } + + setState(1200); + match(SEMI); + } + break; + case 15: + _localctx = new YieldstmtContext(_localctx); + enterOuterAlt(_localctx, 15); + { + setState(1201); + match(YIELD); + setState(1202); + expression(0); + setState(1203); + match(SEMI); + } + break; + case 16: + _localctx = new SemistmtContext(_localctx); + enterOuterAlt(_localctx, 16); + { + setState(1205); + match(SEMI); + } + break; + case 17: + _localctx = new StmtexpressionContext(_localctx); + enterOuterAlt(_localctx, 17); + { + setState(1206); + ((StmtexpressionContext)_localctx).statementExpression = expression(0); + setState(1207); + match(SEMI); + } + break; + case 18: + _localctx = new LabeledstmtContext(_localctx); + enterOuterAlt(_localctx, 18); + { + setState(1209); + ((LabeledstmtContext)_localctx).identifierLabel = identifier(); + setState(1210); + match(COLON); + setState(1211); + statement(); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class CatchClauseContext extends ParserRuleContext { + public TerminalNode CATCH() { return getToken(Java17Parser.CATCH, 0); } + public TerminalNode LPAREN() { return getToken(Java17Parser.LPAREN, 0); } + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public TerminalNode RPAREN() { return getToken(Java17Parser.RPAREN, 0); } + public BlockContext block() { + return getRuleContext(BlockContext.class,0); + } + public List variableModifier() { + return getRuleContexts(VariableModifierContext.class); + } + public VariableModifierContext variableModifier(int i) { + return getRuleContext(VariableModifierContext.class,i); + } + public CatchTypeContext catchType() { + return getRuleContext(CatchTypeContext.class,0); + } + public CatchClauseContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_catchClause; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterCatchClause(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitCatchClause(this); + } + } + + public final CatchClauseContext catchClause() throws RecognitionException { + CatchClauseContext _localctx = new CatchClauseContext(_ctx, getState()); + enterRule(_localctx, 182, RULE_catchClause); + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(1215); + match(CATCH); + setState(1216); + match(LPAREN); + setState(1220); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,143,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + setState(1217); + variableModifier(); + } + } + } + setState(1222); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,143,_ctx); + } + setState(1224); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,144,_ctx) ) { + case 1: + { + setState(1223); + catchType(); + } + break; + } + setState(1226); + identifier(); + setState(1227); + match(RPAREN); + setState(1228); + block(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class CatchTypeContext extends ParserRuleContext { + public List qualifiedName() { + return getRuleContexts(QualifiedNameContext.class); + } + public QualifiedNameContext qualifiedName(int i) { + return getRuleContext(QualifiedNameContext.class,i); + } + public List BITOR() { return getTokens(Java17Parser.BITOR); } + public TerminalNode BITOR(int i) { + return getToken(Java17Parser.BITOR, i); + } + public CatchTypeContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_catchType; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterCatchType(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitCatchType(this); + } + } + + public final CatchTypeContext catchType() throws RecognitionException { + CatchTypeContext _localctx = new CatchTypeContext(_ctx, getState()); + enterRule(_localctx, 184, RULE_catchType); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1230); + qualifiedName(); + setState(1235); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==BITOR) { + { + { + setState(1231); + match(BITOR); + setState(1232); + qualifiedName(); + } + } + setState(1237); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class FinallyBlockContext extends ParserRuleContext { + public TerminalNode FINALLY() { return getToken(Java17Parser.FINALLY, 0); } + public BlockContext block() { + return getRuleContext(BlockContext.class,0); + } + public FinallyBlockContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_finallyBlock; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterFinallyBlock(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitFinallyBlock(this); + } + } + + public final FinallyBlockContext finallyBlock() throws RecognitionException { + FinallyBlockContext _localctx = new FinallyBlockContext(_ctx, getState()); + enterRule(_localctx, 186, RULE_finallyBlock); + try { + enterOuterAlt(_localctx, 1); + { + setState(1238); + match(FINALLY); + setState(1239); + block(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ResourceSpecificationContext extends ParserRuleContext { + public TerminalNode LPAREN() { return getToken(Java17Parser.LPAREN, 0); } + public ResourcesContext resources() { + return getRuleContext(ResourcesContext.class,0); + } + public TerminalNode RPAREN() { return getToken(Java17Parser.RPAREN, 0); } + public TerminalNode SEMI() { return getToken(Java17Parser.SEMI, 0); } + public ResourceSpecificationContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_resourceSpecification; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterResourceSpecification(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitResourceSpecification(this); + } + } + + public final ResourceSpecificationContext resourceSpecification() throws RecognitionException { + ResourceSpecificationContext _localctx = new ResourceSpecificationContext(_ctx, getState()); + enterRule(_localctx, 188, RULE_resourceSpecification); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1241); + match(LPAREN); + setState(1242); + resources(); + setState(1244); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==SEMI) { + { + setState(1243); + match(SEMI); + } + } + + setState(1246); + match(RPAREN); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ResourcesContext extends ParserRuleContext { + public List resource() { + return getRuleContexts(ResourceContext.class); + } + public ResourceContext resource(int i) { + return getRuleContext(ResourceContext.class,i); + } + public List SEMI() { return getTokens(Java17Parser.SEMI); } + public TerminalNode SEMI(int i) { + return getToken(Java17Parser.SEMI, i); + } + public ResourcesContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_resources; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterResources(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitResources(this); + } + } + + public final ResourcesContext resources() throws RecognitionException { + ResourcesContext _localctx = new ResourcesContext(_ctx, getState()); + enterRule(_localctx, 190, RULE_resources); + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(1248); + resource(); + setState(1253); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,147,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + setState(1249); + match(SEMI); + setState(1250); + resource(); + } + } + } + setState(1255); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,147,_ctx); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ResourceContext extends ParserRuleContext { + public TerminalNode ASSIGN() { return getToken(Java17Parser.ASSIGN, 0); } + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class,0); + } + public VariableDeclaratorIdContext variableDeclaratorId() { + return getRuleContext(VariableDeclaratorIdContext.class,0); + } + public TerminalNode VAR() { return getToken(Java17Parser.VAR, 0); } + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public List variableModifier() { + return getRuleContexts(VariableModifierContext.class); + } + public VariableModifierContext variableModifier(int i) { + return getRuleContext(VariableModifierContext.class,i); + } + public ClassOrInterfaceTypeContext classOrInterfaceType() { + return getRuleContext(ClassOrInterfaceTypeContext.class,0); + } + public ResourceContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_resource; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterResource(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitResource(this); + } + } + + public final ResourceContext resource() throws RecognitionException { + ResourceContext _localctx = new ResourceContext(_ctx, getState()); + enterRule(_localctx, 192, RULE_resource); + try { + int _alt; + setState(1274); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,151,_ctx) ) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(1259); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,148,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + setState(1256); + variableModifier(); + } + } + } + setState(1261); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,148,_ctx); + } + setState(1268); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,150,_ctx) ) { + case 1: + { + setState(1263); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,149,_ctx) ) { + case 1: + { + setState(1262); + classOrInterfaceType(); + } + break; + } + setState(1265); + variableDeclaratorId(); + } + break; + case 2: + { + setState(1266); + match(VAR); + setState(1267); + identifier(); + } + break; + } + setState(1270); + match(ASSIGN); + setState(1271); + expression(0); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(1273); + identifier(); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class SwitchBlockStatementGroupContext extends ParserRuleContext { + public List switchLabel() { + return getRuleContexts(SwitchLabelContext.class); + } + public SwitchLabelContext switchLabel(int i) { + return getRuleContext(SwitchLabelContext.class,i); + } + public List blockStatement() { + return getRuleContexts(BlockStatementContext.class); + } + public BlockStatementContext blockStatement(int i) { + return getRuleContext(BlockStatementContext.class,i); + } + public SwitchBlockStatementGroupContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_switchBlockStatementGroup; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterSwitchBlockStatementGroup(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitSwitchBlockStatementGroup(this); + } + } + + public final SwitchBlockStatementGroupContext switchBlockStatementGroup() throws RecognitionException { + SwitchBlockStatementGroupContext _localctx = new SwitchBlockStatementGroupContext(_ctx, getState()); + enterRule(_localctx, 194, RULE_switchBlockStatementGroup); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1277); + _errHandler.sync(this); + _la = _input.LA(1); + do { + { + { + setState(1276); + switchLabel(); + } + } + setState(1279); + _errHandler.sync(this); + _la = _input.LA(1); + } while ( _la==CASE || _la==DEFAULT ); + setState(1282); + _errHandler.sync(this); + _la = _input.LA(1); + do { + { + { + setState(1281); + blockStatement(); + } + } + setState(1284); + _errHandler.sync(this); + _la = _input.LA(1); + } while ( (((_la - 1)) & ~0x3f) == 0 && ((1L << (_la - 1)) & -334254282492513L) != 0 || (((_la - 65)) & ~0x3f) == 0 && ((1L << (_la - 65)) & -8935141145188974593L) != 0 ); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class SwitchLabelContext extends ParserRuleContext { + public SwitchLabelContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_switchLabel; } + + public SwitchLabelContext() { } + public void copyFrom(SwitchLabelContext ctx) { + super.copyFrom(ctx); + } + } + @SuppressWarnings("CheckReturnValue") + public static class SwitchLabelPatternContext extends SwitchLabelContext { + public TerminalNode CASE() { return getToken(Java17Parser.CASE, 0); } + public PatternContext pattern() { + return getRuleContext(PatternContext.class,0); + } + public TerminalNode COLON() { return getToken(Java17Parser.COLON, 0); } + public SwitchLabelPatternContext(SwitchLabelContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterSwitchLabelPattern(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitSwitchLabelPattern(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class SwitchLabelConstContext extends SwitchLabelContext { + public ExpressionContext constantExpression; + public TerminalNode CASE() { return getToken(Java17Parser.CASE, 0); } + public TerminalNode COLON() { return getToken(Java17Parser.COLON, 0); } + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class,0); + } + public SwitchLabelConstContext(SwitchLabelContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterSwitchLabelConst(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitSwitchLabelConst(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class SwitchLabelDefaultContext extends SwitchLabelContext { + public TerminalNode DEFAULT() { return getToken(Java17Parser.DEFAULT, 0); } + public TerminalNode COLON() { return getToken(Java17Parser.COLON, 0); } + public SwitchLabelDefaultContext(SwitchLabelContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterSwitchLabelDefault(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitSwitchLabelDefault(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class SwitchLabelEnumContext extends SwitchLabelContext { + public Token enumConstantName; + public TerminalNode CASE() { return getToken(Java17Parser.CASE, 0); } + public TerminalNode COLON() { return getToken(Java17Parser.COLON, 0); } + public TerminalNode IDENTIFIER() { return getToken(Java17Parser.IDENTIFIER, 0); } + public SwitchLabelEnumContext(SwitchLabelContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterSwitchLabelEnum(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitSwitchLabelEnum(this); + } + } + + public final SwitchLabelContext switchLabel() throws RecognitionException { + SwitchLabelContext _localctx = new SwitchLabelContext(_ctx, getState()); + enterRule(_localctx, 196, RULE_switchLabel); + try { + setState(1299); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,154,_ctx) ) { + case 1: + _localctx = new SwitchLabelConstContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(1286); + match(CASE); + setState(1287); + ((SwitchLabelConstContext)_localctx).constantExpression = expression(0); + setState(1288); + match(COLON); + } + break; + case 2: + _localctx = new SwitchLabelEnumContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(1290); + match(CASE); + setState(1291); + ((SwitchLabelEnumContext)_localctx).enumConstantName = match(IDENTIFIER); + setState(1292); + match(COLON); + } + break; + case 3: + _localctx = new SwitchLabelPatternContext(_localctx); + enterOuterAlt(_localctx, 3); + { + setState(1293); + match(CASE); + setState(1294); + pattern(); + setState(1295); + match(COLON); + } + break; + case 4: + _localctx = new SwitchLabelDefaultContext(_localctx); + enterOuterAlt(_localctx, 4); + { + setState(1297); + match(DEFAULT); + setState(1298); + match(COLON); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ForControlContext extends ParserRuleContext { + public ExpressionListContext forUpdate; + public EnhancedForControlContext enhancedForControl() { + return getRuleContext(EnhancedForControlContext.class,0); + } + public List SEMI() { return getTokens(Java17Parser.SEMI); } + public TerminalNode SEMI(int i) { + return getToken(Java17Parser.SEMI, i); + } + public ForInitContext forInit() { + return getRuleContext(ForInitContext.class,0); + } + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class,0); + } + public ExpressionListContext expressionList() { + return getRuleContext(ExpressionListContext.class,0); + } + public ForControlContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_forControl; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterForControl(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitForControl(this); + } + } + + public final ForControlContext forControl() throws RecognitionException { + ForControlContext _localctx = new ForControlContext(_ctx, getState()); + enterRule(_localctx, 198, RULE_forControl); + int _la; + try { + setState(1313); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,158,_ctx) ) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(1301); + enhancedForControl(); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(1303); + _errHandler.sync(this); + _la = _input.LA(1); + if ((((_la - 3)) & ~0x3f) == 0 && ((1L << (_la - 3)) & 9223127275610998821L) != 0 || (((_la - 67)) & ~0x3f) == 0 && ((1L << (_la - 67)) & 2377900732130004991L) != 0) { + { + setState(1302); + forInit(); + } + } + + setState(1305); + match(SEMI); + setState(1307); + _errHandler.sync(this); + _la = _input.LA(1); + if ((((_la - 3)) & ~0x3f) == 0 && ((1L << (_la - 3)) & 9223127275610966053L) != 0 || (((_la - 67)) & ~0x3f) == 0 && ((1L << (_la - 67)) & 2377900732130004991L) != 0) { + { + setState(1306); + expression(0); + } + } + + setState(1309); + match(SEMI); + setState(1311); + _errHandler.sync(this); + _la = _input.LA(1); + if ((((_la - 3)) & ~0x3f) == 0 && ((1L << (_la - 3)) & 9223127275610966053L) != 0 || (((_la - 67)) & ~0x3f) == 0 && ((1L << (_la - 67)) & 2377900732130004991L) != 0) { + { + setState(1310); + ((ForControlContext)_localctx).forUpdate = expressionList(); + } + } + + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ForInitContext extends ParserRuleContext { + public LocalVariableDeclarationContext localVariableDeclaration() { + return getRuleContext(LocalVariableDeclarationContext.class,0); + } + public ExpressionListContext expressionList() { + return getRuleContext(ExpressionListContext.class,0); + } + public ForInitContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_forInit; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterForInit(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitForInit(this); + } + } + + public final ForInitContext forInit() throws RecognitionException { + ForInitContext _localctx = new ForInitContext(_ctx, getState()); + enterRule(_localctx, 200, RULE_forInit); + try { + setState(1317); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,159,_ctx) ) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(1315); + localVariableDeclaration(); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(1316); + expressionList(); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class EnhancedForControlContext extends ParserRuleContext { + public VariableDeclaratorIdContext variableDeclaratorId() { + return getRuleContext(VariableDeclaratorIdContext.class,0); + } + public TerminalNode COLON() { return getToken(Java17Parser.COLON, 0); } + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class,0); + } + public TerminalNode VAR() { return getToken(Java17Parser.VAR, 0); } + public List variableModifier() { + return getRuleContexts(VariableModifierContext.class); + } + public VariableModifierContext variableModifier(int i) { + return getRuleContext(VariableModifierContext.class,i); + } + public TypeTypeContext typeType() { + return getRuleContext(TypeTypeContext.class,0); + } + public EnhancedForControlContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_enhancedForControl; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterEnhancedForControl(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitEnhancedForControl(this); + } + } + + public final EnhancedForControlContext enhancedForControl() throws RecognitionException { + EnhancedForControlContext _localctx = new EnhancedForControlContext(_ctx, getState()); + enterRule(_localctx, 202, RULE_enhancedForControl); + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(1322); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,160,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + setState(1319); + variableModifier(); + } + } + } + setState(1324); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,160,_ctx); + } + setState(1329); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,162,_ctx) ) { + case 1: + { + setState(1326); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,161,_ctx) ) { + case 1: + { + setState(1325); + typeType(); + } + break; + } + } + break; + case 2: + { + setState(1328); + match(VAR); + } + break; + } + setState(1331); + variableDeclaratorId(); + setState(1332); + match(COLON); + setState(1333); + expression(0); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ParExpressionContext extends ParserRuleContext { + public TerminalNode LPAREN() { return getToken(Java17Parser.LPAREN, 0); } + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class,0); + } + public TerminalNode RPAREN() { return getToken(Java17Parser.RPAREN, 0); } + public ParExpressionContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_parExpression; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterParExpression(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitParExpression(this); + } + } + + public final ParExpressionContext parExpression() throws RecognitionException { + ParExpressionContext _localctx = new ParExpressionContext(_ctx, getState()); + enterRule(_localctx, 204, RULE_parExpression); + try { + enterOuterAlt(_localctx, 1); + { + setState(1335); + match(LPAREN); + setState(1336); + expression(0); + setState(1337); + match(RPAREN); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ExpressionListContext extends ParserRuleContext { + public List expression() { + return getRuleContexts(ExpressionContext.class); + } + public ExpressionContext expression(int i) { + return getRuleContext(ExpressionContext.class,i); + } + public List COMMA() { return getTokens(Java17Parser.COMMA); } + public TerminalNode COMMA(int i) { + return getToken(Java17Parser.COMMA, i); + } + public ExpressionListContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_expressionList; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterExpressionList(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitExpressionList(this); + } + } + + public final ExpressionListContext expressionList() throws RecognitionException { + ExpressionListContext _localctx = new ExpressionListContext(_ctx, getState()); + enterRule(_localctx, 206, RULE_expressionList); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1339); + expression(0); + setState(1344); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==COMMA) { + { + { + setState(1340); + match(COMMA); + setState(1341); + expression(0); + } + } + setState(1346); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class MethodCallContext extends ParserRuleContext { + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public TerminalNode LPAREN() { return getToken(Java17Parser.LPAREN, 0); } + public TerminalNode RPAREN() { return getToken(Java17Parser.RPAREN, 0); } + public ExpressionListContext expressionList() { + return getRuleContext(ExpressionListContext.class,0); + } + public TerminalNode THIS() { return getToken(Java17Parser.THIS, 0); } + public TerminalNode SUPER() { return getToken(Java17Parser.SUPER, 0); } + public MethodCallContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_methodCall; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterMethodCall(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitMethodCall(this); + } + } + + public final MethodCallContext methodCall() throws RecognitionException { + MethodCallContext _localctx = new MethodCallContext(_ctx, getState()); + enterRule(_localctx, 208, RULE_methodCall); + int _la; + try { + setState(1366); + _errHandler.sync(this); + switch (_input.LA(1)) { + case MODULE: + case OPEN: + case REQUIRES: + case EXPORTS: + case OPENS: + case TO: + case USES: + case PROVIDES: + case WITH: + case TRANSITIVE: + case VAR: + case YIELD: + case RECORD: + case SEALED: + case PERMITS: + case IDENTIFIER: + enterOuterAlt(_localctx, 1); + { + setState(1347); + identifier(); + setState(1348); + match(LPAREN); + setState(1350); + _errHandler.sync(this); + _la = _input.LA(1); + if ((((_la - 3)) & ~0x3f) == 0 && ((1L << (_la - 3)) & 9223127275610966053L) != 0 || (((_la - 67)) & ~0x3f) == 0 && ((1L << (_la - 67)) & 2377900732130004991L) != 0) { + { + setState(1349); + expressionList(); + } + } + + setState(1352); + match(RPAREN); + } + break; + case THIS: + enterOuterAlt(_localctx, 2); + { + setState(1354); + match(THIS); + setState(1355); + match(LPAREN); + setState(1357); + _errHandler.sync(this); + _la = _input.LA(1); + if ((((_la - 3)) & ~0x3f) == 0 && ((1L << (_la - 3)) & 9223127275610966053L) != 0 || (((_la - 67)) & ~0x3f) == 0 && ((1L << (_la - 67)) & 2377900732130004991L) != 0) { + { + setState(1356); + expressionList(); + } + } + + setState(1359); + match(RPAREN); + } + break; + case SUPER: + enterOuterAlt(_localctx, 3); + { + setState(1360); + match(SUPER); + setState(1361); + match(LPAREN); + setState(1363); + _errHandler.sync(this); + _la = _input.LA(1); + if ((((_la - 3)) & ~0x3f) == 0 && ((1L << (_la - 3)) & 9223127275610966053L) != 0 || (((_la - 67)) & ~0x3f) == 0 && ((1L << (_la - 67)) & 2377900732130004991L) != 0) { + { + setState(1362); + expressionList(); + } + } + + setState(1365); + match(RPAREN); + } + break; + default: + throw new NoViableAltException(this); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ExpressionContext extends ParserRuleContext { + public ExpressionContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_expression; } + + public ExpressionContext() { } + public void copyFrom(ExpressionContext ctx) { + super.copyFrom(ctx); + } + } + @SuppressWarnings("CheckReturnValue") + public static class CastexpressionContext extends ExpressionContext { + public TerminalNode LPAREN() { return getToken(Java17Parser.LPAREN, 0); } + public List typeType() { + return getRuleContexts(TypeTypeContext.class); + } + public TypeTypeContext typeType(int i) { + return getRuleContext(TypeTypeContext.class,i); + } + public TerminalNode RPAREN() { return getToken(Java17Parser.RPAREN, 0); } + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class,0); + } + public List annotation() { + return getRuleContexts(AnnotationContext.class); + } + public AnnotationContext annotation(int i) { + return getRuleContext(AnnotationContext.class,i); + } + public List BITAND() { return getTokens(Java17Parser.BITAND); } + public TerminalNode BITAND(int i) { + return getToken(Java17Parser.BITAND, i); + } + public CastexpressionContext(ExpressionContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterCastexpression(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitCastexpression(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class ArrayaccessexpressionContext extends ExpressionContext { + public List expression() { + return getRuleContexts(ExpressionContext.class); + } + public ExpressionContext expression(int i) { + return getRuleContext(ExpressionContext.class,i); + } + public TerminalNode LBRACK() { return getToken(Java17Parser.LBRACK, 0); } + public TerminalNode RBRACK() { return getToken(Java17Parser.RBRACK, 0); } + public ArrayaccessexpressionContext(ExpressionContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterArrayaccessexpression(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitArrayaccessexpression(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class NewinstanceexpressionContext extends ExpressionContext { + public TerminalNode NEW() { return getToken(Java17Parser.NEW, 0); } + public CreatorContext creator() { + return getRuleContext(CreatorContext.class,0); + } + public NewinstanceexpressionContext(ExpressionContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterNewinstanceexpression(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitNewinstanceexpression(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class BitwiseandexpressionContext extends ExpressionContext { + public Token bop; + public List expression() { + return getRuleContexts(ExpressionContext.class); + } + public ExpressionContext expression(int i) { + return getRuleContext(ExpressionContext.class,i); + } + public TerminalNode BITAND() { return getToken(Java17Parser.BITAND, 0); } + public BitwiseandexpressionContext(ExpressionContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterBitwiseandexpression(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitBitwiseandexpression(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class PrimaryExpression2Context extends ExpressionContext { + public PrimaryContext primary() { + return getRuleContext(PrimaryContext.class,0); + } + public PrimaryExpression2Context(ExpressionContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterPrimaryExpression2(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitPrimaryExpression2(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class MethodcallexpressionContext extends ExpressionContext { + public MethodCallContext methodCall() { + return getRuleContext(MethodCallContext.class,0); + } + public MethodcallexpressionContext(ExpressionContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterMethodcallexpression(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitMethodcallexpression(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class ConditionalassignexpressionContext extends ExpressionContext { + public Token bop; + public List expression() { + return getRuleContexts(ExpressionContext.class); + } + public ExpressionContext expression(int i) { + return getRuleContext(ExpressionContext.class,i); + } + public TerminalNode COLON() { return getToken(Java17Parser.COLON, 0); } + public TerminalNode QUESTION() { return getToken(Java17Parser.QUESTION, 0); } + public ConditionalassignexpressionContext(ExpressionContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterConditionalassignexpression(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitConditionalassignexpression(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class MethodorcreatorreferenceexpressionContext extends ExpressionContext { + public TypeTypeContext typeType() { + return getRuleContext(TypeTypeContext.class,0); + } + public TerminalNode COLONCOLON() { return getToken(Java17Parser.COLONCOLON, 0); } + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public TerminalNode NEW() { return getToken(Java17Parser.NEW, 0); } + public TypeArgumentsContext typeArguments() { + return getRuleContext(TypeArgumentsContext.class,0); + } + public MethodorcreatorreferenceexpressionContext(ExpressionContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterMethodorcreatorreferenceexpression(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitMethodorcreatorreferenceexpression(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class ShiftexpressionContext extends ExpressionContext { + public List expression() { + return getRuleContexts(ExpressionContext.class); + } + public ExpressionContext expression(int i) { + return getRuleContext(ExpressionContext.class,i); + } + public List LT() { return getTokens(Java17Parser.LT); } + public TerminalNode LT(int i) { + return getToken(Java17Parser.LT, i); + } + public List GT() { return getTokens(Java17Parser.GT); } + public TerminalNode GT(int i) { + return getToken(Java17Parser.GT, i); + } + public ShiftexpressionContext(ExpressionContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterShiftexpression(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitShiftexpression(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class SwitchExpression2Context extends ExpressionContext { + public SwitchExpressionContext switchExpression() { + return getRuleContext(SwitchExpressionContext.class,0); + } + public SwitchExpression2Context(ExpressionContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterSwitchExpression2(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitSwitchExpression2(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class MathaddsubexpressionContext extends ExpressionContext { + public Token bop; + public List expression() { + return getRuleContexts(ExpressionContext.class); + } + public ExpressionContext expression(int i) { + return getRuleContext(ExpressionContext.class,i); + } + public TerminalNode ADD() { return getToken(Java17Parser.ADD, 0); } + public TerminalNode SUB() { return getToken(Java17Parser.SUB, 0); } + public MathaddsubexpressionContext(ExpressionContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterMathaddsubexpression(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitMathaddsubexpression(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class DottedexpressionContext extends ExpressionContext { + public Token bop; + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class,0); + } + public TerminalNode DOT() { return getToken(Java17Parser.DOT, 0); } + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public MethodCallContext methodCall() { + return getRuleContext(MethodCallContext.class,0); + } + public TerminalNode THIS() { return getToken(Java17Parser.THIS, 0); } + public TerminalNode NEW() { return getToken(Java17Parser.NEW, 0); } + public InnerCreatorContext innerCreator() { + return getRuleContext(InnerCreatorContext.class,0); + } + public TerminalNode SUPER() { return getToken(Java17Parser.SUPER, 0); } + public SuperSuffixContext superSuffix() { + return getRuleContext(SuperSuffixContext.class,0); + } + public ExplicitGenericInvocationContext explicitGenericInvocation() { + return getRuleContext(ExplicitGenericInvocationContext.class,0); + } + public NonWildcardTypeArgumentsContext nonWildcardTypeArguments() { + return getRuleContext(NonWildcardTypeArgumentsContext.class,0); + } + public DottedexpressionContext(ExpressionContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterDottedexpression(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitDottedexpression(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class OrexpressionContext extends ExpressionContext { + public Token bop; + public List expression() { + return getRuleContexts(ExpressionContext.class); + } + public ExpressionContext expression(int i) { + return getRuleContext(ExpressionContext.class,i); + } + public TerminalNode OR() { return getToken(Java17Parser.OR, 0); } + public OrexpressionContext(ExpressionContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterOrexpression(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitOrexpression(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class AndexpressionContext extends ExpressionContext { + public Token bop; + public List expression() { + return getRuleContexts(ExpressionContext.class); + } + public ExpressionContext expression(int i) { + return getRuleContext(ExpressionContext.class,i); + } + public TerminalNode AND() { return getToken(Java17Parser.AND, 0); } + public AndexpressionContext(ExpressionContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterAndexpression(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitAndexpression(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class AssignexpressionContext extends ExpressionContext { + public Token bop; + public List expression() { + return getRuleContexts(ExpressionContext.class); + } + public ExpressionContext expression(int i) { + return getRuleContext(ExpressionContext.class,i); + } + public TerminalNode ASSIGN() { return getToken(Java17Parser.ASSIGN, 0); } + public TerminalNode ADD_ASSIGN() { return getToken(Java17Parser.ADD_ASSIGN, 0); } + public TerminalNode SUB_ASSIGN() { return getToken(Java17Parser.SUB_ASSIGN, 0); } + public TerminalNode MUL_ASSIGN() { return getToken(Java17Parser.MUL_ASSIGN, 0); } + public TerminalNode DIV_ASSIGN() { return getToken(Java17Parser.DIV_ASSIGN, 0); } + public TerminalNode AND_ASSIGN() { return getToken(Java17Parser.AND_ASSIGN, 0); } + public TerminalNode OR_ASSIGN() { return getToken(Java17Parser.OR_ASSIGN, 0); } + public TerminalNode XOR_ASSIGN() { return getToken(Java17Parser.XOR_ASSIGN, 0); } + public TerminalNode RSHIFT_ASSIGN() { return getToken(Java17Parser.RSHIFT_ASSIGN, 0); } + public TerminalNode URSHIFT_ASSIGN() { return getToken(Java17Parser.URSHIFT_ASSIGN, 0); } + public TerminalNode LSHIFT_ASSIGN() { return getToken(Java17Parser.LSHIFT_ASSIGN, 0); } + public TerminalNode MOD_ASSIGN() { return getToken(Java17Parser.MOD_ASSIGN, 0); } + public AssignexpressionContext(ExpressionContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterAssignexpression(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitAssignexpression(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class MathmuldivmodexpressionContext extends ExpressionContext { + public Token bop; + public List expression() { + return getRuleContexts(ExpressionContext.class); + } + public ExpressionContext expression(int i) { + return getRuleContext(ExpressionContext.class,i); + } + public TerminalNode MUL() { return getToken(Java17Parser.MUL, 0); } + public TerminalNode DIV() { return getToken(Java17Parser.DIV, 0); } + public TerminalNode MOD() { return getToken(Java17Parser.MOD, 0); } + public MathmuldivmodexpressionContext(ExpressionContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterMathmuldivmodexpression(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitMathmuldivmodexpression(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class EqualityexpressionContext extends ExpressionContext { + public Token bop; + public List expression() { + return getRuleContexts(ExpressionContext.class); + } + public ExpressionContext expression(int i) { + return getRuleContext(ExpressionContext.class,i); + } + public TerminalNode EQUAL() { return getToken(Java17Parser.EQUAL, 0); } + public TerminalNode NOTEQUAL() { return getToken(Java17Parser.NOTEQUAL, 0); } + public EqualityexpressionContext(ExpressionContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterEqualityexpression(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitEqualityexpression(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class PostfixexpressionContext extends ExpressionContext { + public Token postfix; + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class,0); + } + public TerminalNode INC() { return getToken(Java17Parser.INC, 0); } + public TerminalNode DEC() { return getToken(Java17Parser.DEC, 0); } + public PostfixexpressionContext(ExpressionContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterPostfixexpression(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitPostfixexpression(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class PrefixexpressionContext extends ExpressionContext { + public Token prefix; + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class,0); + } + public TerminalNode ADD() { return getToken(Java17Parser.ADD, 0); } + public TerminalNode SUB() { return getToken(Java17Parser.SUB, 0); } + public TerminalNode INC() { return getToken(Java17Parser.INC, 0); } + public TerminalNode DEC() { return getToken(Java17Parser.DEC, 0); } + public TerminalNode TILDE() { return getToken(Java17Parser.TILDE, 0); } + public TerminalNode BANG() { return getToken(Java17Parser.BANG, 0); } + public PrefixexpressionContext(ExpressionContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterPrefixexpression(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitPrefixexpression(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class BitwiseorexpressionContext extends ExpressionContext { + public Token bop; + public List expression() { + return getRuleContexts(ExpressionContext.class); + } + public ExpressionContext expression(int i) { + return getRuleContext(ExpressionContext.class,i); + } + public TerminalNode BITOR() { return getToken(Java17Parser.BITOR, 0); } + public BitwiseorexpressionContext(ExpressionContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterBitwiseorexpression(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitBitwiseorexpression(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class CreatorreferenceexpressionContext extends ExpressionContext { + public ClassTypeContext classType() { + return getRuleContext(ClassTypeContext.class,0); + } + public TerminalNode COLONCOLON() { return getToken(Java17Parser.COLONCOLON, 0); } + public TerminalNode NEW() { return getToken(Java17Parser.NEW, 0); } + public TypeArgumentsContext typeArguments() { + return getRuleContext(TypeArgumentsContext.class,0); + } + public CreatorreferenceexpressionContext(ExpressionContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterCreatorreferenceexpression(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitCreatorreferenceexpression(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class LambdaExpression2Context extends ExpressionContext { + public LambdaExpressionContext lambdaExpression() { + return getRuleContext(LambdaExpressionContext.class,0); + } + public LambdaExpression2Context(ExpressionContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterLambdaExpression2(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitLambdaExpression2(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class BitwisexorexpressionContext extends ExpressionContext { + public Token bop; + public List expression() { + return getRuleContexts(ExpressionContext.class); + } + public ExpressionContext expression(int i) { + return getRuleContext(ExpressionContext.class,i); + } + public TerminalNode CARET() { return getToken(Java17Parser.CARET, 0); } + public BitwisexorexpressionContext(ExpressionContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterBitwisexorexpression(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitBitwisexorexpression(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class RelationalexpressionContext extends ExpressionContext { + public Token bop; + public List expression() { + return getRuleContexts(ExpressionContext.class); + } + public ExpressionContext expression(int i) { + return getRuleContext(ExpressionContext.class,i); + } + public TerminalNode LE() { return getToken(Java17Parser.LE, 0); } + public TerminalNode GE() { return getToken(Java17Parser.GE, 0); } + public TerminalNode GT() { return getToken(Java17Parser.GT, 0); } + public TerminalNode LT() { return getToken(Java17Parser.LT, 0); } + public RelationalexpressionContext(ExpressionContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterRelationalexpression(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitRelationalexpression(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class InstanceofexpressionContext extends ExpressionContext { + public Token bop; + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class,0); + } + public TerminalNode INSTANCEOF() { return getToken(Java17Parser.INSTANCEOF, 0); } + public TypeTypeContext typeType() { + return getRuleContext(TypeTypeContext.class,0); + } + public PatternContext pattern() { + return getRuleContext(PatternContext.class,0); + } + public InstanceofexpressionContext(ExpressionContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterInstanceofexpression(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitInstanceofexpression(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class MethodreferenceexpressionContext extends ExpressionContext { + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class,0); + } + public TerminalNode COLONCOLON() { return getToken(Java17Parser.COLONCOLON, 0); } + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public TypeArgumentsContext typeArguments() { + return getRuleContext(TypeArgumentsContext.class,0); + } + public MethodreferenceexpressionContext(ExpressionContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterMethodreferenceexpression(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitMethodreferenceexpression(this); + } + } + + public final ExpressionContext expression() throws RecognitionException { + return expression(0); + } + + private ExpressionContext expression(int _p) throws RecognitionException { + ParserRuleContext _parentctx = _ctx; + int _parentState = getState(); + ExpressionContext _localctx = new ExpressionContext(_ctx, _parentState); + ExpressionContext _prevctx = _localctx; + int _startState = 210; + enterRecursionRule(_localctx, 210, RULE_expression, _p); + int _la; + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(1411); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,173,_ctx) ) { + case 1: + { + _localctx = new PrimaryExpression2Context(_localctx); + _ctx = _localctx; + _prevctx = _localctx; + + setState(1369); + primary(); + } + break; + case 2: + { + _localctx = new MethodcallexpressionContext(_localctx); + _ctx = _localctx; + _prevctx = _localctx; + setState(1370); + methodCall(); + } + break; + case 3: + { + _localctx = new NewinstanceexpressionContext(_localctx); + _ctx = _localctx; + _prevctx = _localctx; + setState(1371); + match(NEW); + setState(1372); + creator(); + } + break; + case 4: + { + _localctx = new CastexpressionContext(_localctx); + _ctx = _localctx; + _prevctx = _localctx; + setState(1373); + match(LPAREN); + setState(1377); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,168,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + setState(1374); + annotation(); + } + } + } + setState(1379); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,168,_ctx); + } + setState(1380); + typeType(); + setState(1385); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==BITAND) { + { + { + setState(1381); + match(BITAND); + setState(1382); + typeType(); + } + } + setState(1387); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(1388); + match(RPAREN); + setState(1389); + expression(21); + } + break; + case 5: + { + _localctx = new PrefixexpressionContext(_localctx); + _ctx = _localctx; + _prevctx = _localctx; + setState(1391); + ((PrefixexpressionContext)_localctx).prefix = _input.LT(1); + _la = _input.LA(1); + if ( !((((_la - 90)) & ~0x3f) == 0 && ((1L << (_la - 90)) & 15363L) != 0) ) { + ((PrefixexpressionContext)_localctx).prefix = (Token)_errHandler.recoverInline(this); + } + else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + setState(1392); + expression(19); + } + break; + case 6: + { + _localctx = new LambdaExpression2Context(_localctx); + _ctx = _localctx; + _prevctx = _localctx; + setState(1393); + lambdaExpression(); + } + break; + case 7: + { + _localctx = new SwitchExpression2Context(_localctx); + _ctx = _localctx; + _prevctx = _localctx; + setState(1394); + switchExpression(); + } + break; + case 8: + { + _localctx = new MethodorcreatorreferenceexpressionContext(_localctx); + _ctx = _localctx; + _prevctx = _localctx; + setState(1395); + typeType(); + setState(1396); + match(COLONCOLON); + setState(1402); + _errHandler.sync(this); + switch (_input.LA(1)) { + case MODULE: + case OPEN: + case REQUIRES: + case EXPORTS: + case OPENS: + case TO: + case USES: + case PROVIDES: + case WITH: + case TRANSITIVE: + case VAR: + case YIELD: + case RECORD: + case SEALED: + case PERMITS: + case LT: + case IDENTIFIER: + { + setState(1398); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==LT) { + { + setState(1397); + typeArguments(); + } + } + + setState(1400); + identifier(); + } + break; + case NEW: + { + setState(1401); + match(NEW); + } + break; + default: + throw new NoViableAltException(this); + } + } + break; + case 9: + { + _localctx = new CreatorreferenceexpressionContext(_localctx); + _ctx = _localctx; + _prevctx = _localctx; + setState(1404); + classType(); + setState(1405); + match(COLONCOLON); + setState(1407); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==LT) { + { + setState(1406); + typeArguments(); + } + } + + setState(1409); + match(NEW); + } + break; + } + _ctx.stop = _input.LT(-1); + setState(1496); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,180,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + if ( _parseListeners!=null ) triggerExitRuleEvent(); + _prevctx = _localctx; + { + setState(1494); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,179,_ctx) ) { + case 1: + { + _localctx = new MathmuldivmodexpressionContext(new ExpressionContext(_parentctx, _parentState)); + pushNewRecursionContext(_localctx, _startState, RULE_expression); + setState(1413); + if (!(precpred(_ctx, 18))) throw new FailedPredicateException(this, "precpred(_ctx, 18)"); + setState(1414); + ((MathmuldivmodexpressionContext)_localctx).bop = _input.LT(1); + _la = _input.LA(1); + if ( !((((_la - 104)) & ~0x3f) == 0 && ((1L << (_la - 104)) & 35L) != 0) ) { + ((MathmuldivmodexpressionContext)_localctx).bop = (Token)_errHandler.recoverInline(this); + } + else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + setState(1415); + expression(19); + } + break; + case 2: + { + _localctx = new MathaddsubexpressionContext(new ExpressionContext(_parentctx, _parentState)); + pushNewRecursionContext(_localctx, _startState, RULE_expression); + setState(1416); + if (!(precpred(_ctx, 17))) throw new FailedPredicateException(this, "precpred(_ctx, 17)"); + setState(1417); + ((MathaddsubexpressionContext)_localctx).bop = _input.LT(1); + _la = _input.LA(1); + if ( !(_la==ADD || _la==SUB) ) { + ((MathaddsubexpressionContext)_localctx).bop = (Token)_errHandler.recoverInline(this); + } + else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + setState(1418); + expression(18); + } + break; + case 3: + { + _localctx = new ShiftexpressionContext(new ExpressionContext(_parentctx, _parentState)); + pushNewRecursionContext(_localctx, _startState, RULE_expression); + setState(1419); + if (!(precpred(_ctx, 16))) throw new FailedPredicateException(this, "precpred(_ctx, 16)"); + setState(1427); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,174,_ctx) ) { + case 1: + { + setState(1420); + match(LT); + setState(1421); + match(LT); + } + break; + case 2: + { + setState(1422); + match(GT); + setState(1423); + match(GT); + setState(1424); + match(GT); + } + break; + case 3: + { + setState(1425); + match(GT); + setState(1426); + match(GT); + } + break; + } + setState(1429); + expression(17); + } + break; + case 4: + { + _localctx = new RelationalexpressionContext(new ExpressionContext(_parentctx, _parentState)); + pushNewRecursionContext(_localctx, _startState, RULE_expression); + setState(1430); + if (!(precpred(_ctx, 15))) throw new FailedPredicateException(this, "precpred(_ctx, 15)"); + setState(1431); + ((RelationalexpressionContext)_localctx).bop = _input.LT(1); + _la = _input.LA(1); + if ( !((((_la - 88)) & ~0x3f) == 0 && ((1L << (_la - 88)) & 387L) != 0) ) { + ((RelationalexpressionContext)_localctx).bop = (Token)_errHandler.recoverInline(this); + } + else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + setState(1432); + expression(16); + } + break; + case 5: + { + _localctx = new EqualityexpressionContext(new ExpressionContext(_parentctx, _parentState)); + pushNewRecursionContext(_localctx, _startState, RULE_expression); + setState(1433); + if (!(precpred(_ctx, 13))) throw new FailedPredicateException(this, "precpred(_ctx, 13)"); + setState(1434); + ((EqualityexpressionContext)_localctx).bop = _input.LT(1); + _la = _input.LA(1); + if ( !(_la==EQUAL || _la==NOTEQUAL) ) { + ((EqualityexpressionContext)_localctx).bop = (Token)_errHandler.recoverInline(this); + } + else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + setState(1435); + expression(14); + } + break; + case 6: + { + _localctx = new BitwiseandexpressionContext(new ExpressionContext(_parentctx, _parentState)); + pushNewRecursionContext(_localctx, _startState, RULE_expression); + setState(1436); + if (!(precpred(_ctx, 12))) throw new FailedPredicateException(this, "precpred(_ctx, 12)"); + setState(1437); + ((BitwiseandexpressionContext)_localctx).bop = match(BITAND); + setState(1438); + expression(13); + } + break; + case 7: + { + _localctx = new BitwisexorexpressionContext(new ExpressionContext(_parentctx, _parentState)); + pushNewRecursionContext(_localctx, _startState, RULE_expression); + setState(1439); + if (!(precpred(_ctx, 11))) throw new FailedPredicateException(this, "precpred(_ctx, 11)"); + setState(1440); + ((BitwisexorexpressionContext)_localctx).bop = match(CARET); + setState(1441); + expression(12); + } + break; + case 8: + { + _localctx = new BitwiseorexpressionContext(new ExpressionContext(_parentctx, _parentState)); + pushNewRecursionContext(_localctx, _startState, RULE_expression); + setState(1442); + if (!(precpred(_ctx, 10))) throw new FailedPredicateException(this, "precpred(_ctx, 10)"); + setState(1443); + ((BitwiseorexpressionContext)_localctx).bop = match(BITOR); + setState(1444); + expression(11); + } + break; + case 9: + { + _localctx = new AndexpressionContext(new ExpressionContext(_parentctx, _parentState)); + pushNewRecursionContext(_localctx, _startState, RULE_expression); + setState(1445); + if (!(precpred(_ctx, 9))) throw new FailedPredicateException(this, "precpred(_ctx, 9)"); + setState(1446); + ((AndexpressionContext)_localctx).bop = match(AND); + setState(1447); + expression(10); + } + break; + case 10: + { + _localctx = new OrexpressionContext(new ExpressionContext(_parentctx, _parentState)); + pushNewRecursionContext(_localctx, _startState, RULE_expression); + setState(1448); + if (!(precpred(_ctx, 8))) throw new FailedPredicateException(this, "precpred(_ctx, 8)"); + setState(1449); + ((OrexpressionContext)_localctx).bop = match(OR); + setState(1450); + expression(9); + } + break; + case 11: + { + _localctx = new ConditionalassignexpressionContext(new ExpressionContext(_parentctx, _parentState)); + pushNewRecursionContext(_localctx, _startState, RULE_expression); + setState(1451); + if (!(precpred(_ctx, 7))) throw new FailedPredicateException(this, "precpred(_ctx, 7)"); + setState(1452); + ((ConditionalassignexpressionContext)_localctx).bop = match(QUESTION); + setState(1453); + expression(0); + setState(1454); + match(COLON); + setState(1455); + expression(7); + } + break; + case 12: + { + _localctx = new AssignexpressionContext(new ExpressionContext(_parentctx, _parentState)); + pushNewRecursionContext(_localctx, _startState, RULE_expression); + setState(1457); + if (!(precpred(_ctx, 6))) throw new FailedPredicateException(this, "precpred(_ctx, 6)"); + setState(1458); + ((AssignexpressionContext)_localctx).bop = _input.LT(1); + _la = _input.LA(1); + if ( !((((_la - 87)) & ~0x3f) == 0 && ((1L << (_la - 87)) & 17171480577L) != 0) ) { + ((AssignexpressionContext)_localctx).bop = (Token)_errHandler.recoverInline(this); + } + else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + setState(1459); + expression(6); + } + break; + case 13: + { + _localctx = new DottedexpressionContext(new ExpressionContext(_parentctx, _parentState)); + pushNewRecursionContext(_localctx, _startState, RULE_expression); + setState(1460); + if (!(precpred(_ctx, 25))) throw new FailedPredicateException(this, "precpred(_ctx, 25)"); + setState(1461); + ((DottedexpressionContext)_localctx).bop = match(DOT); + setState(1473); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,176,_ctx) ) { + case 1: + { + setState(1462); + identifier(); + } + break; + case 2: + { + setState(1463); + methodCall(); + } + break; + case 3: + { + setState(1464); + match(THIS); + } + break; + case 4: + { + setState(1465); + match(NEW); + setState(1467); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==LT) { + { + setState(1466); + nonWildcardTypeArguments(); + } + } + + setState(1469); + innerCreator(); + } + break; + case 5: + { + setState(1470); + match(SUPER); + setState(1471); + superSuffix(); + } + break; + case 6: + { + setState(1472); + explicitGenericInvocation(); + } + break; + } + } + break; + case 14: + { + _localctx = new ArrayaccessexpressionContext(new ExpressionContext(_parentctx, _parentState)); + pushNewRecursionContext(_localctx, _startState, RULE_expression); + setState(1475); + if (!(precpred(_ctx, 24))) throw new FailedPredicateException(this, "precpred(_ctx, 24)"); + setState(1476); + match(LBRACK); + setState(1477); + expression(0); + setState(1478); + match(RBRACK); + } + break; + case 15: + { + _localctx = new PostfixexpressionContext(new ExpressionContext(_parentctx, _parentState)); + pushNewRecursionContext(_localctx, _startState, RULE_expression); + setState(1480); + if (!(precpred(_ctx, 20))) throw new FailedPredicateException(this, "precpred(_ctx, 20)"); + setState(1481); + ((PostfixexpressionContext)_localctx).postfix = _input.LT(1); + _la = _input.LA(1); + if ( !(_la==INC || _la==DEC) ) { + ((PostfixexpressionContext)_localctx).postfix = (Token)_errHandler.recoverInline(this); + } + else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + } + break; + case 16: + { + _localctx = new InstanceofexpressionContext(new ExpressionContext(_parentctx, _parentState)); + pushNewRecursionContext(_localctx, _startState, RULE_expression); + setState(1482); + if (!(precpred(_ctx, 14))) throw new FailedPredicateException(this, "precpred(_ctx, 14)"); + setState(1483); + ((InstanceofexpressionContext)_localctx).bop = match(INSTANCEOF); + setState(1486); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,177,_ctx) ) { + case 1: + { + setState(1484); + typeType(); + } + break; + case 2: + { + setState(1485); + pattern(); + } + break; + } + } + break; + case 17: + { + _localctx = new MethodreferenceexpressionContext(new ExpressionContext(_parentctx, _parentState)); + pushNewRecursionContext(_localctx, _startState, RULE_expression); + setState(1488); + if (!(precpred(_ctx, 3))) throw new FailedPredicateException(this, "precpred(_ctx, 3)"); + setState(1489); + match(COLONCOLON); + setState(1491); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==LT) { + { + setState(1490); + typeArguments(); + } + } + + setState(1493); + identifier(); + } + break; + } + } + } + setState(1498); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,180,_ctx); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + unrollRecursionContexts(_parentctx); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class PatternContext extends ParserRuleContext { + public PatternContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_pattern; } + + public PatternContext() { } + public void copyFrom(PatternContext ctx) { + super.copyFrom(ctx); + } + } + @SuppressWarnings("CheckReturnValue") + public static class GPatternContext extends PatternContext { + public GuardedPatternContext guardedPattern() { + return getRuleContext(GuardedPatternContext.class,0); + } + public GPatternContext(PatternContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterGPattern(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitGPattern(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class PPatternContext extends PatternContext { + public PrimaryPatternContext primaryPattern() { + return getRuleContext(PrimaryPatternContext.class,0); + } + public PPatternContext(PatternContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterPPattern(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitPPattern(this); + } + } + + public final PatternContext pattern() throws RecognitionException { + PatternContext _localctx = new PatternContext(_ctx, getState()); + enterRule(_localctx, 212, RULE_pattern); + try { + setState(1501); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,181,_ctx) ) { + case 1: + _localctx = new PPatternContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(1499); + primaryPattern(); + } + break; + case 2: + _localctx = new GPatternContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(1500); + guardedPattern(); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class PrimaryPatternContext extends ParserRuleContext { + public PrimaryPatternContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_primaryPattern; } + + public PrimaryPatternContext() { } + public void copyFrom(PrimaryPatternContext ctx) { + super.copyFrom(ctx); + } + } + @SuppressWarnings("CheckReturnValue") + public static class EnclosedPatternContext extends PrimaryPatternContext { + public TerminalNode LPAREN() { return getToken(Java17Parser.LPAREN, 0); } + public PatternContext pattern() { + return getRuleContext(PatternContext.class,0); + } + public TerminalNode RPAREN() { return getToken(Java17Parser.RPAREN, 0); } + public EnclosedPatternContext(PrimaryPatternContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterEnclosedPattern(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitEnclosedPattern(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class TPatternContext extends PrimaryPatternContext { + public TypePatternContext typePattern() { + return getRuleContext(TypePatternContext.class,0); + } + public TPatternContext(PrimaryPatternContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterTPattern(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitTPattern(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class RPatternContext extends PrimaryPatternContext { + public RecordPatternContext recordPattern() { + return getRuleContext(RecordPatternContext.class,0); + } + public RPatternContext(PrimaryPatternContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterRPattern(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitRPattern(this); + } + } + + public final PrimaryPatternContext primaryPattern() throws RecognitionException { + PrimaryPatternContext _localctx = new PrimaryPatternContext(_ctx, getState()); + enterRule(_localctx, 214, RULE_primaryPattern); + try { + setState(1509); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,182,_ctx) ) { + case 1: + _localctx = new TPatternContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(1503); + typePattern(); + } + break; + case 2: + _localctx = new RPatternContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(1504); + recordPattern(); + } + break; + case 3: + _localctx = new EnclosedPatternContext(_localctx); + enterOuterAlt(_localctx, 3); + { + setState(1505); + match(LPAREN); + setState(1506); + pattern(); + setState(1507); + match(RPAREN); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class RecordPatternContext extends ParserRuleContext { + public TypeTypeContext typeType() { + return getRuleContext(TypeTypeContext.class,0); + } + public RecordStructurePatternContext recordStructurePattern() { + return getRuleContext(RecordStructurePatternContext.class,0); + } + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public RecordPatternContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_recordPattern; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterRecordPattern(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitRecordPattern(this); + } + } + + public final RecordPatternContext recordPattern() throws RecognitionException { + RecordPatternContext _localctx = new RecordPatternContext(_ctx, getState()); + enterRule(_localctx, 216, RULE_recordPattern); + try { + enterOuterAlt(_localctx, 1); + { + setState(1511); + typeType(); + setState(1512); + recordStructurePattern(); + setState(1514); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,183,_ctx) ) { + case 1: + { + setState(1513); + identifier(); + } + break; + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class TypePatternContext extends ParserRuleContext { + public TypeTypeContext typeType() { + return getRuleContext(TypeTypeContext.class,0); + } + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public List variableModifier() { + return getRuleContexts(VariableModifierContext.class); + } + public VariableModifierContext variableModifier(int i) { + return getRuleContext(VariableModifierContext.class,i); + } + public TypePatternContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_typePattern; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterTypePattern(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitTypePattern(this); + } + } + + public final TypePatternContext typePattern() throws RecognitionException { + TypePatternContext _localctx = new TypePatternContext(_ctx, getState()); + enterRule(_localctx, 218, RULE_typePattern); + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(1519); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,184,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + setState(1516); + variableModifier(); + } + } + } + setState(1521); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,184,_ctx); + } + setState(1522); + typeType(); + setState(1523); + identifier(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class RecordStructurePatternContext extends ParserRuleContext { + public TerminalNode LPAREN() { return getToken(Java17Parser.LPAREN, 0); } + public TerminalNode RPAREN() { return getToken(Java17Parser.RPAREN, 0); } + public RecordComponentPatternListContext recordComponentPatternList() { + return getRuleContext(RecordComponentPatternListContext.class,0); + } + public RecordStructurePatternContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_recordStructurePattern; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterRecordStructurePattern(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitRecordStructurePattern(this); + } + } + + public final RecordStructurePatternContext recordStructurePattern() throws RecognitionException { + RecordStructurePatternContext _localctx = new RecordStructurePatternContext(_ctx, getState()); + enterRule(_localctx, 220, RULE_recordStructurePattern); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1525); + match(LPAREN); + setState(1527); + _errHandler.sync(this); + _la = _input.LA(1); + if ((((_la - 3)) & ~0x3f) == 0 && ((1L << (_la - 3)) & 9223090579141986341L) != 0 || (((_la - 78)) & ~0x3f) == 0 && ((1L << (_la - 78)) & 1161084278931457L) != 0) { + { + setState(1526); + recordComponentPatternList(); + } + } + + setState(1529); + match(RPAREN); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class RecordComponentPatternElementContext extends ParserRuleContext { + public PatternContext pattern() { + return getRuleContext(PatternContext.class,0); + } + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public RecordComponentPatternElementContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_recordComponentPatternElement; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterRecordComponentPatternElement(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitRecordComponentPatternElement(this); + } + } + + public final RecordComponentPatternElementContext recordComponentPatternElement() throws RecognitionException { + RecordComponentPatternElementContext _localctx = new RecordComponentPatternElementContext(_ctx, getState()); + enterRule(_localctx, 222, RULE_recordComponentPatternElement); + try { + setState(1533); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,186,_ctx) ) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(1531); + pattern(); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(1532); + identifier(); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class RecordComponentPatternListContext extends ParserRuleContext { + public List pattern() { + return getRuleContexts(PatternContext.class); + } + public PatternContext pattern(int i) { + return getRuleContext(PatternContext.class,i); + } + public List COMMA() { return getTokens(Java17Parser.COMMA); } + public TerminalNode COMMA(int i) { + return getToken(Java17Parser.COMMA, i); + } + public RecordComponentPatternListContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_recordComponentPatternList; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterRecordComponentPatternList(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitRecordComponentPatternList(this); + } + } + + public final RecordComponentPatternListContext recordComponentPatternList() throws RecognitionException { + RecordComponentPatternListContext _localctx = new RecordComponentPatternListContext(_ctx, getState()); + enterRule(_localctx, 224, RULE_recordComponentPatternList); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1535); + pattern(); + setState(1540); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==COMMA) { + { + { + setState(1536); + match(COMMA); + setState(1537); + pattern(); + } + } + setState(1542); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class LambdaExpressionContext extends ParserRuleContext { + public LambdaParametersContext lambdaParameters() { + return getRuleContext(LambdaParametersContext.class,0); + } + public TerminalNode ARROW() { return getToken(Java17Parser.ARROW, 0); } + public LambdaBodyContext lambdaBody() { + return getRuleContext(LambdaBodyContext.class,0); + } + public LambdaExpressionContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_lambdaExpression; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterLambdaExpression(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitLambdaExpression(this); + } + } + + public final LambdaExpressionContext lambdaExpression() throws RecognitionException { + LambdaExpressionContext _localctx = new LambdaExpressionContext(_ctx, getState()); + enterRule(_localctx, 226, RULE_lambdaExpression); + try { + enterOuterAlt(_localctx, 1); + { + setState(1543); + lambdaParameters(); + setState(1544); + match(ARROW); + setState(1545); + lambdaBody(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class LambdaParametersContext extends ParserRuleContext { + public List identifier() { + return getRuleContexts(IdentifierContext.class); + } + public IdentifierContext identifier(int i) { + return getRuleContext(IdentifierContext.class,i); + } + public TerminalNode LPAREN() { return getToken(Java17Parser.LPAREN, 0); } + public TerminalNode RPAREN() { return getToken(Java17Parser.RPAREN, 0); } + public FormalParameterListContext formalParameterList() { + return getRuleContext(FormalParameterListContext.class,0); + } + public List COMMA() { return getTokens(Java17Parser.COMMA); } + public TerminalNode COMMA(int i) { + return getToken(Java17Parser.COMMA, i); + } + public LambdaLVTIListContext lambdaLVTIList() { + return getRuleContext(LambdaLVTIListContext.class,0); + } + public LambdaParametersContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_lambdaParameters; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterLambdaParameters(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitLambdaParameters(this); + } + } + + public final LambdaParametersContext lambdaParameters() throws RecognitionException { + LambdaParametersContext _localctx = new LambdaParametersContext(_ctx, getState()); + enterRule(_localctx, 228, RULE_lambdaParameters); + int _la; + try { + setState(1569); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,191,_ctx) ) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(1547); + identifier(); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(1548); + match(LPAREN); + setState(1550); + _errHandler.sync(this); + _la = _input.LA(1); + if ((((_la - 3)) & ~0x3f) == 0 && ((1L << (_la - 3)) & 9223090579141986341L) != 0 || (((_la - 78)) & ~0x3f) == 0 && ((1L << (_la - 78)) & 1231453023109121L) != 0) { + { + setState(1549); + formalParameterList(); + } + } + + setState(1552); + match(RPAREN); + } + break; + case 3: + enterOuterAlt(_localctx, 3); + { + setState(1553); + match(LPAREN); + setState(1554); + identifier(); + setState(1559); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==COMMA) { + { + { + setState(1555); + match(COMMA); + setState(1556); + identifier(); + } + } + setState(1561); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(1562); + match(RPAREN); + } + break; + case 4: + enterOuterAlt(_localctx, 4); + { + setState(1564); + match(LPAREN); + setState(1566); + _errHandler.sync(this); + _la = _input.LA(1); + if ((((_la - 18)) & ~0x3f) == 0 && ((1L << (_la - 18)) & 281466386776065L) != 0 || _la==AT || _la==IDENTIFIER) { + { + setState(1565); + lambdaLVTIList(); + } + } + + setState(1568); + match(RPAREN); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class LambdaBodyContext extends ParserRuleContext { + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class,0); + } + public BlockContext block() { + return getRuleContext(BlockContext.class,0); + } + public LambdaBodyContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_lambdaBody; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterLambdaBody(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitLambdaBody(this); + } + } + + public final LambdaBodyContext lambdaBody() throws RecognitionException { + LambdaBodyContext _localctx = new LambdaBodyContext(_ctx, getState()); + enterRule(_localctx, 230, RULE_lambdaBody); + try { + setState(1573); + _errHandler.sync(this); + switch (_input.LA(1)) { + case BOOLEAN: + case BYTE: + case CHAR: + case DOUBLE: + case FLOAT: + case INT: + case LONG: + case NEW: + case SHORT: + case SUPER: + case SWITCH: + case THIS: + case VOID: + case MODULE: + case OPEN: + case REQUIRES: + case EXPORTS: + case OPENS: + case TO: + case USES: + case PROVIDES: + case WITH: + case TRANSITIVE: + case VAR: + case YIELD: + case RECORD: + case SEALED: + case PERMITS: + case DECIMAL_LITERAL: + case HEX_LITERAL: + case OCT_LITERAL: + case BINARY_LITERAL: + case FLOAT_LITERAL: + case HEX_FLOAT_LITERAL: + case BOOL_LITERAL: + case CHAR_LITERAL: + case STRING_LITERAL: + case TEXT_BLOCK: + case NULL_LITERAL: + case LPAREN: + case LT: + case BANG: + case TILDE: + case INC: + case DEC: + case ADD: + case SUB: + case AT: + case IDENTIFIER: + enterOuterAlt(_localctx, 1); + { + setState(1571); + expression(0); + } + break; + case LBRACE: + enterOuterAlt(_localctx, 2); + { + setState(1572); + block(); + } + break; + default: + throw new NoViableAltException(this); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class PrimaryContext extends ParserRuleContext { + public PrimaryContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_primary; } + + public PrimaryContext() { } + public void copyFrom(PrimaryContext ctx) { + super.copyFrom(ctx); + } + } + @SuppressWarnings("CheckReturnValue") + public static class PrimaryExpressionContext extends PrimaryContext { + public TerminalNode LPAREN() { return getToken(Java17Parser.LPAREN, 0); } + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class,0); + } + public TerminalNode RPAREN() { return getToken(Java17Parser.RPAREN, 0); } + public PrimaryExpressionContext(PrimaryContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterPrimaryExpression(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitPrimaryExpression(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class PrimaryInvocationContext extends PrimaryContext { + public NonWildcardTypeArgumentsContext nonWildcardTypeArguments() { + return getRuleContext(NonWildcardTypeArgumentsContext.class,0); + } + public ExplicitGenericInvocationSuffixContext explicitGenericInvocationSuffix() { + return getRuleContext(ExplicitGenericInvocationSuffixContext.class,0); + } + public TerminalNode THIS() { return getToken(Java17Parser.THIS, 0); } + public ArgumentsContext arguments() { + return getRuleContext(ArgumentsContext.class,0); + } + public PrimaryInvocationContext(PrimaryContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterPrimaryInvocation(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitPrimaryInvocation(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class PrimarySuperContext extends PrimaryContext { + public TerminalNode SUPER() { return getToken(Java17Parser.SUPER, 0); } + public PrimarySuperContext(PrimaryContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterPrimarySuper(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitPrimarySuper(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class PrimaryClassrefContext extends PrimaryContext { + public RefTypeContext refType() { + return getRuleContext(RefTypeContext.class,0); + } + public TerminalNode DOT() { return getToken(Java17Parser.DOT, 0); } + public TerminalNode CLASS() { return getToken(Java17Parser.CLASS, 0); } + public PrimaryClassrefContext(PrimaryContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterPrimaryClassref(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitPrimaryClassref(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class PrimaryThisContext extends PrimaryContext { + public TerminalNode THIS() { return getToken(Java17Parser.THIS, 0); } + public PrimaryThisContext(PrimaryContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterPrimaryThis(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitPrimaryThis(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class PrimaryIdentifierContext extends PrimaryContext { + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public PrimaryIdentifierContext(PrimaryContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterPrimaryIdentifier(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitPrimaryIdentifier(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class PrimaryLiteralContext extends PrimaryContext { + public LiteralContext literal() { + return getRuleContext(LiteralContext.class,0); + } + public PrimaryLiteralContext(PrimaryContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterPrimaryLiteral(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitPrimaryLiteral(this); + } + } + + public final PrimaryContext primary() throws RecognitionException { + PrimaryContext _localctx = new PrimaryContext(_ctx, getState()); + enterRule(_localctx, 232, RULE_primary); + try { + setState(1593); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,194,_ctx) ) { + case 1: + _localctx = new PrimaryExpressionContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(1575); + match(LPAREN); + setState(1576); + expression(0); + setState(1577); + match(RPAREN); + } + break; + case 2: + _localctx = new PrimaryThisContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(1579); + match(THIS); + } + break; + case 3: + _localctx = new PrimarySuperContext(_localctx); + enterOuterAlt(_localctx, 3); + { + setState(1580); + match(SUPER); + } + break; + case 4: + _localctx = new PrimaryLiteralContext(_localctx); + enterOuterAlt(_localctx, 4); + { + setState(1581); + literal(); + } + break; + case 5: + _localctx = new PrimaryIdentifierContext(_localctx); + enterOuterAlt(_localctx, 5); + { + setState(1582); + identifier(); + } + break; + case 6: + _localctx = new PrimaryClassrefContext(_localctx); + enterOuterAlt(_localctx, 6); + { + setState(1583); + refType(); + setState(1584); + match(DOT); + setState(1585); + match(CLASS); + } + break; + case 7: + _localctx = new PrimaryInvocationContext(_localctx); + enterOuterAlt(_localctx, 7); + { + setState(1587); + nonWildcardTypeArguments(); + setState(1591); + _errHandler.sync(this); + switch (_input.LA(1)) { + case SUPER: + case MODULE: + case OPEN: + case REQUIRES: + case EXPORTS: + case OPENS: + case TO: + case USES: + case PROVIDES: + case WITH: + case TRANSITIVE: + case VAR: + case YIELD: + case RECORD: + case SEALED: + case PERMITS: + case IDENTIFIER: + { + setState(1588); + explicitGenericInvocationSuffix(); + } + break; + case THIS: + { + setState(1589); + match(THIS); + setState(1590); + arguments(); + } + break; + default: + throw new NoViableAltException(this); + } + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class SwitchExpressionContext extends ParserRuleContext { + public TerminalNode SWITCH() { return getToken(Java17Parser.SWITCH, 0); } + public ParExpressionContext parExpression() { + return getRuleContext(ParExpressionContext.class,0); + } + public TerminalNode LBRACE() { return getToken(Java17Parser.LBRACE, 0); } + public TerminalNode RBRACE() { return getToken(Java17Parser.RBRACE, 0); } + public List switchLabeledRule() { + return getRuleContexts(SwitchLabeledRuleContext.class); + } + public SwitchLabeledRuleContext switchLabeledRule(int i) { + return getRuleContext(SwitchLabeledRuleContext.class,i); + } + public SwitchExpressionContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_switchExpression; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterSwitchExpression(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitSwitchExpression(this); + } + } + + public final SwitchExpressionContext switchExpression() throws RecognitionException { + SwitchExpressionContext _localctx = new SwitchExpressionContext(_ctx, getState()); + enterRule(_localctx, 234, RULE_switchExpression); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1595); + match(SWITCH); + setState(1596); + parExpression(); + setState(1597); + match(LBRACE); + setState(1601); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==CASE || _la==DEFAULT) { + { + { + setState(1598); + switchLabeledRule(); + } + } + setState(1603); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(1604); + match(RBRACE); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class SwitchLabeledRuleContext extends ParserRuleContext { + public SwitchLabelCaseContext switchLabelCase() { + return getRuleContext(SwitchLabelCaseContext.class,0); + } + public SwitchRuleOutcomeContext switchRuleOutcome() { + return getRuleContext(SwitchRuleOutcomeContext.class,0); + } + public SwitchLabeledRuleContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_switchLabeledRule; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterSwitchLabeledRule(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitSwitchLabeledRule(this); + } + } + + public final SwitchLabeledRuleContext switchLabeledRule() throws RecognitionException { + SwitchLabeledRuleContext _localctx = new SwitchLabeledRuleContext(_ctx, getState()); + enterRule(_localctx, 236, RULE_switchLabeledRule); + try { + enterOuterAlt(_localctx, 1); + { + setState(1606); + switchLabelCase(); + setState(1607); + switchRuleOutcome(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class SwitchLabelCaseContext extends ParserRuleContext { + public SwitchLabelCaseContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_switchLabelCase; } + + public SwitchLabelCaseContext() { } + public void copyFrom(SwitchLabelCaseContext ctx) { + super.copyFrom(ctx); + } + } + @SuppressWarnings("CheckReturnValue") + public static class LabeledRulePatternContext extends SwitchLabelCaseContext { + public TerminalNode CASE() { return getToken(Java17Parser.CASE, 0); } + public PatternContext pattern() { + return getRuleContext(PatternContext.class,0); + } + public TerminalNode ARROW() { return getToken(Java17Parser.ARROW, 0); } + public TerminalNode COLON() { return getToken(Java17Parser.COLON, 0); } + public LabeledRulePatternContext(SwitchLabelCaseContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterLabeledRulePattern(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitLabeledRulePattern(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class LabeledRuleNullContext extends SwitchLabelCaseContext { + public TerminalNode CASE() { return getToken(Java17Parser.CASE, 0); } + public TerminalNode NULL_LITERAL() { return getToken(Java17Parser.NULL_LITERAL, 0); } + public TerminalNode ARROW() { return getToken(Java17Parser.ARROW, 0); } + public TerminalNode COLON() { return getToken(Java17Parser.COLON, 0); } + public LabeledRuleNullContext(SwitchLabelCaseContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterLabeledRuleNull(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitLabeledRuleNull(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class LabeledRuleDefaultContext extends SwitchLabelCaseContext { + public TerminalNode DEFAULT() { return getToken(Java17Parser.DEFAULT, 0); } + public TerminalNode ARROW() { return getToken(Java17Parser.ARROW, 0); } + public TerminalNode COLON() { return getToken(Java17Parser.COLON, 0); } + public LabeledRuleDefaultContext(SwitchLabelCaseContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterLabeledRuleDefault(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitLabeledRuleDefault(this); + } + } + @SuppressWarnings("CheckReturnValue") + public static class LabeledRuleExprListContext extends SwitchLabelCaseContext { + public TerminalNode CASE() { return getToken(Java17Parser.CASE, 0); } + public ExpressionListContext expressionList() { + return getRuleContext(ExpressionListContext.class,0); + } + public TerminalNode ARROW() { return getToken(Java17Parser.ARROW, 0); } + public TerminalNode COLON() { return getToken(Java17Parser.COLON, 0); } + public LabeledRuleExprListContext(SwitchLabelCaseContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterLabeledRuleExprList(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitLabeledRuleExprList(this); + } + } + + public final SwitchLabelCaseContext switchLabelCase() throws RecognitionException { + SwitchLabelCaseContext _localctx = new SwitchLabelCaseContext(_ctx, getState()); + enterRule(_localctx, 238, RULE_switchLabelCase); + int _la; + try { + setState(1622); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,196,_ctx) ) { + case 1: + _localctx = new LabeledRuleExprListContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(1609); + match(CASE); + setState(1610); + expressionList(); + setState(1611); + _la = _input.LA(1); + if ( !(_la==COLON || _la==ARROW) ) { + _errHandler.recoverInline(this); + } + else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + } + break; + case 2: + _localctx = new LabeledRuleNullContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(1613); + match(CASE); + setState(1614); + match(NULL_LITERAL); + setState(1615); + _la = _input.LA(1); + if ( !(_la==COLON || _la==ARROW) ) { + _errHandler.recoverInline(this); + } + else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + } + break; + case 3: + _localctx = new LabeledRulePatternContext(_localctx); + enterOuterAlt(_localctx, 3); + { + setState(1616); + match(CASE); + setState(1617); + pattern(); + setState(1618); + _la = _input.LA(1); + if ( !(_la==COLON || _la==ARROW) ) { + _errHandler.recoverInline(this); + } + else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + } + break; + case 4: + _localctx = new LabeledRuleDefaultContext(_localctx); + enterOuterAlt(_localctx, 4); + { + setState(1620); + match(DEFAULT); + setState(1621); + _la = _input.LA(1); + if ( !(_la==COLON || _la==ARROW) ) { + _errHandler.recoverInline(this); + } + else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class GuardedPatternContext extends ParserRuleContext { + public PrimaryPatternContext primaryPattern() { + return getRuleContext(PrimaryPatternContext.class,0); + } + public TerminalNode WITH() { return getToken(Java17Parser.WITH, 0); } + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class,0); + } + public GuardedPatternContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_guardedPattern; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterGuardedPattern(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitGuardedPattern(this); + } + } + + public final GuardedPatternContext guardedPattern() throws RecognitionException { + GuardedPatternContext _localctx = new GuardedPatternContext(_ctx, getState()); + enterRule(_localctx, 240, RULE_guardedPattern); + try { + enterOuterAlt(_localctx, 1); + { + setState(1624); + primaryPattern(); + setState(1625); + match(WITH); + setState(1626); + expression(0); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class SwitchRuleOutcomeContext extends ParserRuleContext { + public BlockContext block() { + return getRuleContext(BlockContext.class,0); + } + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class,0); + } + public TerminalNode SEMI() { return getToken(Java17Parser.SEMI, 0); } + public SwitchRuleOutcomeContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_switchRuleOutcome; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterSwitchRuleOutcome(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitSwitchRuleOutcome(this); + } + } + + public final SwitchRuleOutcomeContext switchRuleOutcome() throws RecognitionException { + SwitchRuleOutcomeContext _localctx = new SwitchRuleOutcomeContext(_ctx, getState()); + enterRule(_localctx, 242, RULE_switchRuleOutcome); + try { + setState(1632); + _errHandler.sync(this); + switch (_input.LA(1)) { + case LBRACE: + enterOuterAlt(_localctx, 1); + { + setState(1628); + block(); + } + break; + case BOOLEAN: + case BYTE: + case CHAR: + case DOUBLE: + case FLOAT: + case INT: + case LONG: + case NEW: + case SHORT: + case SUPER: + case SWITCH: + case THIS: + case VOID: + case MODULE: + case OPEN: + case REQUIRES: + case EXPORTS: + case OPENS: + case TO: + case USES: + case PROVIDES: + case WITH: + case TRANSITIVE: + case VAR: + case YIELD: + case RECORD: + case SEALED: + case PERMITS: + case DECIMAL_LITERAL: + case HEX_LITERAL: + case OCT_LITERAL: + case BINARY_LITERAL: + case FLOAT_LITERAL: + case HEX_FLOAT_LITERAL: + case BOOL_LITERAL: + case CHAR_LITERAL: + case STRING_LITERAL: + case TEXT_BLOCK: + case NULL_LITERAL: + case LPAREN: + case LT: + case BANG: + case TILDE: + case INC: + case DEC: + case ADD: + case SUB: + case AT: + case IDENTIFIER: + enterOuterAlt(_localctx, 2); + { + setState(1629); + expression(0); + setState(1630); + match(SEMI); + } + break; + default: + throw new NoViableAltException(this); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ClassTypeContext extends ParserRuleContext { + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public ClassOrInterfaceTypeContext classOrInterfaceType() { + return getRuleContext(ClassOrInterfaceTypeContext.class,0); + } + public TerminalNode DOT() { return getToken(Java17Parser.DOT, 0); } + public List annotation() { + return getRuleContexts(AnnotationContext.class); + } + public AnnotationContext annotation(int i) { + return getRuleContext(AnnotationContext.class,i); + } + public TypeArgumentsContext typeArguments() { + return getRuleContext(TypeArgumentsContext.class,0); + } + public ClassTypeContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_classType; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterClassType(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitClassType(this); + } + } + + public final ClassTypeContext classType() throws RecognitionException { + ClassTypeContext _localctx = new ClassTypeContext(_ctx, getState()); + enterRule(_localctx, 244, RULE_classType); + int _la; + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(1637); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,198,_ctx) ) { + case 1: + { + setState(1634); + classOrInterfaceType(); + setState(1635); + match(DOT); + } + break; + } + setState(1642); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,199,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + setState(1639); + annotation(); + } + } + } + setState(1644); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,199,_ctx); + } + setState(1645); + identifier(); + setState(1647); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==LT) { + { + setState(1646); + typeArguments(); + } + } + + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class CreatorContext extends ParserRuleContext { + public NonWildcardTypeArgumentsContext nonWildcardTypeArguments() { + return getRuleContext(NonWildcardTypeArgumentsContext.class,0); + } + public CreatedNameContext createdName() { + return getRuleContext(CreatedNameContext.class,0); + } + public ClassCreatorRestContext classCreatorRest() { + return getRuleContext(ClassCreatorRestContext.class,0); + } + public ArrayCreatorRestContext arrayCreatorRest() { + return getRuleContext(ArrayCreatorRestContext.class,0); + } + public CreatorContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_creator; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterCreator(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitCreator(this); + } + } + + public final CreatorContext creator() throws RecognitionException { + CreatorContext _localctx = new CreatorContext(_ctx, getState()); + enterRule(_localctx, 246, RULE_creator); + try { + setState(1658); + _errHandler.sync(this); + switch (_input.LA(1)) { + case LT: + enterOuterAlt(_localctx, 1); + { + setState(1649); + nonWildcardTypeArguments(); + setState(1650); + createdName(); + setState(1651); + classCreatorRest(); + } + break; + case BOOLEAN: + case BYTE: + case CHAR: + case DOUBLE: + case FLOAT: + case INT: + case LONG: + case SHORT: + case MODULE: + case OPEN: + case REQUIRES: + case EXPORTS: + case OPENS: + case TO: + case USES: + case PROVIDES: + case WITH: + case TRANSITIVE: + case VAR: + case YIELD: + case RECORD: + case SEALED: + case PERMITS: + case IDENTIFIER: + enterOuterAlt(_localctx, 2); + { + setState(1653); + createdName(); + setState(1656); + _errHandler.sync(this); + switch (_input.LA(1)) { + case LBRACK: + { + setState(1654); + arrayCreatorRest(); + } + break; + case LPAREN: + { + setState(1655); + classCreatorRest(); + } + break; + default: + throw new NoViableAltException(this); + } + } + break; + default: + throw new NoViableAltException(this); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class CreatedNameContext extends ParserRuleContext { + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public TypeArgumentsOrDiamondContext typeArgumentsOrDiamond() { + return getRuleContext(TypeArgumentsOrDiamondContext.class,0); + } + public PrimitiveTypeContext primitiveType() { + return getRuleContext(PrimitiveTypeContext.class,0); + } + public CreatedNameContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_createdName; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterCreatedName(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitCreatedName(this); + } + } + + public final CreatedNameContext createdName() throws RecognitionException { + CreatedNameContext _localctx = new CreatedNameContext(_ctx, getState()); + enterRule(_localctx, 248, RULE_createdName); + int _la; + try { + setState(1665); + _errHandler.sync(this); + switch (_input.LA(1)) { + case MODULE: + case OPEN: + case REQUIRES: + case EXPORTS: + case OPENS: + case TO: + case USES: + case PROVIDES: + case WITH: + case TRANSITIVE: + case VAR: + case YIELD: + case RECORD: + case SEALED: + case PERMITS: + case IDENTIFIER: + enterOuterAlt(_localctx, 1); + { + setState(1660); + identifier(); + setState(1662); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==LT) { + { + setState(1661); + typeArgumentsOrDiamond(); + } + } + + } + break; + case BOOLEAN: + case BYTE: + case CHAR: + case DOUBLE: + case FLOAT: + case INT: + case LONG: + case SHORT: + enterOuterAlt(_localctx, 2); + { + setState(1664); + primitiveType(); + } + break; + default: + throw new NoViableAltException(this); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class InnerCreatorContext extends ParserRuleContext { + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public ClassCreatorRestContext classCreatorRest() { + return getRuleContext(ClassCreatorRestContext.class,0); + } + public NonWildcardTypeArgumentsOrDiamondContext nonWildcardTypeArgumentsOrDiamond() { + return getRuleContext(NonWildcardTypeArgumentsOrDiamondContext.class,0); + } + public InnerCreatorContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_innerCreator; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterInnerCreator(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitInnerCreator(this); + } + } + + public final InnerCreatorContext innerCreator() throws RecognitionException { + InnerCreatorContext _localctx = new InnerCreatorContext(_ctx, getState()); + enterRule(_localctx, 250, RULE_innerCreator); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1667); + identifier(); + setState(1669); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==LT) { + { + setState(1668); + nonWildcardTypeArgumentsOrDiamond(); + } + } + + setState(1671); + classCreatorRest(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ArrayCreatorRestContext extends ParserRuleContext { + public List LBRACK() { return getTokens(Java17Parser.LBRACK); } + public TerminalNode LBRACK(int i) { + return getToken(Java17Parser.LBRACK, i); + } + public List RBRACK() { return getTokens(Java17Parser.RBRACK); } + public TerminalNode RBRACK(int i) { + return getToken(Java17Parser.RBRACK, i); + } + public ArrayInitializerContext arrayInitializer() { + return getRuleContext(ArrayInitializerContext.class,0); + } + public List expression() { + return getRuleContexts(ExpressionContext.class); + } + public ExpressionContext expression(int i) { + return getRuleContext(ExpressionContext.class,i); + } + public ArrayCreatorRestContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_arrayCreatorRest; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterArrayCreatorRest(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitArrayCreatorRest(this); + } + } + + public final ArrayCreatorRestContext arrayCreatorRest() throws RecognitionException { + ArrayCreatorRestContext _localctx = new ArrayCreatorRestContext(_ctx, getState()); + enterRule(_localctx, 252, RULE_arrayCreatorRest); + int _la; + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(1673); + match(LBRACK); + setState(1701); + _errHandler.sync(this); + switch (_input.LA(1)) { + case RBRACK: + { + setState(1674); + match(RBRACK); + setState(1679); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==LBRACK) { + { + { + setState(1675); + match(LBRACK); + setState(1676); + match(RBRACK); + } + } + setState(1681); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(1682); + arrayInitializer(); + } + break; + case BOOLEAN: + case BYTE: + case CHAR: + case DOUBLE: + case FLOAT: + case INT: + case LONG: + case NEW: + case SHORT: + case SUPER: + case SWITCH: + case THIS: + case VOID: + case MODULE: + case OPEN: + case REQUIRES: + case EXPORTS: + case OPENS: + case TO: + case USES: + case PROVIDES: + case WITH: + case TRANSITIVE: + case VAR: + case YIELD: + case RECORD: + case SEALED: + case PERMITS: + case DECIMAL_LITERAL: + case HEX_LITERAL: + case OCT_LITERAL: + case BINARY_LITERAL: + case FLOAT_LITERAL: + case HEX_FLOAT_LITERAL: + case BOOL_LITERAL: + case CHAR_LITERAL: + case STRING_LITERAL: + case TEXT_BLOCK: + case NULL_LITERAL: + case LPAREN: + case LT: + case BANG: + case TILDE: + case INC: + case DEC: + case ADD: + case SUB: + case AT: + case IDENTIFIER: + { + setState(1683); + expression(0); + setState(1684); + match(RBRACK); + setState(1691); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,207,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + setState(1685); + match(LBRACK); + setState(1686); + expression(0); + setState(1687); + match(RBRACK); + } + } + } + setState(1693); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,207,_ctx); + } + setState(1698); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,208,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + setState(1694); + match(LBRACK); + setState(1695); + match(RBRACK); + } + } + } + setState(1700); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,208,_ctx); + } + } + break; + default: + throw new NoViableAltException(this); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ClassCreatorRestContext extends ParserRuleContext { + public ArgumentsContext arguments() { + return getRuleContext(ArgumentsContext.class,0); + } + public ClassBodyContext classBody() { + return getRuleContext(ClassBodyContext.class,0); + } + public ClassCreatorRestContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_classCreatorRest; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterClassCreatorRest(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitClassCreatorRest(this); + } + } + + public final ClassCreatorRestContext classCreatorRest() throws RecognitionException { + ClassCreatorRestContext _localctx = new ClassCreatorRestContext(_ctx, getState()); + enterRule(_localctx, 254, RULE_classCreatorRest); + try { + enterOuterAlt(_localctx, 1); + { + setState(1703); + arguments(); + setState(1705); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,210,_ctx) ) { + case 1: + { + setState(1704); + classBody(); + } + break; + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ExplicitGenericInvocationContext extends ParserRuleContext { + public NonWildcardTypeArgumentsContext nonWildcardTypeArguments() { + return getRuleContext(NonWildcardTypeArgumentsContext.class,0); + } + public ExplicitGenericInvocationSuffixContext explicitGenericInvocationSuffix() { + return getRuleContext(ExplicitGenericInvocationSuffixContext.class,0); + } + public ExplicitGenericInvocationContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_explicitGenericInvocation; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterExplicitGenericInvocation(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitExplicitGenericInvocation(this); + } + } + + public final ExplicitGenericInvocationContext explicitGenericInvocation() throws RecognitionException { + ExplicitGenericInvocationContext _localctx = new ExplicitGenericInvocationContext(_ctx, getState()); + enterRule(_localctx, 256, RULE_explicitGenericInvocation); + try { + enterOuterAlt(_localctx, 1); + { + setState(1707); + nonWildcardTypeArguments(); + setState(1708); + explicitGenericInvocationSuffix(); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class TypeArgumentsOrDiamondContext extends ParserRuleContext { + public TerminalNode LT() { return getToken(Java17Parser.LT, 0); } + public TerminalNode GT() { return getToken(Java17Parser.GT, 0); } + public TypeArgumentsContext typeArguments() { + return getRuleContext(TypeArgumentsContext.class,0); + } + public TypeArgumentsOrDiamondContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_typeArgumentsOrDiamond; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterTypeArgumentsOrDiamond(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitTypeArgumentsOrDiamond(this); + } + } + + public final TypeArgumentsOrDiamondContext typeArgumentsOrDiamond() throws RecognitionException { + TypeArgumentsOrDiamondContext _localctx = new TypeArgumentsOrDiamondContext(_ctx, getState()); + enterRule(_localctx, 258, RULE_typeArgumentsOrDiamond); + try { + setState(1713); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,211,_ctx) ) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(1710); + match(LT); + setState(1711); + match(GT); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(1712); + typeArguments(); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class NonWildcardTypeArgumentsOrDiamondContext extends ParserRuleContext { + public TerminalNode LT() { return getToken(Java17Parser.LT, 0); } + public TerminalNode GT() { return getToken(Java17Parser.GT, 0); } + public NonWildcardTypeArgumentsContext nonWildcardTypeArguments() { + return getRuleContext(NonWildcardTypeArgumentsContext.class,0); + } + public NonWildcardTypeArgumentsOrDiamondContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_nonWildcardTypeArgumentsOrDiamond; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterNonWildcardTypeArgumentsOrDiamond(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitNonWildcardTypeArgumentsOrDiamond(this); + } + } + + public final NonWildcardTypeArgumentsOrDiamondContext nonWildcardTypeArgumentsOrDiamond() throws RecognitionException { + NonWildcardTypeArgumentsOrDiamondContext _localctx = new NonWildcardTypeArgumentsOrDiamondContext(_ctx, getState()); + enterRule(_localctx, 260, RULE_nonWildcardTypeArgumentsOrDiamond); + try { + setState(1718); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,212,_ctx) ) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(1715); + match(LT); + setState(1716); + match(GT); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(1717); + nonWildcardTypeArguments(); + } + break; + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class NonWildcardTypeArgumentsContext extends ParserRuleContext { + public TerminalNode LT() { return getToken(Java17Parser.LT, 0); } + public TypeListContext typeList() { + return getRuleContext(TypeListContext.class,0); + } + public TerminalNode GT() { return getToken(Java17Parser.GT, 0); } + public NonWildcardTypeArgumentsContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_nonWildcardTypeArguments; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterNonWildcardTypeArguments(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitNonWildcardTypeArguments(this); + } + } + + public final NonWildcardTypeArgumentsContext nonWildcardTypeArguments() throws RecognitionException { + NonWildcardTypeArgumentsContext _localctx = new NonWildcardTypeArgumentsContext(_ctx, getState()); + enterRule(_localctx, 262, RULE_nonWildcardTypeArguments); + try { + enterOuterAlt(_localctx, 1); + { + setState(1720); + match(LT); + setState(1721); + typeList(); + setState(1722); + match(GT); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class TypeListContext extends ParserRuleContext { + public List typeType() { + return getRuleContexts(TypeTypeContext.class); + } + public TypeTypeContext typeType(int i) { + return getRuleContext(TypeTypeContext.class,i); + } + public List COMMA() { return getTokens(Java17Parser.COMMA); } + public TerminalNode COMMA(int i) { + return getToken(Java17Parser.COMMA, i); + } + public TypeListContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_typeList; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterTypeList(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitTypeList(this); + } + } + + public final TypeListContext typeList() throws RecognitionException { + TypeListContext _localctx = new TypeListContext(_ctx, getState()); + enterRule(_localctx, 264, RULE_typeList); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1724); + typeType(); + setState(1729); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==COMMA) { + { + { + setState(1725); + match(COMMA); + setState(1726); + typeType(); + } + } + setState(1731); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class TypeTypeContext extends ParserRuleContext { + public ClassOrInterfaceTypeContext classOrInterfaceType() { + return getRuleContext(ClassOrInterfaceTypeContext.class,0); + } + public PrimitiveTypeContext primitiveType() { + return getRuleContext(PrimitiveTypeContext.class,0); + } + public List annotation() { + return getRuleContexts(AnnotationContext.class); + } + public AnnotationContext annotation(int i) { + return getRuleContext(AnnotationContext.class,i); + } + public List LBRACK() { return getTokens(Java17Parser.LBRACK); } + public TerminalNode LBRACK(int i) { + return getToken(Java17Parser.LBRACK, i); + } + public List RBRACK() { return getTokens(Java17Parser.RBRACK); } + public TerminalNode RBRACK(int i) { + return getToken(Java17Parser.RBRACK, i); + } + public TypeTypeContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_typeType; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterTypeType(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitTypeType(this); + } + } + + public final TypeTypeContext typeType() throws RecognitionException { + TypeTypeContext _localctx = new TypeTypeContext(_ctx, getState()); + enterRule(_localctx, 266, RULE_typeType); + int _la; + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(1735); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,214,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + setState(1732); + annotation(); + } + } + } + setState(1737); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,214,_ctx); + } + setState(1740); + _errHandler.sync(this); + switch (_input.LA(1)) { + case MODULE: + case OPEN: + case REQUIRES: + case EXPORTS: + case OPENS: + case TO: + case USES: + case PROVIDES: + case WITH: + case TRANSITIVE: + case VAR: + case YIELD: + case RECORD: + case SEALED: + case PERMITS: + case IDENTIFIER: + { + setState(1738); + classOrInterfaceType(); + } + break; + case BOOLEAN: + case BYTE: + case CHAR: + case DOUBLE: + case FLOAT: + case INT: + case LONG: + case SHORT: + { + setState(1739); + primitiveType(); + } + break; + default: + throw new NoViableAltException(this); + } + setState(1752); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,217,_ctx); + while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { + if ( _alt==1 ) { + { + { + setState(1745); + _errHandler.sync(this); + _la = _input.LA(1); + while ((((_la - 51)) & ~0x3f) == 0 && ((1L << (_la - 51)) & 32767L) != 0 || _la==AT || _la==IDENTIFIER) { + { + { + setState(1742); + annotation(); + } + } + setState(1747); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(1748); + match(LBRACK); + setState(1749); + match(RBRACK); + } + } + } + setState(1754); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input,217,_ctx); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class PrimitiveTypeContext extends ParserRuleContext { + public TerminalNode BOOLEAN() { return getToken(Java17Parser.BOOLEAN, 0); } + public TerminalNode CHAR() { return getToken(Java17Parser.CHAR, 0); } + public TerminalNode BYTE() { return getToken(Java17Parser.BYTE, 0); } + public TerminalNode SHORT() { return getToken(Java17Parser.SHORT, 0); } + public TerminalNode INT() { return getToken(Java17Parser.INT, 0); } + public TerminalNode LONG() { return getToken(Java17Parser.LONG, 0); } + public TerminalNode FLOAT() { return getToken(Java17Parser.FLOAT, 0); } + public TerminalNode DOUBLE() { return getToken(Java17Parser.DOUBLE, 0); } + public PrimitiveTypeContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_primitiveType; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterPrimitiveType(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitPrimitiveType(this); + } + } + + public final PrimitiveTypeContext primitiveType() throws RecognitionException { + PrimitiveTypeContext _localctx = new PrimitiveTypeContext(_ctx, getState()); + enterRule(_localctx, 268, RULE_primitiveType); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1755); + _la = _input.LA(1); + if ( !(((_la) & ~0x3f) == 0 && ((1L << _la) & 138111107368L) != 0) ) { + _errHandler.recoverInline(this); + } + else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class TypeArgumentsContext extends ParserRuleContext { + public TerminalNode LT() { return getToken(Java17Parser.LT, 0); } + public List typeArgument() { + return getRuleContexts(TypeArgumentContext.class); + } + public TypeArgumentContext typeArgument(int i) { + return getRuleContext(TypeArgumentContext.class,i); + } + public TerminalNode GT() { return getToken(Java17Parser.GT, 0); } + public List COMMA() { return getTokens(Java17Parser.COMMA); } + public TerminalNode COMMA(int i) { + return getToken(Java17Parser.COMMA, i); + } + public TypeArgumentsContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_typeArguments; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterTypeArguments(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitTypeArguments(this); + } + } + + public final TypeArgumentsContext typeArguments() throws RecognitionException { + TypeArgumentsContext _localctx = new TypeArgumentsContext(_ctx, getState()); + enterRule(_localctx, 270, RULE_typeArguments); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1757); + match(LT); + setState(1758); + typeArgument(); + setState(1763); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la==COMMA) { + { + { + setState(1759); + match(COMMA); + setState(1760); + typeArgument(); + } + } + setState(1765); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(1766); + match(GT); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class SuperSuffixContext extends ParserRuleContext { + public ArgumentsContext arguments() { + return getRuleContext(ArgumentsContext.class,0); + } + public TerminalNode DOT() { return getToken(Java17Parser.DOT, 0); } + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public TypeArgumentsContext typeArguments() { + return getRuleContext(TypeArgumentsContext.class,0); + } + public SuperSuffixContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_superSuffix; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterSuperSuffix(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitSuperSuffix(this); + } + } + + public final SuperSuffixContext superSuffix() throws RecognitionException { + SuperSuffixContext _localctx = new SuperSuffixContext(_ctx, getState()); + enterRule(_localctx, 272, RULE_superSuffix); + int _la; + try { + setState(1777); + _errHandler.sync(this); + switch (_input.LA(1)) { + case LPAREN: + enterOuterAlt(_localctx, 1); + { + setState(1768); + arguments(); + } + break; + case DOT: + enterOuterAlt(_localctx, 2); + { + setState(1769); + match(DOT); + setState(1771); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la==LT) { + { + setState(1770); + typeArguments(); + } + } + + setState(1773); + identifier(); + setState(1775); + _errHandler.sync(this); + switch ( getInterpreter().adaptivePredict(_input,220,_ctx) ) { + case 1: + { + setState(1774); + arguments(); + } + break; + } + } + break; + default: + throw new NoViableAltException(this); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ExplicitGenericInvocationSuffixContext extends ParserRuleContext { + public TerminalNode SUPER() { return getToken(Java17Parser.SUPER, 0); } + public SuperSuffixContext superSuffix() { + return getRuleContext(SuperSuffixContext.class,0); + } + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class,0); + } + public ArgumentsContext arguments() { + return getRuleContext(ArgumentsContext.class,0); + } + public ExplicitGenericInvocationSuffixContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_explicitGenericInvocationSuffix; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterExplicitGenericInvocationSuffix(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitExplicitGenericInvocationSuffix(this); + } + } + + public final ExplicitGenericInvocationSuffixContext explicitGenericInvocationSuffix() throws RecognitionException { + ExplicitGenericInvocationSuffixContext _localctx = new ExplicitGenericInvocationSuffixContext(_ctx, getState()); + enterRule(_localctx, 274, RULE_explicitGenericInvocationSuffix); + try { + setState(1784); + _errHandler.sync(this); + switch (_input.LA(1)) { + case SUPER: + enterOuterAlt(_localctx, 1); + { + setState(1779); + match(SUPER); + setState(1780); + superSuffix(); + } + break; + case MODULE: + case OPEN: + case REQUIRES: + case EXPORTS: + case OPENS: + case TO: + case USES: + case PROVIDES: + case WITH: + case TRANSITIVE: + case VAR: + case YIELD: + case RECORD: + case SEALED: + case PERMITS: + case IDENTIFIER: + enterOuterAlt(_localctx, 2); + { + setState(1781); + identifier(); + setState(1782); + arguments(); + } + break; + default: + throw new NoViableAltException(this); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + @SuppressWarnings("CheckReturnValue") + public static class ArgumentsContext extends ParserRuleContext { + public TerminalNode LPAREN() { return getToken(Java17Parser.LPAREN, 0); } + public TerminalNode RPAREN() { return getToken(Java17Parser.RPAREN, 0); } + public ExpressionListContext expressionList() { + return getRuleContext(ExpressionListContext.class,0); + } + public ArgumentsContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + @Override public int getRuleIndex() { return RULE_arguments; } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).enterArguments(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof Java17ParserListener ) ((Java17ParserListener)listener).exitArguments(this); + } + } + + public final ArgumentsContext arguments() throws RecognitionException { + ArgumentsContext _localctx = new ArgumentsContext(_ctx, getState()); + enterRule(_localctx, 276, RULE_arguments); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1786); + match(LPAREN); + setState(1788); + _errHandler.sync(this); + _la = _input.LA(1); + if ((((_la - 3)) & ~0x3f) == 0 && ((1L << (_la - 3)) & 9223127275610966053L) != 0 || (((_la - 67)) & ~0x3f) == 0 && ((1L << (_la - 67)) & 2377900732130004991L) != 0) { + { + setState(1787); + expressionList(); + } + } + + setState(1790); + match(RPAREN); + } + } + catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } + finally { + exitRule(); + } + return _localctx; + } + + public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) { + switch (ruleIndex) { + case 105: + return expression_sempred((ExpressionContext)_localctx, predIndex); + } + return true; + } + private boolean expression_sempred(ExpressionContext _localctx, int predIndex) { + switch (predIndex) { + case 0: + return precpred(_ctx, 18); + case 1: + return precpred(_ctx, 17); + case 2: + return precpred(_ctx, 16); + case 3: + return precpred(_ctx, 15); + case 4: + return precpred(_ctx, 13); + case 5: + return precpred(_ctx, 12); + case 6: + return precpred(_ctx, 11); + case 7: + return precpred(_ctx, 10); + case 8: + return precpred(_ctx, 9); + case 9: + return precpred(_ctx, 8); + case 10: + return precpred(_ctx, 7); + case 11: + return precpred(_ctx, 6); + case 12: + return precpred(_ctx, 25); + case 13: + return precpred(_ctx, 24); + case 14: + return precpred(_ctx, 20); + case 15: + return precpred(_ctx, 14); + case 16: + return precpred(_ctx, 3); + } + return true; + } + + public static final String _serializedATN = + "\u0004\u0001\u0080\u0701\u0002\u0000\u0007\u0000\u0002\u0001\u0007\u0001"+ + "\u0002\u0002\u0007\u0002\u0002\u0003\u0007\u0003\u0002\u0004\u0007\u0004"+ + "\u0002\u0005\u0007\u0005\u0002\u0006\u0007\u0006\u0002\u0007\u0007\u0007"+ + "\u0002\b\u0007\b\u0002\t\u0007\t\u0002\n\u0007\n\u0002\u000b\u0007\u000b"+ + "\u0002\f\u0007\f\u0002\r\u0007\r\u0002\u000e\u0007\u000e\u0002\u000f\u0007"+ + "\u000f\u0002\u0010\u0007\u0010\u0002\u0011\u0007\u0011\u0002\u0012\u0007"+ + "\u0012\u0002\u0013\u0007\u0013\u0002\u0014\u0007\u0014\u0002\u0015\u0007"+ + "\u0015\u0002\u0016\u0007\u0016\u0002\u0017\u0007\u0017\u0002\u0018\u0007"+ + "\u0018\u0002\u0019\u0007\u0019\u0002\u001a\u0007\u001a\u0002\u001b\u0007"+ + "\u001b\u0002\u001c\u0007\u001c\u0002\u001d\u0007\u001d\u0002\u001e\u0007"+ + "\u001e\u0002\u001f\u0007\u001f\u0002 \u0007 \u0002!\u0007!\u0002\"\u0007"+ + "\"\u0002#\u0007#\u0002$\u0007$\u0002%\u0007%\u0002&\u0007&\u0002\'\u0007"+ + "\'\u0002(\u0007(\u0002)\u0007)\u0002*\u0007*\u0002+\u0007+\u0002,\u0007"+ + ",\u0002-\u0007-\u0002.\u0007.\u0002/\u0007/\u00020\u00070\u00021\u0007"+ + "1\u00022\u00072\u00023\u00073\u00024\u00074\u00025\u00075\u00026\u0007"+ + "6\u00027\u00077\u00028\u00078\u00029\u00079\u0002:\u0007:\u0002;\u0007"+ + ";\u0002<\u0007<\u0002=\u0007=\u0002>\u0007>\u0002?\u0007?\u0002@\u0007"+ + "@\u0002A\u0007A\u0002B\u0007B\u0002C\u0007C\u0002D\u0007D\u0002E\u0007"+ + "E\u0002F\u0007F\u0002G\u0007G\u0002H\u0007H\u0002I\u0007I\u0002J\u0007"+ + "J\u0002K\u0007K\u0002L\u0007L\u0002M\u0007M\u0002N\u0007N\u0002O\u0007"+ + "O\u0002P\u0007P\u0002Q\u0007Q\u0002R\u0007R\u0002S\u0007S\u0002T\u0007"+ + "T\u0002U\u0007U\u0002V\u0007V\u0002W\u0007W\u0002X\u0007X\u0002Y\u0007"+ + "Y\u0002Z\u0007Z\u0002[\u0007[\u0002\\\u0007\\\u0002]\u0007]\u0002^\u0007"+ + "^\u0002_\u0007_\u0002`\u0007`\u0002a\u0007a\u0002b\u0007b\u0002c\u0007"+ + "c\u0002d\u0007d\u0002e\u0007e\u0002f\u0007f\u0002g\u0007g\u0002h\u0007"+ + "h\u0002i\u0007i\u0002j\u0007j\u0002k\u0007k\u0002l\u0007l\u0002m\u0007"+ + "m\u0002n\u0007n\u0002o\u0007o\u0002p\u0007p\u0002q\u0007q\u0002r\u0007"+ + "r\u0002s\u0007s\u0002t\u0007t\u0002u\u0007u\u0002v\u0007v\u0002w\u0007"+ + "w\u0002x\u0007x\u0002y\u0007y\u0002z\u0007z\u0002{\u0007{\u0002|\u0007"+ + "|\u0002}\u0007}\u0002~\u0007~\u0002\u007f\u0007\u007f\u0002\u0080\u0007"+ + "\u0080\u0002\u0081\u0007\u0081\u0002\u0082\u0007\u0082\u0002\u0083\u0007"+ + "\u0083\u0002\u0084\u0007\u0084\u0002\u0085\u0007\u0085\u0002\u0086\u0007"+ + "\u0086\u0002\u0087\u0007\u0087\u0002\u0088\u0007\u0088\u0002\u0089\u0007"+ + "\u0089\u0002\u008a\u0007\u008a\u0001\u0000\u0003\u0000\u0118\b\u0000\u0001"+ + "\u0000\u0005\u0000\u011b\b\u0000\n\u0000\f\u0000\u011e\t\u0000\u0001\u0000"+ + "\u0005\u0000\u0121\b\u0000\n\u0000\f\u0000\u0124\t\u0000\u0001\u0000\u0001"+ + "\u0000\u0001\u0000\u0003\u0000\u0129\b\u0000\u0001\u0001\u0005\u0001\u012c"+ + "\b\u0001\n\u0001\f\u0001\u012f\t\u0001\u0001\u0001\u0001\u0001\u0001\u0001"+ + "\u0001\u0001\u0001\u0002\u0001\u0002\u0003\u0002\u0137\b\u0002\u0001\u0002"+ + "\u0001\u0002\u0001\u0002\u0003\u0002\u013c\b\u0002\u0001\u0002\u0001\u0002"+ + "\u0001\u0003\u0005\u0003\u0141\b\u0003\n\u0003\f\u0003\u0144\t\u0003\u0001"+ + "\u0003\u0001\u0003\u0001\u0003\u0001\u0003\u0001\u0003\u0003\u0003\u014b"+ + "\b\u0003\u0001\u0003\u0003\u0003\u014e\b\u0003\u0001\u0004\u0001\u0004"+ + "\u0001\u0004\u0001\u0004\u0001\u0004\u0003\u0004\u0155\b\u0004\u0001\u0005"+ + "\u0001\u0005\u0001\u0005\u0001\u0005\u0001\u0005\u0001\u0005\u0001\u0005"+ + "\u0001\u0005\u0001\u0005\u0001\u0005\u0003\u0005\u0161\b\u0005\u0001\u0006"+ + "\u0001\u0006\u0003\u0006\u0165\b\u0006\u0001\u0007\u0001\u0007\u0001\u0007"+ + "\u0003\u0007\u016a\b\u0007\u0001\u0007\u0001\u0007\u0003\u0007\u016e\b"+ + "\u0007\u0001\u0007\u0001\u0007\u0003\u0007\u0172\b\u0007\u0001\u0007\u0001"+ + "\u0007\u0003\u0007\u0176\b\u0007\u0001\u0007\u0001\u0007\u0001\b\u0001"+ + "\b\u0001\b\u0001\b\u0005\b\u017e\b\b\n\b\f\b\u0181\t\b\u0001\b\u0001\b"+ + "\u0001\t\u0005\t\u0186\b\t\n\t\f\t\u0189\t\t\u0001\t\u0001\t\u0001\t\u0005"+ + "\t\u018e\b\t\n\t\f\t\u0191\t\t\u0001\t\u0003\t\u0194\b\t\u0001\n\u0001"+ + "\n\u0001\n\u0005\n\u0199\b\n\n\n\f\n\u019c\t\n\u0001\u000b\u0001\u000b"+ + "\u0001\u000b\u0001\u000b\u0003\u000b\u01a2\b\u000b\u0001\u000b\u0001\u000b"+ + "\u0003\u000b\u01a6\b\u000b\u0001\u000b\u0003\u000b\u01a9\b\u000b\u0001"+ + "\u000b\u0003\u000b\u01ac\b\u000b\u0001\u000b\u0001\u000b\u0001\f\u0001"+ + "\f\u0001\f\u0005\f\u01b3\b\f\n\f\f\f\u01b6\t\f\u0001\r\u0005\r\u01b9\b"+ + "\r\n\r\f\r\u01bc\t\r\u0001\r\u0001\r\u0003\r\u01c0\b\r\u0001\r\u0003\r"+ + "\u01c3\b\r\u0001\u000e\u0001\u000e\u0005\u000e\u01c7\b\u000e\n\u000e\f"+ + "\u000e\u01ca\t\u000e\u0001\u000f\u0001\u000f\u0001\u000f\u0003\u000f\u01cf"+ + "\b\u000f\u0001\u000f\u0001\u000f\u0003\u000f\u01d3\b\u000f\u0001\u000f"+ + "\u0001\u000f\u0003\u000f\u01d7\b\u000f\u0001\u000f\u0001\u000f\u0001\u0010"+ + "\u0001\u0010\u0005\u0010\u01dd\b\u0010\n\u0010\f\u0010\u01e0\t\u0010\u0001"+ + "\u0010\u0001\u0010\u0001\u0011\u0001\u0011\u0005\u0011\u01e6\b\u0011\n"+ + "\u0011\f\u0011\u01e9\t\u0011\u0001\u0011\u0001\u0011\u0001\u0012\u0001"+ + "\u0012\u0003\u0012\u01ef\b\u0012\u0001\u0012\u0001\u0012\u0005\u0012\u01f3"+ + "\b\u0012\n\u0012\f\u0012\u01f6\t\u0012\u0001\u0012\u0003\u0012\u01f9\b"+ + "\u0012\u0001\u0013\u0001\u0013\u0001\u0013\u0001\u0013\u0003\u0013\u01ff"+ + "\b\u0013\u0001\u0014\u0001\u0014\u0003\u0014\u0203\b\u0014\u0001\u0015"+ + "\u0001\u0015\u0001\u0015\u0003\u0015\u0208\b\u0015\u0001\u0015\u0001\u0015"+ + "\u0001\u0016\u0003\u0016\u020d\b\u0016\u0001\u0016\u0001\u0016\u0001\u0016"+ + "\u0001\u0016\u0005\u0016\u0213\b\u0016\n\u0016\f\u0016\u0216\t\u0016\u0001"+ + "\u0017\u0001\u0017\u0003\u0017\u021a\b\u0017\u0001\u0018\u0001\u0018\u0003"+ + "\u0018\u021e\b\u0018\u0001\u0019\u0001\u0019\u0001\u0019\u0001\u001a\u0001"+ + "\u001a\u0003\u001a\u0225\b\u001a\u0001\u001b\u0001\u001b\u0001\u001b\u0001"+ + "\u001c\u0001\u001c\u0001\u001c\u0001\u001c\u0003\u001c\u022e\b\u001c\u0001"+ + "\u001c\u0001\u001c\u0001\u001d\u0003\u001d\u0233\b\u001d\u0001\u001d\u0001"+ + "\u001d\u0001\u001d\u0001\u001e\u0005\u001e\u0239\b\u001e\n\u001e\f\u001e"+ + "\u023c\t\u001e\u0001\u001e\u0001\u001e\u0003\u001e\u0240\b\u001e\u0001"+ + "\u001f\u0001\u001f\u0001\u001f\u0001\u001f\u0003\u001f\u0246\b\u001f\u0001"+ + " \u0003 \u0249\b \u0001 \u0001 \u0001 \u0005 \u024e\b \n \f \u0251\t "+ + "\u0001 \u0001 \u0001!\u0001!\u0001!\u0005!\u0258\b!\n!\f!\u025b\t!\u0001"+ + "!\u0001!\u0001!\u0001\"\u0005\"\u0261\b\"\n\"\f\"\u0264\t\"\u0001\"\u0001"+ + "\"\u0001#\u0001#\u0001#\u0001#\u0001#\u0001#\u0003#\u026e\b#\u0001$\u0005"+ + "$\u0271\b$\n$\f$\u0274\t$\u0001$\u0001$\u0001$\u0001%\u0005%\u027a\b%"+ + "\n%\f%\u027d\t%\u0001%\u0003%\u0280\b%\u0001%\u0001%\u0001%\u0001%\u0005"+ + "%\u0286\b%\n%\f%\u0289\t%\u0001%\u0001%\u0003%\u028d\b%\u0001%\u0001%"+ + "\u0001&\u0001&\u0001&\u0005&\u0294\b&\n&\f&\u0297\t&\u0001\'\u0001\'\u0001"+ + "\'\u0003\'\u029c\b\'\u0001(\u0001(\u0001(\u0005(\u02a1\b(\n(\f(\u02a4"+ + "\t(\u0001)\u0001)\u0003)\u02a8\b)\u0001*\u0001*\u0001*\u0001*\u0005*\u02ae"+ + "\b*\n*\f*\u02b1\t*\u0001*\u0003*\u02b4\b*\u0003*\u02b6\b*\u0001*\u0001"+ + "*\u0001+\u0001+\u0003+\u02bc\b+\u0001+\u0001+\u0005+\u02c0\b+\n+\f+\u02c3"+ + "\t+\u0001+\u0001+\u0003+\u02c7\b+\u0001,\u0001,\u0003,\u02cb\b,\u0001"+ + "-\u0005-\u02ce\b-\n-\f-\u02d1\t-\u0001-\u0001-\u0001-\u0003-\u02d6\b-"+ + "\u0001.\u0001.\u0001.\u0001/\u0001/\u0001/\u00010\u00010\u00010\u0005"+ + "0\u02e1\b0\n0\f0\u02e4\t0\u00011\u00011\u00012\u00012\u00032\u02ea\b2"+ + "\u00012\u00012\u00012\u00032\u02ef\b2\u00012\u00032\u02f2\b2\u00032\u02f4"+ + "\b2\u00012\u00012\u00013\u00033\u02f9\b3\u00013\u00013\u00013\u00053\u02fe"+ + "\b3\n3\f3\u0301\t3\u00013\u00013\u00014\u00014\u00014\u00054\u0308\b4"+ + "\n4\f4\u030b\t4\u00014\u00014\u00034\u030f\b4\u00014\u00034\u0312\b4\u0001"+ + "5\u00055\u0315\b5\n5\f5\u0318\t5\u00015\u00035\u031b\b5\u00015\u00015"+ + "\u00035\u031f\b5\u00016\u00056\u0322\b6\n6\f6\u0325\t6\u00016\u00036\u0328"+ + "\b6\u00016\u00056\u032b\b6\n6\f6\u032e\t6\u00016\u00016\u00016\u00017"+ + "\u00017\u00017\u00057\u0336\b7\n7\f7\u0339\t7\u00018\u00058\u033c\b8\n"+ + "8\f8\u033f\t8\u00018\u00018\u00018\u00019\u00019\u00019\u00059\u0347\b"+ + "9\n9\f9\u034a\t9\u0001:\u0001:\u0001:\u0001:\u0001:\u0001:\u0001:\u0003"+ + ":\u0353\b:\u0001;\u0001;\u0001<\u0001<\u0001=\u0001=\u0001=\u0005=\u035c"+ + "\b=\n=\f=\u035f\t=\u0001=\u0001=\u0001=\u0001>\u0001>\u0001>\u0003>\u0367"+ + "\b>\u0001>\u0001>\u0001>\u0003>\u036c\b>\u0001>\u0003>\u036f\b>\u0001"+ + "?\u0001?\u0001?\u0005?\u0374\b?\n?\f?\u0377\t?\u0001@\u0001@\u0001@\u0001"+ + "@\u0001A\u0001A\u0001A\u0003A\u0380\bA\u0001B\u0001B\u0001B\u0001B\u0005"+ + "B\u0386\bB\nB\fB\u0389\tB\u0003B\u038b\bB\u0001B\u0003B\u038e\bB\u0001"+ + "B\u0001B\u0001C\u0001C\u0001C\u0001C\u0001C\u0001D\u0001D\u0005D\u0399"+ + "\bD\nD\fD\u039c\tD\u0001D\u0001D\u0001E\u0005E\u03a1\bE\nE\fE\u03a4\t"+ + "E\u0001E\u0001E\u0003E\u03a8\bE\u0001F\u0001F\u0001F\u0001F\u0001F\u0001"+ + "F\u0003F\u03b0\bF\u0003F\u03b2\bF\u0001G\u0001G\u0003G\u03b6\bG\u0001"+ + "H\u0001H\u0001H\u0001H\u0003H\u03bc\bH\u0001I\u0001I\u0001J\u0001J\u0001"+ + "J\u0001K\u0003K\u03c4\bK\u0001K\u0001K\u0001K\u0001K\u0001L\u0001L\u0005"+ + "L\u03cc\bL\nL\fL\u03cf\tL\u0001L\u0001L\u0001M\u0001M\u0005M\u03d5\bM"+ + "\nM\fM\u03d8\tM\u0001M\u0001M\u0001M\u0001M\u0001M\u0001M\u0001M\u0003"+ + "M\u03e1\bM\u0001M\u0001M\u0001M\u0001M\u0001M\u0001M\u0003M\u03e9\bM\u0001"+ + "M\u0001M\u0001M\u0001M\u0001M\u0001M\u0001M\u0001M\u0001M\u0001M\u0001"+ + "M\u0001M\u0003M\u03f7\bM\u0001N\u0001N\u0001O\u0001O\u0001O\u0003O\u03fe"+ + "\bO\u0001O\u0001O\u0001O\u0003O\u0403\bO\u0001O\u0001O\u0001P\u0001P\u0003"+ + "P\u0409\bP\u0001P\u0001P\u0001Q\u0001Q\u0001Q\u0005Q\u0410\bQ\nQ\fQ\u0413"+ + "\tQ\u0001R\u0003R\u0416\bR\u0001R\u0001R\u0001S\u0001S\u0005S\u041c\b"+ + "S\nS\fS\u041f\tS\u0001S\u0001S\u0001T\u0001T\u0005T\u0425\bT\nT\fT\u0428"+ + "\tT\u0001T\u0001T\u0001U\u0001U\u0001U\u0001U\u0001U\u0003U\u0431\bU\u0001"+ + "V\u0005V\u0434\bV\nV\fV\u0437\tV\u0001V\u0001V\u0003V\u043b\bV\u0001V"+ + "\u0001V\u0001W\u0001W\u0001X\u0001X\u0001Y\u0005Y\u0444\bY\nY\fY\u0447"+ + "\tY\u0001Y\u0001Y\u0001Y\u0003Y\u044c\bY\u0001Y\u0003Y\u044f\bY\u0001"+ + "Z\u0001Z\u0001Z\u0001Z\u0001Z\u0003Z\u0456\bZ\u0001Z\u0001Z\u0001Z\u0001"+ + "Z\u0001Z\u0001Z\u0001Z\u0003Z\u045f\bZ\u0001Z\u0001Z\u0001Z\u0001Z\u0001"+ + "Z\u0001Z\u0001Z\u0001Z\u0001Z\u0001Z\u0001Z\u0001Z\u0001Z\u0001Z\u0001"+ + "Z\u0001Z\u0001Z\u0001Z\u0001Z\u0004Z\u0474\bZ\u000bZ\fZ\u0475\u0001Z\u0003"+ + "Z\u0479\bZ\u0001Z\u0003Z\u047c\bZ\u0001Z\u0001Z\u0001Z\u0001Z\u0005Z\u0482"+ + "\bZ\nZ\fZ\u0485\tZ\u0001Z\u0003Z\u0488\bZ\u0001Z\u0001Z\u0001Z\u0001Z"+ + "\u0005Z\u048e\bZ\nZ\fZ\u0491\tZ\u0001Z\u0005Z\u0494\bZ\nZ\fZ\u0497\tZ"+ + "\u0001Z\u0001Z\u0001Z\u0001Z\u0001Z\u0001Z\u0001Z\u0001Z\u0003Z\u04a1"+ + "\bZ\u0001Z\u0001Z\u0001Z\u0001Z\u0001Z\u0001Z\u0001Z\u0003Z\u04aa\bZ\u0001"+ + "Z\u0001Z\u0001Z\u0003Z\u04af\bZ\u0001Z\u0001Z\u0001Z\u0001Z\u0001Z\u0001"+ + "Z\u0001Z\u0001Z\u0001Z\u0001Z\u0001Z\u0001Z\u0001Z\u0003Z\u04be\bZ\u0001"+ + "[\u0001[\u0001[\u0005[\u04c3\b[\n[\f[\u04c6\t[\u0001[\u0003[\u04c9\b["+ + "\u0001[\u0001[\u0001[\u0001[\u0001\\\u0001\\\u0001\\\u0005\\\u04d2\b\\"+ + "\n\\\f\\\u04d5\t\\\u0001]\u0001]\u0001]\u0001^\u0001^\u0001^\u0003^\u04dd"+ + "\b^\u0001^\u0001^\u0001_\u0001_\u0001_\u0005_\u04e4\b_\n_\f_\u04e7\t_"+ + "\u0001`\u0005`\u04ea\b`\n`\f`\u04ed\t`\u0001`\u0003`\u04f0\b`\u0001`\u0001"+ + "`\u0001`\u0003`\u04f5\b`\u0001`\u0001`\u0001`\u0001`\u0003`\u04fb\b`\u0001"+ + "a\u0004a\u04fe\ba\u000ba\fa\u04ff\u0001a\u0004a\u0503\ba\u000ba\fa\u0504"+ + "\u0001b\u0001b\u0001b\u0001b\u0001b\u0001b\u0001b\u0001b\u0001b\u0001"+ + "b\u0001b\u0001b\u0001b\u0003b\u0514\bb\u0001c\u0001c\u0003c\u0518\bc\u0001"+ + "c\u0001c\u0003c\u051c\bc\u0001c\u0001c\u0003c\u0520\bc\u0003c\u0522\b"+ + "c\u0001d\u0001d\u0003d\u0526\bd\u0001e\u0005e\u0529\be\ne\fe\u052c\te"+ + "\u0001e\u0003e\u052f\be\u0001e\u0003e\u0532\be\u0001e\u0001e\u0001e\u0001"+ + "e\u0001f\u0001f\u0001f\u0001f\u0001g\u0001g\u0001g\u0005g\u053f\bg\ng"+ + "\fg\u0542\tg\u0001h\u0001h\u0001h\u0003h\u0547\bh\u0001h\u0001h\u0001"+ + "h\u0001h\u0001h\u0003h\u054e\bh\u0001h\u0001h\u0001h\u0001h\u0003h\u0554"+ + "\bh\u0001h\u0003h\u0557\bh\u0001i\u0001i\u0001i\u0001i\u0001i\u0001i\u0001"+ + "i\u0005i\u0560\bi\ni\fi\u0563\ti\u0001i\u0001i\u0001i\u0005i\u0568\bi"+ + "\ni\fi\u056b\ti\u0001i\u0001i\u0001i\u0001i\u0001i\u0001i\u0001i\u0001"+ + "i\u0001i\u0001i\u0003i\u0577\bi\u0001i\u0001i\u0003i\u057b\bi\u0001i\u0001"+ + "i\u0001i\u0003i\u0580\bi\u0001i\u0001i\u0003i\u0584\bi\u0001i\u0001i\u0001"+ + "i\u0001i\u0001i\u0001i\u0001i\u0001i\u0001i\u0001i\u0001i\u0001i\u0001"+ + "i\u0001i\u0003i\u0594\bi\u0001i\u0001i\u0001i\u0001i\u0001i\u0001i\u0001"+ + "i\u0001i\u0001i\u0001i\u0001i\u0001i\u0001i\u0001i\u0001i\u0001i\u0001"+ + "i\u0001i\u0001i\u0001i\u0001i\u0001i\u0001i\u0001i\u0001i\u0001i\u0001"+ + "i\u0001i\u0001i\u0001i\u0001i\u0001i\u0001i\u0001i\u0001i\u0001i\u0001"+ + "i\u0001i\u0003i\u05bc\bi\u0001i\u0001i\u0001i\u0001i\u0003i\u05c2\bi\u0001"+ + "i\u0001i\u0001i\u0001i\u0001i\u0001i\u0001i\u0001i\u0001i\u0001i\u0001"+ + "i\u0003i\u05cf\bi\u0001i\u0001i\u0001i\u0003i\u05d4\bi\u0001i\u0005i\u05d7"+ + "\bi\ni\fi\u05da\ti\u0001j\u0001j\u0003j\u05de\bj\u0001k\u0001k\u0001k"+ + "\u0001k\u0001k\u0001k\u0003k\u05e6\bk\u0001l\u0001l\u0001l\u0003l\u05eb"+ + "\bl\u0001m\u0005m\u05ee\bm\nm\fm\u05f1\tm\u0001m\u0001m\u0001m\u0001n"+ + "\u0001n\u0003n\u05f8\bn\u0001n\u0001n\u0001o\u0001o\u0003o\u05fe\bo\u0001"+ + "p\u0001p\u0001p\u0005p\u0603\bp\np\fp\u0606\tp\u0001q\u0001q\u0001q\u0001"+ + "q\u0001r\u0001r\u0001r\u0003r\u060f\br\u0001r\u0001r\u0001r\u0001r\u0001"+ + "r\u0005r\u0616\br\nr\fr\u0619\tr\u0001r\u0001r\u0001r\u0001r\u0003r\u061f"+ + "\br\u0001r\u0003r\u0622\br\u0001s\u0001s\u0003s\u0626\bs\u0001t\u0001"+ + "t\u0001t\u0001t\u0001t\u0001t\u0001t\u0001t\u0001t\u0001t\u0001t\u0001"+ + "t\u0001t\u0001t\u0001t\u0001t\u0003t\u0638\bt\u0003t\u063a\bt\u0001u\u0001"+ + "u\u0001u\u0001u\u0005u\u0640\bu\nu\fu\u0643\tu\u0001u\u0001u\u0001v\u0001"+ + "v\u0001v\u0001w\u0001w\u0001w\u0001w\u0001w\u0001w\u0001w\u0001w\u0001"+ + "w\u0001w\u0001w\u0001w\u0001w\u0003w\u0657\bw\u0001x\u0001x\u0001x\u0001"+ + "x\u0001y\u0001y\u0001y\u0001y\u0003y\u0661\by\u0001z\u0001z\u0001z\u0003"+ + "z\u0666\bz\u0001z\u0005z\u0669\bz\nz\fz\u066c\tz\u0001z\u0001z\u0003z"+ + "\u0670\bz\u0001{\u0001{\u0001{\u0001{\u0001{\u0001{\u0001{\u0003{\u0679"+ + "\b{\u0003{\u067b\b{\u0001|\u0001|\u0003|\u067f\b|\u0001|\u0003|\u0682"+ + "\b|\u0001}\u0001}\u0003}\u0686\b}\u0001}\u0001}\u0001~\u0001~\u0001~\u0001"+ + "~\u0005~\u068e\b~\n~\f~\u0691\t~\u0001~\u0001~\u0001~\u0001~\u0001~\u0001"+ + "~\u0001~\u0005~\u069a\b~\n~\f~\u069d\t~\u0001~\u0001~\u0005~\u06a1\b~"+ + "\n~\f~\u06a4\t~\u0003~\u06a6\b~\u0001\u007f\u0001\u007f\u0003\u007f\u06aa"+ + "\b\u007f\u0001\u0080\u0001\u0080\u0001\u0080\u0001\u0081\u0001\u0081\u0001"+ + "\u0081\u0003\u0081\u06b2\b\u0081\u0001\u0082\u0001\u0082\u0001\u0082\u0003"+ + "\u0082\u06b7\b\u0082\u0001\u0083\u0001\u0083\u0001\u0083\u0001\u0083\u0001"+ + "\u0084\u0001\u0084\u0001\u0084\u0005\u0084\u06c0\b\u0084\n\u0084\f\u0084"+ + "\u06c3\t\u0084\u0001\u0085\u0005\u0085\u06c6\b\u0085\n\u0085\f\u0085\u06c9"+ + "\t\u0085\u0001\u0085\u0001\u0085\u0003\u0085\u06cd\b\u0085\u0001\u0085"+ + "\u0005\u0085\u06d0\b\u0085\n\u0085\f\u0085\u06d3\t\u0085\u0001\u0085\u0001"+ + "\u0085\u0005\u0085\u06d7\b\u0085\n\u0085\f\u0085\u06da\t\u0085\u0001\u0086"+ + "\u0001\u0086\u0001\u0087\u0001\u0087\u0001\u0087\u0001\u0087\u0005\u0087"+ + "\u06e2\b\u0087\n\u0087\f\u0087\u06e5\t\u0087\u0001\u0087\u0001\u0087\u0001"+ + "\u0088\u0001\u0088\u0001\u0088\u0003\u0088\u06ec\b\u0088\u0001\u0088\u0001"+ + "\u0088\u0003\u0088\u06f0\b\u0088\u0003\u0088\u06f2\b\u0088\u0001\u0089"+ + "\u0001\u0089\u0001\u0089\u0001\u0089\u0001\u0089\u0003\u0089\u06f9\b\u0089"+ + "\u0001\u008a\u0001\u008a\u0003\u008a\u06fd\b\u008a\u0001\u008a\u0001\u008a"+ + "\u0001\u008a\u0000\u0001\u00d2\u008b\u0000\u0002\u0004\u0006\b\n\f\u000e"+ + "\u0010\u0012\u0014\u0016\u0018\u001a\u001c\u001e \"$&(*,.02468:<>@BDF"+ + "HJLNPRTVXZ\\^`bdfhjlnprtvxz|~\u0080\u0082\u0084\u0086\u0088\u008a\u008c"+ + "\u008e\u0090\u0092\u0094\u0096\u0098\u009a\u009c\u009e\u00a0\u00a2\u00a4"+ + "\u00a6\u00a8\u00aa\u00ac\u00ae\u00b0\u00b2\u00b4\u00b6\u00b8\u00ba\u00bc"+ + "\u00be\u00c0\u00c2\u00c4\u00c6\u00c8\u00ca\u00cc\u00ce\u00d0\u00d2\u00d4"+ + "\u00d6\u00d8\u00da\u00dc\u00de\u00e0\u00e2\u00e4\u00e6\u00e8\u00ea\u00ec"+ + "\u00ee\u00f0\u00f2\u00f4\u00f6\u00f8\u00fa\u00fc\u00fe\u0100\u0102\u0104"+ + "\u0106\u0108\u010a\u010c\u010e\u0110\u0112\u0114\u0000\u000f\u0002\u0000"+ + "\u0011\u0011\u0018\u0018\u0001\u0000CF\u0001\u0000GH\u0002\u0000&&<<\u0002"+ + "\u00003A\u0080\u0080\u0003\u00003\u0245\u0001\u0000\u0000\u0000@\u0248\u0001\u0000\u0000\u0000B\u0254"+ + "\u0001\u0000\u0000\u0000D\u0262\u0001\u0000\u0000\u0000F\u026d\u0001\u0000"+ + "\u0000\u0000H\u0272\u0001\u0000\u0000\u0000J\u027b\u0001\u0000\u0000\u0000"+ + "L\u0290\u0001\u0000\u0000\u0000N\u0298\u0001\u0000\u0000\u0000P\u029d"+ + "\u0001\u0000\u0000\u0000R\u02a7\u0001\u0000\u0000\u0000T\u02a9\u0001\u0000"+ + "\u0000\u0000V\u02c1\u0001\u0000\u0000\u0000X\u02ca\u0001\u0000\u0000\u0000"+ + "Z\u02cf\u0001\u0000\u0000\u0000\\\u02d7\u0001\u0000\u0000\u0000^\u02da"+ + "\u0001\u0000\u0000\u0000`\u02dd\u0001\u0000\u0000\u0000b\u02e5\u0001\u0000"+ + "\u0000\u0000d\u02e7\u0001\u0000\u0000\u0000f\u02f8\u0001\u0000\u0000\u0000"+ + "h\u0311\u0001\u0000\u0000\u0000j\u031e\u0001\u0000\u0000\u0000l\u0323"+ + "\u0001\u0000\u0000\u0000n\u0332\u0001\u0000\u0000\u0000p\u033d\u0001\u0000"+ + "\u0000\u0000r\u0343\u0001\u0000\u0000\u0000t\u0352\u0001\u0000\u0000\u0000"+ + "v\u0354\u0001\u0000\u0000\u0000x\u0356\u0001\u0000\u0000\u0000z\u035d"+ + "\u0001\u0000\u0000\u0000|\u0366\u0001\u0000\u0000\u0000~\u0370\u0001\u0000"+ + "\u0000\u0000\u0080\u0378\u0001\u0000\u0000\u0000\u0082\u037f\u0001\u0000"+ + "\u0000\u0000\u0084\u0381\u0001\u0000\u0000\u0000\u0086\u0391\u0001\u0000"+ + "\u0000\u0000\u0088\u0396\u0001\u0000\u0000\u0000\u008a\u03a7\u0001\u0000"+ + "\u0000\u0000\u008c\u03b1\u0001\u0000\u0000\u0000\u008e\u03b5\u0001\u0000"+ + "\u0000\u0000\u0090\u03b7\u0001\u0000\u0000\u0000\u0092\u03bd\u0001\u0000"+ + "\u0000\u0000\u0094\u03bf\u0001\u0000\u0000\u0000\u0096\u03c3\u0001\u0000"+ + "\u0000\u0000\u0098\u03c9\u0001\u0000\u0000\u0000\u009a\u03f6\u0001\u0000"+ + "\u0000\u0000\u009c\u03f8\u0001\u0000\u0000\u0000\u009e\u03fa\u0001\u0000"+ + "\u0000\u0000\u00a0\u0406\u0001\u0000\u0000\u0000\u00a2\u040c\u0001\u0000"+ + "\u0000\u0000\u00a4\u0415\u0001\u0000\u0000\u0000\u00a6\u0419\u0001\u0000"+ + "\u0000\u0000\u00a8\u0422\u0001\u0000\u0000\u0000\u00aa\u0430\u0001\u0000"+ + "\u0000\u0000\u00ac\u0435\u0001\u0000\u0000\u0000\u00ae\u043e\u0001\u0000"+ + "\u0000\u0000\u00b0\u0440\u0001\u0000\u0000\u0000\u00b2\u044e\u0001\u0000"+ + "\u0000\u0000\u00b4\u04bd\u0001\u0000\u0000\u0000\u00b6\u04bf\u0001\u0000"+ + "\u0000\u0000\u00b8\u04ce\u0001\u0000\u0000\u0000\u00ba\u04d6\u0001\u0000"+ + "\u0000\u0000\u00bc\u04d9\u0001\u0000\u0000\u0000\u00be\u04e0\u0001\u0000"+ + "\u0000\u0000\u00c0\u04fa\u0001\u0000\u0000\u0000\u00c2\u04fd\u0001\u0000"+ + "\u0000\u0000\u00c4\u0513\u0001\u0000\u0000\u0000\u00c6\u0521\u0001\u0000"+ + "\u0000\u0000\u00c8\u0525\u0001\u0000\u0000\u0000\u00ca\u052a\u0001\u0000"+ + "\u0000\u0000\u00cc\u0537\u0001\u0000\u0000\u0000\u00ce\u053b\u0001\u0000"+ + "\u0000\u0000\u00d0\u0556\u0001\u0000\u0000\u0000\u00d2\u0583\u0001\u0000"+ + "\u0000\u0000\u00d4\u05dd\u0001\u0000\u0000\u0000\u00d6\u05e5\u0001\u0000"+ + "\u0000\u0000\u00d8\u05e7\u0001\u0000\u0000\u0000\u00da\u05ef\u0001\u0000"+ + "\u0000\u0000\u00dc\u05f5\u0001\u0000\u0000\u0000\u00de\u05fd\u0001\u0000"+ + "\u0000\u0000\u00e0\u05ff\u0001\u0000\u0000\u0000\u00e2\u0607\u0001\u0000"+ + "\u0000\u0000\u00e4\u0621\u0001\u0000\u0000\u0000\u00e6\u0625\u0001\u0000"+ + "\u0000\u0000\u00e8\u0639\u0001\u0000\u0000\u0000\u00ea\u063b\u0001\u0000"+ + "\u0000\u0000\u00ec\u0646\u0001\u0000\u0000\u0000\u00ee\u0656\u0001\u0000"+ + "\u0000\u0000\u00f0\u0658\u0001\u0000\u0000\u0000\u00f2\u0660\u0001\u0000"+ + "\u0000\u0000\u00f4\u0665\u0001\u0000\u0000\u0000\u00f6\u067a\u0001\u0000"+ + "\u0000\u0000\u00f8\u0681\u0001\u0000\u0000\u0000\u00fa\u0683\u0001\u0000"+ + "\u0000\u0000\u00fc\u0689\u0001\u0000\u0000\u0000\u00fe\u06a7\u0001\u0000"+ + "\u0000\u0000\u0100\u06ab\u0001\u0000\u0000\u0000\u0102\u06b1\u0001\u0000"+ + "\u0000\u0000\u0104\u06b6\u0001\u0000\u0000\u0000\u0106\u06b8\u0001\u0000"+ + "\u0000\u0000\u0108\u06bc\u0001\u0000\u0000\u0000\u010a\u06c7\u0001\u0000"+ + "\u0000\u0000\u010c\u06db\u0001\u0000\u0000\u0000\u010e\u06dd\u0001\u0000"+ + "\u0000\u0000\u0110\u06f1\u0001\u0000\u0000\u0000\u0112\u06f8\u0001\u0000"+ + "\u0000\u0000\u0114\u06fa\u0001\u0000\u0000\u0000\u0116\u0118\u0003\u0002"+ + "\u0001\u0000\u0117\u0116\u0001\u0000\u0000\u0000\u0117\u0118\u0001\u0000"+ + "\u0000\u0000\u0118\u011c\u0001\u0000\u0000\u0000\u0119\u011b\u0003\u0004"+ + "\u0002\u0000\u011a\u0119\u0001\u0000\u0000\u0000\u011b\u011e\u0001\u0000"+ + "\u0000\u0000\u011c\u011a\u0001\u0000\u0000\u0000\u011c\u011d\u0001\u0000"+ + "\u0000\u0000\u011d\u0122\u0001\u0000\u0000\u0000\u011e\u011c\u0001\u0000"+ + "\u0000\u0000\u011f\u0121\u0003\u0006\u0003\u0000\u0120\u011f\u0001\u0000"+ + "\u0000\u0000\u0121\u0124\u0001\u0000\u0000\u0000\u0122\u0120\u0001\u0000"+ + "\u0000\u0000\u0122\u0123\u0001\u0000\u0000\u0000\u0123\u0129\u0001\u0000"+ + "\u0000\u0000\u0124\u0122\u0001\u0000\u0000\u0000\u0125\u0126\u0003\u0096"+ + "K\u0000\u0126\u0127\u0005\u0000\u0000\u0001\u0127\u0129\u0001\u0000\u0000"+ + "\u0000\u0128\u0117\u0001\u0000\u0000\u0000\u0128\u0125\u0001\u0000\u0000"+ + "\u0000\u0129\u0001\u0001\u0000\u0000\u0000\u012a\u012c\u0003|>\u0000\u012b"+ + "\u012a\u0001\u0000\u0000\u0000\u012c\u012f\u0001\u0000\u0000\u0000\u012d"+ + "\u012b\u0001\u0000\u0000\u0000\u012d\u012e\u0001\u0000\u0000\u0000\u012e"+ + "\u0130\u0001\u0000\u0000\u0000\u012f\u012d\u0001\u0000\u0000\u0000\u0130"+ + "\u0131\u0005 \u0000\u0000\u0131\u0132\u0003r9\u0000\u0132\u0133\u0005"+ + "T\u0000\u0000\u0133\u0003\u0001\u0000\u0000\u0000\u0134\u0136\u0005\u0019"+ + "\u0000\u0000\u0135\u0137\u0005&\u0000\u0000\u0136\u0135\u0001\u0000\u0000"+ + "\u0000\u0136\u0137\u0001\u0000\u0000\u0000\u0137\u0138\u0001\u0000\u0000"+ + "\u0000\u0138\u013b\u0003r9\u0000\u0139\u013a\u0005V\u0000\u0000\u013a"+ + "\u013c\u0005h\u0000\u0000\u013b\u0139\u0001\u0000\u0000\u0000\u013b\u013c"+ + "\u0001\u0000\u0000\u0000\u013c\u013d\u0001\u0000\u0000\u0000\u013d\u013e"+ + "\u0005T\u0000\u0000\u013e\u0005\u0001\u0000\u0000\u0000\u013f\u0141\u0003"+ + "\n\u0005\u0000\u0140\u013f\u0001\u0000\u0000\u0000\u0141\u0144\u0001\u0000"+ + "\u0000\u0000\u0142\u0140\u0001\u0000\u0000\u0000\u0142\u0143\u0001\u0000"+ + "\u0000\u0000\u0143\u014a\u0001\u0000\u0000\u0000\u0144\u0142\u0001\u0000"+ + "\u0000\u0000\u0145\u014b\u0003\u000e\u0007\u0000\u0146\u014b\u0003\u0016"+ + "\u000b\u0000\u0147\u014b\u0003\u001e\u000f\u0000\u0148\u014b\u0003\u0086"+ + "C\u0000\u0149\u014b\u0003\u009eO\u0000\u014a\u0145\u0001\u0000\u0000\u0000"+ + "\u014a\u0146\u0001\u0000\u0000\u0000\u014a\u0147\u0001\u0000\u0000\u0000"+ + "\u014a\u0148\u0001\u0000\u0000\u0000\u014a\u0149\u0001\u0000\u0000\u0000"+ + "\u014b\u014e\u0001\u0000\u0000\u0000\u014c\u014e\u0005T\u0000\u0000\u014d"+ + "\u0142\u0001\u0000\u0000\u0000\u014d\u014c\u0001\u0000\u0000\u0000\u014e"+ + "\u0007\u0001\u0000\u0000\u0000\u014f\u0155\u0003\n\u0005\u0000\u0150\u0155"+ + "\u0005\u001e\u0000\u0000\u0151\u0155\u0005*\u0000\u0000\u0152\u0155\u0005"+ + ".\u0000\u0000\u0153\u0155\u00051\u0000\u0000\u0154\u014f\u0001\u0000\u0000"+ + "\u0000\u0154\u0150\u0001\u0000\u0000\u0000\u0154\u0151\u0001\u0000\u0000"+ + "\u0000\u0154\u0152\u0001\u0000\u0000\u0000\u0154\u0153\u0001\u0000\u0000"+ + "\u0000\u0155\t\u0001\u0000\u0000\u0000\u0156\u0161\u0003|>\u0000\u0157"+ + "\u0161\u0005#\u0000\u0000\u0158\u0161\u0005\"\u0000\u0000\u0159\u0161"+ + "\u0005!\u0000\u0000\u015a\u0161\u0005&\u0000\u0000\u015b\u0161\u0005\u0001"+ + "\u0000\u0000\u015c\u0161\u0005\u0012\u0000\u0000\u015d\u0161\u0005\'\u0000"+ + "\u0000\u015e\u0161\u0005@\u0000\u0000\u015f\u0161\u0005B\u0000\u0000\u0160"+ + "\u0156\u0001\u0000\u0000\u0000\u0160\u0157\u0001\u0000\u0000\u0000\u0160"+ + "\u0158\u0001\u0000\u0000\u0000\u0160\u0159\u0001\u0000\u0000\u0000\u0160"+ + "\u015a\u0001\u0000\u0000\u0000\u0160\u015b\u0001\u0000\u0000\u0000\u0160"+ + "\u015c\u0001\u0000\u0000\u0000\u0160\u015d\u0001\u0000\u0000\u0000\u0160"+ + "\u015e\u0001\u0000\u0000\u0000\u0160\u015f\u0001\u0000\u0000\u0000\u0161"+ + "\u000b\u0001\u0000\u0000\u0000\u0162\u0165\u0005\u0012\u0000\u0000\u0163"+ + "\u0165\u0003|>\u0000\u0164\u0162\u0001\u0000\u0000\u0000\u0164\u0163\u0001"+ + "\u0000\u0000\u0000\u0165\r\u0001\u0000\u0000\u0000\u0166\u0167\u0005\t"+ + "\u0000\u0000\u0167\u0169\u0003\u00aeW\u0000\u0168\u016a\u0003\u0010\b"+ + "\u0000\u0169\u0168\u0001\u0000\u0000\u0000\u0169\u016a\u0001\u0000\u0000"+ + "\u0000\u016a\u016d\u0001\u0000\u0000\u0000\u016b\u016c\u0005\u0011\u0000"+ + "\u0000\u016c\u016e\u0003\u010a\u0085\u0000\u016d\u016b\u0001\u0000\u0000"+ + "\u0000\u016d\u016e\u0001\u0000\u0000\u0000\u016e\u0171\u0001\u0000\u0000"+ + "\u0000\u016f\u0170\u0005\u0018\u0000\u0000\u0170\u0172\u0003\u0108\u0084"+ + "\u0000\u0171\u016f\u0001\u0000\u0000\u0000\u0171\u0172\u0001\u0000\u0000"+ + "\u0000\u0172\u0175\u0001\u0000\u0000\u0000\u0173\u0174\u0005A\u0000\u0000"+ + "\u0174\u0176\u0003\u0108\u0084\u0000\u0175\u0173\u0001\u0000\u0000\u0000"+ + "\u0175\u0176\u0001\u0000\u0000\u0000\u0176\u0177\u0001\u0000\u0000\u0000"+ + "\u0177\u0178\u0003 \u0010\u0000\u0178\u000f\u0001\u0000\u0000\u0000\u0179"+ + "\u017a\u0005Y\u0000\u0000\u017a\u017f\u0003\u0012\t\u0000\u017b\u017c"+ + "\u0005U\u0000\u0000\u017c\u017e\u0003\u0012\t\u0000\u017d\u017b\u0001"+ + "\u0000\u0000\u0000\u017e\u0181\u0001\u0000\u0000\u0000\u017f\u017d\u0001"+ + "\u0000\u0000\u0000\u017f\u0180\u0001\u0000\u0000\u0000\u0180\u0182\u0001"+ + "\u0000\u0000\u0000\u0181\u017f\u0001\u0000\u0000\u0000\u0182\u0183\u0005"+ + "X\u0000\u0000\u0183\u0011\u0001\u0000\u0000\u0000\u0184\u0186\u0003|>"+ + "\u0000\u0185\u0184\u0001\u0000\u0000\u0000\u0186\u0189\u0001\u0000\u0000"+ + "\u0000\u0187\u0185\u0001\u0000\u0000\u0000\u0187\u0188\u0001\u0000\u0000"+ + "\u0000\u0188\u018a\u0001\u0000\u0000\u0000\u0189\u0187\u0001\u0000\u0000"+ + "\u0000\u018a\u0193\u0003\u00aeW\u0000\u018b\u018f\u0007\u0000\u0000\u0000"+ + "\u018c\u018e\u0003|>\u0000\u018d\u018c\u0001\u0000\u0000\u0000\u018e\u0191"+ + "\u0001\u0000\u0000\u0000\u018f\u018d\u0001\u0000\u0000\u0000\u018f\u0190"+ + "\u0001\u0000\u0000\u0000\u0190\u0192\u0001\u0000\u0000\u0000\u0191\u018f"+ + "\u0001\u0000\u0000\u0000\u0192\u0194\u0003\u0014\n\u0000\u0193\u018b\u0001"+ + "\u0000\u0000\u0000\u0193\u0194\u0001\u0000\u0000\u0000\u0194\u0013\u0001"+ + "\u0000\u0000\u0000\u0195\u019a\u0003\u010a\u0085\u0000\u0196\u0197\u0005"+ + "j\u0000\u0000\u0197\u0199\u0003\u010a\u0085\u0000\u0198\u0196\u0001\u0000"+ + "\u0000\u0000\u0199\u019c\u0001\u0000\u0000\u0000\u019a\u0198\u0001\u0000"+ + "\u0000\u0000\u019a\u019b\u0001\u0000\u0000\u0000\u019b\u0015\u0001\u0000"+ + "\u0000\u0000\u019c\u019a\u0001\u0000\u0000\u0000\u019d\u019e\u0005\u0010"+ + "\u0000\u0000\u019e\u01a1\u0003\u00aeW\u0000\u019f\u01a0\u0005\u0018\u0000"+ + "\u0000\u01a0\u01a2\u0003\u0108\u0084\u0000\u01a1\u019f\u0001\u0000\u0000"+ + "\u0000\u01a1\u01a2\u0001\u0000\u0000\u0000\u01a2\u01a3\u0001\u0000\u0000"+ + "\u0000\u01a3\u01a5\u0005P\u0000\u0000\u01a4\u01a6\u0003\u0018\f\u0000"+ + "\u01a5\u01a4\u0001\u0000\u0000\u0000\u01a5\u01a6\u0001\u0000\u0000\u0000"+ + "\u01a6\u01a8\u0001\u0000\u0000\u0000\u01a7\u01a9\u0005U\u0000\u0000\u01a8"+ + "\u01a7\u0001\u0000\u0000\u0000\u01a8\u01a9\u0001\u0000\u0000\u0000\u01a9"+ + "\u01ab\u0001\u0000\u0000\u0000\u01aa\u01ac\u0003\u001c\u000e\u0000\u01ab"+ + "\u01aa\u0001\u0000\u0000\u0000\u01ab\u01ac\u0001\u0000\u0000\u0000\u01ac"+ + "\u01ad\u0001\u0000\u0000\u0000\u01ad\u01ae\u0005Q\u0000\u0000\u01ae\u0017"+ + "\u0001\u0000\u0000\u0000\u01af\u01b4\u0003\u001a\r\u0000\u01b0\u01b1\u0005"+ + "U\u0000\u0000\u01b1\u01b3\u0003\u001a\r\u0000\u01b2\u01b0\u0001\u0000"+ + "\u0000\u0000\u01b3\u01b6\u0001\u0000\u0000\u0000\u01b4\u01b2\u0001\u0000"+ + "\u0000\u0000\u01b4\u01b5\u0001\u0000\u0000\u0000\u01b5\u0019\u0001\u0000"+ + "\u0000\u0000\u01b6\u01b4\u0001\u0000\u0000\u0000\u01b7\u01b9\u0003|>\u0000"+ + "\u01b8\u01b7\u0001\u0000\u0000\u0000\u01b9\u01bc\u0001\u0000\u0000\u0000"+ + "\u01ba\u01b8\u0001\u0000\u0000\u0000\u01ba\u01bb\u0001\u0000\u0000\u0000"+ + "\u01bb\u01bd\u0001\u0000\u0000\u0000\u01bc\u01ba\u0001\u0000\u0000\u0000"+ + "\u01bd\u01bf\u0003\u00aeW\u0000\u01be\u01c0\u0003\u0114\u008a\u0000\u01bf"+ + "\u01be\u0001\u0000\u0000\u0000\u01bf\u01c0\u0001\u0000\u0000\u0000\u01c0"+ + "\u01c2\u0001\u0000\u0000\u0000\u01c1\u01c3\u0003 \u0010\u0000\u01c2\u01c1"+ + "\u0001\u0000\u0000\u0000\u01c2\u01c3\u0001\u0000\u0000\u0000\u01c3\u001b"+ + "\u0001\u0000\u0000\u0000\u01c4\u01c8\u0005T\u0000\u0000\u01c5\u01c7\u0003"+ + "$\u0012\u0000\u01c6\u01c5\u0001\u0000\u0000\u0000\u01c7\u01ca\u0001\u0000"+ + "\u0000\u0000\u01c8\u01c6\u0001\u0000\u0000\u0000\u01c8\u01c9\u0001\u0000"+ + "\u0000\u0000\u01c9\u001d\u0001\u0000\u0000\u0000\u01ca\u01c8\u0001\u0000"+ + "\u0000\u0000\u01cb\u01cc\u0005\u001c\u0000\u0000\u01cc\u01ce\u0003\u00ae"+ + "W\u0000\u01cd\u01cf\u0003\u0010\b\u0000\u01ce\u01cd\u0001\u0000\u0000"+ + "\u0000\u01ce\u01cf\u0001\u0000\u0000\u0000\u01cf\u01d2\u0001\u0000\u0000"+ + "\u0000\u01d0\u01d1\u0005\u0011\u0000\u0000\u01d1\u01d3\u0003\u0108\u0084"+ + "\u0000\u01d2\u01d0\u0001\u0000\u0000\u0000\u01d2\u01d3\u0001\u0000\u0000"+ + "\u0000\u01d3\u01d6\u0001\u0000\u0000\u0000\u01d4\u01d5\u0005A\u0000\u0000"+ + "\u01d5\u01d7\u0003\u0108\u0084\u0000\u01d6\u01d4\u0001\u0000\u0000\u0000"+ + "\u01d6\u01d7\u0001\u0000\u0000\u0000\u01d7\u01d8\u0001\u0000\u0000\u0000"+ + "\u01d8\u01d9\u0003\"\u0011\u0000\u01d9\u001f\u0001\u0000\u0000\u0000\u01da"+ + "\u01de\u0005P\u0000\u0000\u01db\u01dd\u0003$\u0012\u0000\u01dc\u01db\u0001"+ + "\u0000\u0000\u0000\u01dd\u01e0\u0001\u0000\u0000\u0000\u01de\u01dc\u0001"+ + "\u0000\u0000\u0000\u01de\u01df\u0001\u0000\u0000\u0000\u01df\u01e1\u0001"+ + "\u0000\u0000\u0000\u01e0\u01de\u0001\u0000\u0000\u0000\u01e1\u01e2\u0005"+ + "Q\u0000\u0000\u01e2!\u0001\u0000\u0000\u0000\u01e3\u01e7\u0005P\u0000"+ + "\u0000\u01e4\u01e6\u0003<\u001e\u0000\u01e5\u01e4\u0001\u0000\u0000\u0000"+ + "\u01e6\u01e9\u0001\u0000\u0000\u0000\u01e7\u01e5\u0001\u0000\u0000\u0000"+ + "\u01e7\u01e8\u0001\u0000\u0000\u0000\u01e8\u01ea\u0001\u0000\u0000\u0000"+ + "\u01e9\u01e7\u0001\u0000\u0000\u0000\u01ea\u01eb\u0005Q\u0000\u0000\u01eb"+ + "#\u0001\u0000\u0000\u0000\u01ec\u01f9\u0005T\u0000\u0000\u01ed\u01ef\u0005"+ + "&\u0000\u0000\u01ee\u01ed\u0001\u0000\u0000\u0000\u01ee\u01ef\u0001\u0000"+ + "\u0000\u0000\u01ef\u01f0\u0001\u0000\u0000\u0000\u01f0\u01f9\u0003\u00a8"+ + "T\u0000\u01f1\u01f3\u0003\b\u0004\u0000\u01f2\u01f1\u0001\u0000\u0000"+ + "\u0000\u01f3\u01f6\u0001\u0000\u0000\u0000\u01f4\u01f2\u0001\u0000\u0000"+ + "\u0000\u01f4\u01f5\u0001\u0000\u0000\u0000\u01f5\u01f7\u0001\u0000\u0000"+ + "\u0000\u01f6\u01f4\u0001\u0000\u0000\u0000\u01f7\u01f9\u0003&\u0013\u0000"+ + "\u01f8\u01ec\u0001\u0000\u0000\u0000\u01f8\u01ee\u0001\u0000\u0000\u0000"+ + "\u01f8\u01f4\u0001\u0000\u0000\u0000\u01f9%\u0001\u0000\u0000\u0000\u01fa"+ + "\u01ff\u0003\u0006\u0003\u0000\u01fb\u01ff\u0003:\u001d\u0000\u01fc\u01ff"+ + "\u0003(\u0014\u0000\u01fd\u01ff\u00034\u001a\u0000\u01fe\u01fa\u0001\u0000"+ + "\u0000\u0000\u01fe\u01fb\u0001\u0000\u0000\u0000\u01fe\u01fc\u0001\u0000"+ + "\u0000\u0000\u01fe\u01fd\u0001\u0000\u0000\u0000\u01ff\'\u0001\u0000\u0000"+ + "\u0000\u0200\u0203\u0003*\u0015\u0000\u0201\u0203\u00032\u0019\u0000\u0202"+ + "\u0200\u0001\u0000\u0000\u0000\u0202\u0201\u0001\u0000\u0000\u0000\u0203"+ + ")\u0001\u0000\u0000\u0000\u0204\u0207\u0003,\u0016\u0000\u0205\u0206\u0005"+ + "-\u0000\u0000\u0206\u0208\u0003b1\u0000\u0207\u0205\u0001\u0000\u0000"+ + "\u0000\u0207\u0208\u0001\u0000\u0000\u0000\u0208\u0209\u0001\u0000\u0000"+ + "\u0000\u0209\u020a\u0003.\u0017\u0000\u020a+\u0001\u0000\u0000\u0000\u020b"+ + "\u020d\u00030\u0018\u0000\u020c\u020b\u0001\u0000\u0000\u0000\u020c\u020d"+ + "\u0001\u0000\u0000\u0000\u020d\u020e\u0001\u0000\u0000\u0000\u020e\u020f"+ + "\u0003\u00aeW\u0000\u020f\u0214\u0003d2\u0000\u0210\u0211\u0005R\u0000"+ + "\u0000\u0211\u0213\u0005S\u0000\u0000\u0212\u0210\u0001\u0000\u0000\u0000"+ + "\u0213\u0216\u0001\u0000\u0000\u0000\u0214\u0212\u0001\u0000\u0000\u0000"+ + "\u0214\u0215\u0001\u0000\u0000\u0000\u0215-\u0001\u0000\u0000\u0000\u0216"+ + "\u0214\u0001\u0000\u0000\u0000\u0217\u021a\u0003\u00a8T\u0000\u0218\u021a"+ + "\u0005T\u0000\u0000\u0219\u0217\u0001\u0000\u0000\u0000\u0219\u0218\u0001"+ + "\u0000\u0000\u0000\u021a/\u0001\u0000\u0000\u0000\u021b\u021e\u0003\u010a"+ + "\u0085\u0000\u021c\u021e\u00050\u0000\u0000\u021d\u021b\u0001\u0000\u0000"+ + "\u0000\u021d\u021c\u0001\u0000\u0000\u0000\u021e1\u0001\u0000\u0000\u0000"+ + "\u021f\u0220\u0003\u0010\b\u0000\u0220\u0221\u0003*\u0015\u0000\u0221"+ + "3\u0001\u0000\u0000\u0000\u0222\u0225\u00036\u001b\u0000\u0223\u0225\u0003"+ + "8\u001c\u0000\u0224\u0222\u0001\u0000\u0000\u0000\u0224\u0223\u0001\u0000"+ + "\u0000\u0000\u02255\u0001\u0000\u0000\u0000\u0226\u0227\u0003\u0010\b"+ + "\u0000\u0227\u0228\u00038\u001c\u0000\u02287\u0001\u0000\u0000\u0000\u0229"+ + "\u022a\u0003\u00aeW\u0000\u022a\u022d\u0003d2\u0000\u022b\u022c\u0005"+ + "-\u0000\u0000\u022c\u022e\u0003b1\u0000\u022d\u022b\u0001\u0000\u0000"+ + "\u0000\u022d\u022e\u0001\u0000\u0000\u0000\u022e\u022f\u0001\u0000\u0000"+ + "\u0000\u022f\u0230\u0003\u00a8T\u0000\u02309\u0001\u0000\u0000\u0000\u0231"+ + "\u0233\u0003\u010a\u0085\u0000\u0232\u0231\u0001\u0000\u0000\u0000\u0232"+ + "\u0233\u0001\u0000\u0000\u0000\u0233\u0234\u0001\u0000\u0000\u0000\u0234"+ + "\u0235\u0003L&\u0000\u0235\u0236\u0005T\u0000\u0000\u0236;\u0001\u0000"+ + "\u0000\u0000\u0237\u0239\u0003\b\u0004\u0000\u0238\u0237\u0001\u0000\u0000"+ + "\u0000\u0239\u023c\u0001\u0000\u0000\u0000\u023a\u0238\u0001\u0000\u0000"+ + "\u0000\u023a\u023b\u0001\u0000\u0000\u0000\u023b\u023d\u0001\u0000\u0000"+ + "\u0000\u023c\u023a\u0001\u0000\u0000\u0000\u023d\u0240\u0003>\u001f\u0000"+ + "\u023e\u0240\u0005T\u0000\u0000\u023f\u023a\u0001\u0000\u0000\u0000\u023f"+ + "\u023e\u0001\u0000\u0000\u0000\u0240=\u0001\u0000\u0000\u0000\u0241\u0246"+ + "\u0003@ \u0000\u0242\u0246\u0003D\"\u0000\u0243\u0246\u0003H$\u0000\u0244"+ + "\u0246\u0003\u0006\u0003\u0000\u0245\u0241\u0001\u0000\u0000\u0000\u0245"+ + "\u0242\u0001\u0000\u0000\u0000\u0245\u0243\u0001\u0000\u0000\u0000\u0245"+ + "\u0244\u0001\u0000\u0000\u0000\u0246?\u0001\u0000\u0000\u0000\u0247\u0249"+ + "\u0003\u010a\u0085\u0000\u0248\u0247\u0001\u0000\u0000\u0000\u0248\u0249"+ + "\u0001\u0000\u0000\u0000\u0249\u024a\u0001\u0000\u0000\u0000\u024a\u024f"+ + "\u0003B!\u0000\u024b\u024c\u0005U\u0000\u0000\u024c\u024e\u0003B!\u0000"+ + "\u024d\u024b\u0001\u0000\u0000\u0000\u024e\u0251\u0001\u0000\u0000\u0000"+ + "\u024f\u024d\u0001\u0000\u0000\u0000\u024f\u0250\u0001\u0000\u0000\u0000"+ + "\u0250\u0252\u0001\u0000\u0000\u0000\u0251\u024f\u0001\u0000\u0000\u0000"+ + "\u0252\u0253\u0005T\u0000\u0000\u0253A\u0001\u0000\u0000\u0000\u0254\u0259"+ + "\u0003\u00aeW\u0000\u0255\u0256\u0005R\u0000\u0000\u0256\u0258\u0005S"+ + "\u0000\u0000\u0257\u0255\u0001\u0000\u0000\u0000\u0258\u025b\u0001\u0000"+ + "\u0000\u0000\u0259\u0257\u0001\u0000\u0000\u0000\u0259\u025a\u0001\u0000"+ + "\u0000\u0000\u025a\u025c\u0001\u0000\u0000\u0000\u025b\u0259\u0001\u0000"+ + "\u0000\u0000\u025c\u025d\u0005W\u0000\u0000\u025d\u025e\u0003R)\u0000"+ + "\u025eC\u0001\u0000\u0000\u0000\u025f\u0261\u0003F#\u0000\u0260\u025f"+ + "\u0001\u0000\u0000\u0000\u0261\u0264\u0001\u0000\u0000\u0000\u0262\u0260"+ + "\u0001\u0000\u0000\u0000\u0262\u0263\u0001\u0000\u0000\u0000\u0263\u0265"+ + "\u0001\u0000\u0000\u0000\u0264\u0262\u0001\u0000\u0000\u0000\u0265\u0266"+ + "\u0003J%\u0000\u0266E\u0001\u0000\u0000\u0000\u0267\u026e\u0003|>\u0000"+ + "\u0268\u026e\u0005#\u0000\u0000\u0269\u026e\u0005\u0001\u0000\u0000\u026a"+ + "\u026e\u0005\f\u0000\u0000\u026b\u026e\u0005&\u0000\u0000\u026c\u026e"+ + "\u0005\'\u0000\u0000\u026d\u0267\u0001\u0000\u0000\u0000\u026d\u0268\u0001"+ + "\u0000\u0000\u0000\u026d\u0269\u0001\u0000\u0000\u0000\u026d\u026a\u0001"+ + "\u0000\u0000\u0000\u026d\u026b\u0001\u0000\u0000\u0000\u026d\u026c\u0001"+ + "\u0000\u0000\u0000\u026eG\u0001\u0000\u0000\u0000\u026f\u0271\u0003F#"+ + "\u0000\u0270\u026f\u0001\u0000\u0000\u0000\u0271\u0274\u0001\u0000\u0000"+ + "\u0000\u0272\u0270\u0001\u0000\u0000\u0000\u0272\u0273\u0001\u0000\u0000"+ + "\u0000\u0273\u0275\u0001\u0000\u0000\u0000\u0274\u0272\u0001\u0000\u0000"+ + "\u0000\u0275\u0276\u0003\u0010\b\u0000\u0276\u0277\u0003J%\u0000\u0277"+ + "I\u0001\u0000\u0000\u0000\u0278\u027a\u0003|>\u0000\u0279\u0278\u0001"+ + "\u0000\u0000\u0000\u027a\u027d\u0001\u0000\u0000\u0000\u027b\u0279\u0001"+ + "\u0000\u0000\u0000\u027b\u027c\u0001\u0000\u0000\u0000\u027c\u027f\u0001"+ + "\u0000\u0000\u0000\u027d\u027b\u0001\u0000\u0000\u0000\u027e\u0280\u0003"+ + "0\u0018\u0000\u027f\u027e\u0001\u0000\u0000\u0000\u027f\u0280\u0001\u0000"+ + "\u0000\u0000\u0280\u0281\u0001\u0000\u0000\u0000\u0281\u0282\u0003\u00ae"+ + "W\u0000\u0282\u0287\u0003d2\u0000\u0283\u0284\u0005R\u0000\u0000\u0284"+ + "\u0286\u0005S\u0000\u0000\u0285\u0283\u0001\u0000\u0000\u0000\u0286\u0289"+ + "\u0001\u0000\u0000\u0000\u0287\u0285\u0001\u0000\u0000\u0000\u0287\u0288"+ + "\u0001\u0000\u0000\u0000\u0288\u028c\u0001\u0000\u0000\u0000\u0289\u0287"+ + "\u0001\u0000\u0000\u0000\u028a\u028b\u0005-\u0000\u0000\u028b\u028d\u0003"+ + "b1\u0000\u028c\u028a\u0001\u0000\u0000\u0000\u028c\u028d\u0001\u0000\u0000"+ + "\u0000\u028d\u028e\u0001\u0000\u0000\u0000\u028e\u028f\u0003.\u0017\u0000"+ + "\u028fK\u0001\u0000\u0000\u0000\u0290\u0295\u0003N\'\u0000\u0291\u0292"+ + "\u0005U\u0000\u0000\u0292\u0294\u0003N\'\u0000\u0293\u0291\u0001\u0000"+ + "\u0000\u0000\u0294\u0297\u0001\u0000\u0000\u0000\u0295\u0293\u0001\u0000"+ + "\u0000\u0000\u0295\u0296\u0001\u0000\u0000\u0000\u0296M\u0001\u0000\u0000"+ + "\u0000\u0297\u0295\u0001\u0000\u0000\u0000\u0298\u029b\u0003P(\u0000\u0299"+ + "\u029a\u0005W\u0000\u0000\u029a\u029c\u0003R)\u0000\u029b\u0299\u0001"+ + "\u0000\u0000\u0000\u029b\u029c\u0001\u0000\u0000\u0000\u029cO\u0001\u0000"+ + "\u0000\u0000\u029d\u02a2\u0003\u00aeW\u0000\u029e\u029f\u0005R\u0000\u0000"+ + "\u029f\u02a1\u0005S\u0000\u0000\u02a0\u029e\u0001\u0000\u0000\u0000\u02a1"+ + "\u02a4\u0001\u0000\u0000\u0000\u02a2\u02a0\u0001\u0000\u0000\u0000\u02a2"+ + "\u02a3\u0001\u0000\u0000\u0000\u02a3Q\u0001\u0000\u0000\u0000\u02a4\u02a2"+ + "\u0001\u0000\u0000\u0000\u02a5\u02a8\u0003T*\u0000\u02a6\u02a8\u0003\u00d2"+ + "i\u0000\u02a7\u02a5\u0001\u0000\u0000\u0000\u02a7\u02a6\u0001\u0000\u0000"+ + "\u0000\u02a8S\u0001\u0000\u0000\u0000\u02a9\u02b5\u0005P\u0000\u0000\u02aa"+ + "\u02af\u0003R)\u0000\u02ab\u02ac\u0005U\u0000\u0000\u02ac\u02ae\u0003"+ + "R)\u0000\u02ad\u02ab\u0001\u0000\u0000\u0000\u02ae\u02b1\u0001\u0000\u0000"+ + "\u0000\u02af\u02ad\u0001\u0000\u0000\u0000\u02af\u02b0\u0001\u0000\u0000"+ + "\u0000\u02b0\u02b3\u0001\u0000\u0000\u0000\u02b1\u02af\u0001\u0000\u0000"+ + "\u0000\u02b2\u02b4\u0005U\u0000\u0000\u02b3\u02b2\u0001\u0000\u0000\u0000"+ + "\u02b3\u02b4\u0001\u0000\u0000\u0000\u02b4\u02b6\u0001\u0000\u0000\u0000"+ + "\u02b5\u02aa\u0001\u0000\u0000\u0000\u02b5\u02b6\u0001\u0000\u0000\u0000"+ + "\u02b6\u02b7\u0001\u0000\u0000\u0000\u02b7\u02b8\u0005Q\u0000\u0000\u02b8"+ + "U\u0001\u0000\u0000\u0000\u02b9\u02bb\u0003\u00aeW\u0000\u02ba\u02bc\u0003"+ + "\u010e\u0087\u0000\u02bb\u02ba\u0001\u0000\u0000\u0000\u02bb\u02bc\u0001"+ + "\u0000\u0000\u0000\u02bc\u02bd\u0001\u0000\u0000\u0000\u02bd\u02be\u0005"+ + "V\u0000\u0000\u02be\u02c0\u0001\u0000\u0000\u0000\u02bf\u02b9\u0001\u0000"+ + "\u0000\u0000\u02c0\u02c3\u0001\u0000\u0000\u0000\u02c1\u02bf\u0001\u0000"+ + "\u0000\u0000\u02c1\u02c2\u0001\u0000\u0000\u0000\u02c2\u02c4\u0001\u0000"+ + "\u0000\u0000\u02c3\u02c1\u0001\u0000\u0000\u0000\u02c4\u02c6\u0003\u00b0"+ + "X\u0000\u02c5\u02c7\u0003\u010e\u0087\u0000\u02c6\u02c5\u0001\u0000\u0000"+ + "\u0000\u02c6\u02c7\u0001\u0000\u0000\u0000\u02c7W\u0001\u0000\u0000\u0000"+ + "\u02c8\u02cb\u0003\u010a\u0085\u0000\u02c9\u02cb\u0003Z-\u0000\u02ca\u02c8"+ + "\u0001\u0000\u0000\u0000\u02ca\u02c9\u0001\u0000\u0000\u0000\u02cbY\u0001"+ + "\u0000\u0000\u0000\u02cc\u02ce\u0003|>\u0000\u02cd\u02cc\u0001\u0000\u0000"+ + "\u0000\u02ce\u02d1\u0001\u0000\u0000\u0000\u02cf\u02cd\u0001\u0000\u0000"+ + "\u0000\u02cf\u02d0\u0001\u0000\u0000\u0000\u02d0\u02d2\u0001\u0000\u0000"+ + "\u0000\u02d1\u02cf\u0001\u0000\u0000\u0000\u02d2\u02d5\u0005\\\u0000\u0000"+ + "\u02d3\u02d6\u0003\\.\u0000\u02d4\u02d6\u0003^/\u0000\u02d5\u02d3\u0001"+ + "\u0000\u0000\u0000\u02d5\u02d4\u0001\u0000\u0000\u0000\u02d5\u02d6\u0001"+ + "\u0000\u0000\u0000\u02d6[\u0001\u0000\u0000\u0000\u02d7\u02d8\u0005\u0011"+ + "\u0000\u0000\u02d8\u02d9\u0003\u010a\u0085\u0000\u02d9]\u0001\u0000\u0000"+ + "\u0000\u02da\u02db\u0005(\u0000\u0000\u02db\u02dc\u0003\u010a\u0085\u0000"+ + "\u02dc_\u0001\u0000\u0000\u0000\u02dd\u02e2\u0003r9\u0000\u02de\u02df"+ + "\u0005U\u0000\u0000\u02df\u02e1\u0003r9\u0000\u02e0\u02de\u0001\u0000"+ + "\u0000\u0000\u02e1\u02e4\u0001\u0000\u0000\u0000\u02e2\u02e0\u0001\u0000"+ + "\u0000\u0000\u02e2\u02e3\u0001\u0000\u0000\u0000\u02e3a\u0001\u0000\u0000"+ + "\u0000\u02e4\u02e2\u0001\u0000\u0000\u0000\u02e5\u02e6\u0003`0\u0000\u02e6"+ + "c\u0001\u0000\u0000\u0000\u02e7\u02f3\u0005N\u0000\u0000\u02e8\u02ea\u0003"+ + "f3\u0000\u02e9\u02e8\u0001\u0000\u0000\u0000\u02e9\u02ea\u0001\u0000\u0000"+ + "\u0000\u02ea\u02f4\u0001\u0000\u0000\u0000\u02eb\u02ee\u0003f3\u0000\u02ec"+ + "\u02ed\u0005U\u0000\u0000\u02ed\u02ef\u0003h4\u0000\u02ee\u02ec\u0001"+ + "\u0000\u0000\u0000\u02ee\u02ef\u0001\u0000\u0000\u0000\u02ef\u02f4\u0001"+ + "\u0000\u0000\u0000\u02f0\u02f2\u0003h4\u0000\u02f1\u02f0\u0001\u0000\u0000"+ + "\u0000\u02f1\u02f2\u0001\u0000\u0000\u0000\u02f2\u02f4\u0001\u0000\u0000"+ + "\u0000\u02f3\u02e9\u0001\u0000\u0000\u0000\u02f3\u02eb\u0001\u0000\u0000"+ + "\u0000\u02f3\u02f1\u0001\u0000\u0000\u0000\u02f4\u02f5\u0001\u0000\u0000"+ + "\u0000\u02f5\u02f6\u0005O\u0000\u0000\u02f6e\u0001\u0000\u0000\u0000\u02f7"+ + "\u02f9\u0003\u010a\u0085\u0000\u02f8\u02f7\u0001\u0000\u0000\u0000\u02f8"+ + "\u02f9\u0001\u0000\u0000\u0000\u02f9\u02ff\u0001\u0000\u0000\u0000\u02fa"+ + "\u02fb\u0003\u00aeW\u0000\u02fb\u02fc\u0005V\u0000\u0000\u02fc\u02fe\u0001"+ + "\u0000\u0000\u0000\u02fd\u02fa\u0001\u0000\u0000\u0000\u02fe\u0301\u0001"+ + "\u0000\u0000\u0000\u02ff\u02fd\u0001\u0000\u0000\u0000\u02ff\u0300\u0001"+ + "\u0000\u0000\u0000\u0300\u0302\u0001\u0000\u0000\u0000\u0301\u02ff\u0001"+ + "\u0000\u0000\u0000\u0302\u0303\u0005+\u0000\u0000\u0303g\u0001\u0000\u0000"+ + "\u0000\u0304\u0309\u0003j5\u0000\u0305\u0306\u0005U\u0000\u0000\u0306"+ + "\u0308\u0003j5\u0000\u0307\u0305\u0001\u0000\u0000\u0000\u0308\u030b\u0001"+ + "\u0000\u0000\u0000\u0309\u0307\u0001\u0000\u0000\u0000\u0309\u030a\u0001"+ + "\u0000\u0000\u0000\u030a\u030e\u0001\u0000\u0000\u0000\u030b\u0309\u0001"+ + "\u0000\u0000\u0000\u030c\u030d\u0005U\u0000\u0000\u030d\u030f\u0003l6"+ + "\u0000\u030e\u030c\u0001\u0000\u0000\u0000\u030e\u030f\u0001\u0000\u0000"+ + "\u0000\u030f\u0312\u0001\u0000\u0000\u0000\u0310\u0312\u0003l6\u0000\u0311"+ + "\u0304\u0001\u0000\u0000\u0000\u0311\u0310\u0001\u0000\u0000\u0000\u0312"+ + "i\u0001\u0000\u0000\u0000\u0313\u0315\u0003\f\u0006\u0000\u0314\u0313"+ + "\u0001\u0000\u0000\u0000\u0315\u0318\u0001\u0000\u0000\u0000\u0316\u0314"+ + "\u0001\u0000\u0000\u0000\u0316\u0317\u0001\u0000\u0000\u0000\u0317\u031a"+ + "\u0001\u0000\u0000\u0000\u0318\u0316\u0001\u0000\u0000\u0000\u0319\u031b"+ + "\u0003\u010a\u0085\u0000\u031a\u0319\u0001\u0000\u0000\u0000\u031a\u031b"+ + "\u0001\u0000\u0000\u0000\u031b\u031c\u0001\u0000\u0000\u0000\u031c\u031f"+ + "\u0003P(\u0000\u031d\u031f\u0003\u00d4j\u0000\u031e\u0316\u0001\u0000"+ + "\u0000\u0000\u031e\u031d\u0001\u0000\u0000\u0000\u031fk\u0001\u0000\u0000"+ + "\u0000\u0320\u0322\u0003\f\u0006\u0000\u0321\u0320\u0001\u0000\u0000\u0000"+ + "\u0322\u0325\u0001\u0000\u0000\u0000\u0323\u0321\u0001\u0000\u0000\u0000"+ + "\u0323\u0324\u0001\u0000\u0000\u0000\u0324\u0327\u0001\u0000\u0000\u0000"+ + "\u0325\u0323\u0001\u0000\u0000\u0000\u0326\u0328\u0003\u010a\u0085\u0000"+ + "\u0327\u0326\u0001\u0000\u0000\u0000\u0327\u0328\u0001\u0000\u0000\u0000"+ + "\u0328\u032c\u0001\u0000\u0000\u0000\u0329\u032b\u0003|>\u0000\u032a\u0329"+ + "\u0001\u0000\u0000\u0000\u032b\u032e\u0001\u0000\u0000\u0000\u032c\u032a"+ + "\u0001\u0000\u0000\u0000\u032c\u032d\u0001\u0000\u0000\u0000\u032d\u032f"+ + "\u0001\u0000\u0000\u0000\u032e\u032c\u0001\u0000\u0000\u0000\u032f\u0330"+ + "\u0005|\u0000\u0000\u0330\u0331\u0003P(\u0000\u0331m\u0001\u0000\u0000"+ + "\u0000\u0332\u0337\u0003p8\u0000\u0333\u0334\u0005U\u0000\u0000\u0334"+ + "\u0336\u0003p8\u0000\u0335\u0333\u0001\u0000\u0000\u0000\u0336\u0339\u0001"+ + "\u0000\u0000\u0000\u0337\u0335\u0001\u0000\u0000\u0000\u0337\u0338\u0001"+ + "\u0000\u0000\u0000\u0338o\u0001\u0000\u0000\u0000\u0339\u0337\u0001\u0000"+ + "\u0000\u0000\u033a\u033c\u0003\f\u0006\u0000\u033b\u033a\u0001\u0000\u0000"+ + "\u0000\u033c\u033f\u0001\u0000\u0000\u0000\u033d\u033b\u0001\u0000\u0000"+ + "\u0000\u033d\u033e\u0001\u0000\u0000\u0000\u033e\u0340\u0001\u0000\u0000"+ + "\u0000\u033f\u033d\u0001\u0000\u0000\u0000\u0340\u0341\u0005=\u0000\u0000"+ + "\u0341\u0342\u0003\u00aeW\u0000\u0342q\u0001\u0000\u0000\u0000\u0343\u0348"+ + "\u0003\u00aeW\u0000\u0344\u0345\u0005V\u0000\u0000\u0345\u0347\u0003\u00ae"+ + "W\u0000\u0346\u0344\u0001\u0000\u0000\u0000\u0347\u034a\u0001\u0000\u0000"+ + "\u0000\u0348\u0346\u0001\u0000\u0000\u0000\u0348\u0349\u0001\u0000\u0000"+ + "\u0000\u0349s\u0001\u0000\u0000\u0000\u034a\u0348\u0001\u0000\u0000\u0000"+ + "\u034b\u0353\u0003v;\u0000\u034c\u0353\u0003x<\u0000\u034d\u0353\u0005"+ + "J\u0000\u0000\u034e\u0353\u0005K\u0000\u0000\u034f\u0353\u0005I\u0000"+ + "\u0000\u0350\u0353\u0005M\u0000\u0000\u0351\u0353\u0005L\u0000\u0000\u0352"+ + "\u034b\u0001\u0000\u0000\u0000\u0352\u034c\u0001\u0000\u0000\u0000\u0352"+ + "\u034d\u0001\u0000\u0000\u0000\u0352\u034e\u0001\u0000\u0000\u0000\u0352"+ + "\u034f\u0001\u0000\u0000\u0000\u0352\u0350\u0001\u0000\u0000\u0000\u0352"+ + "\u0351\u0001\u0000\u0000\u0000\u0353u\u0001\u0000\u0000\u0000\u0354\u0355"+ + "\u0007\u0001\u0000\u0000\u0355w\u0001\u0000\u0000\u0000\u0356\u0357\u0007"+ + "\u0002\u0000\u0000\u0357y\u0001\u0000\u0000\u0000\u0358\u0359\u0003\u00ae"+ + "W\u0000\u0359\u035a\u0005V\u0000\u0000\u035a\u035c\u0001\u0000\u0000\u0000"+ + "\u035b\u0358\u0001\u0000\u0000\u0000\u035c\u035f\u0001\u0000\u0000\u0000"+ + "\u035d\u035b\u0001\u0000\u0000\u0000\u035d\u035e\u0001\u0000\u0000\u0000"+ + "\u035e\u0360\u0001\u0000\u0000\u0000\u035f\u035d\u0001\u0000\u0000\u0000"+ + "\u0360\u0361\u0005{\u0000\u0000\u0361\u0362\u0003\u00aeW\u0000\u0362{"+ + "\u0001\u0000\u0000\u0000\u0363\u0364\u0005{\u0000\u0000\u0364\u0367\u0003"+ + "r9\u0000\u0365\u0367\u0003z=\u0000\u0366\u0363\u0001\u0000\u0000\u0000"+ + "\u0366\u0365\u0001\u0000\u0000\u0000\u0367\u036e\u0001\u0000\u0000\u0000"+ + "\u0368\u036b\u0005N\u0000\u0000\u0369\u036c\u0003~?\u0000\u036a\u036c"+ + "\u0003\u0082A\u0000\u036b\u0369\u0001\u0000\u0000\u0000\u036b\u036a\u0001"+ + "\u0000\u0000\u0000\u036b\u036c\u0001\u0000\u0000\u0000\u036c\u036d\u0001"+ + "\u0000\u0000\u0000\u036d\u036f\u0005O\u0000\u0000\u036e\u0368\u0001\u0000"+ + "\u0000\u0000\u036e\u036f\u0001\u0000\u0000\u0000\u036f}\u0001\u0000\u0000"+ + "\u0000\u0370\u0375\u0003\u0080@\u0000\u0371\u0372\u0005U\u0000\u0000\u0372"+ + "\u0374\u0003\u0080@\u0000\u0373\u0371\u0001\u0000\u0000\u0000\u0374\u0377"+ + "\u0001\u0000\u0000\u0000\u0375\u0373\u0001\u0000\u0000\u0000\u0375\u0376"+ + "\u0001\u0000\u0000\u0000\u0376\u007f\u0001\u0000\u0000\u0000\u0377\u0375"+ + "\u0001\u0000\u0000\u0000\u0378\u0379\u0003\u00aeW\u0000\u0379\u037a\u0005"+ + "W\u0000\u0000\u037a\u037b\u0003\u0082A\u0000\u037b\u0081\u0001\u0000\u0000"+ + "\u0000\u037c\u0380\u0003\u00d2i\u0000\u037d\u0380\u0003|>\u0000\u037e"+ + "\u0380\u0003\u0084B\u0000\u037f\u037c\u0001\u0000\u0000\u0000\u037f\u037d"+ + "\u0001\u0000\u0000\u0000\u037f\u037e\u0001\u0000\u0000\u0000\u0380\u0083"+ + "\u0001\u0000\u0000\u0000\u0381\u038a\u0005P\u0000\u0000\u0382\u0387\u0003"+ + "\u0082A\u0000\u0383\u0384\u0005U\u0000\u0000\u0384\u0386\u0003\u0082A"+ + "\u0000\u0385\u0383\u0001\u0000\u0000\u0000\u0386\u0389\u0001\u0000\u0000"+ + "\u0000\u0387\u0385\u0001\u0000\u0000\u0000\u0387\u0388\u0001\u0000\u0000"+ + "\u0000\u0388\u038b\u0001\u0000\u0000\u0000\u0389\u0387\u0001\u0000\u0000"+ + "\u0000\u038a\u0382\u0001\u0000\u0000\u0000\u038a\u038b\u0001\u0000\u0000"+ + "\u0000\u038b\u038d\u0001\u0000\u0000\u0000\u038c\u038e\u0005U\u0000\u0000"+ + "\u038d\u038c\u0001\u0000\u0000\u0000\u038d\u038e\u0001\u0000\u0000\u0000"+ + "\u038e\u038f\u0001\u0000\u0000\u0000\u038f\u0390\u0005Q\u0000\u0000\u0390"+ + "\u0085\u0001\u0000\u0000\u0000\u0391\u0392\u0005{\u0000\u0000\u0392\u0393"+ + "\u0005\u001c\u0000\u0000\u0393\u0394\u0003\u00aeW\u0000\u0394\u0395\u0003"+ + "\u0088D\u0000\u0395\u0087\u0001\u0000\u0000\u0000\u0396\u039a\u0005P\u0000"+ + "\u0000\u0397\u0399\u0003\u008aE\u0000\u0398\u0397\u0001\u0000\u0000\u0000"+ + "\u0399\u039c\u0001\u0000\u0000\u0000\u039a\u0398\u0001\u0000\u0000\u0000"+ + "\u039a\u039b\u0001\u0000\u0000\u0000\u039b\u039d\u0001\u0000\u0000\u0000"+ + "\u039c\u039a\u0001\u0000\u0000\u0000\u039d\u039e\u0005Q\u0000\u0000\u039e"+ + "\u0089\u0001\u0000\u0000\u0000\u039f\u03a1\u0003\b\u0004\u0000\u03a0\u039f"+ + "\u0001\u0000\u0000\u0000\u03a1\u03a4\u0001\u0000\u0000\u0000\u03a2\u03a0"+ + "\u0001\u0000\u0000\u0000\u03a2\u03a3\u0001\u0000\u0000\u0000\u03a3\u03a5"+ + "\u0001\u0000\u0000\u0000\u03a4\u03a2\u0001\u0000\u0000\u0000\u03a5\u03a8"+ + "\u0003\u008cF\u0000\u03a6\u03a8\u0005T\u0000\u0000\u03a7\u03a2\u0001\u0000"+ + "\u0000\u0000\u03a7\u03a6\u0001\u0000\u0000\u0000\u03a8\u008b\u0001\u0000"+ + "\u0000\u0000\u03a9\u03aa\u0003\u010a\u0085\u0000\u03aa\u03ab\u0003\u008e"+ + "G\u0000\u03ab\u03ac\u0005T\u0000\u0000\u03ac\u03b2\u0001\u0000\u0000\u0000"+ + "\u03ad\u03af\u0003\u0006\u0003\u0000\u03ae\u03b0\u0005T\u0000\u0000\u03af"+ + "\u03ae\u0001\u0000\u0000\u0000\u03af\u03b0\u0001\u0000\u0000\u0000\u03b0"+ + "\u03b2\u0001\u0000\u0000\u0000\u03b1\u03a9\u0001\u0000\u0000\u0000\u03b1"+ + "\u03ad\u0001\u0000\u0000\u0000\u03b2\u008d\u0001\u0000\u0000\u0000\u03b3"+ + "\u03b6\u0003\u0090H\u0000\u03b4\u03b6\u0003\u0092I\u0000\u03b5\u03b3\u0001"+ + "\u0000\u0000\u0000\u03b5\u03b4\u0001\u0000\u0000\u0000\u03b6\u008f\u0001"+ + "\u0000\u0000\u0000\u03b7\u03b8\u0003\u00aeW\u0000\u03b8\u03b9\u0005N\u0000"+ + "\u0000\u03b9\u03bb\u0005O\u0000\u0000\u03ba\u03bc\u0003\u0094J\u0000\u03bb"+ + "\u03ba\u0001\u0000\u0000\u0000\u03bb\u03bc\u0001\u0000\u0000\u0000\u03bc"+ + "\u0091\u0001\u0000\u0000\u0000\u03bd\u03be\u0003L&\u0000\u03be\u0093\u0001"+ + "\u0000\u0000\u0000\u03bf\u03c0\u0005\f\u0000\u0000\u03c0\u03c1\u0003\u0082"+ + "A\u0000\u03c1\u0095\u0001\u0000\u0000\u0000\u03c2\u03c4\u00054\u0000\u0000"+ + "\u03c3\u03c2\u0001\u0000\u0000\u0000\u03c3\u03c4\u0001\u0000\u0000\u0000"+ + "\u03c4\u03c5\u0001\u0000\u0000\u0000\u03c5\u03c6\u00053\u0000\u0000\u03c6"+ + "\u03c7\u0003r9\u0000\u03c7\u03c8\u0003\u0098L\u0000\u03c8\u0097\u0001"+ + "\u0000\u0000\u0000\u03c9\u03cd\u0005P\u0000\u0000\u03ca\u03cc\u0003\u009a"+ + "M\u0000\u03cb\u03ca\u0001\u0000\u0000\u0000\u03cc\u03cf\u0001\u0000\u0000"+ + "\u0000\u03cd\u03cb\u0001\u0000\u0000\u0000\u03cd\u03ce\u0001\u0000\u0000"+ + "\u0000\u03ce\u03d0\u0001\u0000\u0000\u0000\u03cf\u03cd\u0001\u0000\u0000"+ + "\u0000\u03d0\u03d1\u0005Q\u0000\u0000\u03d1\u0099\u0001\u0000\u0000\u0000"+ + "\u03d2\u03d6\u00055\u0000\u0000\u03d3\u03d5\u0003\u009cN\u0000\u03d4\u03d3"+ + "\u0001\u0000\u0000\u0000\u03d5\u03d8\u0001\u0000\u0000\u0000\u03d6\u03d4"+ + "\u0001\u0000\u0000\u0000\u03d6\u03d7\u0001\u0000\u0000\u0000\u03d7\u03d9"+ + "\u0001\u0000\u0000\u0000\u03d8\u03d6\u0001\u0000\u0000\u0000\u03d9\u03da"+ + "\u0003r9\u0000\u03da\u03db\u0005T\u0000\u0000\u03db\u03f7\u0001\u0000"+ + "\u0000\u0000\u03dc\u03dd\u00056\u0000\u0000\u03dd\u03e0\u0003r9\u0000"+ + "\u03de\u03df\u00058\u0000\u0000\u03df\u03e1\u0003r9\u0000\u03e0\u03de"+ + "\u0001\u0000\u0000\u0000\u03e0\u03e1\u0001\u0000\u0000\u0000\u03e1\u03e2"+ + "\u0001\u0000\u0000\u0000\u03e2\u03e3\u0005T\u0000\u0000\u03e3\u03f7\u0001"+ + "\u0000\u0000\u0000\u03e4\u03e5\u00057\u0000\u0000\u03e5\u03e8\u0003r9"+ + "\u0000\u03e6\u03e7\u00058\u0000\u0000\u03e7\u03e9\u0003r9\u0000\u03e8"+ + "\u03e6\u0001\u0000\u0000\u0000\u03e8\u03e9\u0001\u0000\u0000\u0000\u03e9"+ + "\u03ea\u0001\u0000\u0000\u0000\u03ea\u03eb\u0005T\u0000\u0000\u03eb\u03f7"+ + "\u0001\u0000\u0000\u0000\u03ec\u03ed\u00059\u0000\u0000\u03ed\u03ee\u0003"+ + "r9\u0000\u03ee\u03ef\u0005T\u0000\u0000\u03ef\u03f7\u0001\u0000\u0000"+ + "\u0000\u03f0\u03f1\u0005:\u0000\u0000\u03f1\u03f2\u0003r9\u0000\u03f2"+ + "\u03f3\u0005;\u0000\u0000\u03f3\u03f4\u0003r9\u0000\u03f4\u03f5\u0005"+ + "T\u0000\u0000\u03f5\u03f7\u0001\u0000\u0000\u0000\u03f6\u03d2\u0001\u0000"+ + "\u0000\u0000\u03f6\u03dc\u0001\u0000\u0000\u0000\u03f6\u03e4\u0001\u0000"+ + "\u0000\u0000\u03f6\u03ec\u0001\u0000\u0000\u0000\u03f6\u03f0\u0001\u0000"+ + "\u0000\u0000\u03f7\u009b\u0001\u0000\u0000\u0000\u03f8\u03f9\u0007\u0003"+ + "\u0000\u0000\u03f9\u009d\u0001\u0000\u0000\u0000\u03fa\u03fb\u0005?\u0000"+ + "\u0000\u03fb\u03fd\u0003\u00aeW\u0000\u03fc\u03fe\u0003\u0010\b\u0000"+ + "\u03fd\u03fc\u0001\u0000\u0000\u0000\u03fd\u03fe\u0001\u0000\u0000\u0000"+ + "\u03fe\u03ff\u0001\u0000\u0000\u0000\u03ff\u0402\u0003\u00a0P\u0000\u0400"+ + "\u0401\u0005\u0018\u0000\u0000\u0401\u0403\u0003\u0108\u0084\u0000\u0402"+ + "\u0400\u0001\u0000\u0000\u0000\u0402\u0403\u0001\u0000\u0000\u0000\u0403"+ + "\u0404\u0001\u0000\u0000\u0000\u0404\u0405\u0003\u00a6S\u0000\u0405\u009f"+ + "\u0001\u0000\u0000\u0000\u0406\u0408\u0005N\u0000\u0000\u0407\u0409\u0003"+ + "\u00a2Q\u0000\u0408\u0407\u0001\u0000\u0000\u0000\u0408\u0409\u0001\u0000"+ + "\u0000\u0000\u0409\u040a\u0001\u0000\u0000\u0000\u040a\u040b\u0005O\u0000"+ + "\u0000\u040b\u00a1\u0001\u0000\u0000\u0000\u040c\u0411\u0003\u00a4R\u0000"+ + "\u040d\u040e\u0005U\u0000\u0000\u040e\u0410\u0003\u00a4R\u0000\u040f\u040d"+ + "\u0001\u0000\u0000\u0000\u0410\u0413\u0001\u0000\u0000\u0000\u0411\u040f"+ + "\u0001\u0000\u0000\u0000\u0411\u0412\u0001\u0000\u0000\u0000\u0412\u00a3"+ + "\u0001\u0000\u0000\u0000\u0413\u0411\u0001\u0000\u0000\u0000\u0414\u0416"+ + "\u0003\u010a\u0085\u0000\u0415\u0414\u0001\u0000\u0000\u0000\u0415\u0416"+ + "\u0001\u0000\u0000\u0000\u0416\u0417\u0001\u0000\u0000\u0000\u0417\u0418"+ + "\u0003\u00aeW\u0000\u0418\u00a5\u0001\u0000\u0000\u0000\u0419\u041d\u0005"+ + "P\u0000\u0000\u041a\u041c\u0003$\u0012\u0000\u041b\u041a\u0001\u0000\u0000"+ + "\u0000\u041c\u041f\u0001\u0000\u0000\u0000\u041d\u041b\u0001\u0000\u0000"+ + "\u0000\u041d\u041e\u0001\u0000\u0000\u0000\u041e\u0420\u0001\u0000\u0000"+ + "\u0000\u041f\u041d\u0001\u0000\u0000\u0000\u0420\u0421\u0005Q\u0000\u0000"+ + "\u0421\u00a7\u0001\u0000\u0000\u0000\u0422\u0426\u0005P\u0000\u0000\u0423"+ + "\u0425\u0003\u00aaU\u0000\u0424\u0423\u0001\u0000\u0000\u0000\u0425\u0428"+ + "\u0001\u0000\u0000\u0000\u0426\u0424\u0001\u0000\u0000\u0000\u0426\u0427"+ + "\u0001\u0000\u0000\u0000\u0427\u0429\u0001\u0000\u0000\u0000\u0428\u0426"+ + "\u0001\u0000\u0000\u0000\u0429\u042a\u0005Q\u0000\u0000\u042a\u00a9\u0001"+ + "\u0000\u0000\u0000\u042b\u042c\u0003\u00acV\u0000\u042c\u042d\u0005T\u0000"+ + "\u0000\u042d\u0431\u0001\u0000\u0000\u0000\u042e\u0431\u0003\u00b2Y\u0000"+ + "\u042f\u0431\u0003\u00b4Z\u0000\u0430\u042b\u0001\u0000\u0000\u0000\u0430"+ + "\u042e\u0001\u0000\u0000\u0000\u0430\u042f\u0001\u0000\u0000\u0000\u0431"+ + "\u00ab\u0001\u0000\u0000\u0000\u0432\u0434\u0003\f\u0006\u0000\u0433\u0432"+ + "\u0001\u0000\u0000\u0000\u0434\u0437\u0001\u0000\u0000\u0000\u0435\u0433"+ + "\u0001\u0000\u0000\u0000\u0435\u0436\u0001\u0000\u0000\u0000\u0436\u043a"+ + "\u0001\u0000\u0000\u0000\u0437\u0435\u0001\u0000\u0000\u0000\u0438\u043b"+ + "\u0005=\u0000\u0000\u0439\u043b\u0003\u010a\u0085\u0000\u043a\u0438\u0001"+ + "\u0000\u0000\u0000\u043a\u0439\u0001\u0000\u0000\u0000\u043b\u043c\u0001"+ + "\u0000\u0000\u0000\u043c\u043d\u0003L&\u0000\u043d\u00ad\u0001\u0000\u0000"+ + "\u0000\u043e\u043f\u0007\u0004\u0000\u0000\u043f\u00af\u0001\u0000\u0000"+ + "\u0000\u0440\u0441\u0007\u0005\u0000\u0000\u0441\u00b1\u0001\u0000\u0000"+ + "\u0000\u0442\u0444\u0003\n\u0005\u0000\u0443\u0442\u0001\u0000\u0000\u0000"+ + "\u0444\u0447\u0001\u0000\u0000\u0000\u0445\u0443\u0001\u0000\u0000\u0000"+ + "\u0445\u0446\u0001\u0000\u0000\u0000\u0446\u044b\u0001\u0000\u0000\u0000"+ + "\u0447\u0445\u0001\u0000\u0000\u0000\u0448\u044c\u0003\u000e\u0007\u0000"+ + "\u0449\u044c\u0003\u001e\u000f\u0000\u044a\u044c\u0003\u009eO\u0000\u044b"+ + "\u0448\u0001\u0000\u0000\u0000\u044b\u0449\u0001\u0000\u0000\u0000\u044b"+ + "\u044a\u0001\u0000\u0000\u0000\u044c\u044f\u0001\u0000\u0000\u0000\u044d"+ + "\u044f\u0005T\u0000\u0000\u044e\u0445\u0001\u0000\u0000\u0000\u044e\u044d"+ + "\u0001\u0000\u0000\u0000\u044f\u00b3\u0001\u0000\u0000\u0000\u0450\u04be"+ + "\u0003\u00a8T\u0000\u0451\u0452\u0005\u0002\u0000\u0000\u0452\u0455\u0003"+ + "\u00d2i\u0000\u0453\u0454\u0005]\u0000\u0000\u0454\u0456\u0003\u00d2i"+ + "\u0000\u0455\u0453\u0001\u0000\u0000\u0000\u0455\u0456\u0001\u0000\u0000"+ + "\u0000\u0456\u0457\u0001\u0000\u0000\u0000\u0457\u0458\u0005T\u0000\u0000"+ + "\u0458\u04be\u0001\u0000\u0000\u0000\u0459\u045a\u0005\u0016\u0000\u0000"+ + "\u045a\u045b\u0003\u00ccf\u0000\u045b\u045e\u0003\u00b4Z\u0000\u045c\u045d"+ + "\u0005\u000f\u0000\u0000\u045d\u045f\u0003\u00b4Z\u0000\u045e\u045c\u0001"+ + "\u0000\u0000\u0000\u045e\u045f\u0001\u0000\u0000\u0000\u045f\u04be\u0001"+ + "\u0000\u0000\u0000\u0460\u0461\u0005\u0015\u0000\u0000\u0461\u0462\u0005"+ + "N\u0000\u0000\u0462\u0463\u0003\u00c6c\u0000\u0463\u0464\u0005O\u0000"+ + "\u0000\u0464\u0465\u0003\u00b4Z\u0000\u0465\u04be\u0001\u0000\u0000\u0000"+ + "\u0466\u0467\u00052\u0000\u0000\u0467\u0468\u0003\u00ccf\u0000\u0468\u0469"+ + "\u0003\u00b4Z\u0000\u0469\u04be\u0001\u0000\u0000\u0000\u046a\u046b\u0005"+ + "\r\u0000\u0000\u046b\u046c\u0003\u00b4Z\u0000\u046c\u046d\u00052\u0000"+ + "\u0000\u046d\u046e\u0003\u00ccf\u0000\u046e\u046f\u0005T\u0000\u0000\u046f"+ + "\u04be\u0001\u0000\u0000\u0000\u0470\u0471\u0005/\u0000\u0000\u0471\u047b"+ + "\u0003\u00a8T\u0000\u0472\u0474\u0003\u00b6[\u0000\u0473\u0472\u0001\u0000"+ + "\u0000\u0000\u0474\u0475\u0001\u0000\u0000\u0000\u0475\u0473\u0001\u0000"+ + "\u0000\u0000\u0475\u0476\u0001\u0000\u0000\u0000\u0476\u0478\u0001\u0000"+ + "\u0000\u0000\u0477\u0479\u0003\u00ba]\u0000\u0478\u0477\u0001\u0000\u0000"+ + "\u0000\u0478\u0479\u0001\u0000\u0000\u0000\u0479\u047c\u0001\u0000\u0000"+ + "\u0000\u047a\u047c\u0003\u00ba]\u0000\u047b\u0473\u0001\u0000\u0000\u0000"+ + "\u047b\u047a\u0001\u0000\u0000\u0000\u047c\u04be\u0001\u0000\u0000\u0000"+ + "\u047d\u047e\u0005/\u0000\u0000\u047e\u047f\u0003\u00bc^\u0000\u047f\u0483"+ + "\u0003\u00a8T\u0000\u0480\u0482\u0003\u00b6[\u0000\u0481\u0480\u0001\u0000"+ + "\u0000\u0000\u0482\u0485\u0001\u0000\u0000\u0000\u0483\u0481\u0001\u0000"+ + "\u0000\u0000\u0483\u0484\u0001\u0000\u0000\u0000\u0484\u0487\u0001\u0000"+ + "\u0000\u0000\u0485\u0483\u0001\u0000\u0000\u0000\u0486\u0488\u0003\u00ba"+ + "]\u0000\u0487\u0486\u0001\u0000\u0000\u0000\u0487\u0488\u0001\u0000\u0000"+ + "\u0000\u0488\u04be\u0001\u0000\u0000\u0000\u0489\u048a\u0005)\u0000\u0000"+ + "\u048a\u048b\u0003\u00ccf\u0000\u048b\u048f\u0005P\u0000\u0000\u048c\u048e"+ + "\u0003\u00c2a\u0000\u048d\u048c\u0001\u0000\u0000\u0000\u048e\u0491\u0001"+ + "\u0000\u0000\u0000\u048f\u048d\u0001\u0000\u0000\u0000\u048f\u0490\u0001"+ + "\u0000\u0000\u0000\u0490\u0495\u0001\u0000\u0000\u0000\u0491\u048f\u0001"+ + "\u0000\u0000\u0000\u0492\u0494\u0003\u00c4b\u0000\u0493\u0492\u0001\u0000"+ + "\u0000\u0000\u0494\u0497\u0001\u0000\u0000\u0000\u0495\u0493\u0001\u0000"+ + "\u0000\u0000\u0495\u0496\u0001\u0000\u0000\u0000\u0496\u0498\u0001\u0000"+ + "\u0000\u0000\u0497\u0495\u0001\u0000\u0000\u0000\u0498\u0499\u0005Q\u0000"+ + "\u0000\u0499\u04be\u0001\u0000\u0000\u0000\u049a\u049b\u0005*\u0000\u0000"+ + "\u049b\u049c\u0003\u00ccf\u0000\u049c\u049d\u0003\u00a8T\u0000\u049d\u04be"+ + "\u0001\u0000\u0000\u0000\u049e\u04a0\u0005$\u0000\u0000\u049f\u04a1\u0003"+ + "\u00d2i\u0000\u04a0\u049f\u0001\u0000\u0000\u0000\u04a0\u04a1\u0001\u0000"+ + "\u0000\u0000\u04a1\u04a2\u0001\u0000\u0000\u0000\u04a2\u04be\u0005T\u0000"+ + "\u0000\u04a3\u04a4\u0005,\u0000\u0000\u04a4\u04a5\u0003\u00d2i\u0000\u04a5"+ + "\u04a6\u0005T\u0000\u0000\u04a6\u04be\u0001\u0000\u0000\u0000\u04a7\u04a9"+ + "\u0005\u0004\u0000\u0000\u04a8\u04aa\u0003\u00aeW\u0000\u04a9\u04a8\u0001"+ + "\u0000\u0000\u0000\u04a9\u04aa\u0001\u0000\u0000\u0000\u04aa\u04ab\u0001"+ + "\u0000\u0000\u0000\u04ab\u04be\u0005T\u0000\u0000\u04ac\u04ae\u0005\u000b"+ + "\u0000\u0000\u04ad\u04af\u0003\u00aeW\u0000\u04ae\u04ad\u0001\u0000\u0000"+ + "\u0000\u04ae\u04af\u0001\u0000\u0000\u0000\u04af\u04b0\u0001\u0000\u0000"+ + "\u0000\u04b0\u04be\u0005T\u0000\u0000\u04b1\u04b2\u0005>\u0000\u0000\u04b2"+ + "\u04b3\u0003\u00d2i\u0000\u04b3\u04b4\u0005T\u0000\u0000\u04b4\u04be\u0001"+ + "\u0000\u0000\u0000\u04b5\u04be\u0005T\u0000\u0000\u04b6\u04b7\u0003\u00d2"+ + "i\u0000\u04b7\u04b8\u0005T\u0000\u0000\u04b8\u04be\u0001\u0000\u0000\u0000"+ + "\u04b9\u04ba\u0003\u00aeW\u0000\u04ba\u04bb\u0005]\u0000\u0000\u04bb\u04bc"+ + "\u0003\u00b4Z\u0000\u04bc\u04be\u0001\u0000\u0000\u0000\u04bd\u0450\u0001"+ + "\u0000\u0000\u0000\u04bd\u0451\u0001\u0000\u0000\u0000\u04bd\u0459\u0001"+ + "\u0000\u0000\u0000\u04bd\u0460\u0001\u0000\u0000\u0000\u04bd\u0466\u0001"+ + "\u0000\u0000\u0000\u04bd\u046a\u0001\u0000\u0000\u0000\u04bd\u0470\u0001"+ + "\u0000\u0000\u0000\u04bd\u047d\u0001\u0000\u0000\u0000\u04bd\u0489\u0001"+ + "\u0000\u0000\u0000\u04bd\u049a\u0001\u0000\u0000\u0000\u04bd\u049e\u0001"+ + "\u0000\u0000\u0000\u04bd\u04a3\u0001\u0000\u0000\u0000\u04bd\u04a7\u0001"+ + "\u0000\u0000\u0000\u04bd\u04ac\u0001\u0000\u0000\u0000\u04bd\u04b1\u0001"+ + "\u0000\u0000\u0000\u04bd\u04b5\u0001\u0000\u0000\u0000\u04bd\u04b6\u0001"+ + "\u0000\u0000\u0000\u04bd\u04b9\u0001\u0000\u0000\u0000\u04be\u00b5\u0001"+ + "\u0000\u0000\u0000\u04bf\u04c0\u0005\u0007\u0000\u0000\u04c0\u04c4\u0005"+ + "N\u0000\u0000\u04c1\u04c3\u0003\f\u0006\u0000\u04c2\u04c1\u0001\u0000"+ + "\u0000\u0000\u04c3\u04c6\u0001\u0000\u0000\u0000\u04c4\u04c2\u0001\u0000"+ + "\u0000\u0000\u04c4\u04c5\u0001\u0000\u0000\u0000\u04c5\u04c8\u0001\u0000"+ + "\u0000\u0000\u04c6\u04c4\u0001\u0000\u0000\u0000\u04c7\u04c9\u0003\u00b8"+ + "\\\u0000\u04c8\u04c7\u0001\u0000\u0000\u0000\u04c8\u04c9\u0001\u0000\u0000"+ + "\u0000\u04c9\u04ca\u0001\u0000\u0000\u0000\u04ca\u04cb\u0003\u00aeW\u0000"+ + "\u04cb\u04cc\u0005O\u0000\u0000\u04cc\u04cd\u0003\u00a8T\u0000\u04cd\u00b7"+ + "\u0001\u0000\u0000\u0000\u04ce\u04d3\u0003r9\u0000\u04cf\u04d0\u0005k"+ + "\u0000\u0000\u04d0\u04d2\u0003r9\u0000\u04d1\u04cf\u0001\u0000\u0000\u0000"+ + "\u04d2\u04d5\u0001\u0000\u0000\u0000\u04d3\u04d1\u0001\u0000\u0000\u0000"+ + "\u04d3\u04d4\u0001\u0000\u0000\u0000\u04d4\u00b9\u0001\u0000\u0000\u0000"+ + "\u04d5\u04d3\u0001\u0000\u0000\u0000\u04d6\u04d7\u0005\u0013\u0000\u0000"+ + "\u04d7\u04d8\u0003\u00a8T\u0000\u04d8\u00bb\u0001\u0000\u0000\u0000\u04d9"+ + "\u04da\u0005N\u0000\u0000\u04da\u04dc\u0003\u00be_\u0000\u04db\u04dd\u0005"+ + "T\u0000\u0000\u04dc\u04db\u0001\u0000\u0000\u0000\u04dc\u04dd\u0001\u0000"+ + "\u0000\u0000\u04dd\u04de\u0001\u0000\u0000\u0000\u04de\u04df\u0005O\u0000"+ + "\u0000\u04df\u00bd\u0001\u0000\u0000\u0000\u04e0\u04e5\u0003\u00c0`\u0000"+ + "\u04e1\u04e2\u0005T\u0000\u0000\u04e2\u04e4\u0003\u00c0`\u0000\u04e3\u04e1"+ + "\u0001\u0000\u0000\u0000\u04e4\u04e7\u0001\u0000\u0000\u0000\u04e5\u04e3"+ + "\u0001\u0000\u0000\u0000\u04e5\u04e6\u0001\u0000\u0000\u0000\u04e6\u00bf"+ + "\u0001\u0000\u0000\u0000\u04e7\u04e5\u0001\u0000\u0000\u0000\u04e8\u04ea"+ + "\u0003\f\u0006\u0000\u04e9\u04e8\u0001\u0000\u0000\u0000\u04ea\u04ed\u0001"+ + "\u0000\u0000\u0000\u04eb\u04e9\u0001\u0000\u0000\u0000\u04eb\u04ec\u0001"+ + "\u0000\u0000\u0000\u04ec\u04f4\u0001\u0000\u0000\u0000\u04ed\u04eb\u0001"+ + "\u0000\u0000\u0000\u04ee\u04f0\u0003V+\u0000\u04ef\u04ee\u0001\u0000\u0000"+ + "\u0000\u04ef\u04f0\u0001\u0000\u0000\u0000\u04f0\u04f1\u0001\u0000\u0000"+ + "\u0000\u04f1\u04f5\u0003P(\u0000\u04f2\u04f3\u0005=\u0000\u0000\u04f3"+ + "\u04f5\u0003\u00aeW\u0000\u04f4\u04ef\u0001\u0000\u0000\u0000\u04f4\u04f2"+ + "\u0001\u0000\u0000\u0000\u04f5\u04f6\u0001\u0000\u0000\u0000\u04f6\u04f7"+ + "\u0005W\u0000\u0000\u04f7\u04f8\u0003\u00d2i\u0000\u04f8\u04fb\u0001\u0000"+ + "\u0000\u0000\u04f9\u04fb\u0003\u00aeW\u0000\u04fa\u04eb\u0001\u0000\u0000"+ + "\u0000\u04fa\u04f9\u0001\u0000\u0000\u0000\u04fb\u00c1\u0001\u0000\u0000"+ + "\u0000\u04fc\u04fe\u0003\u00c4b\u0000\u04fd\u04fc\u0001\u0000\u0000\u0000"+ + "\u04fe\u04ff\u0001\u0000\u0000\u0000\u04ff\u04fd\u0001\u0000\u0000\u0000"+ + "\u04ff\u0500\u0001\u0000\u0000\u0000\u0500\u0502\u0001\u0000\u0000\u0000"+ + "\u0501\u0503\u0003\u00aaU\u0000\u0502\u0501\u0001\u0000\u0000\u0000\u0503"+ + "\u0504\u0001\u0000\u0000\u0000\u0504\u0502\u0001\u0000\u0000\u0000\u0504"+ + "\u0505\u0001\u0000\u0000\u0000\u0505\u00c3\u0001\u0000\u0000\u0000\u0506"+ + "\u0507\u0005\u0006\u0000\u0000\u0507\u0508\u0003\u00d2i\u0000\u0508\u0509"+ + "\u0005]\u0000\u0000\u0509\u0514\u0001\u0000\u0000\u0000\u050a\u050b\u0005"+ + "\u0006\u0000\u0000\u050b\u050c\u0005\u0080\u0000\u0000\u050c\u0514\u0005"+ + "]\u0000\u0000\u050d\u050e\u0005\u0006\u0000\u0000\u050e\u050f\u0003\u00d4"+ + "j\u0000\u050f\u0510\u0005]\u0000\u0000\u0510\u0514\u0001\u0000\u0000\u0000"+ + "\u0511\u0512\u0005\f\u0000\u0000\u0512\u0514\u0005]\u0000\u0000\u0513"+ + "\u0506\u0001\u0000\u0000\u0000\u0513\u050a\u0001\u0000\u0000\u0000\u0513"+ + "\u050d\u0001\u0000\u0000\u0000\u0513\u0511\u0001\u0000\u0000\u0000\u0514"+ + "\u00c5\u0001\u0000\u0000\u0000\u0515\u0522\u0003\u00cae\u0000\u0516\u0518"+ + "\u0003\u00c8d\u0000\u0517\u0516\u0001\u0000\u0000\u0000\u0517\u0518\u0001"+ + "\u0000\u0000\u0000\u0518\u0519\u0001\u0000\u0000\u0000\u0519\u051b\u0005"+ + "T\u0000\u0000\u051a\u051c\u0003\u00d2i\u0000\u051b\u051a\u0001\u0000\u0000"+ + "\u0000\u051b\u051c\u0001\u0000\u0000\u0000\u051c\u051d\u0001\u0000\u0000"+ + "\u0000\u051d\u051f\u0005T\u0000\u0000\u051e\u0520\u0003\u00ceg\u0000\u051f"+ + "\u051e\u0001\u0000\u0000\u0000\u051f\u0520\u0001\u0000\u0000\u0000\u0520"+ + "\u0522\u0001\u0000\u0000\u0000\u0521\u0515\u0001\u0000\u0000\u0000\u0521"+ + "\u0517\u0001\u0000\u0000\u0000\u0522\u00c7\u0001\u0000\u0000\u0000\u0523"+ + "\u0526\u0003\u00acV\u0000\u0524\u0526\u0003\u00ceg\u0000\u0525\u0523\u0001"+ + "\u0000\u0000\u0000\u0525\u0524\u0001\u0000\u0000\u0000\u0526\u00c9\u0001"+ + "\u0000\u0000\u0000\u0527\u0529\u0003\f\u0006\u0000\u0528\u0527\u0001\u0000"+ + "\u0000\u0000\u0529\u052c\u0001\u0000\u0000\u0000\u052a\u0528\u0001\u0000"+ + "\u0000\u0000\u052a\u052b\u0001\u0000\u0000\u0000\u052b\u0531\u0001\u0000"+ + "\u0000\u0000\u052c\u052a\u0001\u0000\u0000\u0000\u052d\u052f\u0003\u010a"+ + "\u0085\u0000\u052e\u052d\u0001\u0000\u0000\u0000\u052e\u052f\u0001\u0000"+ + "\u0000\u0000\u052f\u0532\u0001\u0000\u0000\u0000\u0530\u0532\u0005=\u0000"+ + "\u0000\u0531\u052e\u0001\u0000\u0000\u0000\u0531\u0530\u0001\u0000\u0000"+ + "\u0000\u0532\u0533\u0001\u0000\u0000\u0000\u0533\u0534\u0003P(\u0000\u0534"+ + "\u0535\u0005]\u0000\u0000\u0535\u0536\u0003\u00d2i\u0000\u0536\u00cb\u0001"+ + "\u0000\u0000\u0000\u0537\u0538\u0005N\u0000\u0000\u0538\u0539\u0003\u00d2"+ + "i\u0000\u0539\u053a\u0005O\u0000\u0000\u053a\u00cd\u0001\u0000\u0000\u0000"+ + "\u053b\u0540\u0003\u00d2i\u0000\u053c\u053d\u0005U\u0000\u0000\u053d\u053f"+ + "\u0003\u00d2i\u0000\u053e\u053c\u0001\u0000\u0000\u0000\u053f\u0542\u0001"+ + "\u0000\u0000\u0000\u0540\u053e\u0001\u0000\u0000\u0000\u0540\u0541\u0001"+ + "\u0000\u0000\u0000\u0541\u00cf\u0001\u0000\u0000\u0000\u0542\u0540\u0001"+ + "\u0000\u0000\u0000\u0543\u0544\u0003\u00aeW\u0000\u0544\u0546\u0005N\u0000"+ + "\u0000\u0545\u0547\u0003\u00ceg\u0000\u0546\u0545\u0001\u0000\u0000\u0000"+ + "\u0546\u0547\u0001\u0000\u0000\u0000\u0547\u0548\u0001\u0000\u0000\u0000"+ + "\u0548\u0549\u0005O\u0000\u0000\u0549\u0557\u0001\u0000\u0000\u0000\u054a"+ + "\u054b\u0005+\u0000\u0000\u054b\u054d\u0005N\u0000\u0000\u054c\u054e\u0003"+ + "\u00ceg\u0000\u054d\u054c\u0001\u0000\u0000\u0000\u054d\u054e\u0001\u0000"+ + "\u0000\u0000\u054e\u054f\u0001\u0000\u0000\u0000\u054f\u0557\u0005O\u0000"+ + "\u0000\u0550\u0551\u0005(\u0000\u0000\u0551\u0553\u0005N\u0000\u0000\u0552"+ + "\u0554\u0003\u00ceg\u0000\u0553\u0552\u0001\u0000\u0000\u0000\u0553\u0554"+ + "\u0001\u0000\u0000\u0000\u0554\u0555\u0001\u0000\u0000\u0000\u0555\u0557"+ + "\u0005O\u0000\u0000\u0556\u0543\u0001\u0000\u0000\u0000\u0556\u054a\u0001"+ + "\u0000\u0000\u0000\u0556\u0550\u0001\u0000\u0000\u0000\u0557\u00d1\u0001"+ + "\u0000\u0000\u0000\u0558\u0559\u0006i\uffff\uffff\u0000\u0559\u0584\u0003"+ + "\u00e8t\u0000\u055a\u0584\u0003\u00d0h\u0000\u055b\u055c\u0005\u001f\u0000"+ + "\u0000\u055c\u0584\u0003\u00f6{\u0000\u055d\u0561\u0005N\u0000\u0000\u055e"+ + "\u0560\u0003|>\u0000\u055f\u055e\u0001\u0000\u0000\u0000\u0560\u0563\u0001"+ + "\u0000\u0000\u0000\u0561\u055f\u0001\u0000\u0000\u0000\u0561\u0562\u0001"+ + "\u0000\u0000\u0000\u0562\u0564\u0001\u0000\u0000\u0000\u0563\u0561\u0001"+ + "\u0000\u0000\u0000\u0564\u0569\u0003\u010a\u0085\u0000\u0565\u0566\u0005"+ + "j\u0000\u0000\u0566\u0568\u0003\u010a\u0085\u0000\u0567\u0565\u0001\u0000"+ + "\u0000\u0000\u0568\u056b\u0001\u0000\u0000\u0000\u0569\u0567\u0001\u0000"+ + "\u0000\u0000\u0569\u056a\u0001\u0000\u0000\u0000\u056a\u056c\u0001\u0000"+ + "\u0000\u0000\u056b\u0569\u0001\u0000\u0000\u0000\u056c\u056d\u0005O\u0000"+ + "\u0000\u056d\u056e\u0003\u00d2i\u0015\u056e\u0584\u0001\u0000\u0000\u0000"+ + "\u056f\u0570\u0007\u0006\u0000\u0000\u0570\u0584\u0003\u00d2i\u0013\u0571"+ + "\u0584\u0003\u00e2q\u0000\u0572\u0584\u0003\u00eau\u0000\u0573\u0574\u0003"+ + "\u010a\u0085\u0000\u0574\u057a\u0005z\u0000\u0000\u0575\u0577\u0003\u010e"+ + "\u0087\u0000\u0576\u0575\u0001\u0000\u0000\u0000\u0576\u0577\u0001\u0000"+ + "\u0000\u0000\u0577\u0578\u0001\u0000\u0000\u0000\u0578\u057b\u0003\u00ae"+ + "W\u0000\u0579\u057b\u0005\u001f\u0000\u0000\u057a\u0576\u0001\u0000\u0000"+ + "\u0000\u057a\u0579\u0001\u0000\u0000\u0000\u057b\u0584\u0001\u0000\u0000"+ + "\u0000\u057c\u057d\u0003\u00f4z\u0000\u057d\u057f\u0005z\u0000\u0000\u057e"+ + "\u0580\u0003\u010e\u0087\u0000\u057f\u057e\u0001\u0000\u0000\u0000\u057f"+ + "\u0580\u0001\u0000\u0000\u0000\u0580\u0581\u0001\u0000\u0000\u0000\u0581"+ + "\u0582\u0005\u001f\u0000\u0000\u0582\u0584\u0001\u0000\u0000\u0000\u0583"+ + "\u0558\u0001\u0000\u0000\u0000\u0583\u055a\u0001\u0000\u0000\u0000\u0583"+ + "\u055b\u0001\u0000\u0000\u0000\u0583\u055d\u0001\u0000\u0000\u0000\u0583"+ + "\u056f\u0001\u0000\u0000\u0000\u0583\u0571\u0001\u0000\u0000\u0000\u0583"+ + "\u0572\u0001\u0000\u0000\u0000\u0583\u0573\u0001\u0000\u0000\u0000\u0583"+ + "\u057c\u0001\u0000\u0000\u0000\u0584\u05d8\u0001\u0000\u0000\u0000\u0585"+ + "\u0586\n\u0012\u0000\u0000\u0586\u0587\u0007\u0007\u0000\u0000\u0587\u05d7"+ + "\u0003\u00d2i\u0013\u0588\u0589\n\u0011\u0000\u0000\u0589\u058a\u0007"+ + "\b\u0000\u0000\u058a\u05d7\u0003\u00d2i\u0012\u058b\u0593\n\u0010\u0000"+ + "\u0000\u058c\u058d\u0005Y\u0000\u0000\u058d\u0594\u0005Y\u0000\u0000\u058e"+ + "\u058f\u0005X\u0000\u0000\u058f\u0590\u0005X\u0000\u0000\u0590\u0594\u0005"+ + "X\u0000\u0000\u0591\u0592\u0005X\u0000\u0000\u0592\u0594\u0005X\u0000"+ + "\u0000\u0593\u058c\u0001\u0000\u0000\u0000\u0593\u058e\u0001\u0000\u0000"+ + "\u0000\u0593\u0591\u0001\u0000\u0000\u0000\u0594\u0595\u0001\u0000\u0000"+ + "\u0000\u0595\u05d7\u0003\u00d2i\u0011\u0596\u0597\n\u000f\u0000\u0000"+ + "\u0597\u0598\u0007\t\u0000\u0000\u0598\u05d7\u0003\u00d2i\u0010\u0599"+ + "\u059a\n\r\u0000\u0000\u059a\u059b\u0007\n\u0000\u0000\u059b\u05d7\u0003"+ + "\u00d2i\u000e\u059c\u059d\n\f\u0000\u0000\u059d\u059e\u0005j\u0000\u0000"+ + "\u059e\u05d7\u0003\u00d2i\r\u059f\u05a0\n\u000b\u0000\u0000\u05a0\u05a1"+ + "\u0005l\u0000\u0000\u05a1\u05d7\u0003\u00d2i\f\u05a2\u05a3\n\n\u0000\u0000"+ + "\u05a3\u05a4\u0005k\u0000\u0000\u05a4\u05d7\u0003\u00d2i\u000b\u05a5\u05a6"+ + "\n\t\u0000\u0000\u05a6\u05a7\u0005b\u0000\u0000\u05a7\u05d7\u0003\u00d2"+ + "i\n\u05a8\u05a9\n\b\u0000\u0000\u05a9\u05aa\u0005c\u0000\u0000\u05aa\u05d7"+ + "\u0003\u00d2i\t\u05ab\u05ac\n\u0007\u0000\u0000\u05ac\u05ad\u0005\\\u0000"+ + "\u0000\u05ad\u05ae\u0003\u00d2i\u0000\u05ae\u05af\u0005]\u0000\u0000\u05af"+ + "\u05b0\u0003\u00d2i\u0007\u05b0\u05d7\u0001\u0000\u0000\u0000\u05b1\u05b2"+ + "\n\u0006\u0000\u0000\u05b2\u05b3\u0007\u000b\u0000\u0000\u05b3\u05d7\u0003"+ + "\u00d2i\u0006\u05b4\u05b5\n\u0019\u0000\u0000\u05b5\u05c1\u0005V\u0000"+ + "\u0000\u05b6\u05c2\u0003\u00aeW\u0000\u05b7\u05c2\u0003\u00d0h\u0000\u05b8"+ + "\u05c2\u0005+\u0000\u0000\u05b9\u05bb\u0005\u001f\u0000\u0000\u05ba\u05bc"+ + "\u0003\u0106\u0083\u0000\u05bb\u05ba\u0001\u0000\u0000\u0000\u05bb\u05bc"+ + "\u0001\u0000\u0000\u0000\u05bc\u05bd\u0001\u0000\u0000\u0000\u05bd\u05c2"+ + "\u0003\u00fa}\u0000\u05be\u05bf\u0005(\u0000\u0000\u05bf\u05c2\u0003\u0110"+ + "\u0088\u0000\u05c0\u05c2\u0003\u0100\u0080\u0000\u05c1\u05b6\u0001\u0000"+ + "\u0000\u0000\u05c1\u05b7\u0001\u0000\u0000\u0000\u05c1\u05b8\u0001\u0000"+ + "\u0000\u0000\u05c1\u05b9\u0001\u0000\u0000\u0000\u05c1\u05be\u0001\u0000"+ + "\u0000\u0000\u05c1\u05c0\u0001\u0000\u0000\u0000\u05c2\u05d7\u0001\u0000"+ + "\u0000\u0000\u05c3\u05c4\n\u0018\u0000\u0000\u05c4\u05c5\u0005R\u0000"+ + "\u0000\u05c5\u05c6\u0003\u00d2i\u0000\u05c6\u05c7\u0005S\u0000\u0000\u05c7"+ + "\u05d7\u0001\u0000\u0000\u0000\u05c8\u05c9\n\u0014\u0000\u0000\u05c9\u05d7"+ + "\u0007\f\u0000\u0000\u05ca\u05cb\n\u000e\u0000\u0000\u05cb\u05ce\u0005"+ + "\u001a\u0000\u0000\u05cc\u05cf\u0003\u010a\u0085\u0000\u05cd\u05cf\u0003"+ + "\u00d4j\u0000\u05ce\u05cc\u0001\u0000\u0000\u0000\u05ce\u05cd\u0001\u0000"+ + "\u0000\u0000\u05cf\u05d7\u0001\u0000\u0000\u0000\u05d0\u05d1\n\u0003\u0000"+ + "\u0000\u05d1\u05d3\u0005z\u0000\u0000\u05d2\u05d4\u0003\u010e\u0087\u0000"+ + "\u05d3\u05d2\u0001\u0000\u0000\u0000\u05d3\u05d4\u0001\u0000\u0000\u0000"+ + "\u05d4\u05d5\u0001\u0000\u0000\u0000\u05d5\u05d7\u0003\u00aeW\u0000\u05d6"+ + "\u0585\u0001\u0000\u0000\u0000\u05d6\u0588\u0001\u0000\u0000\u0000\u05d6"+ + "\u058b\u0001\u0000\u0000\u0000\u05d6\u0596\u0001\u0000\u0000\u0000\u05d6"+ + "\u0599\u0001\u0000\u0000\u0000\u05d6\u059c\u0001\u0000\u0000\u0000\u05d6"+ + "\u059f\u0001\u0000\u0000\u0000\u05d6\u05a2\u0001\u0000\u0000\u0000\u05d6"+ + "\u05a5\u0001\u0000\u0000\u0000\u05d6\u05a8\u0001\u0000\u0000\u0000\u05d6"+ + "\u05ab\u0001\u0000\u0000\u0000\u05d6\u05b1\u0001\u0000\u0000\u0000\u05d6"+ + "\u05b4\u0001\u0000\u0000\u0000\u05d6\u05c3\u0001\u0000\u0000\u0000\u05d6"+ + "\u05c8\u0001\u0000\u0000\u0000\u05d6\u05ca\u0001\u0000\u0000\u0000\u05d6"+ + "\u05d0\u0001\u0000\u0000\u0000\u05d7\u05da\u0001\u0000\u0000\u0000\u05d8"+ + "\u05d6\u0001\u0000\u0000\u0000\u05d8\u05d9\u0001\u0000\u0000\u0000\u05d9"+ + "\u00d3\u0001\u0000\u0000\u0000\u05da\u05d8\u0001\u0000\u0000\u0000\u05db"+ + "\u05de\u0003\u00d6k\u0000\u05dc\u05de\u0003\u00f0x\u0000\u05dd\u05db\u0001"+ + "\u0000\u0000\u0000\u05dd\u05dc\u0001\u0000\u0000\u0000\u05de\u00d5\u0001"+ + "\u0000\u0000\u0000\u05df\u05e6\u0003\u00dam\u0000\u05e0\u05e6\u0003\u00d8"+ + "l\u0000\u05e1\u05e2\u0005N\u0000\u0000\u05e2\u05e3\u0003\u00d4j\u0000"+ + "\u05e3\u05e4\u0005O\u0000\u0000\u05e4\u05e6\u0001\u0000\u0000\u0000\u05e5"+ + "\u05df\u0001\u0000\u0000\u0000\u05e5\u05e0\u0001\u0000\u0000\u0000\u05e5"+ + "\u05e1\u0001\u0000\u0000\u0000\u05e6\u00d7\u0001\u0000\u0000\u0000\u05e7"+ + "\u05e8\u0003\u010a\u0085\u0000\u05e8\u05ea\u0003\u00dcn\u0000\u05e9\u05eb"+ + "\u0003\u00aeW\u0000\u05ea\u05e9\u0001\u0000\u0000\u0000\u05ea\u05eb\u0001"+ + "\u0000\u0000\u0000\u05eb\u00d9\u0001\u0000\u0000\u0000\u05ec\u05ee\u0003"+ + "\f\u0006\u0000\u05ed\u05ec\u0001\u0000\u0000\u0000\u05ee\u05f1\u0001\u0000"+ + "\u0000\u0000\u05ef\u05ed\u0001\u0000\u0000\u0000\u05ef\u05f0\u0001\u0000"+ + "\u0000\u0000\u05f0\u05f2\u0001\u0000\u0000\u0000\u05f1\u05ef\u0001\u0000"+ + "\u0000\u0000\u05f2\u05f3\u0003\u010a\u0085\u0000\u05f3\u05f4\u0003\u00ae"+ + "W\u0000\u05f4\u00db\u0001\u0000\u0000\u0000\u05f5\u05f7\u0005N\u0000\u0000"+ + "\u05f6\u05f8\u0003\u00e0p\u0000\u05f7\u05f6\u0001\u0000\u0000\u0000\u05f7"+ + "\u05f8\u0001\u0000\u0000\u0000\u05f8\u05f9\u0001\u0000\u0000\u0000\u05f9"+ + "\u05fa\u0005O\u0000\u0000\u05fa\u00dd\u0001\u0000\u0000\u0000\u05fb\u05fe"+ + "\u0003\u00d4j\u0000\u05fc\u05fe\u0003\u00aeW\u0000\u05fd\u05fb\u0001\u0000"+ + "\u0000\u0000\u05fd\u05fc\u0001\u0000\u0000\u0000\u05fe\u00df\u0001\u0000"+ + "\u0000\u0000\u05ff\u0604\u0003\u00d4j\u0000\u0600\u0601\u0005U\u0000\u0000"+ + "\u0601\u0603\u0003\u00d4j\u0000\u0602\u0600\u0001\u0000\u0000\u0000\u0603"+ + "\u0606\u0001\u0000\u0000\u0000\u0604\u0602\u0001\u0000\u0000\u0000\u0604"+ + "\u0605\u0001\u0000\u0000\u0000\u0605\u00e1\u0001\u0000\u0000\u0000\u0606"+ + "\u0604\u0001\u0000\u0000\u0000\u0607\u0608\u0003\u00e4r\u0000\u0608\u0609"+ + "\u0005y\u0000\u0000\u0609\u060a\u0003\u00e6s\u0000\u060a\u00e3\u0001\u0000"+ + "\u0000\u0000\u060b\u0622\u0003\u00aeW\u0000\u060c\u060e\u0005N\u0000\u0000"+ + "\u060d\u060f\u0003h4\u0000\u060e\u060d\u0001\u0000\u0000\u0000\u060e\u060f"+ + "\u0001\u0000\u0000\u0000\u060f\u0610\u0001\u0000\u0000\u0000\u0610\u0622"+ + "\u0005O\u0000\u0000\u0611\u0612\u0005N\u0000\u0000\u0612\u0617\u0003\u00ae"+ + "W\u0000\u0613\u0614\u0005U\u0000\u0000\u0614\u0616\u0003\u00aeW\u0000"+ + "\u0615\u0613\u0001\u0000\u0000\u0000\u0616\u0619\u0001\u0000\u0000\u0000"+ + "\u0617\u0615\u0001\u0000\u0000\u0000\u0617\u0618\u0001\u0000\u0000\u0000"+ + "\u0618\u061a\u0001\u0000\u0000\u0000\u0619\u0617\u0001\u0000\u0000\u0000"+ + "\u061a\u061b\u0005O\u0000\u0000\u061b\u0622\u0001\u0000\u0000\u0000\u061c"+ + "\u061e\u0005N\u0000\u0000\u061d\u061f\u0003n7\u0000\u061e\u061d\u0001"+ + "\u0000\u0000\u0000\u061e\u061f\u0001\u0000\u0000\u0000\u061f\u0620\u0001"+ + "\u0000\u0000\u0000\u0620\u0622\u0005O\u0000\u0000\u0621\u060b\u0001\u0000"+ + "\u0000\u0000\u0621\u060c\u0001\u0000\u0000\u0000\u0621\u0611\u0001\u0000"+ + "\u0000\u0000\u0621\u061c\u0001\u0000\u0000\u0000\u0622\u00e5\u0001\u0000"+ + "\u0000\u0000\u0623\u0626\u0003\u00d2i\u0000\u0624\u0626\u0003\u00a8T\u0000"+ + "\u0625\u0623\u0001\u0000\u0000\u0000\u0625\u0624\u0001\u0000\u0000\u0000"+ + "\u0626\u00e7\u0001\u0000\u0000\u0000\u0627\u0628\u0005N\u0000\u0000\u0628"+ + "\u0629\u0003\u00d2i\u0000\u0629\u062a\u0005O\u0000\u0000\u062a\u063a\u0001"+ + "\u0000\u0000\u0000\u062b\u063a\u0005+\u0000\u0000\u062c\u063a\u0005(\u0000"+ + "\u0000\u062d\u063a\u0003t:\u0000\u062e\u063a\u0003\u00aeW\u0000\u062f"+ + "\u0630\u00030\u0018\u0000\u0630\u0631\u0005V\u0000\u0000\u0631\u0632\u0005"+ + "\t\u0000\u0000\u0632\u063a\u0001\u0000\u0000\u0000\u0633\u0637\u0003\u0106"+ + "\u0083\u0000\u0634\u0638\u0003\u0112\u0089\u0000\u0635\u0636\u0005+\u0000"+ + "\u0000\u0636\u0638\u0003\u0114\u008a\u0000\u0637\u0634\u0001\u0000\u0000"+ + "\u0000\u0637\u0635\u0001\u0000\u0000\u0000\u0638\u063a\u0001\u0000\u0000"+ + "\u0000\u0639\u0627\u0001\u0000\u0000\u0000\u0639\u062b\u0001\u0000\u0000"+ + "\u0000\u0639\u062c\u0001\u0000\u0000\u0000\u0639\u062d\u0001\u0000\u0000"+ + "\u0000\u0639\u062e\u0001\u0000\u0000\u0000\u0639\u062f\u0001\u0000\u0000"+ + "\u0000\u0639\u0633\u0001\u0000\u0000\u0000\u063a\u00e9\u0001\u0000\u0000"+ + "\u0000\u063b\u063c\u0005)\u0000\u0000\u063c\u063d\u0003\u00ccf\u0000\u063d"+ + "\u0641\u0005P\u0000\u0000\u063e\u0640\u0003\u00ecv\u0000\u063f\u063e\u0001"+ + "\u0000\u0000\u0000\u0640\u0643\u0001\u0000\u0000\u0000\u0641\u063f\u0001"+ + "\u0000\u0000\u0000\u0641\u0642\u0001\u0000\u0000\u0000\u0642\u0644\u0001"+ + "\u0000\u0000\u0000\u0643\u0641\u0001\u0000\u0000\u0000\u0644\u0645\u0005"+ + "Q\u0000\u0000\u0645\u00eb\u0001\u0000\u0000\u0000\u0646\u0647\u0003\u00ee"+ + "w\u0000\u0647\u0648\u0003\u00f2y\u0000\u0648\u00ed\u0001\u0000\u0000\u0000"+ + "\u0649\u064a\u0005\u0006\u0000\u0000\u064a\u064b\u0003\u00ceg\u0000\u064b"+ + "\u064c\u0007\r\u0000\u0000\u064c\u0657\u0001\u0000\u0000\u0000\u064d\u064e"+ + "\u0005\u0006\u0000\u0000\u064e\u064f\u0005M\u0000\u0000\u064f\u0657\u0007"+ + "\r\u0000\u0000\u0650\u0651\u0005\u0006\u0000\u0000\u0651\u0652\u0003\u00d4"+ + "j\u0000\u0652\u0653\u0007\r\u0000\u0000\u0653\u0657\u0001\u0000\u0000"+ + "\u0000\u0654\u0655\u0005\f\u0000\u0000\u0655\u0657\u0007\r\u0000\u0000"+ + "\u0656\u0649\u0001\u0000\u0000\u0000\u0656\u064d\u0001\u0000\u0000\u0000"+ + "\u0656\u0650\u0001\u0000\u0000\u0000\u0656\u0654\u0001\u0000\u0000\u0000"+ + "\u0657\u00ef\u0001\u0000\u0000\u0000\u0658\u0659\u0003\u00d6k\u0000\u0659"+ + "\u065a\u0005;\u0000\u0000\u065a\u065b\u0003\u00d2i\u0000\u065b\u00f1\u0001"+ + "\u0000\u0000\u0000\u065c\u0661\u0003\u00a8T\u0000\u065d\u065e\u0003\u00d2"+ + "i\u0000\u065e\u065f\u0005T\u0000\u0000\u065f\u0661\u0001\u0000\u0000\u0000"+ + "\u0660\u065c\u0001\u0000\u0000\u0000\u0660\u065d\u0001\u0000\u0000\u0000"+ + "\u0661\u00f3\u0001\u0000\u0000\u0000\u0662\u0663\u0003V+\u0000\u0663\u0664"+ + "\u0005V\u0000\u0000\u0664\u0666\u0001\u0000\u0000\u0000\u0665\u0662\u0001"+ + "\u0000\u0000\u0000\u0665\u0666\u0001\u0000\u0000\u0000\u0666\u066a\u0001"+ + "\u0000\u0000\u0000\u0667\u0669\u0003|>\u0000\u0668\u0667\u0001\u0000\u0000"+ + "\u0000\u0669\u066c\u0001\u0000\u0000\u0000\u066a\u0668\u0001\u0000\u0000"+ + "\u0000\u066a\u066b\u0001\u0000\u0000\u0000\u066b\u066d\u0001\u0000\u0000"+ + "\u0000\u066c\u066a\u0001\u0000\u0000\u0000\u066d\u066f\u0003\u00aeW\u0000"+ + "\u066e\u0670\u0003\u010e\u0087\u0000\u066f\u066e\u0001\u0000\u0000\u0000"+ + "\u066f\u0670\u0001\u0000\u0000\u0000\u0670\u00f5\u0001\u0000\u0000\u0000"+ + "\u0671\u0672\u0003\u0106\u0083\u0000\u0672\u0673\u0003\u00f8|\u0000\u0673"+ + "\u0674\u0003\u00fe\u007f\u0000\u0674\u067b\u0001\u0000\u0000\u0000\u0675"+ + "\u0678\u0003\u00f8|\u0000\u0676\u0679\u0003\u00fc~\u0000\u0677\u0679\u0003"+ + "\u00fe\u007f\u0000\u0678\u0676\u0001\u0000\u0000\u0000\u0678\u0677\u0001"+ + "\u0000\u0000\u0000\u0679\u067b\u0001\u0000\u0000\u0000\u067a\u0671\u0001"+ + "\u0000\u0000\u0000\u067a\u0675\u0001\u0000\u0000\u0000\u067b\u00f7\u0001"+ + "\u0000\u0000\u0000\u067c\u067e\u0003\u00aeW\u0000\u067d\u067f\u0003\u0102"+ + "\u0081\u0000\u067e\u067d\u0001\u0000\u0000\u0000\u067e\u067f\u0001\u0000"+ + "\u0000\u0000\u067f\u0682\u0001\u0000\u0000\u0000\u0680\u0682\u0003\u010c"+ + "\u0086\u0000\u0681\u067c\u0001\u0000\u0000\u0000\u0681\u0680\u0001\u0000"+ + "\u0000\u0000\u0682\u00f9\u0001\u0000\u0000\u0000\u0683\u0685\u0003\u00ae"+ + "W\u0000\u0684\u0686\u0003\u0104\u0082\u0000\u0685\u0684\u0001\u0000\u0000"+ + "\u0000\u0685\u0686\u0001\u0000\u0000\u0000\u0686\u0687\u0001\u0000\u0000"+ + "\u0000\u0687\u0688\u0003\u00fe\u007f\u0000\u0688\u00fb\u0001\u0000\u0000"+ + "\u0000\u0689\u06a5\u0005R\u0000\u0000\u068a\u068f\u0005S\u0000\u0000\u068b"+ + "\u068c\u0005R\u0000\u0000\u068c\u068e\u0005S\u0000\u0000\u068d\u068b\u0001"+ + "\u0000\u0000\u0000\u068e\u0691\u0001\u0000\u0000\u0000\u068f\u068d\u0001"+ + "\u0000\u0000\u0000\u068f\u0690\u0001\u0000\u0000\u0000\u0690\u0692\u0001"+ + "\u0000\u0000\u0000\u0691\u068f\u0001\u0000\u0000\u0000\u0692\u06a6\u0003"+ + "T*\u0000\u0693\u0694\u0003\u00d2i\u0000\u0694\u069b\u0005S\u0000\u0000"+ + "\u0695\u0696\u0005R\u0000\u0000\u0696\u0697\u0003\u00d2i\u0000\u0697\u0698"+ + "\u0005S\u0000\u0000\u0698\u069a\u0001\u0000\u0000\u0000\u0699\u0695\u0001"+ + "\u0000\u0000\u0000\u069a\u069d\u0001\u0000\u0000\u0000\u069b\u0699\u0001"+ + "\u0000\u0000\u0000\u069b\u069c\u0001\u0000\u0000\u0000\u069c\u06a2\u0001"+ + "\u0000\u0000\u0000\u069d\u069b\u0001\u0000\u0000\u0000\u069e\u069f\u0005"+ + "R\u0000\u0000\u069f\u06a1\u0005S\u0000\u0000\u06a0\u069e\u0001\u0000\u0000"+ + "\u0000\u06a1\u06a4\u0001\u0000\u0000\u0000\u06a2\u06a0\u0001\u0000\u0000"+ + "\u0000\u06a2\u06a3\u0001\u0000\u0000\u0000\u06a3\u06a6\u0001\u0000\u0000"+ + "\u0000\u06a4\u06a2\u0001\u0000\u0000\u0000\u06a5\u068a\u0001\u0000\u0000"+ + "\u0000\u06a5\u0693\u0001\u0000\u0000\u0000\u06a6\u00fd\u0001\u0000\u0000"+ + "\u0000\u06a7\u06a9\u0003\u0114\u008a\u0000\u06a8\u06aa\u0003 \u0010\u0000"+ + "\u06a9\u06a8\u0001\u0000\u0000\u0000\u06a9\u06aa\u0001\u0000\u0000\u0000"+ + "\u06aa\u00ff\u0001\u0000\u0000\u0000\u06ab\u06ac\u0003\u0106\u0083\u0000"+ + "\u06ac\u06ad\u0003\u0112\u0089\u0000\u06ad\u0101\u0001\u0000\u0000\u0000"+ + "\u06ae\u06af\u0005Y\u0000\u0000\u06af\u06b2\u0005X\u0000\u0000\u06b0\u06b2"+ + "\u0003\u010e\u0087\u0000\u06b1\u06ae\u0001\u0000\u0000\u0000\u06b1\u06b0"+ + "\u0001\u0000\u0000\u0000\u06b2\u0103\u0001\u0000\u0000\u0000\u06b3\u06b4"+ + "\u0005Y\u0000\u0000\u06b4\u06b7\u0005X\u0000\u0000\u06b5\u06b7\u0003\u0106"+ + "\u0083\u0000\u06b6\u06b3\u0001\u0000\u0000\u0000\u06b6\u06b5\u0001\u0000"+ + "\u0000\u0000\u06b7\u0105\u0001\u0000\u0000\u0000\u06b8\u06b9\u0005Y\u0000"+ + "\u0000\u06b9\u06ba\u0003\u0108\u0084\u0000\u06ba\u06bb\u0005X\u0000\u0000"+ + "\u06bb\u0107\u0001\u0000\u0000\u0000\u06bc\u06c1\u0003\u010a\u0085\u0000"+ + "\u06bd\u06be\u0005U\u0000\u0000\u06be\u06c0\u0003\u010a\u0085\u0000\u06bf"+ + "\u06bd\u0001\u0000\u0000\u0000\u06c0\u06c3\u0001\u0000\u0000\u0000\u06c1"+ + "\u06bf\u0001\u0000\u0000\u0000\u06c1\u06c2\u0001\u0000\u0000\u0000\u06c2"+ + "\u0109\u0001\u0000\u0000\u0000\u06c3\u06c1\u0001\u0000\u0000\u0000\u06c4"+ + "\u06c6\u0003|>\u0000\u06c5\u06c4\u0001\u0000\u0000\u0000\u06c6\u06c9\u0001"+ + "\u0000\u0000\u0000\u06c7\u06c5\u0001\u0000\u0000\u0000\u06c7\u06c8\u0001"+ + "\u0000\u0000\u0000\u06c8\u06cc\u0001\u0000\u0000\u0000\u06c9\u06c7\u0001"+ + "\u0000\u0000\u0000\u06ca\u06cd\u0003V+\u0000\u06cb\u06cd\u0003\u010c\u0086"+ + "\u0000\u06cc\u06ca\u0001\u0000\u0000\u0000\u06cc\u06cb\u0001\u0000\u0000"+ + "\u0000\u06cd\u06d8\u0001\u0000\u0000\u0000\u06ce\u06d0\u0003|>\u0000\u06cf"+ + "\u06ce\u0001\u0000\u0000\u0000\u06d0\u06d3\u0001\u0000\u0000\u0000\u06d1"+ + "\u06cf\u0001\u0000\u0000\u0000\u06d1\u06d2\u0001\u0000\u0000\u0000\u06d2"+ + "\u06d4\u0001\u0000\u0000\u0000\u06d3\u06d1\u0001\u0000\u0000\u0000\u06d4"+ + "\u06d5\u0005R\u0000\u0000\u06d5\u06d7\u0005S\u0000\u0000\u06d6\u06d1\u0001"+ + "\u0000\u0000\u0000\u06d7\u06da\u0001\u0000\u0000\u0000\u06d8\u06d6\u0001"+ + "\u0000\u0000\u0000\u06d8\u06d9\u0001\u0000\u0000\u0000\u06d9\u010b\u0001"+ + "\u0000\u0000\u0000\u06da\u06d8\u0001\u0000\u0000\u0000\u06db\u06dc\u0007"+ + "\u000e\u0000\u0000\u06dc\u010d\u0001\u0000\u0000\u0000\u06dd\u06de\u0005"+ + "Y\u0000\u0000\u06de\u06e3\u0003X,\u0000\u06df\u06e0\u0005U\u0000\u0000"+ + "\u06e0\u06e2\u0003X,\u0000\u06e1\u06df\u0001\u0000\u0000\u0000\u06e2\u06e5"+ + "\u0001\u0000\u0000\u0000\u06e3\u06e1\u0001\u0000\u0000\u0000\u06e3\u06e4"+ + "\u0001\u0000\u0000\u0000\u06e4\u06e6\u0001\u0000\u0000\u0000\u06e5\u06e3"+ + "\u0001\u0000\u0000\u0000\u06e6\u06e7\u0005X\u0000\u0000\u06e7\u010f\u0001"+ + "\u0000\u0000\u0000\u06e8\u06f2\u0003\u0114\u008a\u0000\u06e9\u06eb\u0005"+ + "V\u0000\u0000\u06ea\u06ec\u0003\u010e\u0087\u0000\u06eb\u06ea\u0001\u0000"+ + "\u0000\u0000\u06eb\u06ec\u0001\u0000\u0000\u0000\u06ec\u06ed\u0001\u0000"+ + "\u0000\u0000\u06ed\u06ef\u0003\u00aeW\u0000\u06ee\u06f0\u0003\u0114\u008a"+ + "\u0000\u06ef\u06ee\u0001\u0000\u0000\u0000\u06ef\u06f0\u0001\u0000\u0000"+ + "\u0000\u06f0\u06f2\u0001\u0000\u0000\u0000\u06f1\u06e8\u0001\u0000\u0000"+ + "\u0000\u06f1\u06e9\u0001\u0000\u0000\u0000\u06f2\u0111\u0001\u0000\u0000"+ + "\u0000\u06f3\u06f4\u0005(\u0000\u0000\u06f4\u06f9\u0003\u0110\u0088\u0000"+ + "\u06f5\u06f6\u0003\u00aeW\u0000\u06f6\u06f7\u0003\u0114\u008a\u0000\u06f7"+ + "\u06f9\u0001\u0000\u0000\u0000\u06f8\u06f3\u0001\u0000\u0000\u0000\u06f8"+ + "\u06f5\u0001\u0000\u0000\u0000\u06f9\u0113\u0001\u0000\u0000\u0000\u06fa"+ + "\u06fc\u0005N\u0000\u0000\u06fb\u06fd\u0003\u00ceg\u0000\u06fc\u06fb\u0001"+ + "\u0000\u0000\u0000\u06fc\u06fd\u0001\u0000\u0000\u0000\u06fd\u06fe\u0001"+ + "\u0000\u0000\u0000\u06fe\u06ff\u0005O\u0000\u0000\u06ff\u0115\u0001\u0000"+ + "\u0000\u0000\u00e0\u0117\u011c\u0122\u0128\u012d\u0136\u013b\u0142\u014a"+ + "\u014d\u0154\u0160\u0164\u0169\u016d\u0171\u0175\u017f\u0187\u018f\u0193"+ + "\u019a\u01a1\u01a5\u01a8\u01ab\u01b4\u01ba\u01bf\u01c2\u01c8\u01ce\u01d2"+ + "\u01d6\u01de\u01e7\u01ee\u01f4\u01f8\u01fe\u0202\u0207\u020c\u0214\u0219"+ + "\u021d\u0224\u022d\u0232\u023a\u023f\u0245\u0248\u024f\u0259\u0262\u026d"+ + "\u0272\u027b\u027f\u0287\u028c\u0295\u029b\u02a2\u02a7\u02af\u02b3\u02b5"+ + "\u02bb\u02c1\u02c6\u02ca\u02cf\u02d5\u02e2\u02e9\u02ee\u02f1\u02f3\u02f8"+ + "\u02ff\u0309\u030e\u0311\u0316\u031a\u031e\u0323\u0327\u032c\u0337\u033d"+ + "\u0348\u0352\u035d\u0366\u036b\u036e\u0375\u037f\u0387\u038a\u038d\u039a"+ + "\u03a2\u03a7\u03af\u03b1\u03b5\u03bb\u03c3\u03cd\u03d6\u03e0\u03e8\u03f6"+ + "\u03fd\u0402\u0408\u0411\u0415\u041d\u0426\u0430\u0435\u043a\u0445\u044b"+ + "\u044e\u0455\u045e\u0475\u0478\u047b\u0483\u0487\u048f\u0495\u04a0\u04a9"+ + "\u04ae\u04bd\u04c4\u04c8\u04d3\u04dc\u04e5\u04eb\u04ef\u04f4\u04fa\u04ff"+ + "\u0504\u0513\u0517\u051b\u051f\u0521\u0525\u052a\u052e\u0531\u0540\u0546"+ + "\u054d\u0553\u0556\u0561\u0569\u0576\u057a\u057f\u0583\u0593\u05bb\u05c1"+ + "\u05ce\u05d3\u05d6\u05d8\u05dd\u05e5\u05ea\u05ef\u05f7\u05fd\u0604\u060e"+ + "\u0617\u061e\u0621\u0625\u0637\u0639\u0641\u0656\u0660\u0665\u066a\u066f"+ + "\u0678\u067a\u067e\u0681\u0685\u068f\u069b\u06a2\u06a5\u06a9\u06b1\u06b6"+ + "\u06c1\u06c7\u06cc\u06d1\u06d8\u06e3\u06eb\u06ef\u06f1\u06f8\u06fc"; + public static final ATN _ATN = + new ATNDeserializer().deserialize(_serializedATN.toCharArray()); + static { + _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()]; + for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) { + _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); + } + } +} \ No newline at end of file diff --git a/javatx-src/main/java/de/dhbwstuttgart/parser/antlr/Java17ParserBaseListener.java b/javatx-src/main/java/de/dhbwstuttgart/parser/antlr/Java17ParserBaseListener.java new file mode 100644 index 0000000..2f1a830 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/parser/antlr/Java17ParserBaseListener.java @@ -0,0 +1,2656 @@ +// Generated from java-escape by ANTLR 4.11.1 +package de.dhbwstuttgart.parser.antlr; + +import org.antlr.v4.runtime.ParserRuleContext; +import org.antlr.v4.runtime.tree.ErrorNode; +import org.antlr.v4.runtime.tree.TerminalNode; + +/** + * This class provides an empty implementation of {@link Java17ParserListener}, + * which can be extended to create a listener which only needs to handle a subset + * of the available methods. + */ +@SuppressWarnings("CheckReturnValue") +public class Java17ParserBaseListener implements Java17ParserListener { + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterSrcfile(Java17Parser.SrcfileContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitSrcfile(Java17Parser.SrcfileContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterModuledecl(Java17Parser.ModuledeclContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitModuledecl(Java17Parser.ModuledeclContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterPackageDeclaration(Java17Parser.PackageDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitPackageDeclaration(Java17Parser.PackageDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterImportDeclaration(Java17Parser.ImportDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitImportDeclaration(Java17Parser.ImportDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterClassorinterfacedecl(Java17Parser.ClassorinterfacedeclContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitClassorinterfacedecl(Java17Parser.ClassorinterfacedeclContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterNoclassorinterface(Java17Parser.NoclassorinterfaceContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitNoclassorinterface(Java17Parser.NoclassorinterfaceContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterModifier(Java17Parser.ModifierContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitModifier(Java17Parser.ModifierContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterClassOrInterfaceModifier(Java17Parser.ClassOrInterfaceModifierContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitClassOrInterfaceModifier(Java17Parser.ClassOrInterfaceModifierContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterFinalvarmod(Java17Parser.FinalvarmodContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitFinalvarmod(Java17Parser.FinalvarmodContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterAnnotationvarmod(Java17Parser.AnnotationvarmodContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitAnnotationvarmod(Java17Parser.AnnotationvarmodContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterClassDeclaration(Java17Parser.ClassDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitClassDeclaration(Java17Parser.ClassDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterGenericDeclarationList(Java17Parser.GenericDeclarationListContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitGenericDeclarationList(Java17Parser.GenericDeclarationListContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterGenericTypeVar(Java17Parser.GenericTypeVarContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitGenericTypeVar(Java17Parser.GenericTypeVarContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterTypeBound(Java17Parser.TypeBoundContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitTypeBound(Java17Parser.TypeBoundContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterEnumDeclaration(Java17Parser.EnumDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitEnumDeclaration(Java17Parser.EnumDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterEnumConstants(Java17Parser.EnumConstantsContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitEnumConstants(Java17Parser.EnumConstantsContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterEnumConstant(Java17Parser.EnumConstantContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitEnumConstant(Java17Parser.EnumConstantContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterEnumBodyDeclarations(Java17Parser.EnumBodyDeclarationsContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitEnumBodyDeclarations(Java17Parser.EnumBodyDeclarationsContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterInterfaceDeclaration(Java17Parser.InterfaceDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitInterfaceDeclaration(Java17Parser.InterfaceDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterClassBody(Java17Parser.ClassBodyContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitClassBody(Java17Parser.ClassBodyContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterInterfaceBody(Java17Parser.InterfaceBodyContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitInterfaceBody(Java17Parser.InterfaceBodyContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterEmptyclassbody(Java17Parser.EmptyclassbodyContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitEmptyclassbody(Java17Parser.EmptyclassbodyContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterClassblock(Java17Parser.ClassblockContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitClassblock(Java17Parser.ClassblockContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterMemberdecl(Java17Parser.MemberdeclContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitMemberdecl(Java17Parser.MemberdeclContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterMemberclassorinterface(Java17Parser.MemberclassorinterfaceContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitMemberclassorinterface(Java17Parser.MemberclassorinterfaceContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterMemberfield(Java17Parser.MemberfieldContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitMemberfield(Java17Parser.MemberfieldContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterMembermethod(Java17Parser.MembermethodContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitMembermethod(Java17Parser.MembermethodContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterMemberconstructor(Java17Parser.MemberconstructorContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitMemberconstructor(Java17Parser.MemberconstructorContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterMethoddecl(Java17Parser.MethoddeclContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitMethoddecl(Java17Parser.MethoddeclContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterGenericmethod(Java17Parser.GenericmethodContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitGenericmethod(Java17Parser.GenericmethodContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterMethodDeclaration(Java17Parser.MethodDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitMethodDeclaration(Java17Parser.MethodDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterMethodHeader(Java17Parser.MethodHeaderContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitMethodHeader(Java17Parser.MethodHeaderContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterMethodblock(Java17Parser.MethodblockContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitMethodblock(Java17Parser.MethodblockContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterEmptymethod(Java17Parser.EmptymethodContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitEmptymethod(Java17Parser.EmptymethodContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterRefType2(Java17Parser.RefType2Context ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitRefType2(Java17Parser.RefType2Context ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterRefvoid(Java17Parser.RefvoidContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitRefvoid(Java17Parser.RefvoidContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterGenericMethodDeclaration(Java17Parser.GenericMethodDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitGenericMethodDeclaration(Java17Parser.GenericMethodDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterGenericconstructor(Java17Parser.GenericconstructorContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitGenericconstructor(Java17Parser.GenericconstructorContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterConstructordecl(Java17Parser.ConstructordeclContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitConstructordecl(Java17Parser.ConstructordeclContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterGenericConstructorDeclaration(Java17Parser.GenericConstructorDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitGenericConstructorDeclaration(Java17Parser.GenericConstructorDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterConstructorDeclaration(Java17Parser.ConstructorDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitConstructorDeclaration(Java17Parser.ConstructorDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterFieldDeclaration(Java17Parser.FieldDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitFieldDeclaration(Java17Parser.FieldDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterInterfacemember(Java17Parser.InterfacememberContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitInterfacemember(Java17Parser.InterfacememberContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterEmptyinterface(Java17Parser.EmptyinterfaceContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitEmptyinterface(Java17Parser.EmptyinterfaceContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterInterfaceconst(Java17Parser.InterfaceconstContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitInterfaceconst(Java17Parser.InterfaceconstContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterInterfacemethod(Java17Parser.InterfacemethodContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitInterfacemethod(Java17Parser.InterfacemethodContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterGenericinterfacemethod(Java17Parser.GenericinterfacemethodContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitGenericinterfacemethod(Java17Parser.GenericinterfacemethodContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterSubclassorinterface(Java17Parser.SubclassorinterfaceContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitSubclassorinterface(Java17Parser.SubclassorinterfaceContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterConstDeclaration(Java17Parser.ConstDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitConstDeclaration(Java17Parser.ConstDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterConstantDeclarator(Java17Parser.ConstantDeclaratorContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitConstantDeclarator(Java17Parser.ConstantDeclaratorContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterInterfaceMethodDeclaration(Java17Parser.InterfaceMethodDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitInterfaceMethodDeclaration(Java17Parser.InterfaceMethodDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterInterfaceMethodModifier(Java17Parser.InterfaceMethodModifierContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitInterfaceMethodModifier(Java17Parser.InterfaceMethodModifierContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterGenericInterfaceMethodDeclaration(Java17Parser.GenericInterfaceMethodDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitGenericInterfaceMethodDeclaration(Java17Parser.GenericInterfaceMethodDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterInterfaceCommonBodyDeclaration(Java17Parser.InterfaceCommonBodyDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitInterfaceCommonBodyDeclaration(Java17Parser.InterfaceCommonBodyDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterVariableDeclarators(Java17Parser.VariableDeclaratorsContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitVariableDeclarators(Java17Parser.VariableDeclaratorsContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterVariableDeclarator(Java17Parser.VariableDeclaratorContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitVariableDeclarator(Java17Parser.VariableDeclaratorContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterVariableDeclaratorId(Java17Parser.VariableDeclaratorIdContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitVariableDeclaratorId(Java17Parser.VariableDeclaratorIdContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterVariableInitializer(Java17Parser.VariableInitializerContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitVariableInitializer(Java17Parser.VariableInitializerContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterArrayInitializer(Java17Parser.ArrayInitializerContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitArrayInitializer(Java17Parser.ArrayInitializerContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterClassOrInterfaceType(Java17Parser.ClassOrInterfaceTypeContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitClassOrInterfaceType(Java17Parser.ClassOrInterfaceTypeContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterTypeArgument(Java17Parser.TypeArgumentContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitTypeArgument(Java17Parser.TypeArgumentContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterWildcardType(Java17Parser.WildcardTypeContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitWildcardType(Java17Parser.WildcardTypeContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterExtendsWildcardType(Java17Parser.ExtendsWildcardTypeContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitExtendsWildcardType(Java17Parser.ExtendsWildcardTypeContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterSuperWildcardType(Java17Parser.SuperWildcardTypeContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitSuperWildcardType(Java17Parser.SuperWildcardTypeContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterQualifiedNameList(Java17Parser.QualifiedNameListContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitQualifiedNameList(Java17Parser.QualifiedNameListContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterExceptionList(Java17Parser.ExceptionListContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitExceptionList(Java17Parser.ExceptionListContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterFormalParameters(Java17Parser.FormalParametersContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitFormalParameters(Java17Parser.FormalParametersContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterReceiverParameter(Java17Parser.ReceiverParameterContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitReceiverParameter(Java17Parser.ReceiverParameterContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterFormalParameterList(Java17Parser.FormalParameterListContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitFormalParameterList(Java17Parser.FormalParameterListContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterFormalParameter(Java17Parser.FormalParameterContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitFormalParameter(Java17Parser.FormalParameterContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterLastFormalParameter(Java17Parser.LastFormalParameterContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitLastFormalParameter(Java17Parser.LastFormalParameterContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterLambdaLVTIList(Java17Parser.LambdaLVTIListContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitLambdaLVTIList(Java17Parser.LambdaLVTIListContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterLambdaLVTIParameter(Java17Parser.LambdaLVTIParameterContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitLambdaLVTIParameter(Java17Parser.LambdaLVTIParameterContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterQualifiedName(Java17Parser.QualifiedNameContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitQualifiedName(Java17Parser.QualifiedNameContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterIntLiteral(Java17Parser.IntLiteralContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitIntLiteral(Java17Parser.IntLiteralContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterFltLiteral(Java17Parser.FltLiteralContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitFltLiteral(Java17Parser.FltLiteralContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterCharLiteral(Java17Parser.CharLiteralContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitCharLiteral(Java17Parser.CharLiteralContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterStringLiteral(Java17Parser.StringLiteralContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitStringLiteral(Java17Parser.StringLiteralContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterBoolLiteral(Java17Parser.BoolLiteralContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitBoolLiteral(Java17Parser.BoolLiteralContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterNullLiteral(Java17Parser.NullLiteralContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitNullLiteral(Java17Parser.NullLiteralContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterTextBlock(Java17Parser.TextBlockContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitTextBlock(Java17Parser.TextBlockContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterIntegerLiteral(Java17Parser.IntegerLiteralContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitIntegerLiteral(Java17Parser.IntegerLiteralContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterFloatLiteral(Java17Parser.FloatLiteralContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitFloatLiteral(Java17Parser.FloatLiteralContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterAltAnnotationQualifiedName(Java17Parser.AltAnnotationQualifiedNameContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitAltAnnotationQualifiedName(Java17Parser.AltAnnotationQualifiedNameContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterAnnotation(Java17Parser.AnnotationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitAnnotation(Java17Parser.AnnotationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterElementValuePairs(Java17Parser.ElementValuePairsContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitElementValuePairs(Java17Parser.ElementValuePairsContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterElementValuePair(Java17Parser.ElementValuePairContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitElementValuePair(Java17Parser.ElementValuePairContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterElementValue(Java17Parser.ElementValueContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitElementValue(Java17Parser.ElementValueContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterElementValueArrayInitializer(Java17Parser.ElementValueArrayInitializerContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitElementValueArrayInitializer(Java17Parser.ElementValueArrayInitializerContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterAnnotationTypeDeclaration(Java17Parser.AnnotationTypeDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitAnnotationTypeDeclaration(Java17Parser.AnnotationTypeDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterAnnotationTypeBody(Java17Parser.AnnotationTypeBodyContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitAnnotationTypeBody(Java17Parser.AnnotationTypeBodyContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterAnnotationTypeElementDeclaration(Java17Parser.AnnotationTypeElementDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitAnnotationTypeElementDeclaration(Java17Parser.AnnotationTypeElementDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterAnnotationTypeElementRest(Java17Parser.AnnotationTypeElementRestContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitAnnotationTypeElementRest(Java17Parser.AnnotationTypeElementRestContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterAnnotationMethodOrConstantRest(Java17Parser.AnnotationMethodOrConstantRestContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitAnnotationMethodOrConstantRest(Java17Parser.AnnotationMethodOrConstantRestContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterAnnotationMethodRest(Java17Parser.AnnotationMethodRestContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitAnnotationMethodRest(Java17Parser.AnnotationMethodRestContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterAnnotationConstantRest(Java17Parser.AnnotationConstantRestContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitAnnotationConstantRest(Java17Parser.AnnotationConstantRestContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterDefaultValue(Java17Parser.DefaultValueContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitDefaultValue(Java17Parser.DefaultValueContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterModuleDeclaration(Java17Parser.ModuleDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitModuleDeclaration(Java17Parser.ModuleDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterModuleBody(Java17Parser.ModuleBodyContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitModuleBody(Java17Parser.ModuleBodyContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterModuleDirective(Java17Parser.ModuleDirectiveContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitModuleDirective(Java17Parser.ModuleDirectiveContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterRequiresModifier(Java17Parser.RequiresModifierContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitRequiresModifier(Java17Parser.RequiresModifierContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterRecordDeclaration(Java17Parser.RecordDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitRecordDeclaration(Java17Parser.RecordDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterRecordHeader(Java17Parser.RecordHeaderContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitRecordHeader(Java17Parser.RecordHeaderContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterRecordComponentList(Java17Parser.RecordComponentListContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitRecordComponentList(Java17Parser.RecordComponentListContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterRecordComponent(Java17Parser.RecordComponentContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitRecordComponent(Java17Parser.RecordComponentContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterRecordBody(Java17Parser.RecordBodyContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitRecordBody(Java17Parser.RecordBodyContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterBlock(Java17Parser.BlockContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitBlock(Java17Parser.BlockContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterBlockStatement(Java17Parser.BlockStatementContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitBlockStatement(Java17Parser.BlockStatementContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterLocalVariableDeclaration(Java17Parser.LocalVariableDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitLocalVariableDeclaration(Java17Parser.LocalVariableDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterIdentifier(Java17Parser.IdentifierContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitIdentifier(Java17Parser.IdentifierContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterTypeIdentifier(Java17Parser.TypeIdentifierContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitTypeIdentifier(Java17Parser.TypeIdentifierContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterLocalTypeDeclaration(Java17Parser.LocalTypeDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitLocalTypeDeclaration(Java17Parser.LocalTypeDeclarationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterBlockstmt(Java17Parser.BlockstmtContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitBlockstmt(Java17Parser.BlockstmtContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterAssertstmt(Java17Parser.AssertstmtContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitAssertstmt(Java17Parser.AssertstmtContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterConditionalstmt(Java17Parser.ConditionalstmtContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitConditionalstmt(Java17Parser.ConditionalstmtContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterForloop(Java17Parser.ForloopContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitForloop(Java17Parser.ForloopContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterWhileloop(Java17Parser.WhileloopContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitWhileloop(Java17Parser.WhileloopContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterDowhileloop(Java17Parser.DowhileloopContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitDowhileloop(Java17Parser.DowhileloopContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterTrycatchblock(Java17Parser.TrycatchblockContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitTrycatchblock(Java17Parser.TrycatchblockContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterTrycatchresource(Java17Parser.TrycatchresourceContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitTrycatchresource(Java17Parser.TrycatchresourceContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterSwitchstmt(Java17Parser.SwitchstmtContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitSwitchstmt(Java17Parser.SwitchstmtContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterSynchronizedstmt(Java17Parser.SynchronizedstmtContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitSynchronizedstmt(Java17Parser.SynchronizedstmtContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterReturnstmt(Java17Parser.ReturnstmtContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitReturnstmt(Java17Parser.ReturnstmtContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterThrowstmt(Java17Parser.ThrowstmtContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitThrowstmt(Java17Parser.ThrowstmtContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterBreakstmt(Java17Parser.BreakstmtContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitBreakstmt(Java17Parser.BreakstmtContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterContinuestmt(Java17Parser.ContinuestmtContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitContinuestmt(Java17Parser.ContinuestmtContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterYieldstmt(Java17Parser.YieldstmtContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitYieldstmt(Java17Parser.YieldstmtContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterSemistmt(Java17Parser.SemistmtContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitSemistmt(Java17Parser.SemistmtContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterStmtexpression(Java17Parser.StmtexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitStmtexpression(Java17Parser.StmtexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterLabeledstmt(Java17Parser.LabeledstmtContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitLabeledstmt(Java17Parser.LabeledstmtContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterCatchClause(Java17Parser.CatchClauseContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitCatchClause(Java17Parser.CatchClauseContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterCatchType(Java17Parser.CatchTypeContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitCatchType(Java17Parser.CatchTypeContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterFinallyBlock(Java17Parser.FinallyBlockContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitFinallyBlock(Java17Parser.FinallyBlockContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterResourceSpecification(Java17Parser.ResourceSpecificationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitResourceSpecification(Java17Parser.ResourceSpecificationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterResources(Java17Parser.ResourcesContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitResources(Java17Parser.ResourcesContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterResource(Java17Parser.ResourceContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitResource(Java17Parser.ResourceContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterSwitchBlockStatementGroup(Java17Parser.SwitchBlockStatementGroupContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitSwitchBlockStatementGroup(Java17Parser.SwitchBlockStatementGroupContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterSwitchLabelConst(Java17Parser.SwitchLabelConstContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitSwitchLabelConst(Java17Parser.SwitchLabelConstContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterSwitchLabelEnum(Java17Parser.SwitchLabelEnumContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitSwitchLabelEnum(Java17Parser.SwitchLabelEnumContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterSwitchLabelPattern(Java17Parser.SwitchLabelPatternContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitSwitchLabelPattern(Java17Parser.SwitchLabelPatternContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterSwitchLabelDefault(Java17Parser.SwitchLabelDefaultContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitSwitchLabelDefault(Java17Parser.SwitchLabelDefaultContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterForControl(Java17Parser.ForControlContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitForControl(Java17Parser.ForControlContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterForInit(Java17Parser.ForInitContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitForInit(Java17Parser.ForInitContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterEnhancedForControl(Java17Parser.EnhancedForControlContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitEnhancedForControl(Java17Parser.EnhancedForControlContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterParExpression(Java17Parser.ParExpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitParExpression(Java17Parser.ParExpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterExpressionList(Java17Parser.ExpressionListContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitExpressionList(Java17Parser.ExpressionListContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterMethodCall(Java17Parser.MethodCallContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitMethodCall(Java17Parser.MethodCallContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterCastexpression(Java17Parser.CastexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitCastexpression(Java17Parser.CastexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterArrayaccessexpression(Java17Parser.ArrayaccessexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitArrayaccessexpression(Java17Parser.ArrayaccessexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterNewinstanceexpression(Java17Parser.NewinstanceexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitNewinstanceexpression(Java17Parser.NewinstanceexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterBitwiseandexpression(Java17Parser.BitwiseandexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitBitwiseandexpression(Java17Parser.BitwiseandexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterPrimaryExpression2(Java17Parser.PrimaryExpression2Context ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitPrimaryExpression2(Java17Parser.PrimaryExpression2Context ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterMethodcallexpression(Java17Parser.MethodcallexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitMethodcallexpression(Java17Parser.MethodcallexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterConditionalassignexpression(Java17Parser.ConditionalassignexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitConditionalassignexpression(Java17Parser.ConditionalassignexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterMethodorcreatorreferenceexpression(Java17Parser.MethodorcreatorreferenceexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitMethodorcreatorreferenceexpression(Java17Parser.MethodorcreatorreferenceexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterShiftexpression(Java17Parser.ShiftexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitShiftexpression(Java17Parser.ShiftexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterSwitchExpression2(Java17Parser.SwitchExpression2Context ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitSwitchExpression2(Java17Parser.SwitchExpression2Context ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterMathaddsubexpression(Java17Parser.MathaddsubexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitMathaddsubexpression(Java17Parser.MathaddsubexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterDottedexpression(Java17Parser.DottedexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitDottedexpression(Java17Parser.DottedexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterOrexpression(Java17Parser.OrexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitOrexpression(Java17Parser.OrexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterAndexpression(Java17Parser.AndexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitAndexpression(Java17Parser.AndexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterAssignexpression(Java17Parser.AssignexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitAssignexpression(Java17Parser.AssignexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterMathmuldivmodexpression(Java17Parser.MathmuldivmodexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitMathmuldivmodexpression(Java17Parser.MathmuldivmodexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterEqualityexpression(Java17Parser.EqualityexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitEqualityexpression(Java17Parser.EqualityexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterPostfixexpression(Java17Parser.PostfixexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitPostfixexpression(Java17Parser.PostfixexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterPrefixexpression(Java17Parser.PrefixexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitPrefixexpression(Java17Parser.PrefixexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterBitwiseorexpression(Java17Parser.BitwiseorexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitBitwiseorexpression(Java17Parser.BitwiseorexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterCreatorreferenceexpression(Java17Parser.CreatorreferenceexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitCreatorreferenceexpression(Java17Parser.CreatorreferenceexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterLambdaExpression2(Java17Parser.LambdaExpression2Context ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitLambdaExpression2(Java17Parser.LambdaExpression2Context ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterBitwisexorexpression(Java17Parser.BitwisexorexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitBitwisexorexpression(Java17Parser.BitwisexorexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterRelationalexpression(Java17Parser.RelationalexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitRelationalexpression(Java17Parser.RelationalexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterInstanceofexpression(Java17Parser.InstanceofexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitInstanceofexpression(Java17Parser.InstanceofexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterMethodreferenceexpression(Java17Parser.MethodreferenceexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitMethodreferenceexpression(Java17Parser.MethodreferenceexpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterPPattern(Java17Parser.PPatternContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitPPattern(Java17Parser.PPatternContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterGPattern(Java17Parser.GPatternContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitGPattern(Java17Parser.GPatternContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterTPattern(Java17Parser.TPatternContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitTPattern(Java17Parser.TPatternContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterRPattern(Java17Parser.RPatternContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitRPattern(Java17Parser.RPatternContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterEnclosedPattern(Java17Parser.EnclosedPatternContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitEnclosedPattern(Java17Parser.EnclosedPatternContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterRecordPattern(Java17Parser.RecordPatternContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitRecordPattern(Java17Parser.RecordPatternContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterTypePattern(Java17Parser.TypePatternContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitTypePattern(Java17Parser.TypePatternContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterRecordStructurePattern(Java17Parser.RecordStructurePatternContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitRecordStructurePattern(Java17Parser.RecordStructurePatternContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterRecordComponentPatternElement(Java17Parser.RecordComponentPatternElementContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitRecordComponentPatternElement(Java17Parser.RecordComponentPatternElementContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterRecordComponentPatternList(Java17Parser.RecordComponentPatternListContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitRecordComponentPatternList(Java17Parser.RecordComponentPatternListContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterLambdaExpression(Java17Parser.LambdaExpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitLambdaExpression(Java17Parser.LambdaExpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterLambdaParameters(Java17Parser.LambdaParametersContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitLambdaParameters(Java17Parser.LambdaParametersContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterLambdaBody(Java17Parser.LambdaBodyContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitLambdaBody(Java17Parser.LambdaBodyContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterPrimaryExpression(Java17Parser.PrimaryExpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitPrimaryExpression(Java17Parser.PrimaryExpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterPrimaryThis(Java17Parser.PrimaryThisContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitPrimaryThis(Java17Parser.PrimaryThisContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterPrimarySuper(Java17Parser.PrimarySuperContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitPrimarySuper(Java17Parser.PrimarySuperContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterPrimaryLiteral(Java17Parser.PrimaryLiteralContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitPrimaryLiteral(Java17Parser.PrimaryLiteralContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterPrimaryIdentifier(Java17Parser.PrimaryIdentifierContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitPrimaryIdentifier(Java17Parser.PrimaryIdentifierContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterPrimaryClassref(Java17Parser.PrimaryClassrefContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitPrimaryClassref(Java17Parser.PrimaryClassrefContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterPrimaryInvocation(Java17Parser.PrimaryInvocationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitPrimaryInvocation(Java17Parser.PrimaryInvocationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterSwitchExpression(Java17Parser.SwitchExpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitSwitchExpression(Java17Parser.SwitchExpressionContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterSwitchLabeledRule(Java17Parser.SwitchLabeledRuleContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitSwitchLabeledRule(Java17Parser.SwitchLabeledRuleContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterLabeledRuleExprList(Java17Parser.LabeledRuleExprListContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitLabeledRuleExprList(Java17Parser.LabeledRuleExprListContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterLabeledRuleNull(Java17Parser.LabeledRuleNullContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitLabeledRuleNull(Java17Parser.LabeledRuleNullContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterLabeledRulePattern(Java17Parser.LabeledRulePatternContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitLabeledRulePattern(Java17Parser.LabeledRulePatternContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterLabeledRuleDefault(Java17Parser.LabeledRuleDefaultContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitLabeledRuleDefault(Java17Parser.LabeledRuleDefaultContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterGuardedPattern(Java17Parser.GuardedPatternContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitGuardedPattern(Java17Parser.GuardedPatternContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterSwitchRuleOutcome(Java17Parser.SwitchRuleOutcomeContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitSwitchRuleOutcome(Java17Parser.SwitchRuleOutcomeContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterClassType(Java17Parser.ClassTypeContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitClassType(Java17Parser.ClassTypeContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterCreator(Java17Parser.CreatorContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitCreator(Java17Parser.CreatorContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterCreatedName(Java17Parser.CreatedNameContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitCreatedName(Java17Parser.CreatedNameContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterInnerCreator(Java17Parser.InnerCreatorContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitInnerCreator(Java17Parser.InnerCreatorContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterArrayCreatorRest(Java17Parser.ArrayCreatorRestContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitArrayCreatorRest(Java17Parser.ArrayCreatorRestContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterClassCreatorRest(Java17Parser.ClassCreatorRestContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitClassCreatorRest(Java17Parser.ClassCreatorRestContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterExplicitGenericInvocation(Java17Parser.ExplicitGenericInvocationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitExplicitGenericInvocation(Java17Parser.ExplicitGenericInvocationContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterTypeArgumentsOrDiamond(Java17Parser.TypeArgumentsOrDiamondContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitTypeArgumentsOrDiamond(Java17Parser.TypeArgumentsOrDiamondContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterNonWildcardTypeArgumentsOrDiamond(Java17Parser.NonWildcardTypeArgumentsOrDiamondContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitNonWildcardTypeArgumentsOrDiamond(Java17Parser.NonWildcardTypeArgumentsOrDiamondContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterNonWildcardTypeArguments(Java17Parser.NonWildcardTypeArgumentsContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitNonWildcardTypeArguments(Java17Parser.NonWildcardTypeArgumentsContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterTypeList(Java17Parser.TypeListContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitTypeList(Java17Parser.TypeListContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterTypeType(Java17Parser.TypeTypeContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitTypeType(Java17Parser.TypeTypeContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterPrimitiveType(Java17Parser.PrimitiveTypeContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitPrimitiveType(Java17Parser.PrimitiveTypeContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterTypeArguments(Java17Parser.TypeArgumentsContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitTypeArguments(Java17Parser.TypeArgumentsContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterSuperSuffix(Java17Parser.SuperSuffixContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitSuperSuffix(Java17Parser.SuperSuffixContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterExplicitGenericInvocationSuffix(Java17Parser.ExplicitGenericInvocationSuffixContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitExplicitGenericInvocationSuffix(Java17Parser.ExplicitGenericInvocationSuffixContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterArguments(Java17Parser.ArgumentsContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitArguments(Java17Parser.ArgumentsContext ctx) { } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void enterEveryRule(ParserRuleContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void exitEveryRule(ParserRuleContext ctx) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void visitTerminal(TerminalNode node) { } + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override public void visitErrorNode(ErrorNode node) { } +} \ No newline at end of file diff --git a/javatx-src/main/java/de/dhbwstuttgart/parser/antlr/Java17ParserListener.java b/javatx-src/main/java/de/dhbwstuttgart/parser/antlr/Java17ParserListener.java new file mode 100644 index 0000000..e7a607a --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/parser/antlr/Java17ParserListener.java @@ -0,0 +1,2386 @@ +// Generated from java-escape by ANTLR 4.11.1 +package de.dhbwstuttgart.parser.antlr; +import org.antlr.v4.runtime.tree.ParseTreeListener; + +/** + * This interface defines a complete listener for a parse tree produced by + * {@link Java17Parser}. + */ +public interface Java17ParserListener extends ParseTreeListener { + /** + * Enter a parse tree produced by the {@code srcfile} + * labeled alternative in {@link Java17Parser#sourceFile}. + * @param ctx the parse tree + */ + void enterSrcfile(Java17Parser.SrcfileContext ctx); + /** + * Exit a parse tree produced by the {@code srcfile} + * labeled alternative in {@link Java17Parser#sourceFile}. + * @param ctx the parse tree + */ + void exitSrcfile(Java17Parser.SrcfileContext ctx); + /** + * Enter a parse tree produced by the {@code moduledecl} + * labeled alternative in {@link Java17Parser#sourceFile}. + * @param ctx the parse tree + */ + void enterModuledecl(Java17Parser.ModuledeclContext ctx); + /** + * Exit a parse tree produced by the {@code moduledecl} + * labeled alternative in {@link Java17Parser#sourceFile}. + * @param ctx the parse tree + */ + void exitModuledecl(Java17Parser.ModuledeclContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#packageDeclaration}. + * @param ctx the parse tree + */ + void enterPackageDeclaration(Java17Parser.PackageDeclarationContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#packageDeclaration}. + * @param ctx the parse tree + */ + void exitPackageDeclaration(Java17Parser.PackageDeclarationContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#importDeclaration}. + * @param ctx the parse tree + */ + void enterImportDeclaration(Java17Parser.ImportDeclarationContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#importDeclaration}. + * @param ctx the parse tree + */ + void exitImportDeclaration(Java17Parser.ImportDeclarationContext ctx); + /** + * Enter a parse tree produced by the {@code classorinterfacedecl} + * labeled alternative in {@link Java17Parser#classOrInterface}. + * @param ctx the parse tree + */ + void enterClassorinterfacedecl(Java17Parser.ClassorinterfacedeclContext ctx); + /** + * Exit a parse tree produced by the {@code classorinterfacedecl} + * labeled alternative in {@link Java17Parser#classOrInterface}. + * @param ctx the parse tree + */ + void exitClassorinterfacedecl(Java17Parser.ClassorinterfacedeclContext ctx); + /** + * Enter a parse tree produced by the {@code noclassorinterface} + * labeled alternative in {@link Java17Parser#classOrInterface}. + * @param ctx the parse tree + */ + void enterNoclassorinterface(Java17Parser.NoclassorinterfaceContext ctx); + /** + * Exit a parse tree produced by the {@code noclassorinterface} + * labeled alternative in {@link Java17Parser#classOrInterface}. + * @param ctx the parse tree + */ + void exitNoclassorinterface(Java17Parser.NoclassorinterfaceContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#modifier}. + * @param ctx the parse tree + */ + void enterModifier(Java17Parser.ModifierContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#modifier}. + * @param ctx the parse tree + */ + void exitModifier(Java17Parser.ModifierContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#classOrInterfaceModifier}. + * @param ctx the parse tree + */ + void enterClassOrInterfaceModifier(Java17Parser.ClassOrInterfaceModifierContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#classOrInterfaceModifier}. + * @param ctx the parse tree + */ + void exitClassOrInterfaceModifier(Java17Parser.ClassOrInterfaceModifierContext ctx); + /** + * Enter a parse tree produced by the {@code finalvarmod} + * labeled alternative in {@link Java17Parser#variableModifier}. + * @param ctx the parse tree + */ + void enterFinalvarmod(Java17Parser.FinalvarmodContext ctx); + /** + * Exit a parse tree produced by the {@code finalvarmod} + * labeled alternative in {@link Java17Parser#variableModifier}. + * @param ctx the parse tree + */ + void exitFinalvarmod(Java17Parser.FinalvarmodContext ctx); + /** + * Enter a parse tree produced by the {@code annotationvarmod} + * labeled alternative in {@link Java17Parser#variableModifier}. + * @param ctx the parse tree + */ + void enterAnnotationvarmod(Java17Parser.AnnotationvarmodContext ctx); + /** + * Exit a parse tree produced by the {@code annotationvarmod} + * labeled alternative in {@link Java17Parser#variableModifier}. + * @param ctx the parse tree + */ + void exitAnnotationvarmod(Java17Parser.AnnotationvarmodContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#classDeclaration}. + * @param ctx the parse tree + */ + void enterClassDeclaration(Java17Parser.ClassDeclarationContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#classDeclaration}. + * @param ctx the parse tree + */ + void exitClassDeclaration(Java17Parser.ClassDeclarationContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#genericDeclarationList}. + * @param ctx the parse tree + */ + void enterGenericDeclarationList(Java17Parser.GenericDeclarationListContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#genericDeclarationList}. + * @param ctx the parse tree + */ + void exitGenericDeclarationList(Java17Parser.GenericDeclarationListContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#genericTypeVar}. + * @param ctx the parse tree + */ + void enterGenericTypeVar(Java17Parser.GenericTypeVarContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#genericTypeVar}. + * @param ctx the parse tree + */ + void exitGenericTypeVar(Java17Parser.GenericTypeVarContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#typeBound}. + * @param ctx the parse tree + */ + void enterTypeBound(Java17Parser.TypeBoundContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#typeBound}. + * @param ctx the parse tree + */ + void exitTypeBound(Java17Parser.TypeBoundContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#enumDeclaration}. + * @param ctx the parse tree + */ + void enterEnumDeclaration(Java17Parser.EnumDeclarationContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#enumDeclaration}. + * @param ctx the parse tree + */ + void exitEnumDeclaration(Java17Parser.EnumDeclarationContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#enumConstants}. + * @param ctx the parse tree + */ + void enterEnumConstants(Java17Parser.EnumConstantsContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#enumConstants}. + * @param ctx the parse tree + */ + void exitEnumConstants(Java17Parser.EnumConstantsContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#enumConstant}. + * @param ctx the parse tree + */ + void enterEnumConstant(Java17Parser.EnumConstantContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#enumConstant}. + * @param ctx the parse tree + */ + void exitEnumConstant(Java17Parser.EnumConstantContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#enumBodyDeclarations}. + * @param ctx the parse tree + */ + void enterEnumBodyDeclarations(Java17Parser.EnumBodyDeclarationsContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#enumBodyDeclarations}. + * @param ctx the parse tree + */ + void exitEnumBodyDeclarations(Java17Parser.EnumBodyDeclarationsContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#interfaceDeclaration}. + * @param ctx the parse tree + */ + void enterInterfaceDeclaration(Java17Parser.InterfaceDeclarationContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#interfaceDeclaration}. + * @param ctx the parse tree + */ + void exitInterfaceDeclaration(Java17Parser.InterfaceDeclarationContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#classBody}. + * @param ctx the parse tree + */ + void enterClassBody(Java17Parser.ClassBodyContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#classBody}. + * @param ctx the parse tree + */ + void exitClassBody(Java17Parser.ClassBodyContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#interfaceBody}. + * @param ctx the parse tree + */ + void enterInterfaceBody(Java17Parser.InterfaceBodyContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#interfaceBody}. + * @param ctx the parse tree + */ + void exitInterfaceBody(Java17Parser.InterfaceBodyContext ctx); + /** + * Enter a parse tree produced by the {@code emptyclassbody} + * labeled alternative in {@link Java17Parser#classBodyDeclaration}. + * @param ctx the parse tree + */ + void enterEmptyclassbody(Java17Parser.EmptyclassbodyContext ctx); + /** + * Exit a parse tree produced by the {@code emptyclassbody} + * labeled alternative in {@link Java17Parser#classBodyDeclaration}. + * @param ctx the parse tree + */ + void exitEmptyclassbody(Java17Parser.EmptyclassbodyContext ctx); + /** + * Enter a parse tree produced by the {@code classblock} + * labeled alternative in {@link Java17Parser#classBodyDeclaration}. + * @param ctx the parse tree + */ + void enterClassblock(Java17Parser.ClassblockContext ctx); + /** + * Exit a parse tree produced by the {@code classblock} + * labeled alternative in {@link Java17Parser#classBodyDeclaration}. + * @param ctx the parse tree + */ + void exitClassblock(Java17Parser.ClassblockContext ctx); + /** + * Enter a parse tree produced by the {@code memberdecl} + * labeled alternative in {@link Java17Parser#classBodyDeclaration}. + * @param ctx the parse tree + */ + void enterMemberdecl(Java17Parser.MemberdeclContext ctx); + /** + * Exit a parse tree produced by the {@code memberdecl} + * labeled alternative in {@link Java17Parser#classBodyDeclaration}. + * @param ctx the parse tree + */ + void exitMemberdecl(Java17Parser.MemberdeclContext ctx); + /** + * Enter a parse tree produced by the {@code memberclassorinterface} + * labeled alternative in {@link Java17Parser#memberDeclaration}. + * @param ctx the parse tree + */ + void enterMemberclassorinterface(Java17Parser.MemberclassorinterfaceContext ctx); + /** + * Exit a parse tree produced by the {@code memberclassorinterface} + * labeled alternative in {@link Java17Parser#memberDeclaration}. + * @param ctx the parse tree + */ + void exitMemberclassorinterface(Java17Parser.MemberclassorinterfaceContext ctx); + /** + * Enter a parse tree produced by the {@code memberfield} + * labeled alternative in {@link Java17Parser#memberDeclaration}. + * @param ctx the parse tree + */ + void enterMemberfield(Java17Parser.MemberfieldContext ctx); + /** + * Exit a parse tree produced by the {@code memberfield} + * labeled alternative in {@link Java17Parser#memberDeclaration}. + * @param ctx the parse tree + */ + void exitMemberfield(Java17Parser.MemberfieldContext ctx); + /** + * Enter a parse tree produced by the {@code membermethod} + * labeled alternative in {@link Java17Parser#memberDeclaration}. + * @param ctx the parse tree + */ + void enterMembermethod(Java17Parser.MembermethodContext ctx); + /** + * Exit a parse tree produced by the {@code membermethod} + * labeled alternative in {@link Java17Parser#memberDeclaration}. + * @param ctx the parse tree + */ + void exitMembermethod(Java17Parser.MembermethodContext ctx); + /** + * Enter a parse tree produced by the {@code memberconstructor} + * labeled alternative in {@link Java17Parser#memberDeclaration}. + * @param ctx the parse tree + */ + void enterMemberconstructor(Java17Parser.MemberconstructorContext ctx); + /** + * Exit a parse tree produced by the {@code memberconstructor} + * labeled alternative in {@link Java17Parser#memberDeclaration}. + * @param ctx the parse tree + */ + void exitMemberconstructor(Java17Parser.MemberconstructorContext ctx); + /** + * Enter a parse tree produced by the {@code methoddecl} + * labeled alternative in {@link Java17Parser#method}. + * @param ctx the parse tree + */ + void enterMethoddecl(Java17Parser.MethoddeclContext ctx); + /** + * Exit a parse tree produced by the {@code methoddecl} + * labeled alternative in {@link Java17Parser#method}. + * @param ctx the parse tree + */ + void exitMethoddecl(Java17Parser.MethoddeclContext ctx); + /** + * Enter a parse tree produced by the {@code genericmethod} + * labeled alternative in {@link Java17Parser#method}. + * @param ctx the parse tree + */ + void enterGenericmethod(Java17Parser.GenericmethodContext ctx); + /** + * Exit a parse tree produced by the {@code genericmethod} + * labeled alternative in {@link Java17Parser#method}. + * @param ctx the parse tree + */ + void exitGenericmethod(Java17Parser.GenericmethodContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#methodDeclaration}. + * @param ctx the parse tree + */ + void enterMethodDeclaration(Java17Parser.MethodDeclarationContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#methodDeclaration}. + * @param ctx the parse tree + */ + void exitMethodDeclaration(Java17Parser.MethodDeclarationContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#methodHeader}. + * @param ctx the parse tree + */ + void enterMethodHeader(Java17Parser.MethodHeaderContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#methodHeader}. + * @param ctx the parse tree + */ + void exitMethodHeader(Java17Parser.MethodHeaderContext ctx); + /** + * Enter a parse tree produced by the {@code methodblock} + * labeled alternative in {@link Java17Parser#methodBody}. + * @param ctx the parse tree + */ + void enterMethodblock(Java17Parser.MethodblockContext ctx); + /** + * Exit a parse tree produced by the {@code methodblock} + * labeled alternative in {@link Java17Parser#methodBody}. + * @param ctx the parse tree + */ + void exitMethodblock(Java17Parser.MethodblockContext ctx); + /** + * Enter a parse tree produced by the {@code emptymethod} + * labeled alternative in {@link Java17Parser#methodBody}. + * @param ctx the parse tree + */ + void enterEmptymethod(Java17Parser.EmptymethodContext ctx); + /** + * Exit a parse tree produced by the {@code emptymethod} + * labeled alternative in {@link Java17Parser#methodBody}. + * @param ctx the parse tree + */ + void exitEmptymethod(Java17Parser.EmptymethodContext ctx); + /** + * Enter a parse tree produced by the {@code refType2} + * labeled alternative in {@link Java17Parser#refType}. + * @param ctx the parse tree + */ + void enterRefType2(Java17Parser.RefType2Context ctx); + /** + * Exit a parse tree produced by the {@code refType2} + * labeled alternative in {@link Java17Parser#refType}. + * @param ctx the parse tree + */ + void exitRefType2(Java17Parser.RefType2Context ctx); + /** + * Enter a parse tree produced by the {@code refvoid} + * labeled alternative in {@link Java17Parser#refType}. + * @param ctx the parse tree + */ + void enterRefvoid(Java17Parser.RefvoidContext ctx); + /** + * Exit a parse tree produced by the {@code refvoid} + * labeled alternative in {@link Java17Parser#refType}. + * @param ctx the parse tree + */ + void exitRefvoid(Java17Parser.RefvoidContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#genericMethodDeclaration}. + * @param ctx the parse tree + */ + void enterGenericMethodDeclaration(Java17Parser.GenericMethodDeclarationContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#genericMethodDeclaration}. + * @param ctx the parse tree + */ + void exitGenericMethodDeclaration(Java17Parser.GenericMethodDeclarationContext ctx); + /** + * Enter a parse tree produced by the {@code genericconstructor} + * labeled alternative in {@link Java17Parser#constructor}. + * @param ctx the parse tree + */ + void enterGenericconstructor(Java17Parser.GenericconstructorContext ctx); + /** + * Exit a parse tree produced by the {@code genericconstructor} + * labeled alternative in {@link Java17Parser#constructor}. + * @param ctx the parse tree + */ + void exitGenericconstructor(Java17Parser.GenericconstructorContext ctx); + /** + * Enter a parse tree produced by the {@code constructordecl} + * labeled alternative in {@link Java17Parser#constructor}. + * @param ctx the parse tree + */ + void enterConstructordecl(Java17Parser.ConstructordeclContext ctx); + /** + * Exit a parse tree produced by the {@code constructordecl} + * labeled alternative in {@link Java17Parser#constructor}. + * @param ctx the parse tree + */ + void exitConstructordecl(Java17Parser.ConstructordeclContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#genericConstructorDeclaration}. + * @param ctx the parse tree + */ + void enterGenericConstructorDeclaration(Java17Parser.GenericConstructorDeclarationContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#genericConstructorDeclaration}. + * @param ctx the parse tree + */ + void exitGenericConstructorDeclaration(Java17Parser.GenericConstructorDeclarationContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#constructorDeclaration}. + * @param ctx the parse tree + */ + void enterConstructorDeclaration(Java17Parser.ConstructorDeclarationContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#constructorDeclaration}. + * @param ctx the parse tree + */ + void exitConstructorDeclaration(Java17Parser.ConstructorDeclarationContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#fieldDeclaration}. + * @param ctx the parse tree + */ + void enterFieldDeclaration(Java17Parser.FieldDeclarationContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#fieldDeclaration}. + * @param ctx the parse tree + */ + void exitFieldDeclaration(Java17Parser.FieldDeclarationContext ctx); + /** + * Enter a parse tree produced by the {@code interfacemember} + * labeled alternative in {@link Java17Parser#interfaceBodyDeclaration}. + * @param ctx the parse tree + */ + void enterInterfacemember(Java17Parser.InterfacememberContext ctx); + /** + * Exit a parse tree produced by the {@code interfacemember} + * labeled alternative in {@link Java17Parser#interfaceBodyDeclaration}. + * @param ctx the parse tree + */ + void exitInterfacemember(Java17Parser.InterfacememberContext ctx); + /** + * Enter a parse tree produced by the {@code emptyinterface} + * labeled alternative in {@link Java17Parser#interfaceBodyDeclaration}. + * @param ctx the parse tree + */ + void enterEmptyinterface(Java17Parser.EmptyinterfaceContext ctx); + /** + * Exit a parse tree produced by the {@code emptyinterface} + * labeled alternative in {@link Java17Parser#interfaceBodyDeclaration}. + * @param ctx the parse tree + */ + void exitEmptyinterface(Java17Parser.EmptyinterfaceContext ctx); + /** + * Enter a parse tree produced by the {@code interfaceconst} + * labeled alternative in {@link Java17Parser#interfaceMemberDeclaration}. + * @param ctx the parse tree + */ + void enterInterfaceconst(Java17Parser.InterfaceconstContext ctx); + /** + * Exit a parse tree produced by the {@code interfaceconst} + * labeled alternative in {@link Java17Parser#interfaceMemberDeclaration}. + * @param ctx the parse tree + */ + void exitInterfaceconst(Java17Parser.InterfaceconstContext ctx); + /** + * Enter a parse tree produced by the {@code interfacemethod} + * labeled alternative in {@link Java17Parser#interfaceMemberDeclaration}. + * @param ctx the parse tree + */ + void enterInterfacemethod(Java17Parser.InterfacemethodContext ctx); + /** + * Exit a parse tree produced by the {@code interfacemethod} + * labeled alternative in {@link Java17Parser#interfaceMemberDeclaration}. + * @param ctx the parse tree + */ + void exitInterfacemethod(Java17Parser.InterfacemethodContext ctx); + /** + * Enter a parse tree produced by the {@code genericinterfacemethod} + * labeled alternative in {@link Java17Parser#interfaceMemberDeclaration}. + * @param ctx the parse tree + */ + void enterGenericinterfacemethod(Java17Parser.GenericinterfacemethodContext ctx); + /** + * Exit a parse tree produced by the {@code genericinterfacemethod} + * labeled alternative in {@link Java17Parser#interfaceMemberDeclaration}. + * @param ctx the parse tree + */ + void exitGenericinterfacemethod(Java17Parser.GenericinterfacemethodContext ctx); + /** + * Enter a parse tree produced by the {@code subclassorinterface} + * labeled alternative in {@link Java17Parser#interfaceMemberDeclaration}. + * @param ctx the parse tree + */ + void enterSubclassorinterface(Java17Parser.SubclassorinterfaceContext ctx); + /** + * Exit a parse tree produced by the {@code subclassorinterface} + * labeled alternative in {@link Java17Parser#interfaceMemberDeclaration}. + * @param ctx the parse tree + */ + void exitSubclassorinterface(Java17Parser.SubclassorinterfaceContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#constDeclaration}. + * @param ctx the parse tree + */ + void enterConstDeclaration(Java17Parser.ConstDeclarationContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#constDeclaration}. + * @param ctx the parse tree + */ + void exitConstDeclaration(Java17Parser.ConstDeclarationContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#constantDeclarator}. + * @param ctx the parse tree + */ + void enterConstantDeclarator(Java17Parser.ConstantDeclaratorContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#constantDeclarator}. + * @param ctx the parse tree + */ + void exitConstantDeclarator(Java17Parser.ConstantDeclaratorContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#interfaceMethodDeclaration}. + * @param ctx the parse tree + */ + void enterInterfaceMethodDeclaration(Java17Parser.InterfaceMethodDeclarationContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#interfaceMethodDeclaration}. + * @param ctx the parse tree + */ + void exitInterfaceMethodDeclaration(Java17Parser.InterfaceMethodDeclarationContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#interfaceMethodModifier}. + * @param ctx the parse tree + */ + void enterInterfaceMethodModifier(Java17Parser.InterfaceMethodModifierContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#interfaceMethodModifier}. + * @param ctx the parse tree + */ + void exitInterfaceMethodModifier(Java17Parser.InterfaceMethodModifierContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#genericInterfaceMethodDeclaration}. + * @param ctx the parse tree + */ + void enterGenericInterfaceMethodDeclaration(Java17Parser.GenericInterfaceMethodDeclarationContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#genericInterfaceMethodDeclaration}. + * @param ctx the parse tree + */ + void exitGenericInterfaceMethodDeclaration(Java17Parser.GenericInterfaceMethodDeclarationContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#interfaceCommonBodyDeclaration}. + * @param ctx the parse tree + */ + void enterInterfaceCommonBodyDeclaration(Java17Parser.InterfaceCommonBodyDeclarationContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#interfaceCommonBodyDeclaration}. + * @param ctx the parse tree + */ + void exitInterfaceCommonBodyDeclaration(Java17Parser.InterfaceCommonBodyDeclarationContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#variableDeclarators}. + * @param ctx the parse tree + */ + void enterVariableDeclarators(Java17Parser.VariableDeclaratorsContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#variableDeclarators}. + * @param ctx the parse tree + */ + void exitVariableDeclarators(Java17Parser.VariableDeclaratorsContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#variableDeclarator}. + * @param ctx the parse tree + */ + void enterVariableDeclarator(Java17Parser.VariableDeclaratorContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#variableDeclarator}. + * @param ctx the parse tree + */ + void exitVariableDeclarator(Java17Parser.VariableDeclaratorContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#variableDeclaratorId}. + * @param ctx the parse tree + */ + void enterVariableDeclaratorId(Java17Parser.VariableDeclaratorIdContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#variableDeclaratorId}. + * @param ctx the parse tree + */ + void exitVariableDeclaratorId(Java17Parser.VariableDeclaratorIdContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#variableInitializer}. + * @param ctx the parse tree + */ + void enterVariableInitializer(Java17Parser.VariableInitializerContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#variableInitializer}. + * @param ctx the parse tree + */ + void exitVariableInitializer(Java17Parser.VariableInitializerContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#arrayInitializer}. + * @param ctx the parse tree + */ + void enterArrayInitializer(Java17Parser.ArrayInitializerContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#arrayInitializer}. + * @param ctx the parse tree + */ + void exitArrayInitializer(Java17Parser.ArrayInitializerContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#classOrInterfaceType}. + * @param ctx the parse tree + */ + void enterClassOrInterfaceType(Java17Parser.ClassOrInterfaceTypeContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#classOrInterfaceType}. + * @param ctx the parse tree + */ + void exitClassOrInterfaceType(Java17Parser.ClassOrInterfaceTypeContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#typeArgument}. + * @param ctx the parse tree + */ + void enterTypeArgument(Java17Parser.TypeArgumentContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#typeArgument}. + * @param ctx the parse tree + */ + void exitTypeArgument(Java17Parser.TypeArgumentContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#wildcardType}. + * @param ctx the parse tree + */ + void enterWildcardType(Java17Parser.WildcardTypeContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#wildcardType}. + * @param ctx the parse tree + */ + void exitWildcardType(Java17Parser.WildcardTypeContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#extendsWildcardType}. + * @param ctx the parse tree + */ + void enterExtendsWildcardType(Java17Parser.ExtendsWildcardTypeContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#extendsWildcardType}. + * @param ctx the parse tree + */ + void exitExtendsWildcardType(Java17Parser.ExtendsWildcardTypeContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#superWildcardType}. + * @param ctx the parse tree + */ + void enterSuperWildcardType(Java17Parser.SuperWildcardTypeContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#superWildcardType}. + * @param ctx the parse tree + */ + void exitSuperWildcardType(Java17Parser.SuperWildcardTypeContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#qualifiedNameList}. + * @param ctx the parse tree + */ + void enterQualifiedNameList(Java17Parser.QualifiedNameListContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#qualifiedNameList}. + * @param ctx the parse tree + */ + void exitQualifiedNameList(Java17Parser.QualifiedNameListContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#exceptionList}. + * @param ctx the parse tree + */ + void enterExceptionList(Java17Parser.ExceptionListContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#exceptionList}. + * @param ctx the parse tree + */ + void exitExceptionList(Java17Parser.ExceptionListContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#formalParameters}. + * @param ctx the parse tree + */ + void enterFormalParameters(Java17Parser.FormalParametersContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#formalParameters}. + * @param ctx the parse tree + */ + void exitFormalParameters(Java17Parser.FormalParametersContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#receiverParameter}. + * @param ctx the parse tree + */ + void enterReceiverParameter(Java17Parser.ReceiverParameterContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#receiverParameter}. + * @param ctx the parse tree + */ + void exitReceiverParameter(Java17Parser.ReceiverParameterContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#formalParameterList}. + * @param ctx the parse tree + */ + void enterFormalParameterList(Java17Parser.FormalParameterListContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#formalParameterList}. + * @param ctx the parse tree + */ + void exitFormalParameterList(Java17Parser.FormalParameterListContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#formalParameter}. + * @param ctx the parse tree + */ + void enterFormalParameter(Java17Parser.FormalParameterContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#formalParameter}. + * @param ctx the parse tree + */ + void exitFormalParameter(Java17Parser.FormalParameterContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#lastFormalParameter}. + * @param ctx the parse tree + */ + void enterLastFormalParameter(Java17Parser.LastFormalParameterContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#lastFormalParameter}. + * @param ctx the parse tree + */ + void exitLastFormalParameter(Java17Parser.LastFormalParameterContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#lambdaLVTIList}. + * @param ctx the parse tree + */ + void enterLambdaLVTIList(Java17Parser.LambdaLVTIListContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#lambdaLVTIList}. + * @param ctx the parse tree + */ + void exitLambdaLVTIList(Java17Parser.LambdaLVTIListContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#lambdaLVTIParameter}. + * @param ctx the parse tree + */ + void enterLambdaLVTIParameter(Java17Parser.LambdaLVTIParameterContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#lambdaLVTIParameter}. + * @param ctx the parse tree + */ + void exitLambdaLVTIParameter(Java17Parser.LambdaLVTIParameterContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#qualifiedName}. + * @param ctx the parse tree + */ + void enterQualifiedName(Java17Parser.QualifiedNameContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#qualifiedName}. + * @param ctx the parse tree + */ + void exitQualifiedName(Java17Parser.QualifiedNameContext ctx); + /** + * Enter a parse tree produced by the {@code intLiteral} + * labeled alternative in {@link Java17Parser#literal}. + * @param ctx the parse tree + */ + void enterIntLiteral(Java17Parser.IntLiteralContext ctx); + /** + * Exit a parse tree produced by the {@code intLiteral} + * labeled alternative in {@link Java17Parser#literal}. + * @param ctx the parse tree + */ + void exitIntLiteral(Java17Parser.IntLiteralContext ctx); + /** + * Enter a parse tree produced by the {@code fltLiteral} + * labeled alternative in {@link Java17Parser#literal}. + * @param ctx the parse tree + */ + void enterFltLiteral(Java17Parser.FltLiteralContext ctx); + /** + * Exit a parse tree produced by the {@code fltLiteral} + * labeled alternative in {@link Java17Parser#literal}. + * @param ctx the parse tree + */ + void exitFltLiteral(Java17Parser.FltLiteralContext ctx); + /** + * Enter a parse tree produced by the {@code charLiteral} + * labeled alternative in {@link Java17Parser#literal}. + * @param ctx the parse tree + */ + void enterCharLiteral(Java17Parser.CharLiteralContext ctx); + /** + * Exit a parse tree produced by the {@code charLiteral} + * labeled alternative in {@link Java17Parser#literal}. + * @param ctx the parse tree + */ + void exitCharLiteral(Java17Parser.CharLiteralContext ctx); + /** + * Enter a parse tree produced by the {@code stringLiteral} + * labeled alternative in {@link Java17Parser#literal}. + * @param ctx the parse tree + */ + void enterStringLiteral(Java17Parser.StringLiteralContext ctx); + /** + * Exit a parse tree produced by the {@code stringLiteral} + * labeled alternative in {@link Java17Parser#literal}. + * @param ctx the parse tree + */ + void exitStringLiteral(Java17Parser.StringLiteralContext ctx); + /** + * Enter a parse tree produced by the {@code boolLiteral} + * labeled alternative in {@link Java17Parser#literal}. + * @param ctx the parse tree + */ + void enterBoolLiteral(Java17Parser.BoolLiteralContext ctx); + /** + * Exit a parse tree produced by the {@code boolLiteral} + * labeled alternative in {@link Java17Parser#literal}. + * @param ctx the parse tree + */ + void exitBoolLiteral(Java17Parser.BoolLiteralContext ctx); + /** + * Enter a parse tree produced by the {@code nullLiteral} + * labeled alternative in {@link Java17Parser#literal}. + * @param ctx the parse tree + */ + void enterNullLiteral(Java17Parser.NullLiteralContext ctx); + /** + * Exit a parse tree produced by the {@code nullLiteral} + * labeled alternative in {@link Java17Parser#literal}. + * @param ctx the parse tree + */ + void exitNullLiteral(Java17Parser.NullLiteralContext ctx); + /** + * Enter a parse tree produced by the {@code textBlock} + * labeled alternative in {@link Java17Parser#literal}. + * @param ctx the parse tree + */ + void enterTextBlock(Java17Parser.TextBlockContext ctx); + /** + * Exit a parse tree produced by the {@code textBlock} + * labeled alternative in {@link Java17Parser#literal}. + * @param ctx the parse tree + */ + void exitTextBlock(Java17Parser.TextBlockContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#integerLiteral}. + * @param ctx the parse tree + */ + void enterIntegerLiteral(Java17Parser.IntegerLiteralContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#integerLiteral}. + * @param ctx the parse tree + */ + void exitIntegerLiteral(Java17Parser.IntegerLiteralContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#floatLiteral}. + * @param ctx the parse tree + */ + void enterFloatLiteral(Java17Parser.FloatLiteralContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#floatLiteral}. + * @param ctx the parse tree + */ + void exitFloatLiteral(Java17Parser.FloatLiteralContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#altAnnotationQualifiedName}. + * @param ctx the parse tree + */ + void enterAltAnnotationQualifiedName(Java17Parser.AltAnnotationQualifiedNameContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#altAnnotationQualifiedName}. + * @param ctx the parse tree + */ + void exitAltAnnotationQualifiedName(Java17Parser.AltAnnotationQualifiedNameContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#annotation}. + * @param ctx the parse tree + */ + void enterAnnotation(Java17Parser.AnnotationContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#annotation}. + * @param ctx the parse tree + */ + void exitAnnotation(Java17Parser.AnnotationContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#elementValuePairs}. + * @param ctx the parse tree + */ + void enterElementValuePairs(Java17Parser.ElementValuePairsContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#elementValuePairs}. + * @param ctx the parse tree + */ + void exitElementValuePairs(Java17Parser.ElementValuePairsContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#elementValuePair}. + * @param ctx the parse tree + */ + void enterElementValuePair(Java17Parser.ElementValuePairContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#elementValuePair}. + * @param ctx the parse tree + */ + void exitElementValuePair(Java17Parser.ElementValuePairContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#elementValue}. + * @param ctx the parse tree + */ + void enterElementValue(Java17Parser.ElementValueContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#elementValue}. + * @param ctx the parse tree + */ + void exitElementValue(Java17Parser.ElementValueContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#elementValueArrayInitializer}. + * @param ctx the parse tree + */ + void enterElementValueArrayInitializer(Java17Parser.ElementValueArrayInitializerContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#elementValueArrayInitializer}. + * @param ctx the parse tree + */ + void exitElementValueArrayInitializer(Java17Parser.ElementValueArrayInitializerContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#annotationTypeDeclaration}. + * @param ctx the parse tree + */ + void enterAnnotationTypeDeclaration(Java17Parser.AnnotationTypeDeclarationContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#annotationTypeDeclaration}. + * @param ctx the parse tree + */ + void exitAnnotationTypeDeclaration(Java17Parser.AnnotationTypeDeclarationContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#annotationTypeBody}. + * @param ctx the parse tree + */ + void enterAnnotationTypeBody(Java17Parser.AnnotationTypeBodyContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#annotationTypeBody}. + * @param ctx the parse tree + */ + void exitAnnotationTypeBody(Java17Parser.AnnotationTypeBodyContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#annotationTypeElementDeclaration}. + * @param ctx the parse tree + */ + void enterAnnotationTypeElementDeclaration(Java17Parser.AnnotationTypeElementDeclarationContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#annotationTypeElementDeclaration}. + * @param ctx the parse tree + */ + void exitAnnotationTypeElementDeclaration(Java17Parser.AnnotationTypeElementDeclarationContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#annotationTypeElementRest}. + * @param ctx the parse tree + */ + void enterAnnotationTypeElementRest(Java17Parser.AnnotationTypeElementRestContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#annotationTypeElementRest}. + * @param ctx the parse tree + */ + void exitAnnotationTypeElementRest(Java17Parser.AnnotationTypeElementRestContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#annotationMethodOrConstantRest}. + * @param ctx the parse tree + */ + void enterAnnotationMethodOrConstantRest(Java17Parser.AnnotationMethodOrConstantRestContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#annotationMethodOrConstantRest}. + * @param ctx the parse tree + */ + void exitAnnotationMethodOrConstantRest(Java17Parser.AnnotationMethodOrConstantRestContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#annotationMethodRest}. + * @param ctx the parse tree + */ + void enterAnnotationMethodRest(Java17Parser.AnnotationMethodRestContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#annotationMethodRest}. + * @param ctx the parse tree + */ + void exitAnnotationMethodRest(Java17Parser.AnnotationMethodRestContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#annotationConstantRest}. + * @param ctx the parse tree + */ + void enterAnnotationConstantRest(Java17Parser.AnnotationConstantRestContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#annotationConstantRest}. + * @param ctx the parse tree + */ + void exitAnnotationConstantRest(Java17Parser.AnnotationConstantRestContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#defaultValue}. + * @param ctx the parse tree + */ + void enterDefaultValue(Java17Parser.DefaultValueContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#defaultValue}. + * @param ctx the parse tree + */ + void exitDefaultValue(Java17Parser.DefaultValueContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#moduleDeclaration}. + * @param ctx the parse tree + */ + void enterModuleDeclaration(Java17Parser.ModuleDeclarationContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#moduleDeclaration}. + * @param ctx the parse tree + */ + void exitModuleDeclaration(Java17Parser.ModuleDeclarationContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#moduleBody}. + * @param ctx the parse tree + */ + void enterModuleBody(Java17Parser.ModuleBodyContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#moduleBody}. + * @param ctx the parse tree + */ + void exitModuleBody(Java17Parser.ModuleBodyContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#moduleDirective}. + * @param ctx the parse tree + */ + void enterModuleDirective(Java17Parser.ModuleDirectiveContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#moduleDirective}. + * @param ctx the parse tree + */ + void exitModuleDirective(Java17Parser.ModuleDirectiveContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#requiresModifier}. + * @param ctx the parse tree + */ + void enterRequiresModifier(Java17Parser.RequiresModifierContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#requiresModifier}. + * @param ctx the parse tree + */ + void exitRequiresModifier(Java17Parser.RequiresModifierContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#recordDeclaration}. + * @param ctx the parse tree + */ + void enterRecordDeclaration(Java17Parser.RecordDeclarationContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#recordDeclaration}. + * @param ctx the parse tree + */ + void exitRecordDeclaration(Java17Parser.RecordDeclarationContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#recordHeader}. + * @param ctx the parse tree + */ + void enterRecordHeader(Java17Parser.RecordHeaderContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#recordHeader}. + * @param ctx the parse tree + */ + void exitRecordHeader(Java17Parser.RecordHeaderContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#recordComponentList}. + * @param ctx the parse tree + */ + void enterRecordComponentList(Java17Parser.RecordComponentListContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#recordComponentList}. + * @param ctx the parse tree + */ + void exitRecordComponentList(Java17Parser.RecordComponentListContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#recordComponent}. + * @param ctx the parse tree + */ + void enterRecordComponent(Java17Parser.RecordComponentContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#recordComponent}. + * @param ctx the parse tree + */ + void exitRecordComponent(Java17Parser.RecordComponentContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#recordBody}. + * @param ctx the parse tree + */ + void enterRecordBody(Java17Parser.RecordBodyContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#recordBody}. + * @param ctx the parse tree + */ + void exitRecordBody(Java17Parser.RecordBodyContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#block}. + * @param ctx the parse tree + */ + void enterBlock(Java17Parser.BlockContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#block}. + * @param ctx the parse tree + */ + void exitBlock(Java17Parser.BlockContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#blockStatement}. + * @param ctx the parse tree + */ + void enterBlockStatement(Java17Parser.BlockStatementContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#blockStatement}. + * @param ctx the parse tree + */ + void exitBlockStatement(Java17Parser.BlockStatementContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#localVariableDeclaration}. + * @param ctx the parse tree + */ + void enterLocalVariableDeclaration(Java17Parser.LocalVariableDeclarationContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#localVariableDeclaration}. + * @param ctx the parse tree + */ + void exitLocalVariableDeclaration(Java17Parser.LocalVariableDeclarationContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#identifier}. + * @param ctx the parse tree + */ + void enterIdentifier(Java17Parser.IdentifierContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#identifier}. + * @param ctx the parse tree + */ + void exitIdentifier(Java17Parser.IdentifierContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#typeIdentifier}. + * @param ctx the parse tree + */ + void enterTypeIdentifier(Java17Parser.TypeIdentifierContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#typeIdentifier}. + * @param ctx the parse tree + */ + void exitTypeIdentifier(Java17Parser.TypeIdentifierContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#localTypeDeclaration}. + * @param ctx the parse tree + */ + void enterLocalTypeDeclaration(Java17Parser.LocalTypeDeclarationContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#localTypeDeclaration}. + * @param ctx the parse tree + */ + void exitLocalTypeDeclaration(Java17Parser.LocalTypeDeclarationContext ctx); + /** + * Enter a parse tree produced by the {@code blockstmt} + * labeled alternative in {@link Java17Parser#statement}. + * @param ctx the parse tree + */ + void enterBlockstmt(Java17Parser.BlockstmtContext ctx); + /** + * Exit a parse tree produced by the {@code blockstmt} + * labeled alternative in {@link Java17Parser#statement}. + * @param ctx the parse tree + */ + void exitBlockstmt(Java17Parser.BlockstmtContext ctx); + /** + * Enter a parse tree produced by the {@code assertstmt} + * labeled alternative in {@link Java17Parser#statement}. + * @param ctx the parse tree + */ + void enterAssertstmt(Java17Parser.AssertstmtContext ctx); + /** + * Exit a parse tree produced by the {@code assertstmt} + * labeled alternative in {@link Java17Parser#statement}. + * @param ctx the parse tree + */ + void exitAssertstmt(Java17Parser.AssertstmtContext ctx); + /** + * Enter a parse tree produced by the {@code conditionalstmt} + * labeled alternative in {@link Java17Parser#statement}. + * @param ctx the parse tree + */ + void enterConditionalstmt(Java17Parser.ConditionalstmtContext ctx); + /** + * Exit a parse tree produced by the {@code conditionalstmt} + * labeled alternative in {@link Java17Parser#statement}. + * @param ctx the parse tree + */ + void exitConditionalstmt(Java17Parser.ConditionalstmtContext ctx); + /** + * Enter a parse tree produced by the {@code forloop} + * labeled alternative in {@link Java17Parser#statement}. + * @param ctx the parse tree + */ + void enterForloop(Java17Parser.ForloopContext ctx); + /** + * Exit a parse tree produced by the {@code forloop} + * labeled alternative in {@link Java17Parser#statement}. + * @param ctx the parse tree + */ + void exitForloop(Java17Parser.ForloopContext ctx); + /** + * Enter a parse tree produced by the {@code whileloop} + * labeled alternative in {@link Java17Parser#statement}. + * @param ctx the parse tree + */ + void enterWhileloop(Java17Parser.WhileloopContext ctx); + /** + * Exit a parse tree produced by the {@code whileloop} + * labeled alternative in {@link Java17Parser#statement}. + * @param ctx the parse tree + */ + void exitWhileloop(Java17Parser.WhileloopContext ctx); + /** + * Enter a parse tree produced by the {@code dowhileloop} + * labeled alternative in {@link Java17Parser#statement}. + * @param ctx the parse tree + */ + void enterDowhileloop(Java17Parser.DowhileloopContext ctx); + /** + * Exit a parse tree produced by the {@code dowhileloop} + * labeled alternative in {@link Java17Parser#statement}. + * @param ctx the parse tree + */ + void exitDowhileloop(Java17Parser.DowhileloopContext ctx); + /** + * Enter a parse tree produced by the {@code trycatchblock} + * labeled alternative in {@link Java17Parser#statement}. + * @param ctx the parse tree + */ + void enterTrycatchblock(Java17Parser.TrycatchblockContext ctx); + /** + * Exit a parse tree produced by the {@code trycatchblock} + * labeled alternative in {@link Java17Parser#statement}. + * @param ctx the parse tree + */ + void exitTrycatchblock(Java17Parser.TrycatchblockContext ctx); + /** + * Enter a parse tree produced by the {@code trycatchresource} + * labeled alternative in {@link Java17Parser#statement}. + * @param ctx the parse tree + */ + void enterTrycatchresource(Java17Parser.TrycatchresourceContext ctx); + /** + * Exit a parse tree produced by the {@code trycatchresource} + * labeled alternative in {@link Java17Parser#statement}. + * @param ctx the parse tree + */ + void exitTrycatchresource(Java17Parser.TrycatchresourceContext ctx); + /** + * Enter a parse tree produced by the {@code switchstmt} + * labeled alternative in {@link Java17Parser#statement}. + * @param ctx the parse tree + */ + void enterSwitchstmt(Java17Parser.SwitchstmtContext ctx); + /** + * Exit a parse tree produced by the {@code switchstmt} + * labeled alternative in {@link Java17Parser#statement}. + * @param ctx the parse tree + */ + void exitSwitchstmt(Java17Parser.SwitchstmtContext ctx); + /** + * Enter a parse tree produced by the {@code synchronizedstmt} + * labeled alternative in {@link Java17Parser#statement}. + * @param ctx the parse tree + */ + void enterSynchronizedstmt(Java17Parser.SynchronizedstmtContext ctx); + /** + * Exit a parse tree produced by the {@code synchronizedstmt} + * labeled alternative in {@link Java17Parser#statement}. + * @param ctx the parse tree + */ + void exitSynchronizedstmt(Java17Parser.SynchronizedstmtContext ctx); + /** + * Enter a parse tree produced by the {@code returnstmt} + * labeled alternative in {@link Java17Parser#statement}. + * @param ctx the parse tree + */ + void enterReturnstmt(Java17Parser.ReturnstmtContext ctx); + /** + * Exit a parse tree produced by the {@code returnstmt} + * labeled alternative in {@link Java17Parser#statement}. + * @param ctx the parse tree + */ + void exitReturnstmt(Java17Parser.ReturnstmtContext ctx); + /** + * Enter a parse tree produced by the {@code throwstmt} + * labeled alternative in {@link Java17Parser#statement}. + * @param ctx the parse tree + */ + void enterThrowstmt(Java17Parser.ThrowstmtContext ctx); + /** + * Exit a parse tree produced by the {@code throwstmt} + * labeled alternative in {@link Java17Parser#statement}. + * @param ctx the parse tree + */ + void exitThrowstmt(Java17Parser.ThrowstmtContext ctx); + /** + * Enter a parse tree produced by the {@code breakstmt} + * labeled alternative in {@link Java17Parser#statement}. + * @param ctx the parse tree + */ + void enterBreakstmt(Java17Parser.BreakstmtContext ctx); + /** + * Exit a parse tree produced by the {@code breakstmt} + * labeled alternative in {@link Java17Parser#statement}. + * @param ctx the parse tree + */ + void exitBreakstmt(Java17Parser.BreakstmtContext ctx); + /** + * Enter a parse tree produced by the {@code continuestmt} + * labeled alternative in {@link Java17Parser#statement}. + * @param ctx the parse tree + */ + void enterContinuestmt(Java17Parser.ContinuestmtContext ctx); + /** + * Exit a parse tree produced by the {@code continuestmt} + * labeled alternative in {@link Java17Parser#statement}. + * @param ctx the parse tree + */ + void exitContinuestmt(Java17Parser.ContinuestmtContext ctx); + /** + * Enter a parse tree produced by the {@code yieldstmt} + * labeled alternative in {@link Java17Parser#statement}. + * @param ctx the parse tree + */ + void enterYieldstmt(Java17Parser.YieldstmtContext ctx); + /** + * Exit a parse tree produced by the {@code yieldstmt} + * labeled alternative in {@link Java17Parser#statement}. + * @param ctx the parse tree + */ + void exitYieldstmt(Java17Parser.YieldstmtContext ctx); + /** + * Enter a parse tree produced by the {@code semistmt} + * labeled alternative in {@link Java17Parser#statement}. + * @param ctx the parse tree + */ + void enterSemistmt(Java17Parser.SemistmtContext ctx); + /** + * Exit a parse tree produced by the {@code semistmt} + * labeled alternative in {@link Java17Parser#statement}. + * @param ctx the parse tree + */ + void exitSemistmt(Java17Parser.SemistmtContext ctx); + /** + * Enter a parse tree produced by the {@code stmtexpression} + * labeled alternative in {@link Java17Parser#statement}. + * @param ctx the parse tree + */ + void enterStmtexpression(Java17Parser.StmtexpressionContext ctx); + /** + * Exit a parse tree produced by the {@code stmtexpression} + * labeled alternative in {@link Java17Parser#statement}. + * @param ctx the parse tree + */ + void exitStmtexpression(Java17Parser.StmtexpressionContext ctx); + /** + * Enter a parse tree produced by the {@code labeledstmt} + * labeled alternative in {@link Java17Parser#statement}. + * @param ctx the parse tree + */ + void enterLabeledstmt(Java17Parser.LabeledstmtContext ctx); + /** + * Exit a parse tree produced by the {@code labeledstmt} + * labeled alternative in {@link Java17Parser#statement}. + * @param ctx the parse tree + */ + void exitLabeledstmt(Java17Parser.LabeledstmtContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#catchClause}. + * @param ctx the parse tree + */ + void enterCatchClause(Java17Parser.CatchClauseContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#catchClause}. + * @param ctx the parse tree + */ + void exitCatchClause(Java17Parser.CatchClauseContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#catchType}. + * @param ctx the parse tree + */ + void enterCatchType(Java17Parser.CatchTypeContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#catchType}. + * @param ctx the parse tree + */ + void exitCatchType(Java17Parser.CatchTypeContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#finallyBlock}. + * @param ctx the parse tree + */ + void enterFinallyBlock(Java17Parser.FinallyBlockContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#finallyBlock}. + * @param ctx the parse tree + */ + void exitFinallyBlock(Java17Parser.FinallyBlockContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#resourceSpecification}. + * @param ctx the parse tree + */ + void enterResourceSpecification(Java17Parser.ResourceSpecificationContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#resourceSpecification}. + * @param ctx the parse tree + */ + void exitResourceSpecification(Java17Parser.ResourceSpecificationContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#resources}. + * @param ctx the parse tree + */ + void enterResources(Java17Parser.ResourcesContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#resources}. + * @param ctx the parse tree + */ + void exitResources(Java17Parser.ResourcesContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#resource}. + * @param ctx the parse tree + */ + void enterResource(Java17Parser.ResourceContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#resource}. + * @param ctx the parse tree + */ + void exitResource(Java17Parser.ResourceContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#switchBlockStatementGroup}. + * @param ctx the parse tree + */ + void enterSwitchBlockStatementGroup(Java17Parser.SwitchBlockStatementGroupContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#switchBlockStatementGroup}. + * @param ctx the parse tree + */ + void exitSwitchBlockStatementGroup(Java17Parser.SwitchBlockStatementGroupContext ctx); + /** + * Enter a parse tree produced by the {@code switchLabelConst} + * labeled alternative in {@link Java17Parser#switchLabel}. + * @param ctx the parse tree + */ + void enterSwitchLabelConst(Java17Parser.SwitchLabelConstContext ctx); + /** + * Exit a parse tree produced by the {@code switchLabelConst} + * labeled alternative in {@link Java17Parser#switchLabel}. + * @param ctx the parse tree + */ + void exitSwitchLabelConst(Java17Parser.SwitchLabelConstContext ctx); + /** + * Enter a parse tree produced by the {@code switchLabelEnum} + * labeled alternative in {@link Java17Parser#switchLabel}. + * @param ctx the parse tree + */ + void enterSwitchLabelEnum(Java17Parser.SwitchLabelEnumContext ctx); + /** + * Exit a parse tree produced by the {@code switchLabelEnum} + * labeled alternative in {@link Java17Parser#switchLabel}. + * @param ctx the parse tree + */ + void exitSwitchLabelEnum(Java17Parser.SwitchLabelEnumContext ctx); + /** + * Enter a parse tree produced by the {@code switchLabelPattern} + * labeled alternative in {@link Java17Parser#switchLabel}. + * @param ctx the parse tree + */ + void enterSwitchLabelPattern(Java17Parser.SwitchLabelPatternContext ctx); + /** + * Exit a parse tree produced by the {@code switchLabelPattern} + * labeled alternative in {@link Java17Parser#switchLabel}. + * @param ctx the parse tree + */ + void exitSwitchLabelPattern(Java17Parser.SwitchLabelPatternContext ctx); + /** + * Enter a parse tree produced by the {@code switchLabelDefault} + * labeled alternative in {@link Java17Parser#switchLabel}. + * @param ctx the parse tree + */ + void enterSwitchLabelDefault(Java17Parser.SwitchLabelDefaultContext ctx); + /** + * Exit a parse tree produced by the {@code switchLabelDefault} + * labeled alternative in {@link Java17Parser#switchLabel}. + * @param ctx the parse tree + */ + void exitSwitchLabelDefault(Java17Parser.SwitchLabelDefaultContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#forControl}. + * @param ctx the parse tree + */ + void enterForControl(Java17Parser.ForControlContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#forControl}. + * @param ctx the parse tree + */ + void exitForControl(Java17Parser.ForControlContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#forInit}. + * @param ctx the parse tree + */ + void enterForInit(Java17Parser.ForInitContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#forInit}. + * @param ctx the parse tree + */ + void exitForInit(Java17Parser.ForInitContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#enhancedForControl}. + * @param ctx the parse tree + */ + void enterEnhancedForControl(Java17Parser.EnhancedForControlContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#enhancedForControl}. + * @param ctx the parse tree + */ + void exitEnhancedForControl(Java17Parser.EnhancedForControlContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#parExpression}. + * @param ctx the parse tree + */ + void enterParExpression(Java17Parser.ParExpressionContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#parExpression}. + * @param ctx the parse tree + */ + void exitParExpression(Java17Parser.ParExpressionContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#expressionList}. + * @param ctx the parse tree + */ + void enterExpressionList(Java17Parser.ExpressionListContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#expressionList}. + * @param ctx the parse tree + */ + void exitExpressionList(Java17Parser.ExpressionListContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#methodCall}. + * @param ctx the parse tree + */ + void enterMethodCall(Java17Parser.MethodCallContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#methodCall}. + * @param ctx the parse tree + */ + void exitMethodCall(Java17Parser.MethodCallContext ctx); + /** + * Enter a parse tree produced by the {@code castexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void enterCastexpression(Java17Parser.CastexpressionContext ctx); + /** + * Exit a parse tree produced by the {@code castexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void exitCastexpression(Java17Parser.CastexpressionContext ctx); + /** + * Enter a parse tree produced by the {@code arrayaccessexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void enterArrayaccessexpression(Java17Parser.ArrayaccessexpressionContext ctx); + /** + * Exit a parse tree produced by the {@code arrayaccessexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void exitArrayaccessexpression(Java17Parser.ArrayaccessexpressionContext ctx); + /** + * Enter a parse tree produced by the {@code newinstanceexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void enterNewinstanceexpression(Java17Parser.NewinstanceexpressionContext ctx); + /** + * Exit a parse tree produced by the {@code newinstanceexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void exitNewinstanceexpression(Java17Parser.NewinstanceexpressionContext ctx); + /** + * Enter a parse tree produced by the {@code bitwiseandexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void enterBitwiseandexpression(Java17Parser.BitwiseandexpressionContext ctx); + /** + * Exit a parse tree produced by the {@code bitwiseandexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void exitBitwiseandexpression(Java17Parser.BitwiseandexpressionContext ctx); + /** + * Enter a parse tree produced by the {@code primaryExpression2} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void enterPrimaryExpression2(Java17Parser.PrimaryExpression2Context ctx); + /** + * Exit a parse tree produced by the {@code primaryExpression2} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void exitPrimaryExpression2(Java17Parser.PrimaryExpression2Context ctx); + /** + * Enter a parse tree produced by the {@code methodcallexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void enterMethodcallexpression(Java17Parser.MethodcallexpressionContext ctx); + /** + * Exit a parse tree produced by the {@code methodcallexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void exitMethodcallexpression(Java17Parser.MethodcallexpressionContext ctx); + /** + * Enter a parse tree produced by the {@code conditionalassignexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void enterConditionalassignexpression(Java17Parser.ConditionalassignexpressionContext ctx); + /** + * Exit a parse tree produced by the {@code conditionalassignexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void exitConditionalassignexpression(Java17Parser.ConditionalassignexpressionContext ctx); + /** + * Enter a parse tree produced by the {@code methodorcreatorreferenceexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void enterMethodorcreatorreferenceexpression(Java17Parser.MethodorcreatorreferenceexpressionContext ctx); + /** + * Exit a parse tree produced by the {@code methodorcreatorreferenceexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void exitMethodorcreatorreferenceexpression(Java17Parser.MethodorcreatorreferenceexpressionContext ctx); + /** + * Enter a parse tree produced by the {@code shiftexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void enterShiftexpression(Java17Parser.ShiftexpressionContext ctx); + /** + * Exit a parse tree produced by the {@code shiftexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void exitShiftexpression(Java17Parser.ShiftexpressionContext ctx); + /** + * Enter a parse tree produced by the {@code switchExpression2} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void enterSwitchExpression2(Java17Parser.SwitchExpression2Context ctx); + /** + * Exit a parse tree produced by the {@code switchExpression2} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void exitSwitchExpression2(Java17Parser.SwitchExpression2Context ctx); + /** + * Enter a parse tree produced by the {@code mathaddsubexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void enterMathaddsubexpression(Java17Parser.MathaddsubexpressionContext ctx); + /** + * Exit a parse tree produced by the {@code mathaddsubexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void exitMathaddsubexpression(Java17Parser.MathaddsubexpressionContext ctx); + /** + * Enter a parse tree produced by the {@code dottedexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void enterDottedexpression(Java17Parser.DottedexpressionContext ctx); + /** + * Exit a parse tree produced by the {@code dottedexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void exitDottedexpression(Java17Parser.DottedexpressionContext ctx); + /** + * Enter a parse tree produced by the {@code orexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void enterOrexpression(Java17Parser.OrexpressionContext ctx); + /** + * Exit a parse tree produced by the {@code orexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void exitOrexpression(Java17Parser.OrexpressionContext ctx); + /** + * Enter a parse tree produced by the {@code andexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void enterAndexpression(Java17Parser.AndexpressionContext ctx); + /** + * Exit a parse tree produced by the {@code andexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void exitAndexpression(Java17Parser.AndexpressionContext ctx); + /** + * Enter a parse tree produced by the {@code assignexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void enterAssignexpression(Java17Parser.AssignexpressionContext ctx); + /** + * Exit a parse tree produced by the {@code assignexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void exitAssignexpression(Java17Parser.AssignexpressionContext ctx); + /** + * Enter a parse tree produced by the {@code mathmuldivmodexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void enterMathmuldivmodexpression(Java17Parser.MathmuldivmodexpressionContext ctx); + /** + * Exit a parse tree produced by the {@code mathmuldivmodexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void exitMathmuldivmodexpression(Java17Parser.MathmuldivmodexpressionContext ctx); + /** + * Enter a parse tree produced by the {@code equalityexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void enterEqualityexpression(Java17Parser.EqualityexpressionContext ctx); + /** + * Exit a parse tree produced by the {@code equalityexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void exitEqualityexpression(Java17Parser.EqualityexpressionContext ctx); + /** + * Enter a parse tree produced by the {@code postfixexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void enterPostfixexpression(Java17Parser.PostfixexpressionContext ctx); + /** + * Exit a parse tree produced by the {@code postfixexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void exitPostfixexpression(Java17Parser.PostfixexpressionContext ctx); + /** + * Enter a parse tree produced by the {@code prefixexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void enterPrefixexpression(Java17Parser.PrefixexpressionContext ctx); + /** + * Exit a parse tree produced by the {@code prefixexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void exitPrefixexpression(Java17Parser.PrefixexpressionContext ctx); + /** + * Enter a parse tree produced by the {@code bitwiseorexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void enterBitwiseorexpression(Java17Parser.BitwiseorexpressionContext ctx); + /** + * Exit a parse tree produced by the {@code bitwiseorexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void exitBitwiseorexpression(Java17Parser.BitwiseorexpressionContext ctx); + /** + * Enter a parse tree produced by the {@code creatorreferenceexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void enterCreatorreferenceexpression(Java17Parser.CreatorreferenceexpressionContext ctx); + /** + * Exit a parse tree produced by the {@code creatorreferenceexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void exitCreatorreferenceexpression(Java17Parser.CreatorreferenceexpressionContext ctx); + /** + * Enter a parse tree produced by the {@code lambdaExpression2} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void enterLambdaExpression2(Java17Parser.LambdaExpression2Context ctx); + /** + * Exit a parse tree produced by the {@code lambdaExpression2} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void exitLambdaExpression2(Java17Parser.LambdaExpression2Context ctx); + /** + * Enter a parse tree produced by the {@code bitwisexorexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void enterBitwisexorexpression(Java17Parser.BitwisexorexpressionContext ctx); + /** + * Exit a parse tree produced by the {@code bitwisexorexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void exitBitwisexorexpression(Java17Parser.BitwisexorexpressionContext ctx); + /** + * Enter a parse tree produced by the {@code relationalexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void enterRelationalexpression(Java17Parser.RelationalexpressionContext ctx); + /** + * Exit a parse tree produced by the {@code relationalexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void exitRelationalexpression(Java17Parser.RelationalexpressionContext ctx); + /** + * Enter a parse tree produced by the {@code instanceofexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void enterInstanceofexpression(Java17Parser.InstanceofexpressionContext ctx); + /** + * Exit a parse tree produced by the {@code instanceofexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void exitInstanceofexpression(Java17Parser.InstanceofexpressionContext ctx); + /** + * Enter a parse tree produced by the {@code methodreferenceexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void enterMethodreferenceexpression(Java17Parser.MethodreferenceexpressionContext ctx); + /** + * Exit a parse tree produced by the {@code methodreferenceexpression} + * labeled alternative in {@link Java17Parser#expression}. + * @param ctx the parse tree + */ + void exitMethodreferenceexpression(Java17Parser.MethodreferenceexpressionContext ctx); + /** + * Enter a parse tree produced by the {@code pPattern} + * labeled alternative in {@link Java17Parser#pattern}. + * @param ctx the parse tree + */ + void enterPPattern(Java17Parser.PPatternContext ctx); + /** + * Exit a parse tree produced by the {@code pPattern} + * labeled alternative in {@link Java17Parser#pattern}. + * @param ctx the parse tree + */ + void exitPPattern(Java17Parser.PPatternContext ctx); + /** + * Enter a parse tree produced by the {@code gPattern} + * labeled alternative in {@link Java17Parser#pattern}. + * @param ctx the parse tree + */ + void enterGPattern(Java17Parser.GPatternContext ctx); + /** + * Exit a parse tree produced by the {@code gPattern} + * labeled alternative in {@link Java17Parser#pattern}. + * @param ctx the parse tree + */ + void exitGPattern(Java17Parser.GPatternContext ctx); + /** + * Enter a parse tree produced by the {@code tPattern} + * labeled alternative in {@link Java17Parser#primaryPattern}. + * @param ctx the parse tree + */ + void enterTPattern(Java17Parser.TPatternContext ctx); + /** + * Exit a parse tree produced by the {@code tPattern} + * labeled alternative in {@link Java17Parser#primaryPattern}. + * @param ctx the parse tree + */ + void exitTPattern(Java17Parser.TPatternContext ctx); + /** + * Enter a parse tree produced by the {@code rPattern} + * labeled alternative in {@link Java17Parser#primaryPattern}. + * @param ctx the parse tree + */ + void enterRPattern(Java17Parser.RPatternContext ctx); + /** + * Exit a parse tree produced by the {@code rPattern} + * labeled alternative in {@link Java17Parser#primaryPattern}. + * @param ctx the parse tree + */ + void exitRPattern(Java17Parser.RPatternContext ctx); + /** + * Enter a parse tree produced by the {@code enclosedPattern} + * labeled alternative in {@link Java17Parser#primaryPattern}. + * @param ctx the parse tree + */ + void enterEnclosedPattern(Java17Parser.EnclosedPatternContext ctx); + /** + * Exit a parse tree produced by the {@code enclosedPattern} + * labeled alternative in {@link Java17Parser#primaryPattern}. + * @param ctx the parse tree + */ + void exitEnclosedPattern(Java17Parser.EnclosedPatternContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#recordPattern}. + * @param ctx the parse tree + */ + void enterRecordPattern(Java17Parser.RecordPatternContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#recordPattern}. + * @param ctx the parse tree + */ + void exitRecordPattern(Java17Parser.RecordPatternContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#typePattern}. + * @param ctx the parse tree + */ + void enterTypePattern(Java17Parser.TypePatternContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#typePattern}. + * @param ctx the parse tree + */ + void exitTypePattern(Java17Parser.TypePatternContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#recordStructurePattern}. + * @param ctx the parse tree + */ + void enterRecordStructurePattern(Java17Parser.RecordStructurePatternContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#recordStructurePattern}. + * @param ctx the parse tree + */ + void exitRecordStructurePattern(Java17Parser.RecordStructurePatternContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#recordComponentPatternElement}. + * @param ctx the parse tree + */ + void enterRecordComponentPatternElement(Java17Parser.RecordComponentPatternElementContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#recordComponentPatternElement}. + * @param ctx the parse tree + */ + void exitRecordComponentPatternElement(Java17Parser.RecordComponentPatternElementContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#recordComponentPatternList}. + * @param ctx the parse tree + */ + void enterRecordComponentPatternList(Java17Parser.RecordComponentPatternListContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#recordComponentPatternList}. + * @param ctx the parse tree + */ + void exitRecordComponentPatternList(Java17Parser.RecordComponentPatternListContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#lambdaExpression}. + * @param ctx the parse tree + */ + void enterLambdaExpression(Java17Parser.LambdaExpressionContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#lambdaExpression}. + * @param ctx the parse tree + */ + void exitLambdaExpression(Java17Parser.LambdaExpressionContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#lambdaParameters}. + * @param ctx the parse tree + */ + void enterLambdaParameters(Java17Parser.LambdaParametersContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#lambdaParameters}. + * @param ctx the parse tree + */ + void exitLambdaParameters(Java17Parser.LambdaParametersContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#lambdaBody}. + * @param ctx the parse tree + */ + void enterLambdaBody(Java17Parser.LambdaBodyContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#lambdaBody}. + * @param ctx the parse tree + */ + void exitLambdaBody(Java17Parser.LambdaBodyContext ctx); + /** + * Enter a parse tree produced by the {@code primaryExpression} + * labeled alternative in {@link Java17Parser#primary}. + * @param ctx the parse tree + */ + void enterPrimaryExpression(Java17Parser.PrimaryExpressionContext ctx); + /** + * Exit a parse tree produced by the {@code primaryExpression} + * labeled alternative in {@link Java17Parser#primary}. + * @param ctx the parse tree + */ + void exitPrimaryExpression(Java17Parser.PrimaryExpressionContext ctx); + /** + * Enter a parse tree produced by the {@code primaryThis} + * labeled alternative in {@link Java17Parser#primary}. + * @param ctx the parse tree + */ + void enterPrimaryThis(Java17Parser.PrimaryThisContext ctx); + /** + * Exit a parse tree produced by the {@code primaryThis} + * labeled alternative in {@link Java17Parser#primary}. + * @param ctx the parse tree + */ + void exitPrimaryThis(Java17Parser.PrimaryThisContext ctx); + /** + * Enter a parse tree produced by the {@code primarySuper} + * labeled alternative in {@link Java17Parser#primary}. + * @param ctx the parse tree + */ + void enterPrimarySuper(Java17Parser.PrimarySuperContext ctx); + /** + * Exit a parse tree produced by the {@code primarySuper} + * labeled alternative in {@link Java17Parser#primary}. + * @param ctx the parse tree + */ + void exitPrimarySuper(Java17Parser.PrimarySuperContext ctx); + /** + * Enter a parse tree produced by the {@code primaryLiteral} + * labeled alternative in {@link Java17Parser#primary}. + * @param ctx the parse tree + */ + void enterPrimaryLiteral(Java17Parser.PrimaryLiteralContext ctx); + /** + * Exit a parse tree produced by the {@code primaryLiteral} + * labeled alternative in {@link Java17Parser#primary}. + * @param ctx the parse tree + */ + void exitPrimaryLiteral(Java17Parser.PrimaryLiteralContext ctx); + /** + * Enter a parse tree produced by the {@code primaryIdentifier} + * labeled alternative in {@link Java17Parser#primary}. + * @param ctx the parse tree + */ + void enterPrimaryIdentifier(Java17Parser.PrimaryIdentifierContext ctx); + /** + * Exit a parse tree produced by the {@code primaryIdentifier} + * labeled alternative in {@link Java17Parser#primary}. + * @param ctx the parse tree + */ + void exitPrimaryIdentifier(Java17Parser.PrimaryIdentifierContext ctx); + /** + * Enter a parse tree produced by the {@code primaryClassref} + * labeled alternative in {@link Java17Parser#primary}. + * @param ctx the parse tree + */ + void enterPrimaryClassref(Java17Parser.PrimaryClassrefContext ctx); + /** + * Exit a parse tree produced by the {@code primaryClassref} + * labeled alternative in {@link Java17Parser#primary}. + * @param ctx the parse tree + */ + void exitPrimaryClassref(Java17Parser.PrimaryClassrefContext ctx); + /** + * Enter a parse tree produced by the {@code primaryInvocation} + * labeled alternative in {@link Java17Parser#primary}. + * @param ctx the parse tree + */ + void enterPrimaryInvocation(Java17Parser.PrimaryInvocationContext ctx); + /** + * Exit a parse tree produced by the {@code primaryInvocation} + * labeled alternative in {@link Java17Parser#primary}. + * @param ctx the parse tree + */ + void exitPrimaryInvocation(Java17Parser.PrimaryInvocationContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#switchExpression}. + * @param ctx the parse tree + */ + void enterSwitchExpression(Java17Parser.SwitchExpressionContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#switchExpression}. + * @param ctx the parse tree + */ + void exitSwitchExpression(Java17Parser.SwitchExpressionContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#switchLabeledRule}. + * @param ctx the parse tree + */ + void enterSwitchLabeledRule(Java17Parser.SwitchLabeledRuleContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#switchLabeledRule}. + * @param ctx the parse tree + */ + void exitSwitchLabeledRule(Java17Parser.SwitchLabeledRuleContext ctx); + /** + * Enter a parse tree produced by the {@code labeledRuleExprList} + * labeled alternative in {@link Java17Parser#switchLabelCase}. + * @param ctx the parse tree + */ + void enterLabeledRuleExprList(Java17Parser.LabeledRuleExprListContext ctx); + /** + * Exit a parse tree produced by the {@code labeledRuleExprList} + * labeled alternative in {@link Java17Parser#switchLabelCase}. + * @param ctx the parse tree + */ + void exitLabeledRuleExprList(Java17Parser.LabeledRuleExprListContext ctx); + /** + * Enter a parse tree produced by the {@code labeledRuleNull} + * labeled alternative in {@link Java17Parser#switchLabelCase}. + * @param ctx the parse tree + */ + void enterLabeledRuleNull(Java17Parser.LabeledRuleNullContext ctx); + /** + * Exit a parse tree produced by the {@code labeledRuleNull} + * labeled alternative in {@link Java17Parser#switchLabelCase}. + * @param ctx the parse tree + */ + void exitLabeledRuleNull(Java17Parser.LabeledRuleNullContext ctx); + /** + * Enter a parse tree produced by the {@code labeledRulePattern} + * labeled alternative in {@link Java17Parser#switchLabelCase}. + * @param ctx the parse tree + */ + void enterLabeledRulePattern(Java17Parser.LabeledRulePatternContext ctx); + /** + * Exit a parse tree produced by the {@code labeledRulePattern} + * labeled alternative in {@link Java17Parser#switchLabelCase}. + * @param ctx the parse tree + */ + void exitLabeledRulePattern(Java17Parser.LabeledRulePatternContext ctx); + /** + * Enter a parse tree produced by the {@code labeledRuleDefault} + * labeled alternative in {@link Java17Parser#switchLabelCase}. + * @param ctx the parse tree + */ + void enterLabeledRuleDefault(Java17Parser.LabeledRuleDefaultContext ctx); + /** + * Exit a parse tree produced by the {@code labeledRuleDefault} + * labeled alternative in {@link Java17Parser#switchLabelCase}. + * @param ctx the parse tree + */ + void exitLabeledRuleDefault(Java17Parser.LabeledRuleDefaultContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#guardedPattern}. + * @param ctx the parse tree + */ + void enterGuardedPattern(Java17Parser.GuardedPatternContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#guardedPattern}. + * @param ctx the parse tree + */ + void exitGuardedPattern(Java17Parser.GuardedPatternContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#switchRuleOutcome}. + * @param ctx the parse tree + */ + void enterSwitchRuleOutcome(Java17Parser.SwitchRuleOutcomeContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#switchRuleOutcome}. + * @param ctx the parse tree + */ + void exitSwitchRuleOutcome(Java17Parser.SwitchRuleOutcomeContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#classType}. + * @param ctx the parse tree + */ + void enterClassType(Java17Parser.ClassTypeContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#classType}. + * @param ctx the parse tree + */ + void exitClassType(Java17Parser.ClassTypeContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#creator}. + * @param ctx the parse tree + */ + void enterCreator(Java17Parser.CreatorContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#creator}. + * @param ctx the parse tree + */ + void exitCreator(Java17Parser.CreatorContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#createdName}. + * @param ctx the parse tree + */ + void enterCreatedName(Java17Parser.CreatedNameContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#createdName}. + * @param ctx the parse tree + */ + void exitCreatedName(Java17Parser.CreatedNameContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#innerCreator}. + * @param ctx the parse tree + */ + void enterInnerCreator(Java17Parser.InnerCreatorContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#innerCreator}. + * @param ctx the parse tree + */ + void exitInnerCreator(Java17Parser.InnerCreatorContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#arrayCreatorRest}. + * @param ctx the parse tree + */ + void enterArrayCreatorRest(Java17Parser.ArrayCreatorRestContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#arrayCreatorRest}. + * @param ctx the parse tree + */ + void exitArrayCreatorRest(Java17Parser.ArrayCreatorRestContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#classCreatorRest}. + * @param ctx the parse tree + */ + void enterClassCreatorRest(Java17Parser.ClassCreatorRestContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#classCreatorRest}. + * @param ctx the parse tree + */ + void exitClassCreatorRest(Java17Parser.ClassCreatorRestContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#explicitGenericInvocation}. + * @param ctx the parse tree + */ + void enterExplicitGenericInvocation(Java17Parser.ExplicitGenericInvocationContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#explicitGenericInvocation}. + * @param ctx the parse tree + */ + void exitExplicitGenericInvocation(Java17Parser.ExplicitGenericInvocationContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#typeArgumentsOrDiamond}. + * @param ctx the parse tree + */ + void enterTypeArgumentsOrDiamond(Java17Parser.TypeArgumentsOrDiamondContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#typeArgumentsOrDiamond}. + * @param ctx the parse tree + */ + void exitTypeArgumentsOrDiamond(Java17Parser.TypeArgumentsOrDiamondContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#nonWildcardTypeArgumentsOrDiamond}. + * @param ctx the parse tree + */ + void enterNonWildcardTypeArgumentsOrDiamond(Java17Parser.NonWildcardTypeArgumentsOrDiamondContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#nonWildcardTypeArgumentsOrDiamond}. + * @param ctx the parse tree + */ + void exitNonWildcardTypeArgumentsOrDiamond(Java17Parser.NonWildcardTypeArgumentsOrDiamondContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#nonWildcardTypeArguments}. + * @param ctx the parse tree + */ + void enterNonWildcardTypeArguments(Java17Parser.NonWildcardTypeArgumentsContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#nonWildcardTypeArguments}. + * @param ctx the parse tree + */ + void exitNonWildcardTypeArguments(Java17Parser.NonWildcardTypeArgumentsContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#typeList}. + * @param ctx the parse tree + */ + void enterTypeList(Java17Parser.TypeListContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#typeList}. + * @param ctx the parse tree + */ + void exitTypeList(Java17Parser.TypeListContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#typeType}. + * @param ctx the parse tree + */ + void enterTypeType(Java17Parser.TypeTypeContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#typeType}. + * @param ctx the parse tree + */ + void exitTypeType(Java17Parser.TypeTypeContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#primitiveType}. + * @param ctx the parse tree + */ + void enterPrimitiveType(Java17Parser.PrimitiveTypeContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#primitiveType}. + * @param ctx the parse tree + */ + void exitPrimitiveType(Java17Parser.PrimitiveTypeContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#typeArguments}. + * @param ctx the parse tree + */ + void enterTypeArguments(Java17Parser.TypeArgumentsContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#typeArguments}. + * @param ctx the parse tree + */ + void exitTypeArguments(Java17Parser.TypeArgumentsContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#superSuffix}. + * @param ctx the parse tree + */ + void enterSuperSuffix(Java17Parser.SuperSuffixContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#superSuffix}. + * @param ctx the parse tree + */ + void exitSuperSuffix(Java17Parser.SuperSuffixContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#explicitGenericInvocationSuffix}. + * @param ctx the parse tree + */ + void enterExplicitGenericInvocationSuffix(Java17Parser.ExplicitGenericInvocationSuffixContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#explicitGenericInvocationSuffix}. + * @param ctx the parse tree + */ + void exitExplicitGenericInvocationSuffix(Java17Parser.ExplicitGenericInvocationSuffixContext ctx); + /** + * Enter a parse tree produced by {@link Java17Parser#arguments}. + * @param ctx the parse tree + */ + void enterArguments(Java17Parser.ArgumentsContext ctx); + /** + * Exit a parse tree produced by {@link Java17Parser#arguments}. + * @param ctx the parse tree + */ + void exitArguments(Java17Parser.ArgumentsContext ctx); +} \ No newline at end of file diff --git a/javatx-src/main/java/de/dhbwstuttgart/parser/notes/GetNames b/javatx-src/main/java/de/dhbwstuttgart/parser/notes/GetNames new file mode 100644 index 0000000..2c59e3b --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/parser/notes/GetNames @@ -0,0 +1,15 @@ +* Methode als statische Klasse +* Methode gibt eine JavaClassRegistry zurück (für mehr als 1 S0ourcefile). +* Suchmuster: \n rule +* Generell: lieber leere Listen und wenig null verwenden (Spezialfälle ausgenommen). + +== Fehler/Exceptions == + +* Eigene wie z.B. TypeCheckExceptions +* Fehler sollen an Semantikchecker usw. weiter gegeben werden. + +== Offset == + +* Evtl. Zeichen im File/in der Klasse durch Antlr ermitteln. +* z.B. ParserRuleContext.getStart() +* Anstatt offset: Instanz des entsprechenden ParserRuleContext (liefert evtl. noch mehr Infos) diff --git a/javatx-src/main/java/de/dhbwstuttgart/parser/notes/TODO b/javatx-src/main/java/de/dhbwstuttgart/parser/notes/TODO new file mode 100644 index 0000000..8d04f71 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/parser/notes/TODO @@ -0,0 +1,3 @@ +* fieldDeclarations +* Imports +* (Q)Generics diff --git a/javatx-src/main/java/de/dhbwstuttgart/parser/notes/questions b/javatx-src/main/java/de/dhbwstuttgart/parser/notes/questions new file mode 100644 index 0000000..61a725a --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/parser/notes/questions @@ -0,0 +1,2 @@ +* Ablegen der Type Parameter: kompletter Name? +* Typen (unannType etc.) diff --git a/javatx-src/main/java/de/dhbwstuttgart/parser/parse_tree b/javatx-src/main/java/de/dhbwstuttgart/parser/parse_tree new file mode 100644 index 0000000..13078b5 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/parser/parse_tree @@ -0,0 +1,18 @@ +* Listener-Pattern für das Projekt eher ungeeignet. + += Herangehensweise/Format = + +* CompilatunUnit (Rot) wird zu Source-File (Root) +* Im Paket Syntaxtree finden sich die Klassen, die ich letztendlich erzeugen muss. +* Kann hier auch Veränderungen vornehmen (Pull Request) +* Wichtig! Typnamen müssen aufgelöst werden können (also z.B. java.lang.util.ArrayList (JavaClassRegistry). + += Idee bei mehreren Files = +* Zunächst alle Files anschauen und Pakate/Klassen für die spätere Verwendung "registrieren". +* Danach erst das komplette Package/alle Klassen imselben Verzeichnis parsen. + +== Fragen/PProbleme SyntaxTreeGenerator == + +* ClassRegistry: Unklar, woher diese kommen soll. +* Konstruktor für Class fehlt. +* Namenskonflikt Class vs. Class in Java? diff --git a/javatx-src/main/java/de/dhbwstuttgart/parser/scope/GatherNames.java b/javatx-src/main/java/de/dhbwstuttgart/parser/scope/GatherNames.java new file mode 100644 index 0000000..d36a2d9 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/parser/scope/GatherNames.java @@ -0,0 +1,166 @@ +package de.dhbwstuttgart.parser.scope; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +import com.google.common.collect.Iterables; +import de.dhbwstuttgart.core.JavaTXCompiler; +import de.dhbwstuttgart.environment.PackageCrawler; +import de.dhbwstuttgart.exceptions.NotImplementedException; +import de.dhbwstuttgart.parser.antlr.Java17Parser; +import de.dhbwstuttgart.parser.antlr.Java17Parser.AnnotationTypeElementDeclarationContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.ClassBodyContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.ClassBodyDeclarationContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.ClassOrInterfaceContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.ClassorinterfacedeclContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.EnumConstantContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.EnumConstantsContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.InterfaceBodyDeclarationContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.InterfacememberContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.MemberclassorinterfaceContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.MemberdeclContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.NoclassorinterfaceContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.SrcfileContext; +import de.dhbwstuttgart.parser.antlr.Java17Parser.SubclassorinterfaceContext; + +public class GatherNames { + + public static Map getNames(SrcfileContext ctx, PackageCrawler packages, JavaTXCompiler compiler) throws ClassNotFoundException { + Map ret = new HashMap<>(); + for (Java17Parser.ClassOrInterfaceContext clsoifctx : ctx.classOrInterface()) { + if (clsoifctx instanceof NoclassorinterfaceContext) { + continue; + } + ret.putAll(getNames(clsoifctx, getPackageName(ctx), packages, compiler)); + } + ret.putAll(getImports(ctx, packages, compiler)); + return ret; + } + + public static Map getNames(ClassOrInterfaceContext clsoifctx, String pkgName, PackageCrawler packages, JavaTXCompiler compiler) throws ClassNotFoundException { + Map ret = new HashMap<>(); + ClassorinterfacedeclContext clsoif = (ClassorinterfacedeclContext) clsoifctx; + String nameString = ""; + String fullname = clsoif.getChild(clsoif.getChildCount() - 1).getClass().getName(); + String classname = fullname.substring(fullname.indexOf("$") + 1); + int numGenerics = 0; + /* + * Es werden alle Namen gesammelt, die syntaktisch von Java-TX (sprich der Grammatik) erkannt werden. Auch wenn z.B. Annotationen oder Enumerationen noch nicht im Compiler implementiert sind. Die "NotImplementedException" wird dann im "SyntaxTreeGenerator" geworfen. Das Statement soll als Vorbereitung dienen, für den Fall, dass weitere Sprachkonstrukte in den Compiler aufgenommen werden. + */ + switch (classname) { + case "ClassDeclarationContext": + if (!pkgName.isEmpty()) { + nameString = pkgName + "." + clsoif.classDeclaration().identifier().getText(); + } else { + nameString = clsoif.classDeclaration().identifier().getText(); + } + numGenerics = clsoif.classDeclaration().genericDeclarationList() != null ? clsoif.classDeclaration().genericDeclarationList().genericTypeVar().size() : 0; + ret.put(nameString, numGenerics); + ret.putAll(getNames(clsoif.classDeclaration().classBody().classBodyDeclaration(), pkgName, packages, compiler)); + break; + case "EnumDeclarationContext": + if (!pkgName.isEmpty()) { + nameString = pkgName + "." + clsoif.enumDeclaration().identifier().getText(); + } else { + nameString = clsoif.enumDeclaration().identifier().getText(); + } + numGenerics = 0; + ret.put(nameString, numGenerics); + EnumConstantsContext enumConstants = clsoif.enumDeclaration().enumConstants(); + if (!Objects.isNull(enumConstants)) { + for (EnumConstantContext enumConstant : enumConstants.enumConstant()) { + ClassBodyContext enumConstClassBody = enumConstant.classBody(); + if (!Objects.isNull(enumConstClassBody)) { + ret.putAll(getNames(enumConstClassBody.classBodyDeclaration(), pkgName, packages, compiler)); + } + } + } + break; + case "InterfaceDeclarationContext": + if (pkgName != "") { + nameString = pkgName + "." + clsoif.interfaceDeclaration().identifier().getText(); + } else { + nameString = clsoif.interfaceDeclaration().identifier().getText(); + } + numGenerics = clsoif.interfaceDeclaration().genericDeclarationList() != null ? clsoif.interfaceDeclaration().genericDeclarationList().genericTypeVar().size() : 0; + ret.put(nameString, numGenerics); + for (InterfaceBodyDeclarationContext ifbody : clsoif.interfaceDeclaration().interfaceBody().interfaceBodyDeclaration()) { + if (ifbody instanceof InterfacememberContext member && member.interfaceMemberDeclaration() instanceof SubclassorinterfaceContext sub) { + ret.putAll(getNames(sub.classOrInterface(), pkgName, packages, compiler)); + } + } + break; + case "AnnotationTypeDeclarationContext": + if (pkgName != "") { + nameString = pkgName + "." + clsoif.annotationTypeDeclaration().identifier().getText(); + } else { + nameString = clsoif.annotationTypeDeclaration().identifier().getText(); + } + numGenerics = 0; + ret.put(nameString, numGenerics); + for (AnnotationTypeElementDeclarationContext anTypeElem : clsoif.annotationTypeDeclaration().annotationTypeBody().annotationTypeElementDeclaration()) { + ClassOrInterfaceContext anClsoifctx = anTypeElem.annotationTypeElementRest().classOrInterface(); + if (!Objects.isNull(anClsoifctx)) { + ret.putAll(getNames(anClsoifctx, pkgName, packages, compiler)); + } + } + break; + case "RecordDeclarationContext": + if (pkgName != "") { + nameString = pkgName + "." + clsoif.recordDeclaration().identifier().getText(); + } else { + nameString = clsoif.recordDeclaration().identifier().getText(); + } + numGenerics = clsoif.recordDeclaration().genericDeclarationList() != null ? clsoif.recordDeclaration().genericDeclarationList().genericTypeVar().size() : 0; + ret.put(nameString, numGenerics); + ret.putAll(getNames(clsoif.recordDeclaration().recordBody().classBodyDeclaration(), pkgName, packages, compiler)); + break; + default: + throw new NotImplementedException(); + } + return ret; + } + + public static Map getNames(List clsBodyDecl, String pkgName, PackageCrawler packages, JavaTXCompiler compiler) throws ClassNotFoundException { + Map ret = new HashMap<>(); + for (ClassBodyDeclarationContext clsbody : clsBodyDecl) { + if (clsbody instanceof MemberdeclContext member && member.memberDeclaration() instanceof MemberclassorinterfaceContext memberclsoifctx) { + ret.putAll(getNames(memberclsoifctx.classOrInterface(), pkgName, packages, compiler)); + } + } + return ret; + } + + public static Map getImports(Java17Parser.SrcfileContext ctx, PackageCrawler packages, JavaTXCompiler compiler) throws ClassNotFoundException { + Map ret = new HashMap<>(); + // ret.putAll(packages.getClassNames("java.lang")); + for (Java17Parser.ImportDeclarationContext importDeclCtx : ctx.importDeclaration()) { + if (importDeclCtx.MUL() == null) { + var name = importDeclCtx.qualifiedName().getText(); + var className = new JavaClassName(name); + if (compiler.loadJavaTXClass(className)) { + ret.put(name, compiler.classRegistry.getNumberOfGenerics(name)); + } else { + Class cl = compiler.getClassLoader().loadClass(name); + ret.put(cl.getName(), cl.getTypeParameters().length); + } + } else if (importDeclCtx.MUL() != null) { + // TODO Find stuff in user defined packages + ret.putAll(packages.getClassNames(importDeclCtx.qualifiedName().getText())); + } + // Die Unterscheidungen für 'static imports' wurden herausgenommen, da sie den + // auszuführenden Code nicht beeinflussen + } + return ret; + } + + private static String getPackageName(Java17Parser.SrcfileContext ctx) { + String pkgName = ""; + if (ctx.packageDeclaration() != null) { + pkgName = ctx.packageDeclaration().qualifiedName().getText(); + } + return pkgName; + } +} \ No newline at end of file diff --git a/javatx-src/main/java/de/dhbwstuttgart/parser/scope/GenericsRegistry.java b/javatx-src/main/java/de/dhbwstuttgart/parser/scope/GenericsRegistry.java new file mode 100644 index 0000000..e0b32e6 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/parser/scope/GenericsRegistry.java @@ -0,0 +1,50 @@ +package de.dhbwstuttgart.parser.scope; + +import de.dhbwstuttgart.parser.SyntaxTreeGenerator.GenericContext; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +public class GenericsRegistry { + private final List registry = new ArrayList<>(); + public final GenericsRegistry globalRegistry; + + public GenericsRegistry(GenericsRegistry globalRegistry){ + this.globalRegistry = globalRegistry; + } + + public void put(String name, GenericContext genericContext){ + registry.add(new GenericVariable(genericContext,name)); + if(globalRegistry != null)globalRegistry.put(name, genericContext); + } + + public boolean contains(String name) { + Optional ret = registry.stream().map(((GenericVariable genericVariable) -> genericVariable.name.equals(name))) + .reduce(((a, b) -> a || b)); + if(ret.isPresent()) + return ret.get(); + return false; + } + + public GenericContext get(String name) { + return registry.stream() + .filter((genericVariable -> genericVariable.name.equals(name))).findAny().get().context; + } + + public void putAll(GenericsRegistry generics) { + for(GenericVariable generic : generics.registry){ + this.put(generic.name, generic.context); + } + } +} + +class GenericVariable{ + final GenericContext context; + final String name; + + GenericVariable(GenericContext context, String name){ + this.context = context; + this.name = name; + } +} \ No newline at end of file diff --git a/javatx-src/main/java/de/dhbwstuttgart/parser/scope/JavaClassName.java b/javatx-src/main/java/de/dhbwstuttgart/parser/scope/JavaClassName.java new file mode 100644 index 0000000..0426f2e --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/parser/scope/JavaClassName.java @@ -0,0 +1,159 @@ +package de.dhbwstuttgart.parser.scope; + +import java.util.ArrayList; +import java.util.List; + +/** + * Stellt den Namen einer Java Klasse dar. + * Dieser kann auch den Packagenamen mit beinhalten: + * de.dhbwstuttgart.typeinference.Menge + * + * @author Andreas Stadelmeier + */ +public class JavaClassName { + + // FIXME It's very much possible to have imports to inner classes + // In that case a.package.Foo.Bar, a.package is the Package and Foo.Bar the class name + // Its impossible to decide what's the package based solely on the name of the class + + public static final JavaClassName Void = new JavaClassName("void"); + private String name; + private PackageName packageName; + + public JavaClassName(String name) { + if (name == null) + throw new NullPointerException(); + + String[] names = name.split("[.]"); + boolean match = true; + if (names.length == 1) { + // packageName = new PackageName(); + this.name = name; + } else { + name = names[names.length - 1]; + List packageNames = new ArrayList(); + for (int i = 0; i < names.length - 1; i++) { + packageNames.add(names[i]); + } + packageName = new PackageName(packageNames); + this.name = names[names.length - 1]; + } + } + + /** + * Gibt von einem Klassennamen nur den Namen der Klasse zur�ck + * Beispiel: + * java.lang.Object wird zu: Object + */ + public static String stripClassName(String className) { + return new JavaClassName(className).name; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((name == null) ? 0 : name.hashCode()); + /* + * result = prime * result + * + ((packageName == null) ? 0 : packageName.hashCode()); //PackageName does + * not infect hashCode + */ + return result; + } + + /** + * Namen sind nur gleich, wenn bei den beiden zu vergleichenden JavaClassNames + * auch das Package angegeben ist + */ + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (obj instanceof String) + return this.toString().equals(obj) || (this.name != null && this.name.equals(obj)); // Auch mit Strings als + // Klassennamen kompatibel + // TODO: sollte bald obsolet + // sein + if (getClass() != obj.getClass()) + return false; + JavaClassName other = (JavaClassName) obj; + if (name == null) { + if (other.name != null) + return false; + } else if (!name.equals(other.name)) + return false; + if (packageName != null && other.packageName != null) { + if (!packageName.equals(other.packageName)) + return false;// Spezialfall, nicht beide Typen müssen eindeutig mit Packagenamen angegeben + // werden + } + return true; + } + + @Override + public String toString() { + return (packageName != null ? packageName.toString() + "." : "") + name; + } + + public String getPackageName() { + return (packageName != null ? packageName.toString() : ""); + } + + public String getClassName() { + return name; + } +} + +class PackageName { + + List names = new ArrayList<>(); + + public PackageName(List packageNames) { + names = packageNames; + } + + public PackageName() { + // Do nothing + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((names == null) ? 0 : names.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + PackageName other = (PackageName) obj; + if (names == null) { + if (other.names != null) + return false; + } else if (!names.equals(other.names)) + return false; + return true; + } + + @Override + public String toString() { + String ret = ""; + if (names == null) + return ""; + for (String n : names) + ret += n + "."; + if (ret != null && ret.length() > 0 && ret.charAt(ret.length() - 1) == '.') { + ret = ret.substring(0, ret.length() - 1); + } + return ret; + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/parser/scope/JavaClassRegistry.java b/javatx-src/main/java/de/dhbwstuttgart/parser/scope/JavaClassRegistry.java new file mode 100644 index 0000000..968daf8 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/parser/scope/JavaClassRegistry.java @@ -0,0 +1,65 @@ +package de.dhbwstuttgart.parser.scope; + +import de.dhbwstuttgart.exceptions.NotImplementedException; + +import java.util.*; + +/** + * Speichert die Klassen f�r einen bestimmten Projektscope + */ +public class JavaClassRegistry { + final Map existingClasses = new HashMap<>(); + + public JavaClassRegistry(Map initialNames) { + addNames(initialNames); + } + + public JavaClassRegistry() {} + + public void addNames(Map names) { + for (String name : names.keySet()) { + existingClasses.put(new JavaClassName(name), names.get(name)); + } + } + + public void addName(String className, int numberOfGenerics) { + existingClasses.put(new JavaClassName(className), numberOfGenerics); + } + + public JavaClassName getName(String className) { + for (JavaClassName name : existingClasses.keySet()) { + if (name.equals(new JavaClassName(className))) + return name; + } + throw new RuntimeException("Class " + className + " not found!"); + } + + @Override + public String toString() { + return existingClasses.toString(); + } + + public List getAllFromPackage(String packageName) { + List ret = new ArrayList<>(); + for (JavaClassName className : this.existingClasses.keySet()) { + JavaClassName toCompare = new JavaClassName( + packageName + "." + JavaClassName.stripClassName(className.toString())); + if (toCompare.toString().equals(className.toString())) { + ret.add(className); + } + } + return ret; + } + + public boolean contains(String whole) { + return existingClasses.containsKey(new JavaClassName(whole)); + } + + public boolean contains(JavaClassName name) { + return existingClasses.containsKey(name); + } + + public int getNumberOfGenerics(String name) { + return existingClasses.get(new JavaClassName(name)); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/ASTVisitor.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/ASTVisitor.java new file mode 100644 index 0000000..41d821f --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/ASTVisitor.java @@ -0,0 +1,41 @@ +package de.dhbwstuttgart.syntaxtree; + +import de.dhbwstuttgart.syntaxtree.type.*; + +public interface ASTVisitor extends StatementVisitor{ + + void visit(SourceFile sourceFile); + + void visit(GenericTypeVar genericTypeVar); + + void visit(FormalParameter formalParameter); + + void visit(GenericDeclarationList genericTypeVars); + + void visit(Field field); + + void visit(Method field); + + void visit(Constructor field); + + void visit(ParameterList formalParameters); + + void visit(ClassOrInterface classOrInterface); + + void visit(RefType refType); + + void visit(SuperWildcardType superWildcardType); + + void visit(TypePlaceholder typePlaceholder); + + void visit(ExtendsWildcardType extendsWildcardType); + + void visit(GenericRefType genericRefType); + + void visit(ExpressionPattern aPattern); + + void visit(RecordPattern aRecordPattern); + + void visit(GuardedPattern aGuardedPattern); + +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/AbstractASTWalker.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/AbstractASTWalker.java new file mode 100644 index 0000000..bc46fa6 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/AbstractASTWalker.java @@ -0,0 +1,333 @@ +package de.dhbwstuttgart.syntaxtree; + +import de.dhbwstuttgart.parser.SyntaxTreeGenerator.AssignToLocal; +import de.dhbwstuttgart.syntaxtree.statement.*; +import de.dhbwstuttgart.syntaxtree.type.*; + +import java.util.Iterator; +import java.util.Objects; + +import de.dhbwstuttgart.syntaxtree.*; + +public abstract class AbstractASTWalker implements ASTVisitor { + @Override + public void visit(Constructor cons) { + visitMethod(cons); + } + + @Override + public void visit(SourceFile sourceFile) { + for (ClassOrInterface cl : sourceFile.getClasses()) { + cl.accept(this); + } + } + + @Override + public void visit(ArgumentList argumentList) { + for (Expression expr : argumentList.getArguments()) { + expr.accept(this); + } + } + + @Override + public void visit(GenericTypeVar genericTypeVar) { + + } + + @Override + public void visit(FormalParameter formalParameter) { + formalParameter.getType().accept((ASTVisitor) this); + } + + @Override + public void visit(GenericDeclarationList genericTypeVars) { + Iterator genericIterator = genericTypeVars.iterator(); + if (genericIterator.hasNext()) { + while (genericIterator.hasNext()) { + genericIterator.next().accept(this); + } + } + } + + @Override + public void visit(Field field) { + field.getType().accept(this); + } + + @Override + public void visit(Method method) { + visitMethod(method); + } + + private void visitMethod(Method method) { + method.getReturnType().accept(this); + method.getParameterList().accept(this); + if (method.block != null) + method.block.accept(this); + } + + @Override + public void visit(ParameterList formalParameters) { + Iterator it = formalParameters.getFormalparalist().iterator(); + if (it.hasNext()) { + while (it.hasNext()) { + it.next().accept(this); + } + } + } + + @Override + public void visit(ClassOrInterface classOrInterface) { + classOrInterface.getGenerics().accept(this); + for (Field f : classOrInterface.getFieldDecl()) { + f.accept(this); + } + for (Constructor c : classOrInterface.getConstructors()) { + c.accept(this); + } + for (Method m : classOrInterface.getMethods()) { + m.accept(this); + } + } + + @Override + public void visit(RefType refType) { + Iterator genericIterator = refType.getParaList().iterator(); + if (genericIterator.hasNext()) { + while (genericIterator.hasNext()) { + genericIterator.next().accept(this); + } + } + } + + @Override + public void visit(SuperWildcardType superWildcardType) { + superWildcardType.getInnerType().accept(this); + } + + @Override + public void visit(TypePlaceholder typePlaceholder) { + } + + @Override + public void visit(ExtendsWildcardType extendsWildcardType) { + extendsWildcardType.getInnerType().accept(this); + } + + @Override + public void visit(GenericRefType genericRefType) { + } + + @Override + public void visit(LambdaExpression lambdaExpression) { + lambdaExpression.params.accept(this); + lambdaExpression.methodBody.accept(this); + } + + @Override + public void visit(Assign assign) { + assign.lefSide.accept(this); + assign.rightSide.accept(this); + assign.rightSide.getType().accept((ASTVisitor) this); + } + + @Override + public void visit(BinaryExpr binary) { + + } + + @Override + public void visit(BoolExpression logical) { + + } + + @Override + public void visit(Block block) { + for (Statement stmt : block.getStatements()) { + stmt.accept(this); + } + } + + @Override + public void visit(CastExpr castExpr) { + + } + + @Override + public void visit(EmptyStmt emptyStmt) { + + } + + @Override + public void visit(FieldVar fieldVar) { + fieldVar.receiver.accept(this); + } + + @Override + public void visit(ForStmt forStmt) { + forStmt.block.accept(this); + } + + @Override + public void visit(ForEachStmt forEachStmt) { + forEachStmt.block.accept(this); + } + + @Override + public void visit(IfStmt ifStmt) { + ifStmt.then_block.accept(this); + if (!Objects.isNull(ifStmt.else_block)) + ifStmt.else_block.accept(this); + } + + @Override + public void visit(InstanceOf instanceOf) { + + } + + @Override + public void visit(LocalVar localVar) { + + } + + @Override + public void visit(LocalVarDecl localVarDecl) { + localVarDecl.getType().accept(this); + } + + @Override + public void visit(MethodCall methodCall) { + methodCall.receiver.accept(this); + methodCall.getArgumentList().accept(this); + methodCall.getArgumentList().getArguments().forEach(a -> a.getType().accept((ASTVisitor) this)); + } + + @Override + public void visit(NewClass methodCall) { + visit((MethodCall) methodCall); + } + + @Override + public void visit(NewArray newArray) { + + } + + @Override + public void visit(ExpressionReceiver receiver) { + receiver.expr.accept(this); + } + + @Override + public void visit(UnaryExpr unaryExpr) { + unaryExpr.expr.accept(this); + } + + @Override + public void visit(Return aReturn) { + aReturn.retexpr.accept(this); + aReturn.getType().accept((ASTVisitor) this); + } + + @Override + public void visit(ReturnVoid aReturn) { + + } + + @Override + public void visit(Break aBreak) { + aBreak.accept(this); + } + + @Override + public void visit(StaticClassName staticClassName) { + + } + + @Override + public void visit(Super aSuper) { + + } + + @Override + public void visit(This aThis) { + + } + + @Override + public void visit(WhileStmt whileStmt) { + whileStmt.loopBlock.accept(this); + } + + @Override + public void visit(DoStmt whileStmt) { + whileStmt.loopBlock.accept(this); + } + + @Override + public void visit(Literal literal) { + + } + + @Override + public void visit(Throw aThrow) { + + } + + @Override + public void visit(AssignToField assignLeftSide) { + assignLeftSide.field.accept(this); + } + + @Override + public void visit(AssignToLocal assignLeftSide) { + assignLeftSide.localVar.accept(this); + } + + @Override + public void visit(SuperCall superCall) { + this.visit((MethodCall) superCall); + } + + @Override + public void visit(Switch switchStmt) { + switchStmt.getSwitch().accept(this); + switchStmt.getBlocks().stream().forEach((switchBlock) -> { + switchBlock.accept(this); + }); + } + + @Override + public void visit(SwitchBlock switchBlock) { + switchBlock.getLabels().stream().forEach((label) -> { + label.accept(this); + }); + switchBlock.getStatements().stream().forEach((stmt) -> { + stmt.accept(this); + }); + } + + @Override + public void visit(SwitchLabel switchLabel) { + + } + + @Override + public void visit(Yield aYield) { + } + + @Override + public void visit(ExpressionPattern aPattern) { + + } + + @Override + public void visit(RecordPattern aRecordPattern) { + + } + + @Override + public void visit(GuardedPattern aGuardedPattern) { + + } + +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/ClassOrInterface.jav-back b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/ClassOrInterface.jav-back new file mode 100644 index 0000000..68b6a77 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/ClassOrInterface.jav-back @@ -0,0 +1,209 @@ +package de.dhbwstuttgart.syntaxtree; + +import de.dhbwstuttgart.parser.NullToken; +import de.dhbwstuttgart.parser.scope.JavaClassName; +import de.dhbwstuttgart.syntaxtree.type.GenericRefType; +import de.dhbwstuttgart.syntaxtree.type.RefType; +import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import org.antlr.v4.runtime.Token; + +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Optional; + +import java.util.function.Predicate; +import java.util.stream.Stream; +//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; +import java.lang.Integer; + +/** + * Stellt jede Art von Klasse dar. Auch abstrakte Klassen und Interfaces + */ +public class ClassOrInterface extends SyntaxTreeNode implements TypeScope { + private Boolean methodAdded = false; // wird benoetigt bei in JavaTXCompiler.getConstraints() + protected int modifiers; + protected JavaClassName name; + private final String fileName; + + private List fields = new ArrayList<>(); + private Optional fieldInitializations; // PL 2018-11-24: Noetig, um Bytecode fuer initializators nur einmal zu erzeugen + private Optional staticInitializer; + private List methods = new ArrayList<>(); + private GenericDeclarationList genericClassParameters; + private RefType superClass; + protected boolean isInterface; + protected boolean isFunctionalInterface; + private List implementedInterfaces; + private List permittedSubtypes; + private List constructors; + + public ClassOrInterface(modifiers, name, fielddecl, fieldInitializations, staticInitializer, methods, constructors, genericClassParameters, superClass, isInterface, isFunctionalInterface, implementedInterfaces, permittedSubtypes, offset, fileName) { + super(offset); + if (isInterface) { + modifiers = modifiers | Modifier.INTERFACE | Modifier.ABSTRACT; + } + this.modifiers = modifiers; + this.name = name; + this.fields = fielddecl; + this.fieldInitializations = fieldInitializations; + this.staticInitializer = staticInitializer; + this.genericClassParameters = genericClassParameters; + this.superClass = superClass; + this.isInterface = isInterface; + this.isFunctionalInterface= isFunctionalInterface; + this.implementedInterfaces = implementedInterfaces; + this.permittedSubtypes = permittedSubtypes; + this.methods = methods; + this.constructors = constructors; + this.fileName = fileName; + } + + /* + * erzeugt fuer Fields, Konstruktoren und Methoden neue ArrayList-Objekte alle anderen Datenobjekte werden nur kopiert. + */ + public ClassOrInterface(cl) { + super(cl.getOffset()); + this.modifiers = cl.modifiers; + this.name = cl.name; + this.fields = new ArrayList<>(cl.fields); + this.fieldInitializations = cl.fieldInitializations; + this.staticInitializer = cl.staticInitializer; + this.genericClassParameters = cl.genericClassParameters; + this.superClass = cl.superClass; + this.isInterface = cl.isInterface; + this.isFunctionalInterface= cl.isFunctionalInterface; + this.implementedInterfaces = cl.implementedInterfaces; + this.methods = new ArrayList<>(cl.methods); + this.constructors = new ArrayList<>(cl.constructors); + this.fileName = cl.fileName; + } + + public getFileName() { + return fileName; + } + + public getField(name) { + // TODO This should be a map + return fields.stream().filter(field -> field.getName().equals(name)).findFirst(); + } + + public getStaticInitializer() { + return staticInitializer; + } + + public isInterface() { + return (Modifier.INTERFACE & this.getModifiers()) != 0; + } + + public isFunctionalInterface() { + return this.isFunctionalInterface; + } + + // Gets if it is added + public areMethodsAdded() { + return methodAdded; + } + + // Sets that it is added + public setMethodsAdded() { + methodAdded = true; + } + + // Gets class name + public getClassName() { + return this.name; + } + + // Get modifiers + public getModifiers() { + return this.modifiers; + } + + public getFieldDecl() { + return this.fields; + } + + public getfieldInitializations() { + return this.fieldInitializations; + } + + public getMethods() { + return this.methods; + } + + /* + * public RefType getType() { return generateTypeOfClass(this.getClassName(), this.getGenerics(), this.getOffset()); } + */ + // TODO: Das hier ist ein Problem. Je nach Kontext wird hier ein anderer Typ benötigt + public static generateTypeOfClass(name, genericsOfClass, offset) { + // Hier wird immer ein generischer Typ generiert, also mit Type placeholdern + List params = new ArrayList<>(); + for (GenericTypeVar genericTypeVar : genericsOfClass) { + // params.add(genericTypeVar.getTypePlaceholder()); + params.add(TypePlaceholder.fresh(offset)); + } + return new RefType(name, params, offset); + } + + + /** + * + * @return die aktuelle Klasse als RefType + */ + public generateTypeOfThisClass() { + List params = new ArrayList<>(); + for (GenericTypeVar genericTypeVar : this.getGenerics()) { + // params.add(genericTypeVar.getTypePlaceholder()); + params.add(new GenericRefType(genericTypeVar.getName(), new NullToken())); + } + return new RefType(name, params, new NullToken()); + } + + /** + * Die Superklasse im Kontext dieser ClassOrInterface Das bedeutet, dass generische Variablen als GenericRefTypes dargestellt sind + */ + public getSuperClass() { + return superClass; + } + + public getGenerics() { + return this.genericClassParameters; + } + + @Override + public getReturnType() { + return null; + } + + public getConstructors() { + return constructors; + } + + @Override + public accept(visitor) { + visitor.visit(this); + } + + public getSuperInterfaces() { + return implementedInterfaces; + } + + public toString() { + return this.name.toString() + this.genericClassParameters.toString(); + } + +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/ClassOrInterface.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/ClassOrInterface.java new file mode 100644 index 0000000..108c813 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/ClassOrInterface.java @@ -0,0 +1,191 @@ +package de.dhbwstuttgart.syntaxtree; + +import de.dhbwstuttgart.parser.NullToken; +import de.dhbwstuttgart.parser.scope.JavaClassName; +import de.dhbwstuttgart.syntaxtree.type.GenericRefType; +import de.dhbwstuttgart.syntaxtree.type.RefType; +import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import org.antlr.v4.runtime.Token; + +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Optional; + +/** + * Stellt jede Art von Klasse dar. Auch abstrakte Klassen und Interfaces + */ +public class ClassOrInterface extends SyntaxTreeNode implements TypeScope { + private Boolean methodAdded = false; // wird benoetigt bei in JavaTXCompiler.getConstraints() + protected int modifiers; + protected JavaClassName name; + private final String fileName; + + private List fields = new ArrayList<>(); + private Optional fieldInitializations; // PL 2018-11-24: Noetig, um Bytecode fuer initializators nur einmal zu erzeugen + private Optional staticInitializer; + private List methods = new ArrayList<>(); + private GenericDeclarationList genericClassParameters; + private RefType superClass; + protected boolean isInterface; + protected boolean isFunctionalInterface; + private List implementedInterfaces; + private List permittedSubtypes; + private List constructors; + + public ClassOrInterface(int modifiers, JavaClassName name, List fielddecl, Optional fieldInitializations, Optional staticInitializer, List methods, List constructors, GenericDeclarationList genericClassParameters, RefType superClass, Boolean isInterface, Boolean isFunctionalInterface, List implementedInterfaces, List permittedSubtypes, Token offset, String fileName) { + super(offset); + if (isInterface) { + modifiers |= Modifier.INTERFACE | Modifier.ABSTRACT; + } + this.modifiers = modifiers; + this.name = name; + this.fields = fielddecl; + this.fieldInitializations = fieldInitializations; + this.staticInitializer = staticInitializer; + this.genericClassParameters = genericClassParameters; + this.superClass = superClass; + this.isInterface = isInterface; + this.isFunctionalInterface= isFunctionalInterface; + this.implementedInterfaces = implementedInterfaces; + this.permittedSubtypes = permittedSubtypes; + this.methods = methods; + this.constructors = constructors; + this.fileName = fileName; + } + + /* + * erzeugt fuer Fields, Konstruktoren und Methoden neue ArrayList-Objekte alle anderen Datenobjekte werden nur kopiert. + */ + public ClassOrInterface(ClassOrInterface cl) { + super(cl.getOffset()); + this.modifiers = cl.modifiers; + this.name = cl.name; + this.fields = new ArrayList<>(cl.fields); + this.fieldInitializations = cl.fieldInitializations; + this.staticInitializer = cl.staticInitializer; + this.genericClassParameters = cl.genericClassParameters; + this.superClass = cl.superClass; + this.isInterface = cl.isInterface; + this.isFunctionalInterface= cl.isFunctionalInterface; + this.implementedInterfaces = cl.implementedInterfaces; + this.methods = new ArrayList<>(cl.methods); + this.constructors = new ArrayList<>(cl.constructors); + this.fileName = cl.fileName; + } + + public String getFileName() { + return fileName; + } + + public Optional getField(String name) { + // TODO This should be a map + return fields.stream().filter(field -> field.getName().equals(name)).findFirst(); + } + + public Optional getStaticInitializer() { + return staticInitializer; + } + + public boolean isInterface() { + return (Modifier.INTERFACE & this.getModifiers()) != 0; + } + + public boolean isFunctionalInterface() { + return this.isFunctionalInterface; + } + + // Gets if it is added + public Boolean areMethodsAdded() { + return methodAdded; + } + + // Sets that it is added + public void setMethodsAdded() { + methodAdded = true; + } + + // Gets class name + public JavaClassName getClassName() { + return this.name; + } + + // Get modifiers + public int getModifiers() { + return this.modifiers; + } + + public List getFieldDecl() { + return this.fields; + } + + public Optional getfieldInitializations() { + return this.fieldInitializations; + } + + public List getMethods() { + return this.methods; + } + /* + * public RefType getType() { return generateTypeOfClass(this.getClassName(), this.getGenerics(), this.getOffset()); } + */ + // TODO: Das hier ist ein Problem. Je nach Kontext wird hier ein anderer Typ benötigt + public static RefType generateTypeOfClass(JavaClassName name, GenericDeclarationList genericsOfClass, Token offset) { + // Hier wird immer ein generischer Typ generiert, also mit Type placeholdern + List params = new ArrayList<>(); + for (GenericTypeVar genericTypeVar : genericsOfClass) { + // params.add(genericTypeVar.getTypePlaceholder()); + params.add(TypePlaceholder.fresh(offset)); + } + return new RefType(name, params, offset); + } + + /** + * + * @return die aktuelle Klasse als RefType + */ + public RefType generateTypeOfThisClass() { + List params = new ArrayList<>(); + for (GenericTypeVar genericTypeVar : this.getGenerics()) { + // params.add(genericTypeVar.getTypePlaceholder()); + params.add(new GenericRefType(genericTypeVar.getName(), new NullToken())); + } + return new RefType(name, params, new NullToken()); + } + + /** + * Die Superklasse im Kontext dieser ClassOrInterface Das bedeutet, dass generische Variablen als GenericRefTypes dargestellt sind + */ + public RefType getSuperClass() { + return superClass; + } + + public GenericDeclarationList getGenerics() { + return this.genericClassParameters; + } + + @Override + public RefTypeOrTPHOrWildcardOrGeneric getReturnType() { + return null; + } + + public List getConstructors() { + return constructors; + } + + @Override + public void accept(ASTVisitor visitor) { + visitor.visit(this); + } + + public Collection getSuperInterfaces() { + return implementedInterfaces; + } + + public String toString() { + return this.name.toString() + this.genericClassParameters.toString(); + } + +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/Constructor.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/Constructor.java new file mode 100644 index 0000000..7766c6d --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/Constructor.java @@ -0,0 +1,36 @@ +package de.dhbwstuttgart.syntaxtree; + +import de.dhbwstuttgart.parser.NullToken; +import de.dhbwstuttgart.syntaxtree.statement.Statement; +import de.dhbwstuttgart.syntaxtree.statement.Super; +import de.dhbwstuttgart.syntaxtree.statement.SuperCall; +import de.dhbwstuttgart.syntaxtree.type.RefType; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import de.dhbwstuttgart.syntaxtree.type.Void; +import org.antlr.v4.runtime.Token; + +import de.dhbwstuttgart.syntaxtree.statement.Block; + +import java.sql.Ref; +import java.util.ArrayList; +import java.util.List; + +import de.dhbwstuttgart.syntaxtree.Method; +import de.dhbwstuttgart.syntaxtree.GenericDeclarationList; +import de.dhbwstuttgart.syntaxtree.ParameterList; +import de.dhbwstuttgart.syntaxtree.ASTVisitor; +import java.lang.String; +import java.lang.Integer; + +public class Constructor extends Method { + + // TODO: Constructor braucht ein super-Statement + public Constructor(int modifier, String name, RefTypeOrTPHOrWildcardOrGeneric returnType, ParameterList parameterList, Block codeInsideConstructor, GenericDeclarationList gtvDeclarations, Token offset) { + super(modifier, name, returnType, parameterList, codeInsideConstructor, gtvDeclarations, offset); + } + + @Override + public void accept(ASTVisitor visitor) { + visitor.visit(this); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/ExceptionList.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/ExceptionList.java new file mode 100644 index 0000000..78f0020 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/ExceptionList.java @@ -0,0 +1,14 @@ +package de.dhbwstuttgart.syntaxtree; + +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; + +import java.util.List; + +public class ExceptionList +{ + private List exceptions; + + public ExceptionList(List exceptions){ + this.exceptions = exceptions; + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/ExpressionPattern.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/ExpressionPattern.java new file mode 100644 index 0000000..4a050b1 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/ExpressionPattern.java @@ -0,0 +1,28 @@ +package de.dhbwstuttgart.syntaxtree; + +import de.dhbwstuttgart.syntaxtree.statement.Expression; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import org.antlr.v4.runtime.Token; + +public class ExpressionPattern extends Pattern { + private final Expression expression; + + public ExpressionPattern(Expression expression, Token offset) { + super(expression.getType(), offset); + this.expression = expression; + } + + public Expression getExpression() { + return expression; + } + + @Override + public void accept(ASTVisitor visitor) { + visitor.visit(this); + } + + @Override + public ExpressionPattern withType(RefTypeOrTPHOrWildcardOrGeneric type) { + return new ExpressionPattern(expression, getOffset()); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/Field.jav b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/Field.jav new file mode 100644 index 0000000..ec92db0 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/Field.jav @@ -0,0 +1,53 @@ +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; + private String name; + private RefTypeOrTPHOrWildcardOrGeneric type; + + public Field(String name, RefTypeOrTPHOrWildcardOrGeneric type, int modifier, Token offset) { + super(offset); + this.name = name; + this.type = type; + this.modifier = modifier; + } + + public String getName() { + return this.name; + } + + public RefTypeOrTPHOrWildcardOrGeneric getType() { + return type; + } + + @Override + public void accept(ASTVisitor visitor) { + visitor.visit(this); + } + + @Override + public Iterable getGenerics() { + return new ArrayList<>(); + } + + @Override + public RefTypeOrTPHOrWildcardOrGeneric getReturnType() { + return type; + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/FieldDeclaration.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/FieldDeclaration.java new file mode 100644 index 0000000..a0c420e --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/FieldDeclaration.java @@ -0,0 +1,28 @@ +package de.dhbwstuttgart.syntaxtree; + +import de.dhbwstuttgart.syntaxtree.statement.Expression; +import org.antlr.v4.runtime.Token; + +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; + +/** + * Eine Feldinitialisation steht für eine Felddeklaration mit gleichzeitiger Wertzuweisung + * Beispiel: 'public Feld FeldVar = FeldWert;' + * @author janulrich + * + */ +public class FieldDeclaration extends Field{ + + private Expression wert; + + /** + * Dieser Konstruktor der FieldDeclaration erstellt den Syntaxknoten vollständig. + * Kein nachträgliches hinzfügen von Informationen oder aufrufen von parserPostProcessing ist notwendig. + */ + public FieldDeclaration(String name, RefTypeOrTPHOrWildcardOrGeneric typ, int modifier, Expression value, Token offset){ + super(name, typ, modifier, offset);//Dieser Deklarator wird nicht vom Parser aufgerufen. Dadurch gibt es auch keinen Offset + this.wert = value; + } + + +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/FormalParameter.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/FormalParameter.java new file mode 100644 index 0000000..841147e --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/FormalParameter.java @@ -0,0 +1,27 @@ +package de.dhbwstuttgart.syntaxtree; + +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import org.antlr.v4.runtime.Token; + +public class FormalParameter extends Pattern { + private String name; + + public FormalParameter(String name, RefTypeOrTPHOrWildcardOrGeneric type, Token offset) { + super(type, offset); + this.name = name; + } + + public String getName() { + return name; + } + + @Override + public void accept(ASTVisitor visitor) { + visitor.visit(this); + } + + @Override + public FormalParameter withType(RefTypeOrTPHOrWildcardOrGeneric type) { + return new FormalParameter(name, type, getOffset()); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/GenericDeclarationList.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/GenericDeclarationList.java new file mode 100644 index 0000000..c579c46 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/GenericDeclarationList.java @@ -0,0 +1,65 @@ +package de.dhbwstuttgart.syntaxtree; + +import org.antlr.v4.runtime.Token; + +import com.google.common.collect.Lists; + +import de.dhbwstuttgart.parser.NullToken; + +import java.util.*; + + +/** + * Stellt eine Deklarations-Liste von Generischen Variablen dar. + * Kann vor Methoden und Klassen auftauchen. (<....>) + * @author janulrich + * + */ +public class GenericDeclarationList extends SyntaxTreeNode implements Iterable{ + + private Token offsetOfLastElement; + private List gtvs = new ArrayList<>(); + + @SuppressWarnings("unchecked") + public GenericDeclarationList(Iterable values, Token endOffset) { + super(endOffset); + gtvs = isListOfGenericTypeVar(values) ? (List)values : Lists.newArrayList(values); + this.offsetOfLastElement = endOffset; + } + + public GenericDeclarationList(ArrayList values, Token endOffset) { + super(endOffset); + gtvs = values; + this.offsetOfLastElement = endOffset; } + + private boolean isListOfGenericTypeVar(Iterable values) { + return values instanceof List && ((List)values).size() > 0 && ((List)values).get(0) instanceof GenericTypeVar; + } + + @Override + public Iterator iterator() { + return gtvs.iterator(); + } + + @Override + public void accept(ASTVisitor visitor) { + visitor.visit(this); + } + + public String toString() { + return this.gtvs.toString(); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + GenericDeclarationList that = (GenericDeclarationList) o; + return gtvs.equals(that.gtvs); + } + + @Override + public int hashCode() { + return Objects.hash(gtvs); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/GenericTypeVar.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/GenericTypeVar.java new file mode 100644 index 0000000..80c57db --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/GenericTypeVar.java @@ -0,0 +1,78 @@ +package de.dhbwstuttgart.syntaxtree; + +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; + +import org.antlr.v4.runtime.Token; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * Entspricht einem GenericTypeVar, jedoch mit Bounds + * (d.h. vorgaben, von welchem Typ die Typevar sein darf + * => extends Class x + * => implements Interface y + * ... + * @author hoti 4.5.06 + * + */ +public class GenericTypeVar extends SyntaxTreeNode +{ + + /** + * Hier sind die Bounds in Form von Type-Objekten abgespeichert + */ + List bounds=new ArrayList(); + private Token endOffset; + private String name; + + public GenericTypeVar(String s, List bounds, Token offset, Token endOffset) + { + super(offset); + name = s; + if(bounds != null)for(RefTypeOrTPHOrWildcardOrGeneric t : bounds){ + //if(t!=null)this.extendVars.add(t); + } + //this.genericTypeVar = new RefType(s,offset); + this.bounds = bounds; + this.endOffset = endOffset; + } + + public List getBounds() + { + return bounds; + } + + public String toString() + { + return "BoGTV " + this.name + " " + this.bounds; + } + + public String getName(){ + return name.toString(); + } + + /* + public JavaClassName definingClass(){ + return name.getParentClass(); + } +*/ + @Override + public void accept(ASTVisitor visitor) { + visitor.visit(this); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + GenericTypeVar that = (GenericTypeVar) o; + return bounds.equals(that.bounds) && name.equals(that.name); + } + + @Override + public int hashCode() { + return Objects.hash(bounds, name); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/GuardedPattern.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/GuardedPattern.java new file mode 100644 index 0000000..c8ca1d7 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/GuardedPattern.java @@ -0,0 +1,35 @@ +package de.dhbwstuttgart.syntaxtree; + +import de.dhbwstuttgart.syntaxtree.statement.Expression; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import org.antlr.v4.runtime.Token; + +public class GuardedPattern extends Pattern { + + private final Expression condition; + private final Pattern nested; + + public GuardedPattern(Expression condition, Pattern nested, Token offset) { + super(nested.getType(), offset); + this.condition = condition; + this.nested = nested; + } + + public Expression getCondition() { + return condition; + } + + public Pattern getNestedPattern() { + return nested; + } + + @Override + public void accept(ASTVisitor visitor) { + visitor.visit(this); + } + + @Override + public GuardedPattern withType(RefTypeOrTPHOrWildcardOrGeneric type) { + return new GuardedPattern(condition, nested, getOffset()); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/Method.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/Method.java new file mode 100644 index 0000000..904e4c8 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/Method.java @@ -0,0 +1,96 @@ +package de.dhbwstuttgart.syntaxtree; + +import java.util.ArrayList; + +import de.dhbwstuttgart.parser.NullToken; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceBlockInformation; +import de.dhbwstuttgart.typeinference.constraints.ConstraintSet; +import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceInformation; +import de.dhbwstuttgart.typeinference.typeAlgo.TYPE; +import de.dhbwstuttgart.typeinference.typeAlgo.TYPEStmt; +import org.antlr.v4.runtime.Token; + +import de.dhbwstuttgart.core.IItemWithOffset; +import de.dhbwstuttgart.syntaxtree.statement.Block; + +/** + * Stellt eine Methode dar. Problem: Parser kann nicht zwischen Methode und + * Konstruktor unterscheiden. Daher kann diese Klasse beides sein. Dies wird mit + * dem ParserPostProcessing behoben. + * + * @author janulrich + * + */ +public class Method extends SyntaxTreeNode implements IItemWithOffset, TypeScope +{ + public final Block block; + public final int modifier; + public final String name; + private ParameterList parameterlist = new ParameterList(new ArrayList<>(), new NullToken()); + private ExceptionList exceptionlist; + private GenericDeclarationList generics; + private final RefTypeOrTPHOrWildcardOrGeneric returnType; + public final Boolean isInherited; + + /* + * its Constraints + * eingefuegt PL 2021-02-15 + */ + public final ConstraintSet constraints = new ConstraintSet(); + + public Method(int modifier, String name, RefTypeOrTPHOrWildcardOrGeneric returnType, ParameterList parameterList, Block block, + GenericDeclarationList gtvDeclarations, Token offset) { + super(offset); + this.name = name; + this.modifier = modifier; + this.returnType = returnType; + this.parameterlist = parameterList; + this.block = block; + this.generics = gtvDeclarations; + this.isInherited = false; + } + + public Method(int modifier, String name, RefTypeOrTPHOrWildcardOrGeneric returnType, ParameterList parameterList, Block block, + GenericDeclarationList gtvDeclarations, Token offset, Boolean isInherited) { + super(offset); + this.name = name; + this.modifier = modifier; + this.returnType = returnType; + this.parameterlist = parameterList; + this.block = block; + this.generics = gtvDeclarations; + this.isInherited = isInherited; + } + + public ParameterList getParameterList() { + return parameterlist; + } + + public GenericDeclarationList getGenerics() { + return generics; + } + + @Override + public RefTypeOrTPHOrWildcardOrGeneric getReturnType() { + return this.returnType; + } + + public ConstraintSet getConstraints() { + return this.constraints; + } + + @Override + public void accept(ASTVisitor visitor) { + visitor.visit(this); + } + + @Override + public Token getOffset() { + return super.getOffset(); + } + + public String getName() { + return name; + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/ParameterList.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/ParameterList.java new file mode 100644 index 0000000..cc18290 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/ParameterList.java @@ -0,0 +1,36 @@ +package de.dhbwstuttgart.syntaxtree; + +import org.antlr.v4.runtime.Token; + +import java.util.Iterator; +import java.util.List; + +public class ParameterList extends SyntaxTreeNode implements Iterable { + private List formalparameter; + + public ParameterList(List params, Token offset) { + super(offset); + this.formalparameter = params; + } + + public Pattern getParameterAt(int i) { + if (i >= formalparameter.size()) + return null; + + return formalparameter.get(i); + } + + public List getFormalparalist() { + return formalparameter; + } + + @Override + public Iterator iterator() { + return formalparameter.iterator(); + } + + @Override + public void accept(ASTVisitor visitor) { + visitor.visit(this); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/Pattern.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/Pattern.java new file mode 100644 index 0000000..85c880e --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/Pattern.java @@ -0,0 +1,19 @@ +package de.dhbwstuttgart.syntaxtree; + +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import org.antlr.v4.runtime.Token; + +public abstract class Pattern extends SyntaxTreeNode { + private final RefTypeOrTPHOrWildcardOrGeneric type; + + public Pattern(RefTypeOrTPHOrWildcardOrGeneric type, Token offset) { + super(offset); + this.type = type; + } + + public RefTypeOrTPHOrWildcardOrGeneric getType(){ + return type; + } + + public abstract Pattern withType(RefTypeOrTPHOrWildcardOrGeneric type); +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/Record.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/Record.java new file mode 100644 index 0000000..8fe6258 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/Record.java @@ -0,0 +1,19 @@ +package de.dhbwstuttgart.syntaxtree; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +import org.antlr.v4.runtime.Token; + +import de.dhbwstuttgart.parser.scope.JavaClassName; +import de.dhbwstuttgart.syntaxtree.type.RefType; + +import javax.swing.text.html.Option; + +public class Record extends ClassOrInterface { + + public Record(int modifiers, JavaClassName name, List fielddecl, Optional fieldInitializations, Optional staticInitializer, List methods, List constructors, GenericDeclarationList genericClassParameters, RefType superClass, Boolean isInterface, List implementedInterfaces, Token offset, String fileName) { + super(modifiers, name, fielddecl, fieldInitializations, staticInitializer, methods, constructors, genericClassParameters, superClass, isInterface, methods.size() == 1 ? true : false, implementedInterfaces, new ArrayList<>(), offset, fileName); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/RecordPattern.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/RecordPattern.java new file mode 100644 index 0000000..506a6dd --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/RecordPattern.java @@ -0,0 +1,33 @@ +package de.dhbwstuttgart.syntaxtree; + +import java.util.ArrayList; +import java.util.List; + +import org.antlr.v4.runtime.Token; + +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; + +public class RecordPattern extends FormalParameter { + + private final List subPattern; + + public RecordPattern(String name, RefTypeOrTPHOrWildcardOrGeneric type, Token offset) { + super(name, type, offset); + subPattern = new ArrayList<>(); + } + + public RecordPattern(List subPattern, String name, RefTypeOrTPHOrWildcardOrGeneric type, Token offset) { + super(name, type, offset); + this.subPattern = subPattern; + } + + public List getSubPattern() { + return this.subPattern; + } + + @Override + public void accept(ASTVisitor visitor) { + visitor.visit(this); + } + +} \ No newline at end of file diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/SourceFile.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/SourceFile.java new file mode 100644 index 0000000..a0a7e42 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/SourceFile.java @@ -0,0 +1,64 @@ +package de.dhbwstuttgart.syntaxtree; + +import java.io.File; +import java.util.*; + +import de.dhbwstuttgart.parser.NullToken; +import de.dhbwstuttgart.parser.scope.JavaClassName; +import de.dhbwstuttgart.typeinference.constraints.ConstraintSet; +import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceInformation; +//import sun.security.x509.X509CertInfo; + +public class SourceFile extends SyntaxTreeNode { + private String pkgName; + + public final List KlassenVektor; + public final Set imports; + + public List availableClasses = new ArrayList<>(); + + /** + * Die SourceFile repräsntiert eine zu einem Syntaxbaum eingelesene Java-Datei. + * SourceFile stellt dabei den Wurzelknoten des Syntaxbaumes dar. + */ + public SourceFile(String pkgName, List classDefinitions, Set imports) { + super(new NullToken()); + //if (classDefinitions.size() > 0) { // Enthält die Liste Klassen? + this.KlassenVektor = classDefinitions; // Klassen werden übernommen + //} else { + // this.KlassenVektor = null; // es handelt sich um ein "Java Module" + //} + this.pkgName = pkgName; + this.imports = imports; + } + + public SourceFile(SourceFile sf) { + super(new NullToken()); + this.KlassenVektor = new ArrayList<>(sf.KlassenVektor); + this.imports = new HashSet<>(sf.imports); + } + + public String getPkgName() { + return this.pkgName; + } + + // Get imports (to test implementation) + public Set getImports() { + return this.imports; + } + + public List getClasses() { + return KlassenVektor; + } + + public List getAllMethods() { + List ret = new ArrayList<>(); + getClasses().forEach(cl -> ret.addAll(cl.getMethods())); + return ret; + } + + @Override + public void accept(ASTVisitor visitor) { + visitor.visit(this); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/StatementVisitor.jav b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/StatementVisitor.jav new file mode 100644 index 0000000..68d2dc5 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/StatementVisitor.jav @@ -0,0 +1,118 @@ +package de.dhbwstuttgart.syntaxtree; + +import de.dhbwstuttgart.parser.SyntaxTreeGenerator.AssignToLocal; +import de.dhbwstuttgart.syntaxtree.statement.ArgumentList; +import de.dhbwstuttgart.syntaxtree.statement.LambdaExpression; +import de.dhbwstuttgart.syntaxtree.statement.Assign; +import de.dhbwstuttgart.syntaxtree.statement.BinaryExpr; +import de.dhbwstuttgart.syntaxtree.statement.BoolExpression; +import de.dhbwstuttgart.syntaxtree.statement.Block; +import de.dhbwstuttgart.syntaxtree.statement.CastExpr; +import de.dhbwstuttgart.syntaxtree.statement.EmptyStmt; +import de.dhbwstuttgart.syntaxtree.statement.FieldVar; +import de.dhbwstuttgart.syntaxtree.statement.ForStmt; +import de.dhbwstuttgart.syntaxtree.statement.ForEachStmt; +import de.dhbwstuttgart.syntaxtree.statement.IfStmt; +import de.dhbwstuttgart.syntaxtree.statement.InstanceOf; +import de.dhbwstuttgart.syntaxtree.statement.LocalVar; +import de.dhbwstuttgart.syntaxtree.statement.LocalVarDecl; +import de.dhbwstuttgart.syntaxtree.statement.MethodCall; +import de.dhbwstuttgart.syntaxtree.statement.NewClass; +import de.dhbwstuttgart.syntaxtree.statement.NewArray; +import de.dhbwstuttgart.syntaxtree.statement.Return; +import de.dhbwstuttgart.syntaxtree.statement.ReturnVoid; +import de.dhbwstuttgart.syntaxtree.statement.Switch; +import de.dhbwstuttgart.syntaxtree.statement.SwitchBlock; +import de.dhbwstuttgart.syntaxtree.statement.SwitchLabel; +import de.dhbwstuttgart.syntaxtree.statement.Break; +import de.dhbwstuttgart.syntaxtree.statement.Yield; +import de.dhbwstuttgart.syntaxtree.statement.StaticClassName; +import de.dhbwstuttgart.syntaxtree.statement.Super; +import de.dhbwstuttgart.syntaxtree.statement.This; +import de.dhbwstuttgart.syntaxtree.statement.WhileStmt; +import de.dhbwstuttgart.syntaxtree.statement.DoStmt; +import de.dhbwstuttgart.syntaxtree.statement.AssignToField; +import de.dhbwstuttgart.syntaxtree.statement.SuperCall; +import de.dhbwstuttgart.syntaxtree.statement.ExpressionReceiver; +import de.dhbwstuttgart.syntaxtree.statement.UnaryExpr; +import de.dhbwstuttgart.syntaxtree.statement.Literal; +import de.dhbwstuttgart.syntaxtree.statement.Throw; + + + +public interface StatementVisitor { + + void visit(ArgumentList argumentList); + + void visit(LambdaExpression lambdaExpression); + + void visit(Assign assign); + + void visit(BinaryExpr binary); + + void visit(BoolExpression logical); + + void visit(Block block); + + void visit(CastExpr castExpr); + + void visit(EmptyStmt emptyStmt); + + void visit(FieldVar fieldVar); + + void visit(ForStmt forStmt); + + void visit(ForEachStmt forEachStmt); + + void visit(IfStmt ifStmt); + + void visit(InstanceOf instanceOf); + + void visit(LocalVar localVar); + + void visit(LocalVarDecl localVarDecl); + + void visit(MethodCall methodCall); + + void visit(NewClass methodCall); + + void visit(NewArray newArray); + + void visit(Return aReturn); + + void visit(ReturnVoid aReturn); + + void visit(Switch switchStmt); + + void visit(SwitchBlock switchBlock); + + void visit(SwitchLabel switchLabel); + + void visit(Break aBreak); + + void visit(Yield aYield); + + void visit(StaticClassName staticClassName); + + void visit(Super aSuper); + + void visit(This aThis); + + void visit(WhileStmt whileStmt); + + void visit(DoStmt whileStmt); + + void visit(AssignToField assignLeftSide); + + void visit(AssignToLocal assignLeftSide); + + void visit(SuperCall superCall); + + void visit(ExpressionReceiver expressionReceiver); + + void visit(UnaryExpr unaryExpr); + + void visit(Literal literal); + + void visit(Throw aThrow); +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/SyntaxTreeNode.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/SyntaxTreeNode.java new file mode 100644 index 0000000..a9886e2 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/SyntaxTreeNode.java @@ -0,0 +1,23 @@ +package de.dhbwstuttgart.syntaxtree; + +import java.util.ArrayList; +import java.util.List; + +import de.dhbwstuttgart.core.IItemWithOffset; +import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceInformation; +import org.antlr.v4.runtime.Token; +//import org.antlr.v4.runtime.misc.Pair; + +public abstract class SyntaxTreeNode implements IItemWithOffset{ + private final Token offset; + + public SyntaxTreeNode(Token offset){ + this.offset = offset; + } + + public Token getOffset(){ + return offset; + } + + public abstract void accept(ASTVisitor visitor); +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/TypeScope.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/TypeScope.java new file mode 100644 index 0000000..814586e --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/TypeScope.java @@ -0,0 +1,13 @@ +package de.dhbwstuttgart.syntaxtree; + +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import de.dhbwstuttgart.syntaxtree.GenericTypeVar; + +import java.lang.Iterable; + + +public interface TypeScope { + Iterable getGenerics(); + + RefTypeOrTPHOrWildcardOrGeneric getReturnType(); +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/factory/ASTFactory.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/factory/ASTFactory.java new file mode 100644 index 0000000..eb1538d --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/factory/ASTFactory.java @@ -0,0 +1,450 @@ +package de.dhbwstuttgart.syntaxtree.factory; + +import java.io.File; +import java.io.IOException; +import java.lang.annotation.Annotation; +import java.lang.reflect.*; +import java.lang.reflect.Constructor; +import java.lang.reflect.Type; +import java.util.*; + +import de.dhbwstuttgart.bytecode.JavaTXSignatureAttribute; +import de.dhbwstuttgart.parser.NullToken; +import de.dhbwstuttgart.parser.scope.JavaClassName; +import de.dhbwstuttgart.syntaxtree.*; +import de.dhbwstuttgart.syntaxtree.Field; +import de.dhbwstuttgart.syntaxtree.Method; +import de.dhbwstuttgart.syntaxtree.type.*; +import de.dhbwstuttgart.syntaxtree.type.Void; +import de.dhbwstuttgart.syntaxtree.statement.Block; +import de.dhbwstuttgart.syntaxtree.statement.Statement; +import de.dhbwstuttgart.syntaxtree.type.WildcardType; +import de.dhbwstuttgart.util.Pair; +import org.antlr.v4.runtime.Token; +import org.apache.commons.io.IOUtils; +import org.objectweb.asm.*; +import org.objectweb.asm.signature.SignatureReader; +import org.objectweb.asm.signature.SignatureVisitor; + +/** + * Anmerkung: Die ASTFactory Methoden, welche ASTBäume aus java.lang.Class Objekten generieren, können davon ausgehen, dass alle Imports und Typnamen korrekt sind und müssen diese nicht überprüfen. + */ +public class ASTFactory { + + private static final HashMap cache = new HashMap<>(); + + public static ClassOrInterface createClass(java.lang.Class jreClass) { + if (cache.containsKey(jreClass)) + return cache.get(jreClass); + + // TODO Inner classes + + var methodSignatures = new HashMap, String>(); + String classSignature = null; + + // Load class with asm to figure out if there's a JavaTX signature + try { + var path = jreClass.getName().replace('.', '/') + ".class"; + var classLoader = jreClass.getClassLoader(); + if (classLoader != null && new File(path).exists()) { + var bytes = IOUtils.toByteArray(Objects.requireNonNull(classLoader.getResourceAsStream(path))); + var classReader = new ClassReader(bytes); + var classVisitor = new ClassVisitor(Opcodes.ASM7) { + String classSignature; + + @Override + public void visitAttribute(Attribute attribute) { + if (attribute.type.equals("JavaTXSignature")) { + classSignature = ((JavaTXSignatureAttribute) attribute).signature; + } + super.visitAttribute(attribute); + } + + @Override + public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) { + classSignature = signature; + super.visit(version, access, name, signature, superName, interfaces); + } + + @Override + public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) { + + methodSignatures.put(new Pair<>(name, descriptor), signature); + return new MethodVisitor(Opcodes.ASM7) { + @Override + public void visitAttribute(Attribute attribute) { + if (attribute.type.equals("JavaTXSignature")) { + methodSignatures.put(new Pair<>(name, descriptor), ((JavaTXSignatureAttribute) attribute).signature); + } + super.visitAttribute(attribute); + } + }; + } + }; + + classReader.accept(classVisitor, new Attribute[] { new JavaTXSignatureAttribute() }, ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES); + classSignature = classVisitor.classSignature; + } + } catch (IOException e) { + // Skip + } + JavaClassName name = new JavaClassName(jreClass.getName()); + List methoden = new ArrayList<>(); + List konstruktoren = new ArrayList<>(); + for (java.lang.reflect.Constructor constructor : jreClass.getConstructors()) { + var signature = methodSignatures.get(new Pair<>(constructor.getName(), org.objectweb.asm.Type.getConstructorDescriptor(constructor))); + createConstructor(constructor, signature, jreClass).map(c -> konstruktoren.add(c)); + } + + Set allMethods = new HashSet<>(Arrays.asList(jreClass.getMethods())); + if (jreClass.isInterface()) + allMethods.addAll(Arrays.asList(Object.class.getMethods())); // For some reason interfaces don't inherit from Object + + Set allDeclaredMethods = new HashSet<>(Arrays.asList(jreClass.getDeclaredMethods())); + Set allInheritedMethods = new HashSet<>(allMethods); + allInheritedMethods.removeAll(allDeclaredMethods); + for (java.lang.reflect.Method method : allDeclaredMethods) { + var signature = methodSignatures.get(new Pair<>(method.getName(), org.objectweb.asm.Type.getMethodDescriptor(method))); + methoden.add(createMethod(method, signature, jreClass, false)); + } + for (java.lang.reflect.Method method : allInheritedMethods) { + var signature = methodSignatures.get(new Pair<>(method.getName(), org.objectweb.asm.Type.getMethodDescriptor(method))); + methoden.add(createMethod(method, signature, jreClass, true)); + } + List felder = new ArrayList<>(); + for (java.lang.reflect.Field field : jreClass.getDeclaredFields()) { + felder.add(createField(field, name)); + } + int modifier = jreClass.getModifiers(); + boolean isInterface = jreClass.isInterface(); + List aLA; + boolean isFunctionalInterface = + (aLA = Arrays.asList(jreClass.getAnnotations())).size() > 0 && + aLA.get(0) instanceof FunctionalInterface ? + true : + false; + // see: https://stackoverflow.com/questions/9934774/getting-generic-parameter-from-supertype-class + ParameterizedType parameterSuperClass = null; + Type tempSuperClass = jreClass.getGenericSuperclass(); + if (tempSuperClass != null && tempSuperClass instanceof ParameterizedType) + parameterSuperClass = (ParameterizedType) tempSuperClass; + java.lang.Class superjreClass = jreClass.getSuperclass(); + RefType superClass; + if (parameterSuperClass != null) { + superClass = (RefType) createType(parameterSuperClass); + } else if (superjreClass != null) { + superClass = (RefType) createType(superjreClass); + } else {// Jede Klasse und jedes Interface erbt von Object: (auch Object selbst!) + superClass = (RefType) createType(java.lang.Object.class); + } + List implementedInterfaces = new ArrayList<>(); + for (Type jreInterface : jreClass.getGenericInterfaces()) { + implementedInterfaces.add((RefType) createType(jreInterface)); + } + List permittedSubtypes = new ArrayList<>(); + if (jreClass.isSealed()) { + for (Class subclass : jreClass.getPermittedSubclasses()) { + permittedSubtypes.add((RefType) createType(subclass)); + } + } + + GenericDeclarationList genericDeclarationList = createGenerics(jreClass.getTypeParameters(), jreClass, null, classSignature); + + Token offset = new NullToken(); // Braucht keinen Offset, da diese Klasse nicht aus einem Quellcode geparst wurde + + var cinf = new ClassOrInterface(modifier, name, felder, Optional.empty() /* eingefuegt PL 2018-11-24 */, Optional.empty(), methoden, konstruktoren, genericDeclarationList, superClass, isInterface, isFunctionalInterface, implementedInterfaces, permittedSubtypes, offset, null); + cache.put(jreClass, cinf); + return cinf; + } + + private static Field createField(java.lang.reflect.Field field, JavaClassName jreClass) { + return new Field(field.getName(), createType(field.getGenericType()), field.getModifiers(), new NullToken()); + } + + // private static RefType createType(Class classType) { + // return createClass(classType).getType(); + // } + + private static Optional createConstructor(Constructor constructor, String signature, Class inClass) { + String name = constructor.getName(); + RefTypeOrTPHOrWildcardOrGeneric returnType = createType(inClass); + Parameter[] jreParams = constructor.getParameters(); + Type[] jreGenericParams = constructor.getGenericParameterTypes(); + List params = new ArrayList<>(); + int i = 0; + for (Type jreParam : jreGenericParams) { + if (jreParam == null) + continue; + RefTypeOrTPHOrWildcardOrGeneric paramType = createType(jreParam); + params.add(new FormalParameter(jreParams[i].getName(), paramType, new NullToken())); + i++; + } + ParameterList parameterList = new ParameterList(params, new NullToken()); + Block block = new Block(new ArrayList(), new NullToken()); + GenericDeclarationList gtvDeclarations = createGenerics(constructor.getTypeParameters(), inClass, constructor.getName(), signature); + Token offset = new NullToken(); + int modifier = constructor.getModifiers(); + + if (inClass.equals(java.lang.Object.class)) { + return Optional.empty(); + } + + return Optional.of(new de.dhbwstuttgart.syntaxtree.Constructor(modifier, name, returnType, parameterList, block, gtvDeclarations, offset /* , new ArrayList<>() geloescht PL 2018-11-24 */)); + } + + public static Method createMethod(java.lang.reflect.Method jreMethod, String signature, java.lang.Class inClass, Boolean isInherited) { + String name = jreMethod.getName(); + RefTypeOrTPHOrWildcardOrGeneric returnType; + Type jreRetType; + if (jreMethod.getGenericReturnType() != null) { + jreRetType = jreMethod.getGenericReturnType(); + } else { + jreRetType = jreMethod.getReturnType(); + } + returnType = createType(jreRetType); + Parameter[] jreParams = jreMethod.getParameters(); + Type[] jreGenericParams = jreMethod.getGenericParameterTypes(); + List params = new ArrayList<>(); + int i = 0; + for (Type jreParam : jreGenericParams) { + if (jreParam == null) + continue; + RefTypeOrTPHOrWildcardOrGeneric paramType = createType(jreParam); + params.add(new FormalParameter(jreParams[i].getName(), paramType, new NullToken())); + i++; + } + ParameterList parameterList = new ParameterList(params, new NullToken()); + Block block = new Block(new ArrayList(), new NullToken()); + GenericDeclarationList gtvDeclarations = createGenerics(jreMethod.getTypeParameters(), inClass, jreMethod.getName(), signature); + Token offset = new NullToken(); + + return new Method(jreMethod.getModifiers(), name, returnType, parameterList, block, gtvDeclarations, offset, isInherited); + } + + public static GenericDeclarationList createGenerics(TypeVariable[] typeParameters, Class context, String methodName, String signature) { + if (signature == null) { + List gtvs = new ArrayList<>(); + for (TypeVariable jreTV : typeParameters) { + de.dhbwstuttgart.syntaxtree.GenericTypeVar gtv = createGeneric(jreTV, jreTV.getName(), context, methodName); + gtvs.add(gtv); + } + return new GenericDeclarationList(gtvs, new NullToken()); + } else { + var res = createGenerics(signature); + return res; + } + } + + public static GenericDeclarationList createGenerics(String signature) { + if (signature == null) + return new GenericDeclarationList(new ArrayList<>(), new NullToken()); + + var gtvs = new ArrayList(); + var signatureVisitor = new SignatureVisitor(Opcodes.ASM7) { + List bounds = new ArrayList<>(); + final Stack bound = new Stack<>(); + final Stack classTypes = new Stack<>(); + + // All hail the mighty visitor pattern + final SignatureVisitor doNothing = new SignatureVisitor(Opcodes.ASM7) { + }; + + char wildcard = '='; + + @Override + public SignatureVisitor visitSuperclass() { + return doNothing; + } + + @Override + public SignatureVisitor visitParameterType() { + return doNothing; + } + + @Override + public SignatureVisitor visitReturnType() { + return doNothing; + } + + @Override + public SignatureVisitor visitExceptionType() { + return doNothing; + } + + @Override + public void visitFormalTypeParameter(String name) { + bounds = new ArrayList<>(); + gtvs.add(new GenericTypeVar(name, bounds, new NullToken(), new NullToken())); + } + + @Override + public void visitTypeVariable(String name) { + var refType = new GenericRefType(name, new NullToken()); + if (classTypes.isEmpty()) { + ((List) gtvs.get(gtvs.size() - 1).getBounds()).add(refType); + } else { + pushType(refType); + } + } + + @Override + public void visitClassType(String name) { + var refType = new RefType(new JavaClassName(name.replaceAll("/", ".")), new ArrayList<>(), new NullToken()); + classTypes.push(refType); + pushType(refType); + } + + void pushType(RefTypeOrTPHOrWildcardOrGeneric refType) { + if (wildcard == SignatureVisitor.SUPER) { + bound.push(new SuperWildcardType(refType, new NullToken())); + } else if (wildcard == SignatureVisitor.EXTENDS) { + bound.push(new ExtendsWildcardType(refType, new NullToken())); + } else { + bound.push(refType); + } + } + + @Override + public SignatureVisitor visitTypeArgument(char wildcard) { + this.wildcard = wildcard; + return this; + } + + boolean equals(RefTypeOrTPHOrWildcardOrGeneric a, RefTypeOrTPHOrWildcardOrGeneric b) { + if (b instanceof SuperWildcardType wc) + return equals(a, wc.getInnerType()); + else if (b instanceof ExtendsWildcardType wc) + return equals(a, wc.getInnerType()); + return a == b; + } + + @Override + public void visitEnd() { + wildcard = '='; + var classType = (RefType) classTypes.pop(); + if (!classTypes.isEmpty()) { + var next = classTypes.peek(); + var par = bound.pop(); + var toAdd = new ArrayList(); + while (!equals(next, par)) { + toAdd.add(par); + par = bound.pop(); + } + var element = par; + if (par instanceof WildcardType wc) { + element = wc.getInnerType(); + } + Collections.reverse(toAdd); + ((RefType) element).getParaList().addAll(toAdd); + + bound.push(par); + } else { + if (bound.peek() != classType) { + classType.getParaList().add(bound.pop()); + bounds.add(classType); + } else { + bounds.add(bound.pop()); + } + } + } + }; + + var sr = new SignatureReader(signature); + sr.accept(signatureVisitor); + + return new GenericDeclarationList(gtvs, new NullToken()); + } + + private static RefTypeOrTPHOrWildcardOrGeneric createType(java.lang.reflect.Type type) { + if (type == null || type.getTypeName().equals("void")) { + return new Void(new NullToken()); + } else if (type.getTypeName().equals("int")) { + return new RefType(new JavaClassName("java.lang.Integer"), new ArrayList<>(), new NullToken(), true); + } else if (type.getTypeName().equals("byte")) { + return new RefType(new JavaClassName("java.lang.Byte"), new ArrayList<>(), new NullToken(), true); + } else if (type.getTypeName().equals("boolean")) { + return new RefType(new JavaClassName("java.lang.Boolean"), new ArrayList<>(), new NullToken(), true); + } else if (type.getTypeName().equals("char")) { + return new RefType(new JavaClassName("java.lang.Character"), new ArrayList<>(), new NullToken(), true); + } else if (type.getTypeName().equals("short")) { + return new RefType(new JavaClassName("java.lang.Short"), new ArrayList<>(), new NullToken(), true); + } else if (type.getTypeName().equals("double")) { + return new RefType(new JavaClassName("java.lang.Double"), new ArrayList<>(), new NullToken(), true); + } else if (type.getTypeName().equals("long")) { + return new RefType(new JavaClassName("java.lang.Long"), new ArrayList<>(), new NullToken(), true); + } else { + if (type instanceof TypeVariable) { + // GTVDeclarationContext via "(TypeVariable) type).getGenericDeclaration()" + return new GenericRefType(type.getTypeName(), new NullToken()); + } + List params = new ArrayList<>(); + if (type instanceof ParameterizedType) { + for (Type t : ((ParameterizedType) type).getActualTypeArguments()) { + params.add(createType(t)); + } + } + String name = type.getTypeName(); + if (name.contains("<")) { // Komischer fix. Type von Generischen Typen kann die Generics im Namen enthalten Type
+ // Diese entfernen: + name = name.split("<")[0]; + } + if (type instanceof java.lang.reflect.WildcardType) { + java.lang.reflect.WildcardType wildcardType = (java.lang.reflect.WildcardType) type; + if (wildcardType.getLowerBounds().length > 0) { + return new SuperWildcardType(createType(wildcardType.getLowerBounds()[0]), new NullToken()); + } else if (wildcardType.getUpperBounds().length > 0) { + return new ExtendsWildcardType(createType(wildcardType.getUpperBounds()[0]), new NullToken()); + } else {// Es handelt sich um den '?'-Typ: + return new ExtendsWildcardType(createObjectType(), new NullToken()); + } + } else { + RefType ret = new RefType(new JavaClassName(name), params, new NullToken()); + return ret; + } + } + } + + public static de.dhbwstuttgart.syntaxtree.GenericTypeVar createGeneric(TypeVariable jreTypeVar, String jreTVName, Class context, String parentMethod) { + JavaClassName parentClass = new JavaClassName(context.getName()); + List genericBounds = new ArrayList<>(); + java.lang.reflect.Type[] bounds = jreTypeVar.getBounds(); + if (bounds.length > 0) { + for (java.lang.reflect.Type bound : bounds) { + genericBounds.add(createType(bound)); + } + } + return new de.dhbwstuttgart.syntaxtree.GenericTypeVar(jreTVName, genericBounds, new NullToken(), new NullToken()); + } + + public static ClassOrInterface createObjectClass() { + return createClass(Object.class); + } + + public static RefType createObjectType() { + return new RefType(createClass(Object.class).getClassName(), new NullToken()); + } + + /* + * public Constructor createEmptyConstructor(Class parent){ Block block = new Block(); block.setType(new de.dhbwstuttgart.syntaxtree.type.Void(block, 0)); block.statements.add(new SuperCall(block)); + * + * return ASTFactory.createConstructor(parent, new ParameterList(), block); } + * + * public static Constructor createConstructor(Class superClass, ParameterList paralist, Block block){ block.parserPostProcessing(superClass); + * + * Method method = ASTFactory.createMethod("", paralist, block, superClass); method.setType(new de.dhbwstuttgart.syntaxtree.type.Void(block, 0)); + * + * return new Constructor(method, superClass); } + * + * public static Class createClass(String className, RefType type, Modifiers modifiers, Menge supertypeGenPara, SourceFile parent) { // TODO bytecode createClass //String name, RefType superClass, Modifiers modifiers, Menge supertypeGenPara Class generatedClass = new Class(className, type, modifiers, supertypeGenPara); generatedClass.addField(ASTFactory.createEmptyConstructor(generatedClass)); + * + * generatedClass.parserPostProcessing(parent); + * + * return generatedClass; } + * + * public static Class createObject(){ return createClass(java.lang.Object.class); } + * + * public static Class createInterface(String className, RefType superClass, Modifiers modifiers, Menge supertypeGenPara, SourceFile parent){ Class generatedClass = new Class(new JavaClassName(className), new ArrayList(), new ArrayList(), modifiers, true, superClass, new ArrayList(), new GenericDeclarationList(), -1); generatedClass.parserPostProcessing(parent); return generatedClass; } + * + * public static RefType createObjectType(){ return createObjectClass().getType(); } + */ +} \ No newline at end of file diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/factory/NameGenerator.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/factory/NameGenerator.java new file mode 100644 index 0000000..06414b9 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/factory/NameGenerator.java @@ -0,0 +1,91 @@ +package de.dhbwstuttgart.syntaxtree.factory; + +public class NameGenerator { + + private static String strNextName = "A"; + + /** + * Setzt den zu Beginn der Typinferenz auf "A" zurueck. + * Dies ist bei JUnit-Test noetig + * TypePlaceholder.
Author: Martin Pluemicke + * @return void + */ + public static void reset() { + strNextName = "A"; + } + + /** + * Berechnet einen neuen, eindeutigen Namen f�r eine neue + * TypePlaceholder.
Author: J�rg B�uerle + * @return Der Name + */ + public static String makeNewName() + { + // otth: Funktion berechnet einen neuen Namen anhand eines alten gespeicherten + String strReturn = strNextName; + + // n�chster Name berechnen und in strNextName speichern + inc( strNextName.length() - 1 ); + + return strReturn; + } + + /** + * Hilfsfunktion zur Berechnung eines neuen Namens + *
Author: J�rg B�uerle + * @param i + */ + private static void inc(int i) + { + // otth: Hilfsfunktion zur Berechnung eines neuen Namens + // otth: Erh�hung des Buchstabens an der Stelle i im String strNextName + // otth: Nach �berlauf: rekursiver Aufruf + + // falls i = -1 --> neuer Buchstabe vorne anf�gen + if ( i == -1 ) + { + strNextName = "A" + strNextName; + return; + } + + char cBuchstabe = (char)(strNextName.charAt( i )); + cBuchstabe++; + if ( cBuchstabe - 65 > 25 ) + { + // aktuelle Stelle: auf A zuruecksetzen + manipulate( i, 'A' ); + + // vorherige Stelle erh�hen + inc( i - 1 ); + } + else + { + // aktueller Buchstabe �ndern + manipulate( i, cBuchstabe ); + } + + } + + /** + * Hilfsfunktion zur Berechnung eines neuen Namens. + *
Author: J�rg B�uerle + * @param nStelle + * @param nWert + */ + private static void manipulate( int nStelle, char nWert ) + { + // otth: Hilfsfunktion zur Berechnung eines neuen Namens + // otth: Ersetzt im String 'strNextName' an der Position 'nStelle' den Buchstaben durch 'nWert' + + String strTemp = ""; + for( int i = 0; i < strNextName.length(); i++) + { + if ( i == nStelle ) + strTemp = strTemp + nWert; + else + strTemp = strTemp + strNextName.charAt( i ); + } + strNextName = strTemp; + } + +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/factory/PrimitiveMethodsGenerator.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/factory/PrimitiveMethodsGenerator.java new file mode 100644 index 0000000..e8be685 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/factory/PrimitiveMethodsGenerator.java @@ -0,0 +1,9 @@ +package de.dhbwstuttgart.syntaxtree.factory; + +/** + * Generiert Hilfsmethoden für die Unary und Binary Operatoren + * Diese Methoden stellen die möglichen Operationen +,-,++, etc dar + */ +public class PrimitiveMethodsGenerator { + +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/factory/UnifyTypeFactory.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/factory/UnifyTypeFactory.java new file mode 100644 index 0000000..4037d2f --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/factory/UnifyTypeFactory.java @@ -0,0 +1,286 @@ +package de.dhbwstuttgart.syntaxtree.factory; + +import java.io.Writer; +import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + +import de.dhbwstuttgart.exceptions.NotImplementedException; +import de.dhbwstuttgart.parser.NullToken; +import de.dhbwstuttgart.parser.SourceLoc; +import de.dhbwstuttgart.parser.SyntaxTreeGenerator.FCGenerator; +import de.dhbwstuttgart.parser.scope.JavaClassName; +import de.dhbwstuttgart.syntaxtree.ClassOrInterface; +import de.dhbwstuttgart.syntaxtree.type.*; +import de.dhbwstuttgart.syntaxtree.type.Void; +import de.dhbwstuttgart.syntaxtree.type.WildcardType; +import de.dhbwstuttgart.typeinference.constraints.ConstraintSet; +import de.dhbwstuttgart.typeinference.constraints.Pair; +import de.dhbwstuttgart.typeinference.result.PairNoResult; +import de.dhbwstuttgart.typeinference.result.PairTPHEqualTPH; +import de.dhbwstuttgart.typeinference.result.PairTPHequalRefTypeOrWildcardType; +import de.dhbwstuttgart.typeinference.result.PairTPHsmallerTPH; +import de.dhbwstuttgart.typeinference.result.ResultPair; +import de.dhbwstuttgart.typeinference.unify.model.*; +import org.antlr.v4.runtime.Token; + +public class UnifyTypeFactory { + + private static ArrayList PLACEHOLDERS = new ArrayList<>(); + + public static FiniteClosure generateFC(List fromClasses, Writer logFile, ClassLoader classLoader) throws ClassNotFoundException { + /* + Die transitive Hülle muss funktionieren. + Man darf schreiben List
extends AL + und Vector extends List + hier muss dann aber dennoch die Vererbung V < L < AL + hergestellt werden. + In einem solchen Vererbungsbaum dürfen die TPH auch die gleichen Namen haben. + Generell dürfen sie immer die gleichen Namen haben. + TODO: die transitive Hülle bilden + */ + return new FiniteClosure(FCGenerator.toUnifyFC(fromClasses, classLoader), logFile); + } + + public static UnifyPair generateSmallerPair(UnifyType tl, UnifyType tr, SourceLoc location){ + return new UnifyPair(tl, tr, PairOperator.SMALLER, location); + } + + public static UnifyPair generateSmallerDotPair(UnifyType tl, UnifyType tr, SourceLoc location){ + return new UnifyPair(tl, tr, PairOperator.SMALLERDOT, location); + } + + public static UnifyPair generateSmallNotEqualDotPair(UnifyType tl, UnifyType tr, SourceLoc location){ + return new UnifyPair(tl, tr, PairOperator.SMALLERNEQDOT, location); + } + + public static UnifyPair generateEqualDotPair(UnifyType tl, UnifyType tr, SourceLoc location){ + return new UnifyPair(tl, tr, PairOperator.EQUALSDOT, location); + } + + /** + * Convert from + * ASTType -> UnifyType + */ + public static UnifyType convert(RefTypeOrTPHOrWildcardOrGeneric t, Boolean innerType){ + if(t instanceof GenericRefType){ + return UnifyTypeFactory.convert((GenericRefType)t, innerType); + }else if(t instanceof TypePlaceholder){ + return UnifyTypeFactory.convert((TypePlaceholder)t, innerType); + }else if(t instanceof ExtendsWildcardType){ + return UnifyTypeFactory.convert((ExtendsWildcardType)t, innerType); + }else if(t instanceof SuperWildcardType){ + return UnifyTypeFactory.convert((SuperWildcardType)t, innerType); + }else if(t instanceof RefType){ + return UnifyTypeFactory.convert((RefType)t, innerType); + } + //Es wurde versucht ein Typ umzuwandeln, welcher noch nicht von der Factory abgedeckt ist + throw new NotImplementedException("Der Typ "+t+" kann nicht umgewandelt werden"); + } + + public static UnifyType convert(RefType t, Boolean innerType){ + //Check if it is a FunN Type: + Pattern p = Pattern.compile("Fun(\\d+)[$][$]"); + Matcher m = p.matcher(t.getName().toString()); + boolean b = m.matches(); + if(b){ + Integer N = Integer.valueOf(m.group(1)); + if((N + 1) == t.getParaList().size()){ + return convertFunN(t.getParaList(), false); + } + } + UnifyType ret; + if(t.getParaList() != null && t.getParaList().size() > 0){ + List params = new ArrayList<>(); + for(RefTypeOrTPHOrWildcardOrGeneric pT : t.getParaList()){ + params.add(UnifyTypeFactory.convert(pT, true)); + } + ret = new ReferenceType(t.getName().toString(),new TypeParams(params)); + }else{ + ret = new ReferenceType(t.getName().toString(), false); + } + return ret; + } + + public static UnifyType convertFunN(List paraList, Boolean innerType){ + UnifyType ret; + List params = new ArrayList<>(); + if(paraList != null && paraList.size() > 0){ + for(RefTypeOrTPHOrWildcardOrGeneric pT : paraList){ + params.add(UnifyTypeFactory.convert(pT, false)); + } + } + ret = FunNType.getFunNType(new TypeParams(params)); + return ret; + } + + public static UnifyType convert(TypePlaceholder tph, Boolean innerType){ + if (tph.getName().equals("AFR")) { + System.out.println("XXX"+innerType); + } + PlaceholderType ntph = new PlaceholderType(tph.getName()); + ntph.setVariance(tph.getVariance()); + ntph.setOrCons(tph.getOrCons()); + int in = PLACEHOLDERS.indexOf(ntph); + if (in == -1) { + PLACEHOLDERS.add(ntph); + ntph.setInnerType(innerType); + return ntph; + } + else { + PlaceholderType oldpht = PLACEHOLDERS.get(in); + oldpht.setInnerType(oldpht.isInnerType() || innerType); + return oldpht; + } + } + + public static UnifyType convert(GenericRefType t, Boolean innerType){ + return new ReferenceType(t.getParsedName(), true); + } + + public static UnifyType convert(WildcardType t, Boolean innerType){ + if(t.isExtends()) + return new ExtendsType(UnifyTypeFactory.convert(t.getInnerType(), false)); + else if(t.isSuper()) + return new SuperType(UnifyTypeFactory.convert(t.getInnerType(), false)); + else throw new NotImplementedException(); + } + + + public static ConstraintSet convert(ConstraintSet constraints) { + return constraints.map(UnifyTypeFactory::convert); + } + + //NEVER USED + //public static Constraint convert(Constraint constraint){ + // Constraint unifyPairConstraint = constraint.stream() + // .map(UnifyTypeFactory::convert) + // .collect(Collectors.toCollection( () -> new Constraint (constraint.isInherited(), convert(constraint.getExtendConstraint())))); + // return unifyPairConstraint; + //} + + public static UnifyPair convert(Pair p) { + UnifyPair ret = null; + if(p.GetOperator().equals(PairOperator.SMALLERDOT)) { + ret = generateSmallerDotPair(UnifyTypeFactory.convert(p.TA1, false) + , UnifyTypeFactory.convert(p.TA2, false), p.getLocation()); + //return ret; + }else if(p.GetOperator().equals(PairOperator.SMALLERNEQDOT)) { + ret = generateSmallNotEqualDotPair(UnifyTypeFactory.convert(p.TA1, false) + , UnifyTypeFactory.convert(p.TA2, false), p.getLocation()); + //return ret; + }else if(p.GetOperator().equals(PairOperator.EQUALSDOT)) { + ret = generateEqualDotPair(UnifyTypeFactory.convert(p.TA1, false) + , UnifyTypeFactory.convert(p.TA2, false), p.getLocation()); + //return ret; + }else if(p.GetOperator().equals(PairOperator.SMALLER)){ + ret = generateSmallerPair(UnifyTypeFactory.convert(p.TA1, false), + UnifyTypeFactory.convert(p.TA2, false), p.getLocation()); + }else throw new NotImplementedException(); + UnifyType lhs, rhs; + if (((lhs = ret.getLhsType()) instanceof PlaceholderType) + && ((PlaceholderType)lhs).isWildcardable() + && (rhs = ret.getLhsType()) instanceof PlaceholderType) { + if (lhs.getName().equals("AQ")) { + System.out.println(""); + } + ((PlaceholderType)rhs).enableWildcardtable(); + } + + if (((rhs = ret.getLhsType()) instanceof PlaceholderType) + && ((PlaceholderType)rhs).isWildcardable() + && (lhs = ret.getLhsType()) instanceof PlaceholderType) { + if (rhs.getName().equals("AQ")) { + System.out.println(""); + } + ((PlaceholderType)lhs).enableWildcardtable(); + } + return ret; + } + + /** + * Convert from + * UnifyType -> ASTType + */ + public static Set convert(Set unifyPairSet, Map tphs) { + return unifyPairSet.stream().map( + unifyPair -> convert(unifyPair, tphs)) + .collect(Collectors.toSet()); + } + + public static ResultPair convert(UnifyPair mp, Map tphs) { + if (mp == null) { return null;} //kann bei basePairs passieren + RefTypeOrTPHOrWildcardOrGeneric tl = UnifyTypeFactory.convert(mp.getLhsType(), tphs); + RefTypeOrTPHOrWildcardOrGeneric tr = UnifyTypeFactory.convert(mp.getRhsType(), tphs); + if(tl instanceof TypePlaceholder){ + if(tr instanceof TypePlaceholder) { + + if(mp.getPairOp().equals(PairOperator.EQUALSDOT)) { + return new PairTPHEqualTPH((TypePlaceholder)tl, (TypePlaceholder)tr); + //Einfach ignorieren TODO: Das hier muss ausgebessert werden: + //return new PairTPHequalRefTypeOrWildcardType((TypePlaceholder)tl, ASTFactory.createObjectType()); + }else{ + return new PairTPHsmallerTPH((TypePlaceholder)tl, (TypePlaceholder)tr, convert(mp.getBasePair(), tphs)); + } + }else if(tr instanceof RefType){ + return new PairTPHequalRefTypeOrWildcardType((TypePlaceholder)tl, (RefType) tr); + }else if(tr instanceof WildcardType){ + return new PairTPHequalRefTypeOrWildcardType((TypePlaceholder)tl, (WildcardType) tr); + }else if(tr instanceof GenericRefType){ + return new PairTPHequalRefTypeOrWildcardType((TypePlaceholder)tl, (GenericRefType) tr); + }else throw new NotImplementedException(); + }else return new PairNoResult(tl, tr);//throw new NotImplementedException(); + } + + public static RefTypeOrTPHOrWildcardOrGeneric convert(ReferenceType t, Map tphs) { + if(JavaClassName.Void.equals(t.getName()))return new Void(new NullToken()); + if (t.isGenTypeVar()) return new GenericRefType(t.getName(),new NullToken()); + RefType ret = new RefType(new JavaClassName(t.getName()),convert(t.getTypeParams(), tphs),new NullToken()); + return ret; + } + + public static RefTypeOrTPHOrWildcardOrGeneric convert(FunNType t, Map tphs) { + RefType ret = new RefType(new JavaClassName(t.getName()), convert(t.getTypeParams(), tphs), new NullToken()); + return ret; + } + + public static RefTypeOrTPHOrWildcardOrGeneric convert(SuperType t, Map tphs) { + RefTypeOrTPHOrWildcardOrGeneric innerType = convert(t.getSuperedType(), tphs); + return new SuperWildcardType(innerType, new NullToken()); + } + + public static RefTypeOrTPHOrWildcardOrGeneric convert(ExtendsType t, Map tphs) { + RefTypeOrTPHOrWildcardOrGeneric innerType = convert(t.getExtendedType(), tphs); + return new ExtendsWildcardType(innerType, new NullToken()); + } + + public static RefTypeOrTPHOrWildcardOrGeneric convert(PlaceholderType t, Map tphs) { + TypePlaceholder ret = tphs.get(t.getName()); + if(ret == null){ //Dieser TPH wurde vom Unifikationsalgorithmus erstellt + ret = TypePlaceholder.fresh(new NullToken()); + tphs.put(t.getName(), ret); + } + ret.setVariance(t.getVariance()); + return ret; + } + + public static RefTypeOrTPHOrWildcardOrGeneric convert(UnifyType t, Map tphs) { + if(t instanceof FunNType)return convert((FunNType) t, tphs); + if(t instanceof ReferenceType)return convert((ReferenceType) t, tphs); + if(t instanceof SuperType)return convert((SuperType) t, tphs); + if(t instanceof ExtendsType)return convert((ExtendsType) t, tphs); + if(t instanceof PlaceholderType)return convert((PlaceholderType) t, tphs); + throw new NotImplementedException("Der Typ "+t+" kann nicht umgewandelt werden"); + } + + private static List convert(TypeParams typeParams, Map tphs) { + List ret = new ArrayList<>(); + for(UnifyType uT : typeParams){ + RefTypeOrTPHOrWildcardOrGeneric toAdd = convert(uT, tphs); + ret.add(toAdd); + } + return ret; + } + +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/ArgumentList.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/ArgumentList.java new file mode 100644 index 0000000..ed5a082 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/ArgumentList.java @@ -0,0 +1,33 @@ +package de.dhbwstuttgart.syntaxtree.statement; + + +import de.dhbwstuttgart.syntaxtree.ASTVisitor; +import de.dhbwstuttgart.syntaxtree.StatementVisitor; +import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode; +import org.antlr.v4.runtime.Token; + +import java.util.List; + +public class ArgumentList extends SyntaxTreeNode +{ + public ArgumentList(List expr, Token offset) { + super(offset); + this.expr = expr; + } + + private List expr; + + public List getArguments(){ + return expr; + } + + + @Override + public void accept(ASTVisitor visitor) { + visitor.visit(this); + } + + public void accept(StatementVisitor visitor) { + visitor.visit(this); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/Assign.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/Assign.java new file mode 100644 index 0000000..a827805 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/Assign.java @@ -0,0 +1,28 @@ + +package de.dhbwstuttgart.syntaxtree.statement; + +import de.dhbwstuttgart.syntaxtree.StatementVisitor; +import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceBlockInformation; +import de.dhbwstuttgart.typeinference.constraints.ConstraintSet; +import de.dhbwstuttgart.typeinference.unify.model.PairOperator; +import org.antlr.v4.runtime.Token; + +/* +Aufbau: +rightSide = leftSide + */ +public class Assign extends Statement { + public final Expression rightSide; + public final AssignLeftSide lefSide; + + public Assign(AssignLeftSide leftHandSide, Expression value, Token offset) { + super(leftHandSide.getType(), offset); + this.rightSide = value; + this.lefSide = leftHandSide; + } + + @Override + public void accept(StatementVisitor visitor) { + visitor.visit(this); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/AssignLeftSide.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/AssignLeftSide.java new file mode 100644 index 0000000..13fec3f --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/AssignLeftSide.java @@ -0,0 +1,12 @@ +package de.dhbwstuttgart.syntaxtree.statement; + +import de.dhbwstuttgart.syntaxtree.StatementVisitor; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import org.antlr.v4.runtime.Token; + +public abstract class AssignLeftSide extends TypableStatement{ + + public AssignLeftSide(RefTypeOrTPHOrWildcardOrGeneric type, Token offset) { + super(type, offset); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/AssignToField.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/AssignToField.java new file mode 100644 index 0000000..8ed8b95 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/AssignToField.java @@ -0,0 +1,17 @@ +package de.dhbwstuttgart.syntaxtree.statement; + +import de.dhbwstuttgart.syntaxtree.StatementVisitor; + +public class AssignToField extends AssignLeftSide { + public final FieldVar field; + + public AssignToField(FieldVar fieldVar) { + super(fieldVar.getType(), fieldVar.getOffset()); + field = fieldVar; + } + + @Override + public void accept(StatementVisitor visitor) { + visitor.visit(this); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/BinaryExpr.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/BinaryExpr.java new file mode 100644 index 0000000..9902f48 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/BinaryExpr.java @@ -0,0 +1,41 @@ +package de.dhbwstuttgart.syntaxtree.statement; + +import de.dhbwstuttgart.syntaxtree.StatementVisitor; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import org.antlr.v4.runtime.Token; + +public class BinaryExpr extends Expression { + @Override + public void accept(StatementVisitor visitor) { + visitor.visit(this); + } + + public enum Operator { + ADD, // + + SUB, // - + MUL, // * + MOD, // Modulo Operator % + AND, // & + OR, // | + DIV, // / + LESSTHAN, // < + BIGGERTHAN, // > + LESSEQUAL, // <= + BIGGEREQUAL, // >= + EQUAL, // == + NOTEQUAL // != + } + + public final Operator operation; + public final Expression lexpr; + public final Expression rexpr; + + public BinaryExpr(Operator operation, RefTypeOrTPHOrWildcardOrGeneric type, Expression lexpr, Expression rexpr, Token offset) { + super(type, offset); + + this.operation = operation; + this.lexpr = lexpr; + this.rexpr = rexpr; + } + +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/Block.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/Block.java new file mode 100644 index 0000000..3cbcea3 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/Block.java @@ -0,0 +1,27 @@ +package de.dhbwstuttgart.syntaxtree.statement; + +import java.util.ArrayList; +import java.util.List; + +import org.antlr.v4.runtime.Token; + +import de.dhbwstuttgart.syntaxtree.StatementVisitor; +import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; + +public class Block extends Statement { + public Block(List statements, Token offset) { + super(TypePlaceholder.fresh(offset), offset); + this.statements = statements; + } + + public List statements = new ArrayList<>(); + + public List getStatements() { + return statements; + } + + @Override + public void accept(StatementVisitor visitor) { + visitor.visit(this); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/BoolExpression.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/BoolExpression.java new file mode 100644 index 0000000..018c6dc --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/BoolExpression.java @@ -0,0 +1,31 @@ +package de.dhbwstuttgart.syntaxtree.statement; + +import org.antlr.v4.runtime.Token; + +import de.dhbwstuttgart.syntaxtree.StatementVisitor; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; + +public class BoolExpression extends Expression { + + public enum Operator { + AND, // && + OR, // || + } + + public final Operator operation; + public final Expression lexpr; + public final Expression rexpr; + + public BoolExpression(Operator operation, RefTypeOrTPHOrWildcardOrGeneric type, Expression lexpr, Expression rexpr, Token offset) { + super(type, offset); + this.operation = operation; + this.lexpr = lexpr; + this.rexpr = rexpr; + } + + @Override + public void accept(StatementVisitor visitor) { + visitor.visit(this); + } + +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/Break.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/Break.java new file mode 100644 index 0000000..06dd4e6 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/Break.java @@ -0,0 +1,19 @@ +package de.dhbwstuttgart.syntaxtree.statement; + +import org.antlr.v4.runtime.Token; + +import de.dhbwstuttgart.syntaxtree.StatementVisitor; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; + +public class Break extends Statement { + + public Break(RefTypeOrTPHOrWildcardOrGeneric type, Token offset) { + super(type, offset); + } + + @Override + public void accept(StatementVisitor visitor) { + visitor.visit(this); + } + +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/CastExpr.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/CastExpr.java new file mode 100644 index 0000000..15fedbb --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/CastExpr.java @@ -0,0 +1,25 @@ +package de.dhbwstuttgart.syntaxtree.statement; + +import de.dhbwstuttgart.exceptions.NotImplementedException; +import de.dhbwstuttgart.syntaxtree.StatementVisitor; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceBlockInformation; +import de.dhbwstuttgart.typeinference.constraints.ConstraintSet; +import org.antlr.v4.runtime.Token; + + +public class CastExpr extends Expression +{ + public CastExpr(RefTypeOrTPHOrWildcardOrGeneric castType, Expression expr, Token offset) + { + super(castType, offset); + this.expr = expr; + } + + public Expression expr; + + @Override + public void accept(StatementVisitor visitor) { + visitor.visit(this); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/DoStmt.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/DoStmt.java new file mode 100644 index 0000000..b24396b --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/DoStmt.java @@ -0,0 +1,18 @@ +package de.dhbwstuttgart.syntaxtree.statement; + +import de.dhbwstuttgart.syntaxtree.StatementVisitor; +import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; +import org.antlr.v4.runtime.Token; + +public class DoStmt extends WhileStmt +{ + public DoStmt(Expression expr, Statement loopBlock, Token offset) + { + super(expr, loopBlock, offset); + } + + @Override + public void accept(StatementVisitor visitor) { + visitor.visit(this); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/EmptyStmt.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/EmptyStmt.java new file mode 100644 index 0000000..ff80e47 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/EmptyStmt.java @@ -0,0 +1,22 @@ +package de.dhbwstuttgart.syntaxtree.statement; + +import de.dhbwstuttgart.syntaxtree.StatementVisitor; +import de.dhbwstuttgart.syntaxtree.type.Void; +import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceBlockInformation; +import de.dhbwstuttgart.typeinference.constraints.ConstraintSet; +import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceInformation; +import org.antlr.v4.runtime.Token; + + +public class EmptyStmt extends Statement +{ + public EmptyStmt(Token offset) + { + super(new Void(offset),offset); + } + + @Override + public void accept(StatementVisitor visitor) { + visitor.visit(this); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/Expression.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/Expression.java new file mode 100644 index 0000000..3140070 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/Expression.java @@ -0,0 +1,16 @@ + +package de.dhbwstuttgart.syntaxtree.statement; + +import de.dhbwstuttgart.syntaxtree.ASTVisitor; +import de.dhbwstuttgart.syntaxtree.StatementVisitor; +import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceBlockInformation; +import de.dhbwstuttgart.typeinference.constraints.ConstraintSet; +import org.antlr.v4.runtime.Token; + +public abstract class Expression extends TypableStatement { + public Expression(RefTypeOrTPHOrWildcardOrGeneric type, Token offset) { + super(type, offset); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/ExpressionReceiver.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/ExpressionReceiver.java new file mode 100644 index 0000000..409cfe6 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/ExpressionReceiver.java @@ -0,0 +1,21 @@ +package de.dhbwstuttgart.syntaxtree.statement; + +import de.dhbwstuttgart.syntaxtree.StatementVisitor; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import org.antlr.v4.runtime.Token; + +public class ExpressionReceiver extends Receiver +{ + public final Expression expr; + + public ExpressionReceiver(Expression expr) + { + super(expr.getType(), expr.getOffset()); + this.expr = expr; + } + + @Override + public void accept(StatementVisitor visitor) { + visitor.visit(this); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/FieldVar.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/FieldVar.java new file mode 100644 index 0000000..cb98da4 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/FieldVar.java @@ -0,0 +1,33 @@ +package de.dhbwstuttgart.syntaxtree.statement; + +import de.dhbwstuttgart.exceptions.TypeinferenceException; +import de.dhbwstuttgart.syntaxtree.StatementVisitor; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import de.dhbwstuttgart.typeinference.assumptions.FieldAssumption; +import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceBlockInformation; +import de.dhbwstuttgart.typeinference.constraints.Constraint; +import de.dhbwstuttgart.typeinference.constraints.ConstraintSet; +import de.dhbwstuttgart.typeinference.unify.model.PairOperator; +import org.antlr.v4.runtime.Token; + +import java.util.HashSet; +import java.util.Set; + +public class FieldVar extends Expression { + + public final String fieldVarName; + public final Expression receiver; + public final boolean isStatic; + + public FieldVar(Expression receiver, boolean isStatic, String fieldVarName, RefTypeOrTPHOrWildcardOrGeneric type, Token offset) { + super(type, offset); + this.fieldVarName = fieldVarName; + this.receiver = receiver; + this.isStatic = isStatic; + } + + @Override + public void accept(StatementVisitor visitor) { + visitor.visit(this); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/ForEachStmt.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/ForEachStmt.java new file mode 100644 index 0000000..3686ea2 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/ForEachStmt.java @@ -0,0 +1,26 @@ +package de.dhbwstuttgart.syntaxtree.statement; + +import de.dhbwstuttgart.parser.NullToken; +import de.dhbwstuttgart.syntaxtree.StatementVisitor; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import de.dhbwstuttgart.syntaxtree.type.Void; +import org.antlr.v4.runtime.Token; + +public class ForEachStmt extends Statement { + + public final Statement statement; + public final Expression expression; + public final Statement block; + + public ForEachStmt(Token offset, Statement stmt, Expression expression, Statement block) { + super(new Void(new NullToken()), offset); + this.statement = stmt; + this.expression = expression; + this.block = block; + } + + @Override + public void accept(StatementVisitor visitor) { + visitor.visit(this); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/ForStmt.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/ForStmt.java new file mode 100644 index 0000000..cb73f32 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/ForStmt.java @@ -0,0 +1,34 @@ + +package de.dhbwstuttgart.syntaxtree.statement; + +import de.dhbwstuttgart.exceptions.NotImplementedException; +import de.dhbwstuttgart.parser.NullToken; +import de.dhbwstuttgart.syntaxtree.StatementVisitor; +import de.dhbwstuttgart.syntaxtree.type.Void; +import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceBlockInformation; +import de.dhbwstuttgart.typeinference.constraints.ConstraintSet; +import org.antlr.v4.runtime.Token; + +import java.util.List; + +public class ForStmt extends Statement +{ + public final List initializer; + public final Expression condition; + public final List loopExpr; + public final Statement block; + + public ForStmt(Token offset, List initializer, Expression condition, List loopExpr, Statement block) + { + super(new Void(new NullToken()), offset); + this.initializer = initializer; + this.condition = condition; + this.loopExpr = loopExpr; + this.block = block; + } + + @Override + public void accept(StatementVisitor visitor) { + visitor.visit(this); + } +} \ No newline at end of file diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/IfStmt.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/IfStmt.java new file mode 100644 index 0000000..2c64af8 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/IfStmt.java @@ -0,0 +1,26 @@ +package de.dhbwstuttgart.syntaxtree.statement; + +import de.dhbwstuttgart.syntaxtree.StatementVisitor; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceBlockInformation; +import de.dhbwstuttgart.typeinference.constraints.ConstraintSet; +import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceInformation; +import org.antlr.v4.runtime.Token; + +public class IfStmt extends Statement { + public final Expression expr; + public final Statement then_block; + public final Statement else_block; + + public IfStmt(RefTypeOrTPHOrWildcardOrGeneric type, Expression expr, Statement thenBlock, Statement elseBlock, Token offset) { + super(type, offset); + this.expr = expr; + this.then_block = thenBlock; + this.else_block = elseBlock; + } + + @Override + public void accept(StatementVisitor visitor) { + visitor.visit(this); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/InstanceOf.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/InstanceOf.java new file mode 100644 index 0000000..a3a0841 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/InstanceOf.java @@ -0,0 +1,38 @@ +package de.dhbwstuttgart.syntaxtree.statement; + +import de.dhbwstuttgart.syntaxtree.FormalParameter; +import de.dhbwstuttgart.syntaxtree.Pattern; +import org.antlr.v4.runtime.Token; + +import de.dhbwstuttgart.syntaxtree.StatementVisitor; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; + +public class InstanceOf extends Expression { + private final Pattern pattern; + private final Expression expr; + + public InstanceOf(Expression expr, RefTypeOrTPHOrWildcardOrGeneric type, RefTypeOrTPHOrWildcardOrGeneric reftype, Token offset) { + super(type, offset); + this.pattern = new FormalParameter(null, reftype, offset); + this.expr = expr; + } + + public InstanceOf(Expression expr, RefTypeOrTPHOrWildcardOrGeneric type, Pattern pattern, Token offset) { + super(type, offset); + this.pattern = pattern; + this.expr = expr; + } + + public Pattern getPattern() { + return pattern; + } + + public Expression getExpression() { + return expr; + } + + @Override + public void accept(StatementVisitor visitor) { + visitor.visit(this); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/JavaInternalExpression.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/JavaInternalExpression.java new file mode 100644 index 0000000..366c060 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/JavaInternalExpression.java @@ -0,0 +1,12 @@ +package de.dhbwstuttgart.syntaxtree.statement; + +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import org.antlr.v4.runtime.Token; + +import java.nio.charset.StandardCharsets; + +public abstract class JavaInternalExpression extends Statement{ + public JavaInternalExpression(RefTypeOrTPHOrWildcardOrGeneric retType, Token offset){ + super(retType, offset); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/LambdaExpression.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/LambdaExpression.java new file mode 100644 index 0000000..40e6595 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/LambdaExpression.java @@ -0,0 +1,42 @@ +package de.dhbwstuttgart.syntaxtree.statement; + +import de.dhbwstuttgart.syntaxtree.*; +import de.dhbwstuttgart.syntaxtree.type.RefType; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceBlockInformation; +import de.dhbwstuttgart.typeinference.constraints.Constraint; +import de.dhbwstuttgart.typeinference.constraints.ConstraintSet; +import de.dhbwstuttgart.typeinference.constraints.Pair; +import org.antlr.v4.runtime.Token; +//import sun.reflect.generics.reflectiveObjects.NotImplementedException; + +import java.util.ArrayList; + +public class LambdaExpression extends Expression implements TypeScope { + public final Block methodBody; + public final ParameterList params; + + public LambdaExpression(RefTypeOrTPHOrWildcardOrGeneric type, ParameterList params, Block methodBody, Token offset) { + super(type,offset); + this.methodBody = methodBody; + this.params = params; + } + + @Override + public void accept(StatementVisitor visitor) { + visitor.visit(this); + } + + @Override + public Iterable getGenerics() { + //Lambda-Ausdrücke haben keine Generics + return new ArrayList<>(); + } + + @Override + public RefTypeOrTPHOrWildcardOrGeneric getReturnType() { + //RefType type = (RefType) this.getType(); + //return type.getParaList().get(0); + return methodBody.getType(); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/Literal.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/Literal.java new file mode 100644 index 0000000..8bbaae0 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/Literal.java @@ -0,0 +1,24 @@ +package de.dhbwstuttgart.syntaxtree.statement; + + +import de.dhbwstuttgart.syntaxtree.StatementVisitor; +import de.dhbwstuttgart.syntaxtree.statement.Expression; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceBlockInformation; +import de.dhbwstuttgart.typeinference.constraints.ConstraintSet; +import org.antlr.v4.runtime.Token; + +public class Literal extends Expression +{ + public final Object value; + + public Literal(RefTypeOrTPHOrWildcardOrGeneric type, Object value, Token offset) { + super(type, offset); + this.value = value; + } + + @Override + public void accept(StatementVisitor visitor) { + visitor.visit(this); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/LocalVar.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/LocalVar.java new file mode 100644 index 0000000..75ac436 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/LocalVar.java @@ -0,0 +1,25 @@ +package de.dhbwstuttgart.syntaxtree.statement; + +import de.dhbwstuttgart.syntaxtree.StatementVisitor; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import org.antlr.v4.runtime.Token; + +public class LocalVar extends Statement { + + public final String name; + + public LocalVar(String n, RefTypeOrTPHOrWildcardOrGeneric type, Token offset) { + super(type, offset); + this.name = n; + } + + public LocalVar(Expression e1, RefTypeOrTPHOrWildcardOrGeneric type, String access) { + super(type, e1.getOffset()); + this.name = access; + } + + @Override + public void accept(StatementVisitor visitor) { + visitor.visit(this); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/LocalVarDecl.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/LocalVarDecl.java new file mode 100644 index 0000000..fde48e5 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/LocalVarDecl.java @@ -0,0 +1,31 @@ +package de.dhbwstuttgart.syntaxtree.statement; + + +import de.dhbwstuttgart.exceptions.NotImplementedException; +import de.dhbwstuttgart.syntaxtree.StatementVisitor; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceBlockInformation; +import de.dhbwstuttgart.typeinference.constraints.ConstraintSet; +import org.antlr.v4.runtime.Token; + + +public class LocalVarDecl extends Statement +{ + + private String name; + + public LocalVarDecl(String name, RefTypeOrTPHOrWildcardOrGeneric type, Token offset) + { + super(type, offset); + this.name = name; + } + + @Override + public void accept(StatementVisitor visitor) { + visitor.visit(this); + } + + public String getName() { + return name; + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/MethodCall.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/MethodCall.java new file mode 100644 index 0000000..e1deca0 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/MethodCall.java @@ -0,0 +1,56 @@ +package de.dhbwstuttgart.syntaxtree.statement; + +import de.dhbwstuttgart.exceptions.TypeinferenceException; +import de.dhbwstuttgart.syntaxtree.*; +import de.dhbwstuttgart.syntaxtree.type.RefType; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceBlockInformation; +import de.dhbwstuttgart.typeinference.constraints.Constraint; +import de.dhbwstuttgart.typeinference.constraints.ConstraintSet; +import de.dhbwstuttgart.typeinference.assumptions.MethodAssumption; +import de.dhbwstuttgart.typeinference.constraints.Pair; +import de.dhbwstuttgart.typeinference.unify.model.PairOperator; +import org.antlr.v4.runtime.Token; + +import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; + +import java.util.*; + + +public class MethodCall extends Statement +{ + public final String name; + public final Receiver receiver; + + public final ArgumentList arglist; + + public RefTypeOrTPHOrWildcardOrGeneric receiverType; + + //sind Tphs, repraesentieren im Resultset die Signatur der aufgerufenen Methoden, letztes Element ist der Returntyp + public final ArrayList signature; + + public MethodCall(RefTypeOrTPHOrWildcardOrGeneric retType, Receiver receiver, String methodName, ArgumentList argumentList, + RefTypeOrTPHOrWildcardOrGeneric receiverType, ArrayList signature, Token offset){ + super(retType,offset); + this.arglist = argumentList; + this.name = methodName; + this.receiver = receiver; + this.receiverType = receiverType; + this.signature = signature; + if (signature == null) throw new NullPointerException(); + } + + public List signatureArguments() { + return signature.subList(0, signature.size() - 1); + } + + + @Override + public void accept(StatementVisitor visitor) { + visitor.visit(this); + } + + public ArgumentList getArgumentList() { + return arglist; + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/NewArray.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/NewArray.java new file mode 100644 index 0000000..14c54d8 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/NewArray.java @@ -0,0 +1,24 @@ +package de.dhbwstuttgart.syntaxtree.statement; +import java.util.List; + +import de.dhbwstuttgart.syntaxtree.StatementVisitor; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceBlockInformation; +import de.dhbwstuttgart.typeinference.constraints.ConstraintSet; +import de.dhbwstuttgart.exceptions.NotImplementedException; + + +public class NewArray extends Expression +{ + public NewArray(int offset,int variableLength) + { + super(null,null); + } + private RefTypeOrTPHOrWildcardOrGeneric type; + public List expr; + + @Override + public void accept(StatementVisitor visitor) { + visitor.visit(this); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/NewClass.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/NewClass.java new file mode 100644 index 0000000..f27bc3e --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/NewClass.java @@ -0,0 +1,42 @@ +package de.dhbwstuttgart.syntaxtree.statement; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import de.dhbwstuttgart.exceptions.TypeinferenceException; +import de.dhbwstuttgart.parser.NullToken; +import de.dhbwstuttgart.syntaxtree.ClassOrInterface; +import de.dhbwstuttgart.syntaxtree.Method; +import de.dhbwstuttgart.syntaxtree.StatementVisitor; +import de.dhbwstuttgart.syntaxtree.type.RefType; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import de.dhbwstuttgart.typeinference.assumptions.MethodAssumption; +import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceBlockInformation; +import de.dhbwstuttgart.typeinference.constraints.Constraint; +import de.dhbwstuttgart.typeinference.constraints.ConstraintSet; +import de.dhbwstuttgart.typeinference.constraints.Pair; +import de.dhbwstuttgart.typeinference.unify.model.PairOperator; +import org.antlr.v4.runtime.Token; +import de.dhbwstuttgart.exceptions.NotImplementedException; + + +public class NewClass extends MethodCall +{ + /** + * + * @param newClass Typ der Instanzierten Klasse + * @param args Argumente mit denen der New-Call aufgerufen wurde + * @param start + */ + public NewClass(RefType newClass, ArgumentList args, RefTypeOrTPHOrWildcardOrGeneric receiverType, + ArrayList argTypes, Token start) { + super(newClass, new ExpressionReceiver(new EmptyStmt(start)), newClass.getName().toString(), + args, receiverType, argTypes, start); + } + + @Override + public void accept(StatementVisitor visitor) { + visitor.visit(this); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/Receiver.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/Receiver.java new file mode 100644 index 0000000..93ee36a --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/Receiver.java @@ -0,0 +1,12 @@ +package de.dhbwstuttgart.syntaxtree.statement; + +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import org.antlr.v4.runtime.Token; + +public abstract class Receiver extends Expression +{ + public Receiver(RefTypeOrTPHOrWildcardOrGeneric type, Token offset) + { + super(type, offset); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/Return.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/Return.java new file mode 100644 index 0000000..33099a7 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/Return.java @@ -0,0 +1,18 @@ +package de.dhbwstuttgart.syntaxtree.statement; + +import de.dhbwstuttgart.syntaxtree.StatementVisitor; +import org.antlr.v4.runtime.Token; + +public class Return extends Statement { + public final Expression retexpr; + + public Return(Expression retExpr, Token offset) { + super(retExpr.getType(), offset); + this.retexpr = retExpr; + } + + @Override + public void accept(StatementVisitor visitor) { + visitor.visit(this); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/ReturnVoid.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/ReturnVoid.java new file mode 100644 index 0000000..ca64b2c --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/ReturnVoid.java @@ -0,0 +1,15 @@ +package de.dhbwstuttgart.syntaxtree.statement; + +import de.dhbwstuttgart.syntaxtree.StatementVisitor; +import org.antlr.v4.runtime.Token; + +public class ReturnVoid extends Return{ + public ReturnVoid(Token offset) { + super(new EmptyStmt(offset), offset); + } + + @Override + public void accept(StatementVisitor visitor) { + visitor.visit(this); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/Statement.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/Statement.java new file mode 100644 index 0000000..aad5073 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/Statement.java @@ -0,0 +1,25 @@ +package de.dhbwstuttgart.syntaxtree.statement; + +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import org.antlr.v4.runtime.Token; + + +public abstract class Statement extends Expression +{ + /* zeigt an, dass eine StatementExpression als Statement benutzt wird + */ + private boolean isStatement = false; + + public Statement(RefTypeOrTPHOrWildcardOrGeneric type, Token offset) + { + super(type, offset); + } + + public void setStatement() { + isStatement=true; + } + + public boolean getStatement() { + return isStatement; + } +} \ No newline at end of file diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/StaticClassName.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/StaticClassName.java new file mode 100644 index 0000000..75d2a42 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/StaticClassName.java @@ -0,0 +1,21 @@ +package de.dhbwstuttgart.syntaxtree.statement; + +import de.dhbwstuttgart.parser.scope.JavaClassName; +import de.dhbwstuttgart.syntaxtree.StatementVisitor; +import de.dhbwstuttgart.syntaxtree.type.RefType; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceBlockInformation; +import de.dhbwstuttgart.typeinference.constraints.ConstraintSet; +import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceInformation; +import org.antlr.v4.runtime.Token; + +public class StaticClassName extends Receiver { + public StaticClassName(RefTypeOrTPHOrWildcardOrGeneric type, Token offset) { + super(type, offset); + } + + @Override + public void accept(StatementVisitor visitor) { + visitor.visit(this); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/Super.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/Super.java new file mode 100644 index 0000000..e56e2fe --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/Super.java @@ -0,0 +1,24 @@ +package de.dhbwstuttgart.syntaxtree.statement; + +import de.dhbwstuttgart.parser.NullToken; +import de.dhbwstuttgart.syntaxtree.StatementVisitor; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import de.dhbwstuttgart.syntaxtree.type.Void; +import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceBlockInformation; +import de.dhbwstuttgart.typeinference.constraints.ConstraintSet; +import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceInformation; +import org.antlr.v4.runtime.Token; +import de.dhbwstuttgart.exceptions.NotImplementedException; + +public class Super extends Expression +{ + public Super(RefTypeOrTPHOrWildcardOrGeneric type, Token offset) + { + super(type, offset); + } + + @Override + public void accept(StatementVisitor visitor) { + visitor.visit(this); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/SuperCall.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/SuperCall.java new file mode 100644 index 0000000..e4a7ea0 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/SuperCall.java @@ -0,0 +1,33 @@ +package de.dhbwstuttgart.syntaxtree.statement; + +import de.dhbwstuttgart.parser.NullToken; +import de.dhbwstuttgart.syntaxtree.StatementVisitor; +import de.dhbwstuttgart.syntaxtree.type.RefType; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import de.dhbwstuttgart.syntaxtree.type.Void; +import org.antlr.v4.runtime.Token; + +import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode; + +import java.util.ArrayList; +import java.util.List; + + +public class SuperCall extends MethodCall +{ + public SuperCall(RefTypeOrTPHOrWildcardOrGeneric receiverType, + ArrayList argTypes, Token offset){ + this(new ArgumentList(new ArrayList(), offset), receiverType, argTypes, offset); + } + + public SuperCall(ArgumentList argumentList, RefTypeOrTPHOrWildcardOrGeneric receiverType, + ArrayList argTypes, Token offset){ + super(new Void(offset), new ExpressionReceiver(new Super(receiverType, offset)), "", argumentList, receiverType, argTypes, offset); + } + + + @Override + public void accept(StatementVisitor visitor) { + visitor.visit(this); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/Switch.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/Switch.java new file mode 100644 index 0000000..21382b8 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/Switch.java @@ -0,0 +1,37 @@ +package de.dhbwstuttgart.syntaxtree.statement; + +import java.util.ArrayList; +import java.util.List; + +import org.antlr.v4.runtime.Token; + +import de.dhbwstuttgart.syntaxtree.StatementVisitor; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; + +public class Switch extends Statement { + + private Expression switchedExpression; + private List blocks = new ArrayList<>(); + + public Switch(Expression switched, List blocks, RefTypeOrTPHOrWildcardOrGeneric type, Boolean isStatement, Token offset) { + super(type, offset); + if (isStatement) + setStatement(); + this.switchedExpression = switched; + this.blocks = blocks; + } + + public Expression getSwitch() { + return switchedExpression; + } + + public List getBlocks() { + return blocks; + } + + @Override + public void accept(StatementVisitor visitor) { + visitor.visit(this); + } + +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/SwitchBlock.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/SwitchBlock.java new file mode 100644 index 0000000..56a18eb --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/SwitchBlock.java @@ -0,0 +1,43 @@ +package de.dhbwstuttgart.syntaxtree.statement; + +import java.util.ArrayList; +import java.util.List; + +import org.antlr.v4.runtime.Token; + +import de.dhbwstuttgart.syntaxtree.StatementVisitor; + +public class SwitchBlock extends Block { + + private List labels = new ArrayList<>(); + + private boolean defaultBlock = false; + public final boolean isExpression; // This is for single expressions that yield a value + + public SwitchBlock(List labels, Block statements, boolean isExpression, Token offset) { + super(statements.getStatements(), offset); + this.labels = labels; + this.isExpression = isExpression; + } + + public SwitchBlock(List labels, Block statements, boolean isDefault, boolean isExpression, Token offset) { + super(statements.getStatements(), offset); + this.labels = labels; + this.defaultBlock = isDefault; + this.isExpression = isExpression; + } + + public boolean isDefault() { + return defaultBlock; + } + + public List getLabels() { + return labels; + } + + @Override + public void accept(StatementVisitor visitor) { + visitor.visit(this); + } + +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/SwitchLabel.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/SwitchLabel.java new file mode 100644 index 0000000..0ba9281 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/SwitchLabel.java @@ -0,0 +1,37 @@ +package de.dhbwstuttgart.syntaxtree.statement; + +import de.dhbwstuttgart.syntaxtree.Pattern; +import org.antlr.v4.runtime.Token; + +import de.dhbwstuttgart.syntaxtree.StatementVisitor; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; + +public class SwitchLabel extends Expression { + + private Pattern pattern; + private Boolean defaultCase = false; + + public SwitchLabel(Pattern pattern, RefTypeOrTPHOrWildcardOrGeneric type, Token offset) { + super(type, offset); + this.pattern = pattern; + } + + public SwitchLabel(RefTypeOrTPHOrWildcardOrGeneric type, Token offset) { + super(type, offset); + this.defaultCase = true; + } + + public Pattern getPattern() { + return pattern; + } + + public Boolean isDefault() { + return this.defaultCase; + } + + @Override + public void accept(StatementVisitor visitor) { + visitor.visit(this); + } + +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/This.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/This.java new file mode 100644 index 0000000..cd7ef5e --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/This.java @@ -0,0 +1,26 @@ +package de.dhbwstuttgart.syntaxtree.statement; + +import de.dhbwstuttgart.syntaxtree.StatementVisitor; +import de.dhbwstuttgart.syntaxtree.type.RefType; +import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; +import org.antlr.v4.runtime.Token; +import de.dhbwstuttgart.exceptions.NotImplementedException; + +public class This extends Expression +{ + public This(Token offset) + { + super(TypePlaceholder.fresh(offset),offset); + } + + public ArgumentList arglist; + + @Override + public void accept(StatementVisitor visitor) { + visitor.visit(this); + } + + public String toString() { + return "this: "+ this.getType(); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/ThisCall.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/ThisCall.java new file mode 100644 index 0000000..14ec397 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/ThisCall.java @@ -0,0 +1,20 @@ +package de.dhbwstuttgart.syntaxtree.statement; + +import de.dhbwstuttgart.syntaxtree.Constructor; + + + +public class ThisCall extends MethodCall +{ + public ThisCall(Receiver receiver, ArgumentList arglist, int offset) + { + // TODO What is this? + super(null, null, null, null, null, null, null); + + } + + public ArgumentList arglist; + +} + + diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/Throw.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/Throw.java new file mode 100644 index 0000000..6d91389 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/Throw.java @@ -0,0 +1,21 @@ +package de.dhbwstuttgart.syntaxtree.statement; + +import de.dhbwstuttgart.syntaxtree.StatementVisitor; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import de.dhbwstuttgart.syntaxtree.type.Void; +import org.antlr.v4.runtime.Token; + +public class Throw extends Statement { + + public final Expression expr; + + public Throw(Expression expr, Token offset) { + super(new Void(offset), offset); + this.expr = expr; + } + + @Override + public void accept(StatementVisitor visitor) { + visitor.visit(this); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/TypableStatement.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/TypableStatement.java new file mode 100644 index 0000000..a2166d2 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/TypableStatement.java @@ -0,0 +1,28 @@ +package de.dhbwstuttgart.syntaxtree.statement; + +import de.dhbwstuttgart.syntaxtree.ASTVisitor; +import de.dhbwstuttgart.syntaxtree.StatementVisitor; +import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import org.antlr.v4.runtime.Token; + +public abstract class TypableStatement extends SyntaxTreeNode{ + private RefTypeOrTPHOrWildcardOrGeneric type; + + public TypableStatement(RefTypeOrTPHOrWildcardOrGeneric type, Token offset){ + super(offset); + if(type == null)throw new NullPointerException(); + this.type = type; + } + + public RefTypeOrTPHOrWildcardOrGeneric getType(){ + return type; + } + + public abstract void accept(StatementVisitor visitor); + + @Override + public void accept(ASTVisitor visitor) { + this.accept((StatementVisitor)visitor); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/UnaryExpr.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/UnaryExpr.java new file mode 100644 index 0000000..ca06146 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/UnaryExpr.java @@ -0,0 +1,37 @@ +package de.dhbwstuttgart.syntaxtree.statement; + + +import de.dhbwstuttgart.syntaxtree.StatementVisitor; +import de.dhbwstuttgart.syntaxtree.statement.Expression; +import de.dhbwstuttgart.syntaxtree.statement.JavaInternalExpression; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import org.antlr.v4.runtime.Token; + +public class UnaryExpr extends JavaInternalExpression +{ + public enum Operation{ + NOT, + MINUS, + PREINCREMENT, + PREDECREMENT, + POSTINCREMENT, + PLUS, POSTDECREMENT + } + + + public final Operation operation; + public Expression expr; + + public UnaryExpr(Operation operation, Expression argument, RefTypeOrTPHOrWildcardOrGeneric retType, Token offset) + { + super(retType, offset); + this.expr = argument; + this.operation = operation; + } + @Override + public void accept(StatementVisitor visitor) { + visitor.visit(this); + } + + +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/WhileStmt.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/WhileStmt.java new file mode 100644 index 0000000..0127a50 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/WhileStmt.java @@ -0,0 +1,28 @@ +package de.dhbwstuttgart.syntaxtree.statement; + + +import de.dhbwstuttgart.syntaxtree.StatementVisitor; +import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; +import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceBlockInformation; +import de.dhbwstuttgart.typeinference.constraints.ConstraintSet; +import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceInformation; +import de.dhbwstuttgart.exceptions.NotImplementedException; +import org.antlr.v4.runtime.Token; + +public class WhileStmt extends Statement +{ + public final Expression expr; + public final Statement loopBlock; + + public WhileStmt(Expression expr, Statement loopBlock, Token offset) + { + super(TypePlaceholder.fresh(offset), offset); + this.expr = expr; + this.loopBlock = loopBlock; + } + + @Override + public void accept(StatementVisitor visitor) { + visitor.visit(this); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/Yield.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/Yield.java new file mode 100644 index 0000000..cd16b21 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/statement/Yield.java @@ -0,0 +1,18 @@ +package de.dhbwstuttgart.syntaxtree.statement; + +import org.antlr.v4.runtime.Token; + +import de.dhbwstuttgart.syntaxtree.StatementVisitor; + +public class Yield extends Return { + + public Yield(Expression retExpr, Token offset) { + super(retExpr, offset); + } + + @Override + public void accept(StatementVisitor visitor) { + visitor.visit(this); + } + +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/type/ExtendsWildcardType.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/type/ExtendsWildcardType.java new file mode 100644 index 0000000..2c8cffd --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/type/ExtendsWildcardType.java @@ -0,0 +1,71 @@ +package de.dhbwstuttgart.syntaxtree.type; + + +import de.dhbwstuttgart.syntaxtree.ASTVisitor; +import de.dhbwstuttgart.typeinference.result.ResultSetVisitor; +import org.antlr.v4.runtime.Token; + +import java.util.Objects; + +/** + * Stellt eine Wildcard mit oberer Grenze dar. + * z.B. void test(? extends Number var){..} + * ... + * @author luar 2.12.06 + * + */ + +public class ExtendsWildcardType extends WildcardType{ + + /** + * Author: Arne Lüdtke
+ * Standard Konstruktor für eine ExtendsWildcard + */ + public ExtendsWildcardType (RefTypeOrTPHOrWildcardOrGeneric extendsType, Token offset) + { + super(extendsType, offset); + } + + @Override + public boolean isExtends() { + return true; + } + + @Override + public boolean isSuper() { + return false; + } + + @Override + public String toString() { + return "? extends "+innerType.toString(); + } + + @Override + public void accept(ASTVisitor visitor) { + visitor.visit(this); + } + + @Override + public
A acceptTV(TypeVisitor visitor) { + return visitor.visit(this); + } + + @Override + public void accept(ResultSetVisitor visitor) { + visitor.visit(this); + } + + @Override + public int hashCode() { + return Objects.hashCode(this.innerType); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + ExtendsWildcardType that = (ExtendsWildcardType) o; + return that.innerType.equals(this.innerType); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/type/GenericRefType.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/type/GenericRefType.java new file mode 100644 index 0000000..9267dbd --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/type/GenericRefType.java @@ -0,0 +1,57 @@ +package de.dhbwstuttgart.syntaxtree.type; + +import de.dhbwstuttgart.syntaxtree.ASTVisitor; +import de.dhbwstuttgart.typeinference.result.ResultSetVisitor; +import org.antlr.v4.runtime.Token; + +import java.util.Objects; + +public class GenericRefType extends RefTypeOrTPHOrWildcardOrGeneric +{ + private String name; + + public GenericRefType(String name, Token offset) + { + super(offset); + this.name = name; + } + + public String getParsedName(){ + return name.toString(); + } + + @Override + public void accept(ASTVisitor visitor) { + visitor.visit(this); + } + + @Override + public A acceptTV(TypeVisitor visitor) { + return visitor.visit(this); + } + + @Override + public void accept(ResultSetVisitor visitor) { + visitor.visit(this); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + GenericRefType that = (GenericRefType) o; + return name.equals(that.name); + } + + @Override + public int hashCode() { + return Objects.hash(name); + } + + @Override + public String toString() + { + return "GTV " + this.name; + } +} + diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/type/RefType.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/type/RefType.java new file mode 100644 index 0000000..73ca175 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/type/RefType.java @@ -0,0 +1,133 @@ +package de.dhbwstuttgart.syntaxtree.type; + +import de.dhbwstuttgart.parser.scope.JavaClassName; +import de.dhbwstuttgart.syntaxtree.ASTVisitor; +import de.dhbwstuttgart.typeinference.result.ResultSetVisitor; +import org.antlr.v4.runtime.Token; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + + +public class RefType extends RefTypeOrTPHOrWildcardOrGeneric +{ + protected final JavaClassName name; + protected final List parameter; + /** + * Ist primitiveFlag auf true, muss beim Codegen dieser Reftype durch + * den primitiven Datentyp ersetzt werden + * + * Bsp: java.lang.Integer mit Flag wird dann zu [int] + */ + boolean primitiveFlag = false; // TODO Should be final + + public RefType(JavaClassName fullyQualifiedName, Token offset) + { + this(fullyQualifiedName, new ArrayList<>(), offset); + } + + public boolean isPrimitive() { + return primitiveFlag; + } + + @Override + public String toString(){ + String params = ""; + if(parameter.size()>0){ + params += "<"; + Iterator it = parameter.iterator(); + while(it.hasNext()){ + RefTypeOrTPHOrWildcardOrGeneric param = it.next(); + params += param.toString(); + if(it.hasNext())params += ", "; + } + params += ">"; + } + return this.name.toString() + params; + } + + @Override + public int hashCode() { + int hash = 0; + hash += super.hashCode(); + hash += this.name.hashCode();//Nur den Name hashen. Sorgt für langsame, aber funktionierende HashMaps + return hash; + } + + public RefType(JavaClassName fullyQualifiedName, List parameter, Token offset) { + this(fullyQualifiedName, parameter, offset, false); + } + + public RefType(JavaClassName fullyQualifiedName, List parameter, Token offset, boolean primitiveFlag) { + super(offset); + this.name = (fullyQualifiedName); + this.parameter = parameter; + this.primitiveFlag = primitiveFlag; + } + + public JavaClassName getName() + { + return name; + } + + public List getParaList(){ + if(this.parameter==null)return new ArrayList<>(); + return this.parameter; + } + + /** + * Author: Jrg Buerle
+ * @return + */ + public boolean equals(Object obj) + { + if(obj instanceof RefType){ + boolean ret = true; + + //if(!(super.equals(obj))) PL 2020-03-12 muss vll. einkommentiert werden + // return false; + + if(parameter==null || parameter.size()==0){ + ret &= (((RefType)obj).getParaList()==null || ((RefType)obj).getParaList().size()==0); + } + else{ + if(((RefType)obj).getParaList()==null){ + ret = false; + } + else if(parameter.size() != ((RefType)obj).getParaList().size()) + { + ret = false; + } + else + { + for(int i = 0; i A acceptTV(TypeVisitor
visitor) { + return visitor.visit(this); + } + + @Override + public void accept(ResultSetVisitor visitor) { + visitor.visit(this); + } +} + diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/type/RefTypeOrTPHOrWildcardOrGeneric.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/type/RefTypeOrTPHOrWildcardOrGeneric.java new file mode 100644 index 0000000..22c8ab4 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/type/RefTypeOrTPHOrWildcardOrGeneric.java @@ -0,0 +1,22 @@ +package de.dhbwstuttgart.syntaxtree.type; + +import de.dhbwstuttgart.syntaxtree.ASTVisitor; +import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode; +import de.dhbwstuttgart.typeinference.result.ResultSetVisitor; +import org.antlr.v4.runtime.Token; + +public abstract class RefTypeOrTPHOrWildcardOrGeneric extends SyntaxTreeNode{ + public RefTypeOrTPHOrWildcardOrGeneric(Token offset) { + super(offset); + } + + @Override + public abstract void accept(ASTVisitor visitor); + + public abstract A acceptTV(TypeVisitor visitor); + public abstract void accept(ResultSetVisitor visitor); + + @Override + public abstract boolean equals(Object o); + +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/type/SuperWildcardType.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/type/SuperWildcardType.java new file mode 100644 index 0000000..8ac1820 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/type/SuperWildcardType.java @@ -0,0 +1,83 @@ +package de.dhbwstuttgart.syntaxtree.type; + + +import de.dhbwstuttgart.syntaxtree.ASTVisitor; +import de.dhbwstuttgart.syntaxtree.GenericTypeVar; +import de.dhbwstuttgart.typeinference.result.ResultSetVisitor; +import org.antlr.v4.runtime.Token; + +import java.util.Objects; + +/** + * Stellt eine Wildcard mit unterer Grenze dar. + * z.B. void test(? super Integer var){..} + * ... + * @author luar 2.12.06 + * + */ + +public class SuperWildcardType extends WildcardType{ + + /** + * Author: Arne Lüdtke
+ * Standard Konstruktor für eine SuperWildcard + */ + public SuperWildcardType( RefTypeOrTPHOrWildcardOrGeneric innerType, Token offset) + { + super(innerType, offset); + } + + /** + * Author: Arne Lüdtke
+ * Gibt den Typen in der Wildcard zurück. + * Beispiel: ? super Integer. + * Integer wird zurückgegeben. + */ + public RefTypeOrTPHOrWildcardOrGeneric getInnerType() + { + return this.innerType; + } + + @Override + public String toString() { + return "? super "+innerType.toString(); + } + + @Override + public boolean isExtends() { + return false; + } + + @Override + public boolean isSuper() { + return true; + } + + @Override + public void accept(ASTVisitor visitor) { + visitor.visit(this); + } + + @Override + public
A acceptTV(TypeVisitor visitor) { + return visitor.visit(this); + } + + @Override + public void accept(ResultSetVisitor visitor) { + visitor.visit(this); + } + + @Override + public int hashCode() { + return Objects.hashCode(this.innerType); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + SuperWildcardType that = (SuperWildcardType) o; + return that.innerType.equals(this.innerType); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/type/TypePlaceholder.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/type/TypePlaceholder.java new file mode 100644 index 0000000..8452b2c --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/type/TypePlaceholder.java @@ -0,0 +1,123 @@ +package de.dhbwstuttgart.syntaxtree.type; +import java.util.Hashtable; + +import de.dhbwstuttgart.parser.NullToken; +import de.dhbwstuttgart.syntaxtree.ASTVisitor; +import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode; +import de.dhbwstuttgart.syntaxtree.factory.NameGenerator; +import de.dhbwstuttgart.typeinference.result.ResultSetVisitor; +import org.antlr.v4.runtime.Token; + +/** + * Repr�sentiert einen Typparameter f�r einen vom Programmierer nicht angegeben + * Typ. Jede TypePlaceholder besitzt einen eindeutigen Namen aus einem Namenspool + * und + * ist in einer zentralen Registry, d.h. einer Hashtable abgelegt. + * @author J�rg B�uerle + * @version $Date: 2013/06/19 12:45:37 $ + */ +public class TypePlaceholder extends RefTypeOrTPHOrWildcardOrGeneric +{ + private final String name; + + /** + * wird im Generate Generics Teil nach der Rueckumwandlung nach dem Unify genutzt + */ + private int variance = 0; + + /* + * Fuer Oder-Constraints: + * orCons = 1: Receiver + * orCons = 0: Argument oder kein Oder-Constraint + * orCons = -1: RetType + */ + private byte orCons = 0; + + + /** + * Privater Konstruktor - Eine TypePlaceholder-Variable wird �ber die + * Factory-Methode fresh() erzeugt. + *
Author: J�rg B�uerle + */ + private TypePlaceholder(String name, Token offset) + { + super(offset); + this.name = name; + } + + + /** + * @author Andreas Stadelmeier, a10023 + * Ruft die TypePlaceholder.fresh()-Methode auf. + * Fügt zusätzlich einen Replacementlistener hinzu. + * @return + */ + public static TypePlaceholder fresh(Token position){ + return new TypePlaceholder(NameGenerator.makeNewName(), position); + } + + public static RefTypeOrTPHOrWildcardOrGeneric of(String name) { + return new TypePlaceholder(name, new NullToken()); + } + + + /** + * Author: J�rg B�uerle
+ * @return + */ + public boolean equals(Object obj) + { + if(obj instanceof TypePlaceholder){ + return this.toString().equals(((TypePlaceholder)obj).toString()); + //return super.equals(obj); + } + else{ + return false; + } + } + + @Override + public int hashCode() { + return this.getName().hashCode(); + } + + public String toString() + { + return "TPH " + this.name; + } + + public String getName() { + return name; + } + + public void setVariance(int variance) { + this.variance= variance; + } + + public int getVariance() { + return this.variance; + } + + @Override + public void accept(ASTVisitor visitor) { + visitor.visit(this); + } + + @Override + public
A acceptTV(TypeVisitor visitor) { + return visitor.visit(this); + } + + @Override + public void accept(ResultSetVisitor visitor) { + visitor.visit(this); + } + + public void setOrCons(byte i) { + orCons = i; + } + + public byte getOrCons() { + return orCons; + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/type/TypeVisitor.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/type/TypeVisitor.java new file mode 100644 index 0000000..a3b7796 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/type/TypeVisitor.java @@ -0,0 +1,13 @@ +package de.dhbwstuttgart.syntaxtree.type; + +public interface TypeVisitor { + A visit(RefType refType); + + A visit(SuperWildcardType superWildcardType); + + A visit(TypePlaceholder typePlaceholder); + + A visit(ExtendsWildcardType extendsWildcardType); + + A visit(GenericRefType genericRefType); +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/type/Void.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/type/Void.java new file mode 100644 index 0000000..6a322dc --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/type/Void.java @@ -0,0 +1,14 @@ +package de.dhbwstuttgart.syntaxtree.type; + +import org.antlr.v4.runtime.Token; + +import de.dhbwstuttgart.parser.scope.JavaClassName; + + +public class Void extends RefType +{ + public Void(Token offset) { + super(JavaClassName.Void, offset); + } +} + diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/type/WildcardType.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/type/WildcardType.java new file mode 100644 index 0000000..208138b --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/type/WildcardType.java @@ -0,0 +1,42 @@ +package de.dhbwstuttgart.syntaxtree.type; + +import org.antlr.v4.runtime.Token; + +/** + * Stellt eine Wildcard in Java dar. + * z.B. void Test(? var){..} + * @author luar 2.12.06 + * + */ + +public abstract class WildcardType extends RefTypeOrTPHOrWildcardOrGeneric { + + protected RefTypeOrTPHOrWildcardOrGeneric innerType = null; + + /** + * Author: Arne Lüdtke
+ * Standard Konstruktor für eine Wildcard + */ + public WildcardType(RefTypeOrTPHOrWildcardOrGeneric innerType, Token offset) + { + super(offset); + this.innerType = innerType; + } + + public RefTypeOrTPHOrWildcardOrGeneric getInnerType(){ + return innerType; + } + + /** + * Author: Arne Lüdtke
+ * Gibt String Entsprechung zurück. + */ + public String toString() + { + return "?"; + } + + + public abstract boolean isExtends(); + public abstract boolean isSuper(); +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/visual/ASTPrinter.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/visual/ASTPrinter.java new file mode 100644 index 0000000..0562d05 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/visual/ASTPrinter.java @@ -0,0 +1,13 @@ +package de.dhbwstuttgart.syntaxtree.visual; + +import de.dhbwstuttgart.syntaxtree.*; + +public class ASTPrinter { + + public static String print(SourceFile toPrint) { + StringBuilder output = new StringBuilder(); + new OutputGenerator(output).visit(toPrint); + return output.toString(); + } + +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/visual/ASTTypePrinter.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/visual/ASTTypePrinter.java new file mode 100644 index 0000000..cbfc1a1 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/visual/ASTTypePrinter.java @@ -0,0 +1,13 @@ +package de.dhbwstuttgart.syntaxtree.visual; + +import de.dhbwstuttgart.syntaxtree.*; + +public class ASTTypePrinter extends ASTPrinter{ + + public static String print(SourceFile toPrint){ + StringBuilder output = new StringBuilder(); + new TypeOutputGenerator(output).visit(toPrint); + return output.toString(); + } + +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/visual/OutputGenerator.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/visual/OutputGenerator.java new file mode 100644 index 0000000..638d13d --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/visual/OutputGenerator.java @@ -0,0 +1,503 @@ +package de.dhbwstuttgart.syntaxtree.visual; + +import de.dhbwstuttgart.parser.SyntaxTreeGenerator.AssignToLocal; +import de.dhbwstuttgart.syntaxtree.*; +import de.dhbwstuttgart.syntaxtree.statement.*; +import de.dhbwstuttgart.syntaxtree.type.*; + +import java.lang.reflect.Modifier; +import java.util.Iterator; +import java.util.List; + +public class OutputGenerator implements ASTVisitor { + private static final String TAB = " "; + String tabs = ""; + protected final StringBuilder out; + + public OutputGenerator(StringBuilder out) { + this.out = out; + } + + public void tab() { + tabs += TAB; + } + + public void untab() { + tabs = tabs.substring(0, tabs.length() - TAB.length()); + } + + @Override + public void visit(SourceFile sourceFile) { + for (ClassOrInterface cl : sourceFile.getClasses()) { + cl.accept(this); + } + } + + @Override + public void visit(ArgumentList argumentList) { + out.append("("); + Iterator expressionIterator = argumentList.getArguments().iterator(); + while (expressionIterator.hasNext()) { + expressionIterator.next().accept(this); + if (expressionIterator.hasNext()) + out.append(", "); + } + out.append(")"); + } + + @Override + public void visit(GenericTypeVar genericTypeVar) { + out.append(genericTypeVar.getName().toString()); + } + + @Override + public void visit(FormalParameter formalParameter) { + formalParameter.getType().accept(this); + out.append(" "); + out.append(formalParameter.getName()); + } + + @Override + public void visit(GenericDeclarationList genericTypeVars) { + Iterator genericIterator = genericTypeVars.iterator(); + if (genericIterator.hasNext()) { + out.append("<"); + while (genericIterator.hasNext()) { + genericIterator.next().accept(this); + if (genericIterator.hasNext()) + out.append(", "); + } + out.append(">"); + } + } + + @Override + public void visit(Field field) { + field.getType().accept(this); + out.append(" "); + out.append(field.getName()); + out.append(";"); + } + + @Override + public void visit(Method method) { + method.getReturnType().accept(this); + out.append(" " + method.getName()); + method.getParameterList().accept(this); + if (method.block != null) + method.block.accept(this); + out.append("\n"); + } + + @Override + public void visit(Constructor method) { + out.append(method.getName()); + method.getParameterList().accept(this); + method.block.accept(this); + out.append("\n"); + } + + @Override + public void visit(ParameterList formalParameters) { + out.append("("); + Iterator genericIterator = formalParameters.getFormalparalist().iterator(); + if (genericIterator.hasNext()) { + while (genericIterator.hasNext()) { + genericIterator.next().accept(this); + if (genericIterator.hasNext()) + out.append(", "); + } + } + out.append(")"); + } + + @Override + public void visit(ClassOrInterface classOrInterface) { + if (classOrInterface.isInterface()) { + out.append("interface "); + } else { + out.append("class "); + } + out.append(classOrInterface.getClassName().toString()); + classOrInterface.getGenerics().accept(this); + out.append(" {\n\n"); + tab(); + for (Field f : classOrInterface.getFieldDecl()) { + out.append(tabs); + f.accept(this); + out.append("\n"); + } + if (classOrInterface.getfieldInitializations().isPresent()) {// PL 2019-11-28: Zum Ausdrucken der Fieldinitializer + classOrInterface.getfieldInitializations().get().accept(this); + } + for (Method m : classOrInterface.getMethods()) { + out.append(tabs); + m.accept(this); + out.append("\n"); + } + for (Constructor m : classOrInterface.getConstructors()) { + out.append(tabs); + m.accept(this); + out.append("\n"); + } + untab(); + out.append("}"); + } + + @Override + public void visit(RefType refType) { + out.append(refType.getName().toString()); + Iterator genericIterator = refType.getParaList().iterator(); + if (genericIterator.hasNext()) { + out.append("<"); + while (genericIterator.hasNext()) { + genericIterator.next().accept(this); + if (genericIterator.hasNext()) + out.append(", "); + } + out.append(">"); + } + } + + @Override + public void visit(SuperWildcardType superWildcardType) { + out.append("? super "); + superWildcardType.getInnerType().accept(this); + } + + @Override + public void visit(TypePlaceholder typePlaceholder) { + out.append("TPH " + typePlaceholder.getName()); + } + + @Override + public void visit(ExtendsWildcardType extendsWildcardType) { + out.append("? extends "); + extendsWildcardType.getInnerType().accept(this); + } + + @Override + public void visit(GenericRefType genericRefType) { + out.append(genericRefType.getParsedName().toString()); + } + + @Override + public void visit(LambdaExpression lambdaExpression) { + lambdaExpression.params.accept(this); + out.append(" -> "); + lambdaExpression.methodBody.accept(this); + } + + @Override + public void visit(Assign assign) { + assign.lefSide.accept(this); + out.append(" = "); + assign.rightSide.accept(this); + } + + @Override + public void visit(BinaryExpr binary) { + binary.lexpr.accept(this); + out.append(" op "); + binary.rexpr.accept(this); + } + + @Override + public void visit(BoolExpression logical) { + logical.lexpr.accept(this); + out.append(" op "); + logical.rexpr.accept(this); + } + + @Override + public void visit(Block block) { + tab(); + out.append("{\n"); + for (Statement stmt : block.getStatements()) { + out.append(tabs); + stmt.accept(this); + out.append(";\n"); + } + untab(); + out.append(tabs); + out.append("}"); + } + + @Override + public void visit(CastExpr castExpr) { + + } + + @Override + public void visit(EmptyStmt emptyStmt) { + + } + + @Override + public void visit(FieldVar fieldVar) { + fieldVar.receiver.accept(this); + out.append("." + fieldVar.fieldVarName); + } + + @Override + public void visit(ForStmt forStmt) { + + } + + @Override + public void visit(ForEachStmt forEachStmt) { + out.append("for("); + forEachStmt.statement.accept(this); + out.append(" : "); + forEachStmt.expression.accept(this); + out.append(")\n"); + tab(); + out.append(tabs); + forEachStmt.block.accept(this); + untab(); + } + + @Override + public void visit(IfStmt ifStmt) { + out.append("if("); + ifStmt.expr.accept(this); + out.append(")\n"); + tab(); + out.append(tabs); + ifStmt.then_block.accept(this); + untab(); + if (ifStmt.else_block != null) { + out.append("\n" + tabs + "else\n"); + tab(); + out.append(tabs); + ifStmt.else_block.accept(this); + untab(); + } + } + + @Override + public void visit(InstanceOf instanceOf) { + instanceOf.getExpression().accept(this); + out.append(" instanceof "); + instanceOf.getPattern().accept(this); + } + + @Override + public void visit(LocalVar localVar) { + if (localVar.name.isEmpty()) { + localVar.getType().accept(this); + } else { + out.append(localVar.name); + } + } + + @Override + public void visit(LocalVarDecl localVarDecl) { + localVarDecl.getType().accept(this); + out.append(" " + localVarDecl.getName()); + } + + @Override + public void visit(MethodCall methodCall) { + methodCall.receiver.accept(this); + out.append("." + methodCall.name); + out.append(" Signature: " + methodCall.signature); + methodCall.getArgumentList().accept(this); + } + + @Override + public void visit(NewClass methodCall) { + out.append("new "); + out.append(methodCall.name); + methodCall.getArgumentList().accept(this); + } + + @Override + public void visit(NewArray newArray) { + + } + + @Override + public void visit(Return aReturn) { + out.append("return "); + aReturn.retexpr.accept(this); + } + + @Override + public void visit(ReturnVoid aReturn) { + out.append("return"); + } + + @Override + public void visit(Break aBreak) { + out.append("break"); + } + + @Override + public void visit(StaticClassName staticClassName) { + + } + + @Override + public void visit(Super aSuper) { + + } + + @Override + public void visit(This aThis) { + out.append("this"); + } + + @Override + public void visit(WhileStmt whileStmt) { + out.append("while("); + whileStmt.expr.accept(this); + out.append(")"); + whileStmt.loopBlock.accept(this); + } + + @Override + public void visit(DoStmt whileStmt) { + out.append("do "); + whileStmt.loopBlock.accept(this); + out.append("while("); + whileStmt.expr.accept(this); + out.append(");"); + } + + @Override + public void visit(AssignToField assignLeftSide) { + assignLeftSide.field.accept(this); + } + + @Override + public void visit(AssignToLocal assignLeftSide) { + assignLeftSide.localVar.accept(this); + } + + @Override + public void visit(SuperCall superCall) { + out.append("super("); + superCall.arglist.accept(this); + out.append(")"); + } + + @Override + public void visit(ExpressionReceiver receiver) { + receiver.expr.accept(this); + } + + @Override + public void visit(UnaryExpr unaryExpr) { + if (unaryExpr.operation == UnaryExpr.Operation.MINUS) { + out.append("-"); + } + if (unaryExpr.operation == UnaryExpr.Operation.PLUS) { + out.append("+"); + } + if (unaryExpr.operation == UnaryExpr.Operation.PREDECREMENT) { + out.append("--"); + } + if (unaryExpr.operation == UnaryExpr.Operation.PREINCREMENT) { + out.append("++"); + } + unaryExpr.expr.accept(this); + if (unaryExpr.operation == UnaryExpr.Operation.POSTDECREMENT) { + out.append("--"); + } + if (unaryExpr.operation == UnaryExpr.Operation.POSTINCREMENT) { + out.append("++"); + } + } + + @Override + public void visit(de.dhbwstuttgart.syntaxtree.statement.Literal literal) { + out.append(literal.value); + } + + @Override + public void visit(Throw aThrow) { + // TODO implement + } + + @Override + public void visit(Switch switchStmt) { + out.append("switch("); + switchStmt.getSwitch().accept(this); + out.append("){\n"); + tab(); + for (SwitchBlock switchBlock : switchStmt.getBlocks()) { + switchBlock.accept(this); + } + untab(); + out.append(tabs); + out.append("}::"); + switchStmt.getType().accept(this); + } + + @Override + public void visit(SwitchBlock switchBlock) { + switchBlock.getLabels().stream().forEach((label) -> { + out.append(tabs); + label.accept(this); + }); + tab(); + switchBlock.getStatements().stream().forEach((stmt) -> { + out.append(tabs); + stmt.accept(this); + out.append(";\n"); + }); + out.append("\n"); + untab(); + } + + @Override + public void visit(SwitchLabel switchLabel) { + if (switchLabel.isDefault()) { + out.append("default"); + } else { + out.append("case "); + switchLabel.getPattern().accept(this); + } + out.append(":\n"); + } + + @Override + public void visit(Yield aYield) { + out.append("yield ("); + aYield.retexpr.accept(this); + out.append(")::"); + aYield.getType().accept(this); + } + + @Override + public void visit(ExpressionPattern aPattern) { + aPattern.getType().accept(this); + out.append(" "); + aPattern.getExpression().accept(this); + } + + @Override + public void visit(RecordPattern aRecordPattern) { + aRecordPattern.getType().accept(this); + out.append("("); + List subPatterns = aRecordPattern.getSubPattern(); + int i; + for (i = 0; i < subPatterns.size() - 1; i++) { + subPatterns.get(i).accept(this); + out.append(", "); + } + subPatterns.get(i).accept(this); + String name; + if ((name = aRecordPattern.getName()) != null) + out.append(name); + out.append(")"); + } + + @Override + public void visit(GuardedPattern aGuardedPattern) { + aGuardedPattern.getNestedPattern().accept(this); + out.append(" with "); + aGuardedPattern.getCondition().accept(this); + } +} \ No newline at end of file diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/visual/ResultSetOutputGenerator.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/visual/ResultSetOutputGenerator.java new file mode 100644 index 0000000..f50b05a --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/visual/ResultSetOutputGenerator.java @@ -0,0 +1,34 @@ +package de.dhbwstuttgart.syntaxtree.visual; + +import de.dhbwstuttgart.syntaxtree.type.*; +import de.dhbwstuttgart.typeinference.result.*; + +public class ResultSetOutputGenerator extends OutputGenerator implements ResultSetVisitor{ + + public ResultSetOutputGenerator(StringBuilder out) { + super(out); + } + + @Override + public void visit(PairTPHsmallerTPH p) { + print(p, "<"); + } + + @Override + public void visit(PairTPHequalRefTypeOrWildcardType p) { + print(p, "=."); + } + + @Override + public void visit(PairTPHEqualTPH p) { + print(p, "=."); + } + + private void print(ResultPair p , String operator){ + out.append("("); + p.getLeft().accept((ResultSetVisitor) this); + out.append(" "+operator+" "); + p.getRight().accept((ResultSetVisitor) this); + out.append(")"); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/visual/ResultSetPrinter.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/visual/ResultSetPrinter.java new file mode 100644 index 0000000..fc67a72 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/visual/ResultSetPrinter.java @@ -0,0 +1,20 @@ +package de.dhbwstuttgart.syntaxtree.visual; + +import de.dhbwstuttgart.syntaxtree.SourceFile; +import de.dhbwstuttgart.typeinference.result.ResultPair; +import de.dhbwstuttgart.typeinference.result.ResultSet; + +import java.util.Set; + +public class ResultSetPrinter { + + public static String print(ResultSet toPrint){ + StringBuilder output = new StringBuilder(); + for(ResultPair p : toPrint.results){ + p.accept(new ResultSetOutputGenerator(output)); + output.append("\n"); + } + return output.toString(); + } + +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/visual/TypeOutputGenerator.java b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/visual/TypeOutputGenerator.java new file mode 100644 index 0000000..8a210db --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/syntaxtree/visual/TypeOutputGenerator.java @@ -0,0 +1,224 @@ +package de.dhbwstuttgart.syntaxtree.visual; + +import de.dhbwstuttgart.syntaxtree.*; +import de.dhbwstuttgart.syntaxtree.statement.*; +import de.dhbwstuttgart.syntaxtree.statement.Literal; +import de.dhbwstuttgart.syntaxtree.type.*; + +public class TypeOutputGenerator extends OutputGenerator { + + TypeOutputGenerator(StringBuilder out){ + super(out); + } + + @Override + public void visit(SourceFile sourceFile) { + super.visit(sourceFile); + } + + @Override + public void visit(ArgumentList argumentList) { + super.visit(argumentList); + } + + @Override + public void visit(GenericTypeVar genericTypeVar) { + super.visit(genericTypeVar); + } + + @Override + public void visit(FormalParameter formalParameter) { + super.visit(formalParameter); + } + + @Override + public void visit(GenericDeclarationList genericTypeVars) { + super.visit(genericTypeVars); + } + + @Override + public void visit(Field field) { + super.visit(field); + } + + @Override + public void visit(Method method) { + super.visit(method); + } + + @Override + public void visit(ParameterList formalParameters) { + super.visit(formalParameters); + } + + @Override + public void visit(ClassOrInterface classOrInterface) { + super.visit(classOrInterface); + } + + @Override + public void visit(RefType refType) { + super.visit(refType); + } + + @Override + public void visit(SuperWildcardType superWildcardType) { + super.visit(superWildcardType); + } + + @Override + public void visit(TypePlaceholder typePlaceholder) { + super.visit(typePlaceholder); + } + + @Override + public void visit(ExtendsWildcardType extendsWildcardType) { + super.visit(extendsWildcardType); + } + + @Override + public void visit(GenericRefType genericRefType) { + super.visit(genericRefType); + } + + @Override + public void visit(LambdaExpression lambdaExpression) { + out.append("("); + super.visit(lambdaExpression); + out.append(")"); + this.out.append("::"); + lambdaExpression.getType().accept(this); + } + + @Override + public void visit(Assign assign) { + super.visit(assign); + } + + @Override + public void visit(BinaryExpr binary) { + binary.lexpr.accept(this); + out.append(" | "); + binary.rexpr.accept(this); + } + + @Override + public void visit(Block block) { + out.append("("); + super.visit(block); + out.append(")"); + this.out.append("::"); + block.getType().accept(this); + } + + @Override + public void visit(CastExpr castExpr) { + super.visit(castExpr); + } + + @Override + public void visit(EmptyStmt emptyStmt) { + super.visit(emptyStmt); + } + + @Override + public void visit(FieldVar fieldVar) { + out.append("("); + super.visit(fieldVar); + out.append(")"); + this.out.append("::"); + fieldVar.getType().accept(this); + } + + @Override + public void visit(ForStmt forStmt) { + super.visit(forStmt); + } + + @Override + public void visit(IfStmt ifStmt) { + super.visit(ifStmt); + } + + @Override + public void visit(InstanceOf instanceOf) { + super.visit(instanceOf); + } + + @Override + public void visit(LocalVar localVar) { + out.append("("); + super.visit(localVar); + out.append(")"); + this.out.append("::"); + localVar.getType().accept(this); + } + + @Override + public void visit(LocalVarDecl localVarDecl) { + super.visit(localVarDecl); + } + + @Override + public void visit(MethodCall methodCall) { + out.append("("); + super.visit(methodCall); + out.append(")"); + this.out.append("::"); + methodCall.getType().accept(this); + } + + @Override + public void visit(NewClass methodCall) { + super.visit(methodCall); + } + + @Override + public void visit(NewArray newArray) { + super.visit(newArray); + } + + @Override + public void visit(ExpressionReceiver receiver) { + super.visit(receiver); + } + + @Override + public void visit(Return aReturn) { + super.visit(aReturn); + } + + @Override + public void visit(ReturnVoid aReturn) { + super.visit(aReturn); + } + + @Override + public void visit(StaticClassName staticClassName) { + super.visit(staticClassName); + } + + @Override + public void visit(Super aSuper) { + super.visit(aSuper); + } + + @Override + public void visit(This aThis) { + out.append("("); + super.visit(aThis); + out.append(")"); + this.out.append("::"); + aThis.getType().accept(this); + } + + @Override + public void visit(WhileStmt whileStmt) { + super.visit(whileStmt); + } + + @Override + public void visit(Literal literal) { + super.visit(literal); + } +} \ No newline at end of file diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/generate/ASTToTargetAST.java b/javatx-src/main/java/de/dhbwstuttgart/target/generate/ASTToTargetAST.java new file mode 100644 index 0000000..c8be711 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/generate/ASTToTargetAST.java @@ -0,0 +1,513 @@ +package de.dhbwstuttgart.target.generate; + +import de.dhbwstuttgart.bytecode.FunNGenerator; +import de.dhbwstuttgart.core.JavaTXCompiler; +import de.dhbwstuttgart.environment.ByteArrayClassLoader; +import de.dhbwstuttgart.environment.IByteArrayClassLoader; +import de.dhbwstuttgart.exceptions.NotImplementedException; +import de.dhbwstuttgart.parser.NullToken; +import de.dhbwstuttgart.syntaxtree.*; +import de.dhbwstuttgart.syntaxtree.Record; +import de.dhbwstuttgart.syntaxtree.factory.ASTFactory; +import de.dhbwstuttgart.syntaxtree.statement.*; +import de.dhbwstuttgart.syntaxtree.type.*; +import de.dhbwstuttgart.target.tree.*; +import de.dhbwstuttgart.target.tree.expression.*; +import de.dhbwstuttgart.target.tree.type.*; +import de.dhbwstuttgart.typeinference.result.*; + +import javax.sql.rowset.RowSetWarning; +import java.lang.annotation.Target; +import java.util.*; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/** + * @author dholle + */ +public class ASTToTargetAST { + + public static RefType OBJECT = ASTFactory.createObjectType(); // TODO It would be better if I could call this directly but the hashcode seems to change + + protected List all; + protected Generics generics; + final Map> userDefinedGenerics = new HashMap<>(); + + public final JavaTXCompiler compiler; + + protected ClassOrInterface currentClass; // TODO This is only needed because of SuperCall, maybe there's + + public List txGenerics() { + return all.stream().map(generics -> new GenericsResult(generics.txGenerics)).toList(); + } + + public List javaGenerics() { + return all.stream().map(generics -> new GenericsResult(generics.javaGenerics)).toList(); + } + + public TargetExpression convert(Pattern pattern) { + var converter = new StatementToTargetExpression(this); + pattern.accept(converter); + return converter.result; + } + + record Generics(JavaGenerics javaGenerics, TxGenerics txGenerics) { + } + + + protected IByteArrayClassLoader classLoader; + protected SourceFile sourceFile; + + public ASTToTargetAST(List resultSets) { + this(null, resultSets); + } + public ASTToTargetAST(JavaTXCompiler compiler, List resultSets) { + this(compiler, resultSets, null, new ByteArrayClassLoader()); + } + + public ASTToTargetAST(JavaTXCompiler compiler, List resultSets, SourceFile sourceFile, IByteArrayClassLoader classLoader) { + this.compiler = compiler; + this.classLoader = classLoader; + this.sourceFile = sourceFile; + + all = new ArrayList<>(); + for (var set : resultSets) { + all.add(new Generics(new JavaGenerics(this, set), new TxGenerics(this, set))); + } + this.generics = all.get(0); + } + + Optional findMethod(ClassOrInterface owner, String name, List argumentList) { + Optional method = Optional.empty(); + while (method.isEmpty() && !owner.getClassName().toString().equals("java.lang.Object")) { + method = owner.getMethods().stream().filter(m -> m.name.equals(name) && parameterEquals(m.getParameterList(), argumentList)).findFirst(); + owner = compiler.getClass(owner.getSuperClass().getName()); + } + return method; + } + + boolean parameterEquals(ParameterList parameterList, List arguments) { + var pars = parameterList.getFormalparalist(); + if (pars.size() != arguments.size()) + return false; + + for (var i = 0; i < pars.size(); i++) { + var type1 = convert(pars.get(i).getType(), generics.javaGenerics); + var type2 = arguments.get(i); + if (type1 instanceof TargetGenericType) + return true; + if (TargetType.toPrimitive(type2).equals(type1)) + return true; + if (!type1.equals(type2)) + return false; + } + + return true; + } + + Set convert(Set result, GenerateGenerics generics) { + return result.stream().map(p -> { + if (p instanceof GenerateGenerics.PairLT pair) { + return new TargetGeneric(pair.left.resolve().getName(), convert(pair.right.resolve(), generics)); + } else if (p instanceof GenerateGenerics.PairEQ pair) { + return new TargetGeneric(pair.left.resolve().getName(), convert(pair.right, generics)); + } else { + throw new IllegalArgumentException(); + } + }).collect(Collectors.toSet()); + } + + public List convert(GenericTypeVar typeVar, GenerateGenerics generics) { + var ret = new ArrayList(); + for (var bound : typeVar.getBounds()) { + ret.add(new TargetGeneric(typeVar.getName(), generics.getTargetType(bound))); + } + return ret; + } + + public TargetStructure convert(ClassOrInterface input) { + currentClass = input; + Set javaGenerics = new HashSet<>(); + Set txGenerics = new HashSet<>(); + + var genericsIter = input.getGenerics().iterator(); + if (genericsIter.hasNext()) { + // Add empty set of generics to cache so that it doesn't try to calculate it later + var userDefinedGenerics = new HashSet(); + this.userDefinedGenerics.put(input, userDefinedGenerics); + while (genericsIter.hasNext()) { + var next = genericsIter.next(); + userDefinedGenerics.add(next); + // TODO Support multiple bounds + javaGenerics.add(new TargetGeneric(next.getName(), convert(next.getBounds().get(0)))); + } + } else { + this.userDefinedGenerics.put(input, new HashSet<>()); + // Generate generics only if there are no user defined ones + javaGenerics = convert(generics.javaGenerics.generics(input), generics.javaGenerics); + txGenerics = convert(generics.txGenerics.generics(input), generics.txGenerics); + } + + TargetBlock fieldInitializer = null; + if (input.getfieldInitializations().isPresent()) + fieldInitializer = convert(input.getfieldInitializations().get().block); + TargetBlock finalFieldInitializer = fieldInitializer; + + var superInterfaces = input.getSuperInterfaces().stream().map(clazz -> convert(clazz, generics.javaGenerics)).toList(); + var constructors = input.getConstructors().stream().map(constructor -> this.convert(constructor, finalFieldInitializer)).flatMap(List::stream).toList(); + var fields = input.getFieldDecl().stream().map(this::convert).toList(); + var methods = groupOverloads(input.getMethods()).stream().map(this::convert).flatMap(List::stream).toList(); + + TargetMethod staticConstructor = null; + if (input.getStaticInitializer().isPresent()) + staticConstructor = this.convert(input.getStaticInitializer().get()).get(0); + + if (input instanceof Record) + return new TargetRecord(input.getModifiers(), input.getClassName(), javaGenerics, txGenerics, superInterfaces, constructors, staticConstructor, fields, methods); + else if (input.isInterface()) + return new TargetInterface(input.getModifiers(), input.getClassName(), javaGenerics, txGenerics, methods, superInterfaces, staticConstructor); + else return new TargetClass(input.getModifiers(), input.getClassName(), convert(input.getSuperClass(), generics.javaGenerics), javaGenerics, txGenerics, superInterfaces, constructors, staticConstructor, fields, methods); + } + + private List convert(ParameterList input, GenerateGenerics generics) { + return input.getFormalparalist().stream().map(param -> + new MethodParameter((TargetPattern) convert(param)) + ).toList(); + } + + private boolean hasGeneric(Set generics, GenericRefType type) { + return generics.stream().anyMatch(g -> g.name().equals(type.getParsedName())); + } + + private Set collectMethodGenerics(GenerateGenerics generateGenerics, Set generics, Method input) { + var convertedGenerics = new HashSet<>(convert(generics, generateGenerics)); + outer: for (GenericTypeVar typeVar : input.getGenerics()) { + for (var classGeneric : currentClass.getGenerics()) { + if (classGeneric.equals(typeVar)) { + continue outer; + } + } + convertedGenerics.addAll(convert(typeVar, generateGenerics)); + } + /* + * var returnType = sigma.getType(input.getReturnType(), equality); if ((returnType instanceof GenericRefType refType) && !hasGeneric(convertedGenerics, refType)) { convertedGenerics.add(new TargetGeneric(refType.getParsedName(), convert(OBJECT))); } for (var param : input.getParameterList()) { var type = sigma.getType(param.getType(), equality); if (type instanceof GenericRefType refType && !hasGeneric(convertedGenerics, refType)) { convertedGenerics.add(new + * TargetGeneric(refType.getParsedName(), convert(OBJECT))); } } + */ + + return convertedGenerics; + } + + private List convert(Constructor input, TargetBlock fieldInitializer) { + generics = all.get(0); + List result = new ArrayList<>(); + Set> parameterSet = new HashSet<>(); + + for (var s : all) { + generics = s; + var javaGenerics = this.generics.javaGenerics.generics(currentClass, input); + var txGenerics = this.generics.txGenerics.generics(currentClass, input); + List params = convert(input.getParameterList(), this.generics.javaGenerics); + if (parameterSet.stream().noneMatch(p -> p.equals(params))) { + List txParams = convert(input.getParameterList(), this.generics.txGenerics); + var javaMethodGenerics = collectMethodGenerics(generics.javaGenerics(), javaGenerics, input); + var txMethodGenerics = collectMethodGenerics(generics.txGenerics(), txGenerics, input); + + result.add(new TargetConstructor(input.modifier, javaMethodGenerics, txMethodGenerics, params, txParams, convert(input.block), fieldInitializer)); + parameterSet.add(params); + } + } + + return result; + } + + /** + * This only considers type patterns, all other methods aren't grouped together + * @param a + * @param b + * @return + */ + private boolean signatureEquals(Method a, Method b) { + if (!a.name.equals(b.name)) return false; + var para = a.getParameterList().getFormalparalist(); + var parb = b.getParameterList().getFormalparalist(); + if (para.size() != parb.size()) return false; + + for (var i = 0; i < para.size(); i++) { + var pa = para.get(i); + var pb = parb.get(i); + + if (pa instanceof RecordPattern rpa) { + if (pb instanceof RecordPattern rpb) { + if (rpa.getType().equals(rpb.getType())) continue; + } + return false; + } else if (pa.getType().equals(pb.getType())) { + continue; + } + return false; + } + + return true; + } + + // TODO Nested patterns + private List> groupOverloads(List input) { + var done = new HashSet(); + var res = new ArrayList>(); + for (var method : input) { + if (done.contains(method)) continue; + var overloads = new ArrayList(); + overloads.add(method); + done.add(method); + for (var method2 : input) { + if (!done.contains(method2) && signatureEquals(method, method2)) { + done.add(method2); + overloads.add(method2); + } + } + res.add(overloads); + } + return res; + } + + private String encodeName(String name, ParameterList params) { + var res = new StringBuilder(); + res.append(name); + res.append('$'); + for (var param : params.getFormalparalist()) { + if (param instanceof RecordPattern rp) { + res.append(FunNGenerator.encodeType(convert(param.getType()))); + for (var pattern : rp.getSubPattern()) { + res.append(FunNGenerator.encodeType(convert(pattern.getType()))); + } + } + } + return res.toString(); + } + + private List convert(List overloadedMethods) { + if (overloadedMethods.size() == 1) { + return convert(overloadedMethods.get(0)); + } + var res = new ArrayList(); + for (var method : overloadedMethods) { + var newMethod = new Method( + method.modifier, + method.name, + //encodeName(method.name, method.getParameterList()), + method.getReturnType(), + method.getParameterList(), + method.block, + method.getGenerics(), + method.getOffset() + ); + res.add(newMethod); + } + + // TODO Record overloading + /*var template = overloadedMethods.get(0); + + var pParams = new ArrayList(); + var i = 0; + for (var par : template.getParameterList()) { + pParams.add(switch (par) { + case RecordPattern rp -> new RecordPattern(rp.getSubPattern(), "par" + i, rp.getType(), new NullToken()); + default -> par; + }); + i++; + } + var params = new ParameterList(pParams, new NullToken()); + + var statements = new ArrayList(); + statements.add(new Return(makeRecordSwitch(template.getReturnType(), params, res), new NullToken())); + var block = new Block(statements, new NullToken()); + var entryPoint = new Method(template.modifier, template.name, template.getReturnType(), params, block, template.getGenerics(), new NullToken()); + + res.add(entryPoint); // TODO*/ + return res.stream().map(this::convert).flatMap(List::stream).toList(); + } + + private Expression makeRecordSwitch(RefTypeOrTPHOrWildcardOrGeneric returnType, ParameterList params, List overloadedMethods) { + var param = params.getFormalparalist().get(0); + assert param instanceof RecordPattern; // TODO + + var cases = new ArrayList(); + for (var method : overloadedMethods) { + var statements = new ArrayList(); + /*statements.add(new MethodCall( + method.getReturnType(), new ExpressionReceiver(new This(new NullToken())), method.name, + params, + ));*/ + + var block = new Block(statements, new NullToken()); + var labels = new ArrayList(); + cases.add(new SwitchBlock(labels, block, true, new NullToken())); + } + var swtch = new Switch(new LocalVar("par0", param.getType(), new NullToken()), cases, returnType, false, new NullToken()); + + return swtch; + } + + private List convert(Method method) { + generics = all.get(0); + List result = new ArrayList<>(); + Set> parameterSet = new HashSet<>(); + + for (var s : all) { + generics = s; + var javaGenerics = this.generics.javaGenerics.generics(currentClass, method); + var txGenerics = this.generics.txGenerics.generics(currentClass, method); + List params = convert(method.getParameterList(), this.generics.javaGenerics); + if (parameterSet.stream().noneMatch(p -> p.equals(params))) { + List txParams = convert(method.getParameterList(), this.generics.txGenerics); + + var javaMethodGenerics = collectMethodGenerics(generics.javaGenerics(), javaGenerics, method); + var txMethodGenerics = collectMethodGenerics(generics.txGenerics(), txGenerics, method); + + var javaSignature = new TargetMethod.Signature(javaMethodGenerics, params, convert(method.getReturnType(), this.generics.javaGenerics)); + var txSignature = new TargetMethod.Signature(txMethodGenerics, txParams, convert(method.getReturnType(), this.generics.txGenerics)); + result.add(new TargetMethod(method.modifier, method.name, convert(method.block), javaSignature, txSignature)); + parameterSet.add(params); + } + } + return result; + } + + protected TargetSwitch.Case convert(SwitchBlock block) { + return new TargetSwitch.Case(block.getLabels().stream().map(this::convert).toList(), convert((Block) block), block.isExpression); + } + + protected TargetBlock convert(Block block) { + if (block == null) return null; + return new TargetBlock(block.statements.stream().map(this::convert).toList()); + } + + protected TargetBlock convertWrapInBlock(Expression expression) { + var res = convert(expression); + if (!(res instanceof TargetBlock)) + return new TargetBlock(List.of(res)); + return (TargetBlock) res; + } + + protected TargetExpression convert(Expression expr) { + var converter = new StatementToTargetExpression(this); + expr.accept(converter); + return converter.result; + } + + private TargetField convert(Field input) { + return new TargetField(input.modifier, convert(input.getType(), generics.javaGenerics), input.getName()); + } + + private final Map usedFunN = new HashMap<>(); + private final Set usedFunNSuperTypes = new HashSet<>(); + + public Map auxiliaries = new HashMap<>(); + + protected TargetType convert(RefTypeOrTPHOrWildcardOrGeneric input) { + return convert(input, generics.javaGenerics); + } + + private static void collectArguments(TargetSpecializedType tspec, List newParams) { + for (var i = 0; i < tspec.params().size(); i++) { + var param = tspec.params().get(i); + if (param instanceof TargetSpecializedType fn) { + collectArguments(tspec, newParams); + } else { + newParams.add(param); + } + } + } + + static TargetType flattenFunNType(List params, FunNGenerator.GenericParameters gep) { + var newParams = new ArrayList(); + for (TargetType param : params) { + if (param instanceof TargetSpecializedType fn) { + collectArguments(fn, newParams); + } else { + newParams.add(param); + } + } + var filteredParams = new ArrayList(); + for (var i = 0; i < newParams.size(); i++) { + if (gep.parameters.get(i) != null) + filteredParams.add(newParams.get(i)); + } + return TargetFunNType.fromParams(params, filteredParams); + } + + protected TargetType convert(RefTypeOrTPHOrWildcardOrGeneric input, GenerateGenerics generics) { + return input.acceptTV(new TypeVisitor<>() { + @Override + public TargetType visit(RefType refType) { + var name = refType.getName().toString(); + if (name.equals("void")) + return null; + if (refType.isPrimitive()) { + return TargetType.toPrimitive(refType); + } + + var params = refType.getParaList().stream().map(type -> { + var res = convert(type, generics); + if (res == null) res = new TargetRefType("java.lang.Void"); + return res; + }).toList(); + + if (name.matches("Fun\\d+\\$\\$")) { // TODO This seems like a bad idea + var className = FunNGenerator.getSpecializedClassName(FunNGenerator.getArguments(params), FunNGenerator.getReturnType(params)); + if (!usedFunNSuperTypes.contains(params.size())) { + usedFunNSuperTypes.add(params.size()); + var code = FunNGenerator.generateSuperBytecode(params.size() - 1); + var superClassName = FunNGenerator.getSuperClassName(params.size() - 1); + try { + classLoader.findClass(superClassName); + } catch (ClassNotFoundException e) { + try { + classLoader.loadClass(code); + } catch (LinkageError ignored) {} + } + auxiliaries.put(superClassName, code); + } + FunNGenerator.GenericParameters gep = null; + if (!usedFunN.containsKey(className)) { + gep = new FunNGenerator.GenericParameters(); + var code = FunNGenerator.generateSpecializedBytecode(FunNGenerator.getArguments(params), FunNGenerator.getReturnType(params), gep); + try { + classLoader.findClass(className); + } catch (ClassNotFoundException e) { + try { + classLoader.loadClass(code); + } catch (LinkageError ignored) {} + } + usedFunN.put(className, gep); + auxiliaries.put(className, code); + } else { + gep = usedFunN.get(className); + } + return flattenFunNType(params, gep); + } + return new TargetRefType(name, params); + } + + @Override + public TargetType visit(SuperWildcardType superWildcardType) { + return new TargetSuperWildcard(convert(superWildcardType.getInnerType(), generics)); + } + + @Override + public TargetType visit(TypePlaceholder typePlaceholder) { + return generics.getTargetType(typePlaceholder); + } + + @Override + public TargetType visit(ExtendsWildcardType extendsWildcardType) { + return new TargetExtendsWildcard(convert(extendsWildcardType.getInnerType(), generics)); + } + + @Override + public TargetType visit(GenericRefType genericRefType) { + return new TargetGenericType(genericRefType.getParsedName()); + } + }); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/generate/Bound.java b/javatx-src/main/java/de/dhbwstuttgart/target/generate/Bound.java new file mode 100644 index 0000000..3e74909 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/generate/Bound.java @@ -0,0 +1,24 @@ +package de.dhbwstuttgart.target.generate; + +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; + +import java.util.List; + +public record Bound(boolean isOnMethod, RefTypeOrTPHOrWildcardOrGeneric bound) { + public static Bound onMethod(String tph) { + return new Bound(true, TypePlaceholder.of(tph)); + } + + public static Bound onMethod(RefTypeOrTPHOrWildcardOrGeneric bound) { + return new Bound(true, bound); + } + + public static Bound onClass(String tph) { + return new Bound(false, TypePlaceholder.of(tph)); + } + + public static Bound onClass(RefTypeOrTPHOrWildcardOrGeneric bound) { + return new Bound(false, bound); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/generate/BoundsList.java b/javatx-src/main/java/de/dhbwstuttgart/target/generate/BoundsList.java new file mode 100644 index 0000000..5a1f797 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/generate/BoundsList.java @@ -0,0 +1,52 @@ +package de.dhbwstuttgart.target.generate; + +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; + +import java.util.AbstractList; +import java.util.List; + +public class BoundsList extends AbstractList { + private final List bounds; + public final RefTypeOrTPHOrWildcardOrGeneric base; + + public BoundsList(RefTypeOrTPHOrWildcardOrGeneric base, List bounds) { + this.base = base; + this.bounds = bounds; + } + + public BoundsList(List bounds) { + this(null, bounds); + } + + public BoundsList(Bound... bounds) { + this(null, List.of(bounds)); + } + + @Override + public Bound get(int index) { + return bounds.get(index); + } + + @Override + public int size() { + return bounds.size(); + } + + @Override + public boolean equals(Object other) { + if (!(other instanceof BoundsList right)) return false; + if (size() != right.size()) return false; + for (var i = 0; i < size(); i++) { + var l = get(i); + var r = right.get(i); + if (l.isOnMethod() != r.isOnMethod()) return false; + if (i == size() - 1) { + if (!(l.bound() instanceof TypePlaceholder)) { + if (!(l.bound().equals(r.bound()))) return false; + } + } + } + return true; + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/generate/CycleFinder.java b/javatx-src/main/java/de/dhbwstuttgart/target/generate/CycleFinder.java new file mode 100644 index 0000000..175b422 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/generate/CycleFinder.java @@ -0,0 +1,104 @@ +package de.dhbwstuttgart.target.generate; + +import java.util.*; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +public class CycleFinder { + private CycleFinder() {} + + static Set allNodes(Set input) { + return input.stream() + .filter(GenerateGenerics.PairLT.class::isInstance) + .map(GenerateGenerics.PairLT.class::cast) + .flatMap(pair -> Stream.of(pair.left, pair.right)).collect(Collectors.toSet()); + } + + static Set outgoingEdgesOf(GenerateGenerics.TPH tph, Set input) { + return input.stream() + .filter(GenerateGenerics.PairLT.class::isInstance) + .map(GenerateGenerics.PairLT.class::cast) + .filter(pair -> pair.left.equals(tph)) + .map(pair -> pair.right).collect(Collectors.toSet()); + } + + static boolean containsEdge(GenerateGenerics.TPH a, GenerateGenerics.TPH b, Set input) { + return input.stream() + .filter(GenerateGenerics.PairLT.class::isInstance) + .map(GenerateGenerics.PairLT.class::cast) + .anyMatch(pair -> pair.left.equals(a) && pair.right.equals(b)); + } + + // Tiernan simple cycles algorithm + // Adapted from https://github.com/jgrapht/jgrapht/blob/master/jgrapht-core/src/main/java/org/jgrapht/alg/cycle/TiernanSimpleCycles.java + static Set> findCycles(Set input) { + Map indices = new HashMap<>(); + List path = new ArrayList<>(); + Set pathSet = new HashSet<>(); + Map> blocked = new HashMap<>(); + Set> cycles = new HashSet<>(); + + int index = 0; + for (var tph : allNodes(input)) { + blocked.put(tph, new HashSet<>()); + indices.put(tph, index++); + } + + var vertexIterator = allNodes(input).iterator(); + if (!vertexIterator.hasNext()) return cycles; + + GenerateGenerics.TPH startOfPath = null; + GenerateGenerics.TPH endOfPath = vertexIterator.next(); + GenerateGenerics.TPH temp = null; + int endIndex = 0; + boolean extensionFound = false; + path.add(endOfPath); + pathSet.add(endOfPath); + + while (true) { + do { + extensionFound = false; + for (GenerateGenerics.TPH n : outgoingEdgesOf(endOfPath, input)) { + int cmp = indices.get(n).compareTo(indices.get(path.get(0))); + if ((cmp > 0) && !pathSet.contains(n) && !blocked.get(endOfPath).contains(n)) { + path.add(n); + pathSet.add(n); + endOfPath = n; + extensionFound = true; + break; + } + } + } while (extensionFound); + + startOfPath = path.get(0); + if (containsEdge(endOfPath, startOfPath, input)) { + List cycle = new ArrayList<>(path); + cycles.add(cycle); + } + if (path.size() > 1) { + blocked.get(endOfPath).clear(); + endIndex = path.size() - 1; + path.remove(endIndex); + pathSet.remove(endOfPath); + --endIndex; + temp = endOfPath; + endOfPath = path.get(endIndex); + blocked.get(endOfPath).add(temp); + continue; + } + if (vertexIterator.hasNext()) { + path.clear(); + pathSet.clear(); + endOfPath = vertexIterator.next(); + path.add(endOfPath); + pathSet.add(endOfPath); + for (GenerateGenerics.TPH tph : blocked.keySet()) { + blocked.get(tph).clear(); + } + continue; + } + break; + } + return cycles; + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/generate/GenerateGenerics.java b/javatx-src/main/java/de/dhbwstuttgart/target/generate/GenerateGenerics.java new file mode 100644 index 0000000..403ccdb --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/generate/GenerateGenerics.java @@ -0,0 +1,976 @@ +package de.dhbwstuttgart.target.generate; + +import de.dhbwstuttgart.parser.NullToken; +import de.dhbwstuttgart.syntaxtree.ClassOrInterface; +import de.dhbwstuttgart.syntaxtree.Constructor; +import de.dhbwstuttgart.syntaxtree.GenericTypeVar; +import de.dhbwstuttgart.syntaxtree.Method; +import de.dhbwstuttgart.syntaxtree.statement.*; +import de.dhbwstuttgart.syntaxtree.type.*; +import de.dhbwstuttgart.syntaxtree.type.Void; +import de.dhbwstuttgart.target.tree.type.TargetGenericType; +import de.dhbwstuttgart.target.tree.type.TargetType; +import de.dhbwstuttgart.typeinference.result.PairTPHEqualTPH; +import de.dhbwstuttgart.typeinference.result.PairTPHequalRefTypeOrWildcardType; +import de.dhbwstuttgart.typeinference.result.PairTPHsmallerTPH; +import de.dhbwstuttgart.typeinference.result.ResultSet; + +import java.util.*; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +public abstract class GenerateGenerics { + + private final ASTToTargetAST astToTargetAST; + + public class TPH { + private final TypePlaceholder wrap; + + TPH(TypePlaceholder wrap) { + this.wrap = wrap; + } + + public TypePlaceholder resolve() { + return equality.getOrDefault(wrap, wrap); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + TPH tph = (TPH) o; + return Objects.equals(resolve(), tph.resolve()); + } + + @Override + public int hashCode() { + return Objects.hash(resolve()); + } + + @Override + public String toString() { + return resolve().getName(); + } + } + + public abstract class Pair { + public final TPH left; + + Pair(TPH left) { + this.left = left; + } + + public abstract RefTypeOrTPHOrWildcardOrGeneric resolveRight(); + } + + public class PairLT extends Pair { + public final TPH right; + + PairLT(TPH left, TPH right) { + super(left); + this.right = right; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + PairLT pairLT = (PairLT) o; + return Objects.equals(right, pairLT.right) && Objects.equals(left, pairLT.left); + } + + @Override + public int hashCode() { + return Objects.hash(right, left); + } + + @Override + public RefTypeOrTPHOrWildcardOrGeneric resolveRight() { + return right.resolve(); + } + + @Override + public String toString() { + return "(" + left + " < " + right + ")"; + } + } + + public class PairEQ extends Pair { + public final RefType right; + + PairEQ(TPH left, RefType right) { + super(left); + this.right = right; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + PairEQ pairLT = (PairEQ) o; + return Objects.equals(right, pairLT.right) && Objects.equals(left, pairLT.left); + } + + @Override + public int hashCode() { + return Objects.hash(right, left); + } + + @Override + public RefTypeOrTPHOrWildcardOrGeneric resolveRight() { + return right; + } + + @Override + public String toString() { + return "(" + left + " = " + right + ")"; + } + } + + final Map> computedGenericsOfMethods = new HashMap<>(); + final Map> computedGenericsOfClasses = new HashMap<>(); + + final Map> usedTPHsOfMethods = new HashMap<>(); + final Map> familyOfMethods = new HashMap<>(); + + final Set simplifiedConstraints = new HashSet<>(); + final Map concreteTypes = new HashMap<>(); + final Map equality = new HashMap<>(); + + GenerateGenerics(ASTToTargetAST astToTargetAST, ResultSet constraints) { + this.astToTargetAST = astToTargetAST; + for (var constraint : constraints.results) { + if (constraint instanceof PairTPHsmallerTPH p) { + System.out.println(p.left + " " + p.left.getVariance()); + simplifiedConstraints.add(new PairLT(new TPH(p.left), new TPH(p.right))); + } else if (constraint instanceof PairTPHEqualTPH p) { + equality.put(p.getLeft(), p.getRight()); + } else if (constraint instanceof PairTPHequalRefTypeOrWildcardType p) { + System.out.println(p.left + " = " + p.right); + concreteTypes.put(new TPH(p.left), p.right); + } + } + + System.out.println("Simplified constraints: " + simplifiedConstraints); + } + + Set findTypeVariables(RefTypeOrTPHOrWildcardOrGeneric type) { + var result = new HashSet(); + if (type instanceof TypePlaceholder tph) { + var nTph = new TPH(tph); + if (concreteTypes.containsKey(nTph)) { + result.addAll(findTypeVariables(concreteTypes.get(nTph))); + return result; + } + result.add(nTph); + } else if (type instanceof RefType refType) { + for (var t : refType.getParaList()) + result.addAll(findTypeVariables(t)); + } else if (type instanceof ExtendsWildcardType wildcardType) { + result.addAll(findTypeVariables(wildcardType.getInnerType())); + } else if (type instanceof SuperWildcardType wildcardType) { + result.addAll(findTypeVariables(wildcardType.getInnerType())); + } + return result; + } + + boolean containsRelation(Set result, PairLT pair) { + // Check if both the right and the left are already part of a relation + var containsLeft = false; + for (var pair2 : result) { + if (pair2.left.equals(pair.left)) { + containsLeft = true; + break; + } + } + var containsRight = false; + for (var pair2 : result) + if (pair2 instanceof PairLT plt) { + if (plt.right.equals(pair.right)) { + containsRight = true; + break; + } + } + return containsLeft && containsRight; + } + + void addToPairs(Set input, Pair pair) { + if (pair instanceof PairLT plt) { + input.removeIf(pair2 -> { + if (pair2 instanceof PairEQ peq) { + return peq.left.equals(plt.left) && peq.right.equals(ASTToTargetAST.OBJECT); + } + return false; + }); + } else if (input.stream().anyMatch(p -> p.left.equals(pair.left))) { + return; + } + + input.add(pair); + } + + void addToEquality(TypePlaceholder from, TypePlaceholder to, Set referenced) { + for (var entry : new HashSet<>(equality.entrySet())) { + if (entry.getValue().equals(from)) { + equality.remove(entry.getKey()); + equality.put(entry.getKey(), to); + } + } + System.out.println(from + " -> " + to + " " + from.getVariance()); + //from.setVariance(to.getVariance()); + equality.put(from, to); + referenced.remove(new TPH(from)); + referenced.add(new TPH(to)); + } + + Set transitiveClosure(Set generics) { + Set all = new HashSet<>(generics); + Set toAdd = new HashSet<>(); + int sizeBefore; + do { + sizeBefore = all.size(); + toAdd.clear(); + for (var g1 : all) { + for (var g2 : all) { + if (g1 instanceof PairLT pair && g2 instanceof PairLT pair2) { + if (pair2.left.equals(pair.right)) + toAdd.add(new PairLT(pair.left, pair2.right)); + } + } + } + all.addAll(toAdd); + } while (sizeBefore < all.size()); + return all; + } + + private void methodFindConstraints( + ClassOrInterface owner, Method method, + Set typeVariables, + Set typeVariablesOfClass, + Set result + ) { + var userDefinedGenericsOfClass = astToTargetAST.userDefinedGenerics.get(owner); + + // Type variables with bounds that are also type variables of the method + for (var typeVariable : new HashSet<>(typeVariables)) { + if (classHasGeneric(userDefinedGenericsOfClass, typeVariablesOfClass, typeVariable)) + continue; + for (var pair : simplifiedConstraints) { + if (pair.left.equals(typeVariable) && typeVariables.contains(pair.right)) { + addToPairs(result, new PairLT(pair.left, pair.right)); + } + } + } + + if (method.block != null) + method.block.accept(new TracingStatementVisitor() { + + private RefTypeOrTPHOrWildcardOrGeneric superType = new de.dhbwstuttgart.syntaxtree.type.Void(new NullToken()); + + @Override + public void visit(MethodCall methodCall) { + //Anfang es werden Paare von TPHs gespeichert, die bei den Generated Generics ueber die Methodengrenzen hinweg + //betrachtet werden muessen + //Definition 7.2 (Family of generated generics). T1 <. R1 <.^∗ R2 <. T2 + Set T1s = + methodCall.getArgumentList() + .getArguments() + .stream() + .map(TypableStatement::getType) + .collect(Collectors.toCollection(HashSet::new)) + .stream().filter(TypePlaceholder.class::isInstance) + .map(TypePlaceholder.class::cast) + .map(TPH::new) + .collect(Collectors.toCollection(HashSet::new)); + Set T2s = new HashSet<>(); + findTphs(superType, T2s); + + System.out.println("T1s: " + T1s + " T2s: " + T2s); + //Ende + + superType = methodCall.receiverType; + methodCall.receiver.accept(this); + for (int i = 0; i < methodCall.arglist.getArguments().size(); i++) { + superType = methodCall.arglist.getArguments().get(i).getType(); + methodCall.arglist.getArguments().get(i).accept(this); + } + + if (methodCall.receiver instanceof ExpressionReceiver expressionReceiver) { + if (expressionReceiver.expr instanceof This) { + var optMethod = astToTargetAST.findMethod(owner, methodCall.name, methodCall.signatureArguments().stream().map(astToTargetAST::convert).toList()); + if (optMethod.isEmpty()) return; + var method2 = optMethod.get(); + System.out.println("In: " + method.getName() + " Method: " + method2.getName()); + var generics = family(owner, method2); + + // transitive and + var all = transitiveClosure(generics); + // reflexive + var toAdd = new HashSet(); + for (var generic : all) { + toAdd.add(new PairLT(generic.left, generic.left)); + } + all.addAll(toAdd); + + HashSet newPairs = new HashSet<>(); + + // Loop from hell + outer: + for (var R1 : typeVariables) { + if (typeVariablesOfClass.contains(R1)) continue; + for (var generic : all) + if (generic instanceof PairLT ptph) { + for (var pair : simplifiedConstraints) { + if (!(pair.left.equals(R1) && pair.right.equals(ptph.left))) + continue; + + for (var R2 : typeVariables) { + for (var pair2 : simplifiedConstraints) { + + if (!(pair2.right.equals(R2) && pair2.left.equals(ptph.right))) + continue; + if (R1.equals(R2)) continue; + if (!T1s.contains(R1) || !T2s.contains(R2)) continue; + + var newPair = new PairLT(R1, R2); + System.out.println("New pair: " + newPair); + newPairs.add(newPair); + + if (!containsRelation(result, newPair)) + addToPairs(result, newPair); + continue outer; + } + } + } + } + } + simplifiedConstraints.addAll(newPairs); + } + } + } + + @Override + public void visit(LambdaExpression lambdaExpression) { + superType = new Void(new NullToken()); + lambdaExpression.methodBody.accept(this); + } + + @Override + public void visit(Assign assign) { + superType = assign.rightSide.getType(); + assign.rightSide.accept(this); + } + + @Override + public void visit(BinaryExpr binary) { + superType = new Void(new NullToken()); + binary.lexpr.accept(this); + superType = new Void(new NullToken()); + binary.rexpr.accept(this); + } + + @Override + public void visit(Block block) { + for (var expr : block.statements) { + superType = new de.dhbwstuttgart.syntaxtree.type.Void(new NullToken()); + expr.accept(this); + } + } + + @Override + public void visit(IfStmt ifStmt) { + superType = new Void(new NullToken()); + ifStmt.expr.accept(this); + superType = new Void(new NullToken()); + ifStmt.then_block.accept(this); + superType = new Void(new NullToken()); + if (ifStmt.else_block != null) + ifStmt.else_block.accept(this); + } + + @Override + public void visit(Return aReturn) { + superType = aReturn.getType(); + aReturn.retexpr.accept(this); + } + + @Override + public void visit(WhileStmt whileStmt) { + superType = new Void(new NullToken()); + whileStmt.expr.accept(this); + superType = new Void(new NullToken()); + whileStmt.loopBlock.accept(this); + } + + @Override + public void visit(ArgumentList arglist) { + for (int i = 0; i < arglist.getArguments().size(); i++) { + superType = arglist.getArguments().get(i).getType(); + arglist.getArguments().get(i).accept(this); + } + } + }); + + var closure = transitiveClosure(simplifiedConstraints); + // Type variables with bounds that are also type variables of the class + for (var typeVariable : new HashSet<>(typeVariables)) { + if (typeVariablesOfClass.contains(typeVariable)) continue; + + var pairs = new HashSet(); + for (var pair : closure) { + if (!(pair instanceof PairLT ptph)) continue; + if (ptph.left.equals(typeVariable) && typeVariablesOfClass.contains(ptph.right)) { + pairs.add(new PairLT(ptph.left, ptph.right)); + } + } + + // Find the closest pair with the minimum amount of steps + PairLT minimalPair = null; + var minSteps = Integer.MAX_VALUE; + for (var pair : pairs) { + var left = pair.left; + var visited = new HashSet(); + var steps = 0; + while (!left.equals(pair.right)) { + visited.add(left); + var found = false; + for (var pair2 : simplifiedConstraints) { + if (left.equals(pair2.left) && !visited.contains(pair2.right)) { + left = pair2.right; + steps += 1; + found = true; + break; + } + } + if (!found) break; + } + if (steps < minSteps) { + minSteps = steps; + minimalPair = pair; + } + } + + if (minimalPair != null) + addToPairs(result, minimalPair); + } + + // All unbounded type variables (bounds not in method) + outer: + for (var typeVariable : typeVariables) { + if (classHasGeneric(userDefinedGenericsOfClass, typeVariablesOfClass, typeVariable)) + continue; + for (var pair : result) { + if (pair.left.equals(typeVariable)) + continue outer; + } + addToPairs(result, new PairEQ(typeVariable, ASTToTargetAST.OBJECT)); + } + + // All unbounded bounds + outer: + for (var pair : simplifiedConstraints) { + for (var pair2 : simplifiedConstraints) { + if (pair.right.equals(pair2.left)) + continue outer; + } + if (!classHasGeneric(userDefinedGenericsOfClass, typeVariablesOfClass, pair.right) && typeVariables.contains(pair.right)) { + addToPairs(result, new PairEQ(pair.right, ASTToTargetAST.OBJECT)); + } + } + } + + private boolean classHasGeneric(Set userDefinedGenericsOfClass, Set typeVariablesOfClass, TPH typeVariable) { + return typeVariablesOfClass.contains(typeVariable) || userDefinedGenericsOfClass.stream().anyMatch(g -> g.getName().equals(typeVariable.resolve().getName())); + } + + private void methodFindTypeVariables( + Method method, + Set typeVariables + ) { + + if (!(method instanceof Constructor)) + typeVariables.addAll(findTypeVariables(method.getReturnType())); + for (var arg : method.getParameterList().getFormalparalist()) { + typeVariables.addAll(findTypeVariables(arg.getType())); + } + + if (method.block != null) + method.block.accept(new TracingStatementVisitor() { + @Override + public void visit(LocalVarDecl localVarDecl) { + typeVariables.addAll(findTypeVariables(localVarDecl.getType())); + } + + @Override + public void visit(MethodCall methodCall) { + super.visit(methodCall); + typeVariables.addAll(findTypeVariables(methodCall.getType())); + } + }); + } + + abstract void generics(ClassOrInterface owner, Method method, Set result, Set javaTypeVariablesOfClass); + + Set family(ClassOrInterface owner, Method method) { + Set result = new HashSet<>(); + if (familyOfMethods.containsKey(method)) + return familyOfMethods.get(method); + + familyOfMethods.put(method, result); + + var classGenerics = generics(owner); + HashSet typeVariablesOfClass = new HashSet<>(); + + for (var pair : classGenerics) { + typeVariablesOfClass.add(pair.left); + } + + HashSet javaTypeVariables = new HashSet<>(); + + methodFindTypeVariables(method, javaTypeVariables); + methodFindConstraints(owner, method, javaTypeVariables, typeVariablesOfClass, result); + eliminateTransitives(result); + + return result; + } + + Set generics(ClassOrInterface owner, Method method) { + if (computedGenericsOfMethods.containsKey(method)) { + var cached = computedGenericsOfMethods.get(method); + System.out.println("Cached " + method.getName() + ": " + cached); + return cached; + } + + var result = new HashSet(); + computedGenericsOfMethods.put(method, result); + + var classGenerics = generics(owner); + HashSet typeVariablesOfClass = new HashSet<>(); + for (var pair : classGenerics) { + typeVariablesOfClass.add(pair.left); + } + + result.addAll(family(owner, method)); + + var referenced = new HashSet(); + + var usedTphs = new HashSet(); + // For eliminating inner type variables we need to figure out which ones are actually used + for (var param : method.getParameterList().getFormalparalist()) { + usedTphs.addAll(findTypeVariables(param.getType())); + } + usedTphs.addAll(findTypeVariables(method.getReturnType())); + referenced.addAll(usedTphs); + referenced.addAll(typeVariablesOfClass); + + generics(owner, method, result, referenced); + usedTPHsOfMethods.put(method, usedTphs); + + normalize(result, classGenerics, usedTphs); + + System.out.println(this.getClass().getSimpleName() + " " + method.name + ": " + result); + return result; + } + + private void eliminateChain(Set result, List chain) { + for (var pair : new HashSet<>(result)) { + if (pair instanceof PairLT ptph && chain.get(chain.size() - 1).equals(ptph.left)) { + if (chain.contains(ptph.right)) return; + var copy = new ArrayList<>(chain); + copy.add(ptph.right); + if (copy.size() > 2) + result.remove(new PairLT(chain.get(0), ptph.right)); + eliminateChain(result, copy); + } + } + } + + void eliminateTransitives(Set result) { + for (var pair : new HashSet<>(result)) + if (pair instanceof PairLT ptph) { + var first = ptph.left; + var chain = new ArrayList(); + chain.add(ptph.left); + chain.add(ptph.right); + eliminateChain(result, chain); + } + } + + void findAllBounds(RefTypeOrTPHOrWildcardOrGeneric type, Set generics) { + if (type instanceof TypePlaceholder tph) { + var nTph = new TPH(tph); + var concreteType = concreteTypes.get(nTph); + if (concreteType != null) { + findAllBounds(concreteType, generics); + return; + } + + var found = false; + for (var rsp : simplifiedConstraints) { + if (rsp.left.equals(nTph)) { + var pair = new PairLT(new TPH(tph), rsp.right); + if (!generics.contains(pair)) { + addToPairs(generics, pair); + findAllBounds(rsp.right.resolve(), generics); + found = true; + } + } + } + if (!found) + addToPairs(generics, new PairEQ(nTph, ASTToTargetAST.OBJECT)); + } else if (type instanceof RefType refType) { + refType.getParaList().forEach(t -> findAllBounds(t, generics)); + } + } + + abstract void generics(ClassOrInterface classOrInterface, Set result, Set referenced); + + Set generics(ClassOrInterface classOrInterface) { + if (computedGenericsOfClasses.containsKey(classOrInterface)) + return computedGenericsOfClasses.get(classOrInterface); + + Set javaResult = new HashSet<>(); + computedGenericsOfClasses.put(classOrInterface, javaResult); + + for (var field : classOrInterface.getFieldDecl()) { + findAllBounds(field.getType(), javaResult); + } + + var referenced = new HashSet(); + eliminateTransitives(javaResult); + generics(classOrInterface, javaResult, referenced); + + var referencedByClass = new HashSet(); + for (var field : classOrInterface.getFieldDecl()) { + findTphs(field.getType(), referencedByClass); + } + + normalize(javaResult, null, referencedByClass); + + System.out.println(this.getClass().getSimpleName() + " Class " + classOrInterface.getClassName().getClassName() + ": " + javaResult); + return javaResult; + } + + void normalize(Set result, Set classGenerics, Set usedTphs) { + outer: + for (var tph : usedTphs) { + for (var p1 : new HashSet<>(result)) { + if (p1 instanceof PairLT ptph && ptph.left.equals(ptph.right)) + result.remove(p1); // TODO This is a bit strange + if (p1.left.equals(tph)) continue outer; + } + + if (classGenerics == null || classGenerics.stream().noneMatch((pair) -> pair.left.equals(tph))) + addToPairs(result, new PairEQ(tph, ASTToTargetAST.OBJECT)); + } + } + + private record ToAdd(TypePlaceholder left, TypePlaceholder right) {} + + void equalizeTypeVariables(Set input, Set referenced) { + + var elementsToAddToEquality = new ArrayList(); + + for (var pair : new HashSet<>(input)) { + if (pair instanceof PairLT ptph && referenced.contains(ptph.left)) { + var chain = new ArrayList(); + chain.add(ptph.left); + chain.add(ptph.right); + + outer: + while (true) { + var added = false; + for (var pair2 : input) { + if (pair2 instanceof PairLT ptph2 && ptph2.left.equals(chain.get(chain.size() - 1))) { + if (chain.contains(ptph2.right)) break outer; + chain.add(ptph2.right); + added = true; + } + } + if (!added) break; + } + + System.out.println(chain + " " + chain.stream().map(e -> e.resolve().getVariance()).toList()); + var variance = chain.get(0).resolve().getVariance(); + if (variance != 1) continue; + var index = 0; + for (var tph : chain) { + if (variance == 1 && tph.resolve().getVariance() == -1) { + variance = -1; + } + if (variance == -1 && tph.resolve().getVariance() == 1 && referenced.contains(tph)) { + break; + } + index++; + } + if (variance == 1) continue; + + + var start = chain.get(0); + var prev = start; + for (var i = 1; i < index; i++) { + var cur = chain.get(i); + if (!referenced.contains(cur)) continue; + elementsToAddToEquality.add(new ToAdd(cur.resolve(), start.resolve())); + //addToEquality(cur.resolve(), start.resolve(), referenced); + TPH finalPrev = prev; + input.removeIf(p -> p.equals(new PairLT(finalPrev, cur))); + for (var pair2 : new HashSet<>(input)) { + // TODO Maybe this would be unnecessary if we were to add the = constraints later on + if (pair2 instanceof PairEQ peq && pair.left.equals(cur)) { + input.remove(pair2); + input.add(new PairEQ(start, peq.right)); + } + } + prev = chain.get(i); + } + } + } + + for (var pair : elementsToAddToEquality) { + System.out.println(pair); + addToEquality(pair.left, pair.right, referenced); + } + } + + void findTphs(RefTypeOrTPHOrWildcardOrGeneric type, Set tphs) { + if (type instanceof RefType refType) { + refType.getParaList().forEach(t -> findTphs(t, tphs)); + } else if (type instanceof TypePlaceholder tph) { + tph = equality.getOrDefault(tph, tph); + var concreteType = concreteTypes.get(new TPH(tph)); + if (concreteType != null) { + findTphs(concreteType, tphs); + return; + } + tphs.add(new TPH(tph)); + } + } + + void eliminateInnerTypeVariablesOfClass(ClassOrInterface classOrInterface, Set input, Set referenced) { + for (var field : classOrInterface.getFieldDecl()) { + findTphs(field.getType(), referenced); + } + doIterationForMethods(classOrInterface); + for (var method : classOrInterface.getMethods()) { + var usedTPHs = usedTPHsOfMethods.get(method); + if (usedTPHs != null) + referenced.addAll(usedTPHs); + } + eliminateInnerTypeVariables(referenced, input); + } + + void doIterationForMethods(ClassOrInterface classOrInterface) { + familyOfMethods.clear(); + + var oldFamily = new HashMap>(); + do { + oldFamily.clear(); + oldFamily.putAll(familyOfMethods); + familyOfMethods.clear(); + Stream.concat(classOrInterface.getMethods().stream(), classOrInterface.getConstructors().stream()).forEach(method -> { + family(classOrInterface, method); + }); + } while(!oldFamily.equals(familyOfMethods)); + + Stream.concat(classOrInterface.getMethods().stream(), classOrInterface.getConstructors().stream()).forEach(method -> { + generics(classOrInterface, method); + }); + } + + private void findChain(Set referenced, Set input, Set output, TPH start, TPH end, Set chain) { + if (referenced.contains(end)) { + var pair = new PairLT(start, end); + output.add(pair); + return; + } + var foundNext = false; + for (var pair : input) { + if (pair instanceof PairLT ptph && ptph.left.equals(end)) { + if (chain.contains(ptph.right)) return; + chain = new HashSet<>(chain); + chain.add(ptph.right); + findChain(referenced, input, output, start, ptph.right, chain); + foundNext = true; + } + } + if (!foundNext) { + output.add(new PairEQ(start, ASTToTargetAST.OBJECT)); + } + } + + void eliminateInnerTypeVariables(Set referenced, Set input) { + var output = new HashSet(); + for (var tph : referenced) { + for (var pair : input) { + if (pair instanceof PairLT pthp && pthp.left.equals(tph)) { + var chain = new HashSet(); + chain.add(tph); + findChain(referenced, input, output, tph, pthp.right, chain); + } + } + } + for (var pair : input) { + if (pair instanceof PairEQ rtph) { + if (referenced.contains(rtph.left)) + output.add(rtph); + } + } + + input.clear(); + input.addAll(output); + } + + void eliminateCycles(Set input, Set referenced) { + var cycles = CycleFinder.findCycles(input); + for (var cycle : cycles) { + var newTph = TypePlaceholder.fresh(new NullToken()); + var variance = cycle.get(0).resolve().getVariance(); + for (var tph : cycle) { + if (tph.resolve().getVariance() != variance) { + variance = 0; + break; + } + } + newTph.setVariance(variance); + + referenced.add(new TPH(newTph)); + addToPairs(input, new PairEQ(new TPH(newTph), ASTToTargetAST.OBJECT)); + cycle.add(cycle.get(0)); // Make it a complete cycle + for (var i = 0; i < cycle.size() - 1; i++) { + var left = cycle.get(i); + var right = cycle.get(i + 1); + var pair = new PairLT(left, right); + input.remove(pair); + addToEquality(left.resolve(), newTph, referenced); + } + } + } + + Set findConnectionToReturnType(Set returnTypes, Set input, Set visited, TPH tph) { + if (returnTypes.contains(tph)) { + var res = new HashSet(); + res.add(tph); + return res; + } else { + for (var pair : input) if (pair instanceof PairLT ptph) { + if (ptph.left.equals(tph) && !visited.contains(ptph.right)) { + visited.add(ptph.right); + var result = findConnectionToReturnType(returnTypes, input, visited, ptph.right); + if (result.size() > 0) { + result.add(ptph.right); + return result; + }; + } + } + } + return new HashSet<>(); + } + + void eliminateInfimaConnectedToReturnType(Method method, Set input, Set referenced) { + var foundInfima = false; + do { + foundInfima = false; + for (var constraint : new HashSet<>(input)) { + var left = constraint.left; + Set infima = new HashSet<>(); + for (var pair : input) { + if (pair instanceof PairLT stph) { + if (pair.left.equals(constraint.left)) + infima.add(stph); + } + } + if (infima.size() > 1) { + System.out.println(infima); + for (var pair : infima) { + var returnTypes = findTypeVariables(method.getReturnType()); + var chain = findConnectionToReturnType(returnTypes, input, new HashSet<>(), pair.left); + System.out.println("Find: " + pair.left + " " + chain); + chain.remove(pair.left); + if (chain.size() > 0) { + for (var tph : chain) + addToEquality(pair.left.resolve(), tph.resolve(), referenced); + foundInfima = true; + } + } + } + } + } while (foundInfima); + input.removeIf((i) -> (i instanceof PairLT lt) && lt.left.equals(lt.right)); + } + + void eliminateInfima(Set input, Set referenced) { + var foundInfima = false; + do { + foundInfima = false; + for (var constraint : new HashSet<>(input)) { + var left = constraint.left; + Set infima = new HashSet<>(); + for (var pair : input) { + if (pair instanceof PairLT stph) { + if (pair.left.equals(constraint.left)) + infima.add(stph); + } + } + if (infima.size() > 1) { + foundInfima = true; + var newTph = TypePlaceholder.fresh(new NullToken()); + var variance = infima.stream().findFirst().get().right.resolve().getVariance(); + for (var pair : infima) { + if (pair.right.resolve().getVariance() != variance) { + variance = 0; + break; + } + } + newTph.setVariance(variance); + System.out.println(infima + " " + infima.stream().map(i -> i.right.resolve().getVariance()).toList()); + System.out.println("Infima new TPH " + newTph + " variance " + variance); + + //referenced.add(newTph); + addToPairs(input, new PairLT(left, new TPH(newTph))); + input.removeAll(infima); + for (var infimum : infima) { + addToEquality(infimum.right.resolve(), newTph, referenced); + new HashSet<>(input).forEach(pair -> { + if (pair.left.equals(infimum.right)) { + input.remove(pair); + if (pair instanceof PairLT stph) { + if (!newTph.equals(stph.right.resolve())) + addToPairs(input, new PairLT(new TPH(newTph), stph.right)); + } else if (pair instanceof PairEQ rtph) { + addToPairs(input, new PairEQ(new TPH(newTph), rtph.right)); + } + } else if (pair instanceof PairLT stph && stph.right.equals(infimum.right)) { + input.remove(pair); + if (!newTph.equals(stph.left.resolve())) + addToPairs(input, new PairLT(stph.left, new TPH(newTph))); + } + }); + } + } + } + } while (foundInfima); + } + + RefTypeOrTPHOrWildcardOrGeneric getType(RefTypeOrTPHOrWildcardOrGeneric type) { + if (type instanceof TypePlaceholder tph) { + if (equality.containsKey(tph)) { + return getType(equality.get(tph)); + } + return concreteTypes.getOrDefault(new TPH(tph), tph); + } + return type; + } + + TargetType getTargetType(RefTypeOrTPHOrWildcardOrGeneric in) { + if (in instanceof TypePlaceholder tph) { + if (equality.containsKey(tph)) { + return getTargetType(equality.get(tph)); + } + var type = concreteTypes.get(new TPH(tph)); + if (type == null) return new TargetGenericType(tph.getName()); + return astToTargetAST.convert(type, this); + } + return astToTargetAST.convert(in, this); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/generate/GenericsResult.java b/javatx-src/main/java/de/dhbwstuttgart/target/generate/GenericsResult.java new file mode 100644 index 0000000..4447621 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/generate/GenericsResult.java @@ -0,0 +1,76 @@ +package de.dhbwstuttgart.target.generate; + +import de.dhbwstuttgart.syntaxtree.ClassOrInterface; +import de.dhbwstuttgart.syntaxtree.Method; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; +import de.dhbwstuttgart.target.tree.type.TargetType; + +import java.util.*; + +public class GenericsResult { + private final GenerateGenerics generics; + + GenericsResult(GenerateGenerics generics) { + this.generics = generics; + } + + public GenericsResultSet get(ClassOrInterface clazz) { + var generics = this.generics.computedGenericsOfClasses.get(clazz); + return new GenericsResultSet(generics, this.generics.equality); + } + + // TODO Compute generics if not present? + public GenericsResultSet get(Method method) { + var generics = this.generics.computedGenericsOfMethods.get(method); + return new GenericsResultSet(generics, this.generics.equality); + } + + public BoundsList getBounds(RefTypeOrTPHOrWildcardOrGeneric type, ClassOrInterface clazz) { + return getBounds(type, clazz, null); + } + + public BoundsList getBounds(RefTypeOrTPHOrWildcardOrGeneric type, ClassOrInterface clazz, Method method) { + var resolvedType = resolve(type); + type = resolvedType; + if (type instanceof TypePlaceholder) { + var methodGenerics = get(method); + var classGenerics = get(clazz); + List result = new ArrayList<>(); + + Optional bound = Optional.empty(); + do { + bound = Optional.empty(); + for (var pair : methodGenerics) { + if (pair.left.resolve().equals(type)) { + type = pair.resolveRight(); + bound = Optional.of(new Bound(true, type)); + break; + } + } + if (bound.isEmpty()) { + for (var pair : classGenerics) { + if (pair.left.resolve().equals(type)) { + type = pair.resolveRight(); + bound = Optional.of(new Bound(false, type)); + break; + } + } + } + bound.ifPresent(result::add); + } while (bound.isPresent()); + return new BoundsList(resolvedType, result); + } + return new BoundsList(resolvedType, List.of()); + } + + public RefTypeOrTPHOrWildcardOrGeneric resolve(RefTypeOrTPHOrWildcardOrGeneric type) { + if (type instanceof TypePlaceholder tph) + return this.generics.getType(tph); + return type; + } + + public TargetType resolveTarget(RefTypeOrTPHOrWildcardOrGeneric type) { + return this.generics.getTargetType(type); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/generate/GenericsResultSet.java b/javatx-src/main/java/de/dhbwstuttgart/target/generate/GenericsResultSet.java new file mode 100644 index 0000000..19ccaf3 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/generate/GenericsResultSet.java @@ -0,0 +1,43 @@ +package de.dhbwstuttgart.target.generate; + +import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; +import de.dhbwstuttgart.typeinference.result.PairTPHequalRefTypeOrWildcardType; +import de.dhbwstuttgart.typeinference.result.PairTPHsmallerTPH; +import de.dhbwstuttgart.typeinference.result.ResultPair; + +import java.util.*; + +public class GenericsResultSet extends AbstractSet { + + final Set backing; + final Map equality; + + public GenericsResultSet(Set backing, Map equality) { + this.backing = backing == null ? new HashSet<>() : new HashSet<>(backing); + this.equality = equality; + } + + @Override + public Iterator iterator() { + return backing.iterator(); + } + + @Override + public int size() { + return backing.size(); + } + + public Optional> getResultPairFor(TypePlaceholder tph) { + var tph2 = equality.getOrDefault(tph, tph); + return this.stream().filter(pair -> { + return pair.left.resolve().equals(tph2); + }).findFirst().map(pair -> { + ResultPair res = null; + if (pair instanceof GenerateGenerics.PairLT lt) + res = new PairTPHsmallerTPH(lt.left.resolve(), lt.right.resolve()); + else if (pair instanceof GenerateGenerics.PairEQ eq) + res = new PairTPHequalRefTypeOrWildcardType(eq.left.resolve(), eq.right); + return res; + }); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/generate/JavaGenerics.java b/javatx-src/main/java/de/dhbwstuttgart/target/generate/JavaGenerics.java new file mode 100644 index 0000000..abe779a --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/generate/JavaGenerics.java @@ -0,0 +1,30 @@ +package de.dhbwstuttgart.target.generate; + +import de.dhbwstuttgart.syntaxtree.ClassOrInterface; +import de.dhbwstuttgart.syntaxtree.Method; +import de.dhbwstuttgart.typeinference.result.ResultSet; + +import java.util.Set; + +final class JavaGenerics extends GenerateGenerics { + JavaGenerics(ASTToTargetAST astToTargetAST, ResultSet constraints) { + super(astToTargetAST, constraints); + } + + @Override + void generics(ClassOrInterface owner, Method method, Set result, Set referenced) { + eliminateCycles(result, referenced); + eliminateInfimaConnectedToReturnType(method, result, referenced); + eliminateInfima(result, referenced); + equalizeTypeVariables(result, referenced); + eliminateInnerTypeVariables(referenced, result); + } + + @Override + void generics(ClassOrInterface classOrInterface, Set result, Set referenced) { + eliminateCycles(result, referenced); + eliminateInfima(result, referenced); + eliminateInnerTypeVariablesOfClass(classOrInterface, result, referenced); + equalizeTypeVariables(result, referenced); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/generate/StatementToTargetExpression.java b/javatx-src/main/java/de/dhbwstuttgart/target/generate/StatementToTargetExpression.java new file mode 100644 index 0000000..2255441 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/generate/StatementToTargetExpression.java @@ -0,0 +1,452 @@ +package de.dhbwstuttgart.target.generate; + +import de.dhbwstuttgart.exceptions.NotImplementedException; +import de.dhbwstuttgart.parser.SyntaxTreeGenerator.AssignToLocal; +import de.dhbwstuttgart.parser.scope.JavaClassName; +import de.dhbwstuttgart.syntaxtree.*; +import de.dhbwstuttgart.syntaxtree.factory.PrimitiveMethodsGenerator; +import de.dhbwstuttgart.syntaxtree.statement.*; +import de.dhbwstuttgart.syntaxtree.type.*; +import de.dhbwstuttgart.target.tree.MethodParameter; +import de.dhbwstuttgart.target.tree.expression.*; +import de.dhbwstuttgart.target.tree.type.*; + +import javax.swing.text.html.Option; +import java.lang.reflect.Modifier; +import java.util.*; +import java.util.stream.Stream; +import java.util.stream.StreamSupport; + +public class StatementToTargetExpression implements ASTVisitor { + + public StatementToTargetExpression(ASTToTargetAST converter) { + this.converter = converter; + } + + public TargetExpression result; + private final ASTToTargetAST converter; + + @Override + public void visit(ArgumentList argumentList) { + throw new NotImplementedException(); + } + + @Override + public void visit(LambdaExpression lambdaExpression) { + var parameters = StreamSupport.stream(lambdaExpression.params.spliterator(), false) + .map(p -> (FormalParameter) p) + .map(p -> new MethodParameter(new TargetTypePattern(converter.convert(p.getType()), p.getName()))) + .toList(); + + List captures = new ArrayList<>(); + lambdaExpression.methodBody.accept(new TracingStatementVisitor() { + // TODO The same mechanism is implemented in Codegen, maybe use it from there? + final Stack> localVariables = new Stack<>(); + { + localVariables.push(new HashSet<>()); + } + + boolean hasLocalVar(String name) { + for (var localVariables : this.localVariables) { + if (localVariables.contains(name)) + return true; + } + return false; + } + + @Override + public void visit(Block block) { + localVariables.push(new HashSet<>()); + super.visit(block); + localVariables.pop(); + } + + @Override + public void visit(LocalVar localVar) { + super.visit(localVar); + var capture = new MethodParameter(new TargetTypePattern(converter.convert(localVar.getType()), localVar.name)); + if (!hasLocalVar(localVar.name) && !parameters.contains(capture) && !captures.contains(capture)) + captures.add(capture); + } + + @Override + public void visit(LocalVarDecl varDecl) { + var localVariables = this.localVariables.peek(); + localVariables.add(varDecl.getName()); + } + + @Override + public void visit(LambdaExpression lambda) { + } // Don't look at lambda expressions + }); + + result = new TargetLambdaExpression(converter.convert(lambdaExpression.getType()), captures, parameters, converter.convert(lambdaExpression.getReturnType()), converter.convert(lambdaExpression.methodBody)); + } + + @Override + public void visit(Assign assign) { + TargetExpression left; + if (assign.lefSide instanceof AssignToLocal) { + left = converter.convert(((AssignToLocal) assign.lefSide).localVar); + } else { + left = converter.convert(((AssignToField) assign.lefSide).field); + } + + result = new TargetAssign(converter.convert(assign.getType()), left, converter.convert(assign.rightSide)); + } + + @Override + public void visit(BinaryExpr binary) { + result = switch (binary.operation) { + case ADD -> new TargetBinaryOp.Add(converter.convert(binary.getType()), converter.convert(binary.lexpr), converter.convert(binary.rexpr)); + case SUB -> new TargetBinaryOp.Sub(converter.convert(binary.getType()), converter.convert(binary.lexpr), converter.convert(binary.rexpr)); + case MUL -> new TargetBinaryOp.Mul(converter.convert(binary.getType()), converter.convert(binary.lexpr), converter.convert(binary.rexpr)); + case MOD -> new TargetBinaryOp.Rem(converter.convert(binary.getType()), converter.convert(binary.lexpr), converter.convert(binary.rexpr)); + case AND -> new TargetBinaryOp.And(converter.convert(binary.getType()), converter.convert(binary.lexpr), converter.convert(binary.rexpr)); + case OR -> new TargetBinaryOp.Or(converter.convert(binary.getType()), converter.convert(binary.lexpr), converter.convert(binary.rexpr)); + case DIV -> new TargetBinaryOp.Div(converter.convert(binary.getType()), converter.convert(binary.lexpr), converter.convert(binary.rexpr)); + case LESSTHAN -> new TargetBinaryOp.Less(converter.convert(binary.getType()), converter.convert(binary.lexpr), converter.convert(binary.rexpr)); + case BIGGERTHAN -> new TargetBinaryOp.Greater(converter.convert(binary.getType()), converter.convert(binary.lexpr), converter.convert(binary.rexpr)); + case LESSEQUAL -> new TargetBinaryOp.LessOrEqual(converter.convert(binary.getType()), converter.convert(binary.lexpr), converter.convert(binary.rexpr)); + case BIGGEREQUAL -> new TargetBinaryOp.GreaterOrEqual(converter.convert(binary.getType()), converter.convert(binary.lexpr), converter.convert(binary.rexpr)); + case EQUAL -> new TargetBinaryOp.Equal(converter.convert(binary.getType()), converter.convert(binary.lexpr), converter.convert(binary.rexpr)); + case NOTEQUAL -> new TargetBinaryOp.NotEqual(converter.convert(binary.getType()), converter.convert(binary.lexpr), converter.convert(binary.rexpr)); + }; + } + + @Override + public void visit(BoolExpression bool) { + System.out.println("BoolExpression"); + } + + @Override + public void visit(Block block) { + result = converter.convert(block); + } + + @Override + public void visit(CastExpr castExpr) { + result = new TargetCast(converter.convert(castExpr.getType()), converter.convert(castExpr.expr)); + } + + @Override + public void visit(EmptyStmt emptyStmt) { + result = null; + } + + @Override + public void visit(FieldVar fieldVar) { + result = new TargetFieldVar(converter.convert(fieldVar.getType()), converter.convert(fieldVar.receiver.getType()), fieldVar.isStatic, converter.convert(fieldVar.receiver), fieldVar.fieldVarName); + } + + @Override + public void visit(ForStmt forStmt) { + result = new TargetFor( + forStmt.initializer.stream().map(converter::convert).toList(), + forStmt.condition != null ? converter.convert(forStmt.condition) : null, + forStmt.loopExpr.stream().map(converter::convert).toList(), + converter.convertWrapInBlock(forStmt.block) + ); + } + + @Override + public void visit(ForEachStmt forEachStmt) { + result = new TargetForEach(converter.convert(forEachStmt.statement), converter.convert(forEachStmt.expression), converter.convertWrapInBlock(forEachStmt.block)); + } + + @Override + public void visit(IfStmt ifStmt) { + result = new TargetIf(converter.convert(ifStmt.expr), converter.convertWrapInBlock(ifStmt.then_block), ifStmt.else_block != null ? converter.convertWrapInBlock(ifStmt.else_block) : null); + } + + @Override + public void visit(InstanceOf instanceOf) { + result = new TargetInstanceOf(converter.convert(instanceOf.getExpression()), converter.convert(instanceOf.getPattern())); + } + + @Override + public void visit(LocalVar localVar) { + result = new TargetLocalVar(converter.convert(localVar.getType()), localVar.name); + } + + @Override + public void visit(LocalVarDecl localVarDecl) { + // TODO No value, is this correct? + result = new TargetVarDecl(converter.convert(localVarDecl.getType()), localVarDecl.getName(), null); + } + + static boolean convertsTo(TargetType from, TargetType to) { + if (to.equals(TargetType.Object)) + return true; // TODO Consider type coercion and subtyping + return to.equals(from); + } + + Optional findMethod(JavaClassName className, String name, List args) { + return converter.findMethod(converter.compiler.getClass(className), name, args); + } + + @Override + public void visit(MethodCall methodCall) { + var receiverType = converter.convert(methodCall.receiver.getType()); + var isFunNType = receiverType instanceof TargetFunNType; + + var returnType = isFunNType ? TargetType.Object : converter.convert(methodCall.signature.get(methodCall.signature.size() - 1)); + var receiverName = new JavaClassName(converter.convert(methodCall.receiver.getType()).name()); + var argList = methodCall.signature.stream().map(converter::convert).toList(); + argList = argList.subList(0, argList.size() - 1); + + Method foundMethod = null; + var isStatic = false; + var isInterface = true; + var signature = methodCall.signatureArguments().stream().map(converter::convert).toList(); + + var receiverClass = converter.currentClass; + if (methodCall.receiver instanceof ExpressionReceiver expressionReceiver && expressionReceiver.expr instanceof This) { + var thisMethod = converter.findMethod(converter.currentClass, methodCall.name, signature); + foundMethod = thisMethod.orElseGet(() -> findMethod(converter.currentClass.getSuperClass().getName(), methodCall.name, signature).orElseThrow()); + } else if (!isFunNType) { + receiverClass = converter.compiler.getClass(receiverName); + foundMethod = findMethod(receiverName, methodCall.name, signature).orElseThrow(); + } + + if (!isFunNType) { + returnType = converter.convert(foundMethod.getReturnType()); + argList = foundMethod.getParameterList().getFormalparalist().stream().map(e -> converter.convert(e.getType())).toList(); + isStatic = Modifier.isStatic(foundMethod.modifier); + isInterface = receiverClass.isInterface(); + } + + result = new TargetMethodCall(converter.convert(methodCall.getType()), returnType, argList, converter.convert(methodCall.receiver), methodCall.getArgumentList().getArguments().stream().map(converter::convert).toList(), receiverType, methodCall.name, isStatic, isInterface); + } + + @Override + public void visit(NewClass newClass) { + result = new TargetNew(new TargetRefType(newClass.name), newClass.getArgumentList().getArguments().stream().map(converter::convert).toList()); + } + + @Override + public void visit(NewArray newArray) { + // TODO + throw new NotImplementedException(); + } + + @Override + public void visit(Return aReturn) { + result = new TargetReturn(converter.convert(aReturn.retexpr)); + } + + @Override + public void visit(ReturnVoid aReturn) { + result = new TargetReturn(null); + } + + @Override + public void visit(Break aBreak) { + result = new TargetBreak(); + } + + @Override + public void visit(StaticClassName staticClassName) { + result = new TargetClassName(converter.convert(staticClassName.getType())); + } + + @Override + public void visit(Super aSuper) { + result = new TargetSuper(converter.convert(aSuper.getType())); + } + + @Override + public void visit(This aThis) { + result = new TargetThis(converter.convert(aThis.getType())); + } + + @Override + public void visit(WhileStmt whileStmt) { + result = new TargetWhile(converter.convert(whileStmt.expr), converter.convert(whileStmt.loopBlock)); + } + + @Override + public void visit(DoStmt whileStmt) { + throw new NotImplementedException(); + } + + // TODO These two might not be necessary + @Override + public void visit(AssignToField assignLeftSide) { + result = converter.convert(assignLeftSide.field); + } + + @Override + public void visit(AssignToLocal assignLeftSide) { + result = converter.convert(assignLeftSide.localVar); + } + + @Override + public void visit(SuperCall superCall) { + var aSuper = converter.convert(converter.currentClass.getSuperClass()); + var type = converter.convert(superCall.getType()); + var parameters = superCall.arglist.getArguments().stream().map(par -> converter.convert(par.getType())).toList(); + + result = new TargetMethodCall(type, type, parameters, new TargetSuper(aSuper), superCall.getArgumentList().getArguments().stream().map(converter::convert).toList(), aSuper, superCall.name, false, false); + } + + @Override + public void visit(ExpressionReceiver expressionReceiver) { + result = converter.convert(expressionReceiver.expr); + } + + @Override + public void visit(UnaryExpr unaryExpr) { + result = switch (unaryExpr.operation) { + case NOT -> new TargetUnaryOp.Not(converter.convert(unaryExpr.getType()), converter.convert(unaryExpr.expr)); + case MINUS -> new TargetUnaryOp.Negate(converter.convert(unaryExpr.getType()), converter.convert(unaryExpr.expr)); + case PREINCREMENT -> new TargetUnaryOp.PreIncrement(converter.convert(unaryExpr.getType()), converter.convert(unaryExpr.expr)); + case PREDECREMENT -> new TargetUnaryOp.PreDecrement(converter.convert(unaryExpr.getType()), converter.convert(unaryExpr.expr)); + case POSTINCREMENT -> new TargetUnaryOp.PostIncrement(converter.convert(unaryExpr.getType()), converter.convert(unaryExpr.expr)); + case PLUS -> new TargetUnaryOp.Add(converter.convert(unaryExpr.getType()), converter.convert(unaryExpr.expr)); + case POSTDECREMENT -> new TargetUnaryOp.PostDecrement(converter.convert(unaryExpr.getType()), converter.convert(unaryExpr.expr)); + }; + } + + @Override + public void visit(Literal literal) { + if (literal.value instanceof Integer || literal.value instanceof Short || literal.value instanceof Byte) { + + result = new TargetLiteral.IntLiteral((int) literal.value); + } else if (literal.value instanceof Float) { + result = new TargetLiteral.FloatLiteral((float) literal.value); + } else if (literal.value instanceof Double) { + result = new TargetLiteral.DoubleLiteral((double) literal.value); + } else if (literal.value instanceof Long) { + result = new TargetLiteral.LongLiteral((long) literal.value); + } else if (literal.value instanceof Character) { + result = new TargetLiteral.CharLiteral((char) literal.value); + } else if (literal.value instanceof String) { + result = new TargetLiteral.StringLiteral((String) literal.value); + } else if (literal.value instanceof Boolean) { + result = new TargetLiteral.BooleanLiteral((boolean) literal.value); + } else if (literal.value == null) { + result = new TargetLiteral.Null(); + } + } + + @Override + public void visit(Throw aThrow) { + result = new TargetThrow(converter.convert(aThrow.expr)); + } + + @Override + public void visit(Switch switchStmt) { + var cases = switchStmt.getBlocks().stream().filter(s -> !s.isDefault()).map(converter::convert).toList(); + + TargetSwitch.Case default_ = null; + for (var block : switchStmt.getBlocks()) { + if (block.isDefault()) { + default_ = new TargetSwitch.Case(converter.convert((Block) block), block.isExpression); + } + } + result = new TargetSwitch(converter.convert(switchStmt.getSwitch()), cases, default_ , converter.convert(switchStmt.getType()), !switchStmt.getStatement()); + } + + @Override + public void visit(SwitchBlock switchBlock) {} + + @Override + public void visit(SwitchLabel switchLabel) { + result = converter.convert(switchLabel.getPattern()); + } + + @Override + public void visit(Yield aYield) { + result = new TargetYield(converter.convert(aYield.retexpr)); + } + + @Override + public void visit(SourceFile sourceFile) { + + } + + @Override + public void visit(GenericTypeVar genericTypeVar) { + + } + + @Override + public void visit(GenericDeclarationList genericTypeVars) { + + } + + @Override + public void visit(Field field) { + + } + + @Override + public void visit(de.dhbwstuttgart.syntaxtree.Method field) { + + } + + @Override + public void visit(Constructor field) { + + } + + @Override + public void visit(ParameterList formalParameters) { + + } + + @Override + public void visit(ClassOrInterface classOrInterface) { + + } + + @Override + public void visit(RefType refType) { + + } + + @Override + public void visit(SuperWildcardType superWildcardType) { + + } + + @Override + public void visit(TypePlaceholder typePlaceholder) { + + } + + @Override + public void visit(ExtendsWildcardType extendsWildcardType) { + + } + + @Override + public void visit(GenericRefType genericRefType) { + + } + + @Override + public void visit(FormalParameter aPattern) { + result = new TargetTypePattern(converter.convert(aPattern.getType()), aPattern.getName()); + } + + @Override + public void visit(ExpressionPattern aPattern) { + result = converter.convert(aPattern.getExpression()); + } + + @Override + public void visit(RecordPattern aRecordPattern) { + result = new TargetComplexPattern( + converter.convert(aRecordPattern.getType()), + aRecordPattern.getName(), + aRecordPattern.getSubPattern().stream().map(x -> (TargetPattern) converter.convert(x)).toList() + ); + } + + @Override + public void visit(GuardedPattern aGuardedPattern) { + result = new TargetGuard((TargetPattern) converter.convert(aGuardedPattern.getNestedPattern()), converter.convert(aGuardedPattern.getCondition())); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/generate/TracingStatementVisitor.java b/javatx-src/main/java/de/dhbwstuttgart/target/generate/TracingStatementVisitor.java new file mode 100644 index 0000000..7967f0c --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/generate/TracingStatementVisitor.java @@ -0,0 +1,200 @@ +package de.dhbwstuttgart.target.generate; + +import de.dhbwstuttgart.parser.SyntaxTreeGenerator.AssignToLocal; +import de.dhbwstuttgart.syntaxtree.StatementVisitor; +import de.dhbwstuttgart.syntaxtree.statement.*; + +// This visitor walks the entire tree, individual methods may be overridden +public abstract class TracingStatementVisitor implements StatementVisitor { + + @Override + public void visit(MethodCall methodCall) { + methodCall.receiver.accept(this); + methodCall.getArgumentList().accept(this); + } + + @Override + public void visit(ArgumentList argumentList) { + argumentList.getArguments().forEach(expr -> expr.accept(this)); + } + + @Override + public void visit(LambdaExpression lambdaExpression) { + lambdaExpression.methodBody.accept(this); + } + + @Override + public void visit(Assign assign) { + assign.rightSide.accept(this); + } + + @Override + public void visit(BinaryExpr binary) { + binary.lexpr.accept(this); + binary.rexpr.accept(this); + } + + @Override + public void visit(BoolExpression bool) { + bool.lexpr.accept(this); + bool.rexpr.accept(this); + } + + @Override + public void visit(Block block) { + for (var expr : block.statements) + expr.accept(this); + } + + @Override + public void visit(CastExpr castExpr) { + + } + + @Override + public void visit(EmptyStmt emptyStmt) { + + } + + @Override + public void visit(FieldVar fieldVar) { + + } + + @Override + public void visit(ForStmt forStmt) { + forStmt.block.accept(this); + } + + @Override + public void visit(ForEachStmt forEachStmt) { + forEachStmt.block.accept(this); + } + + @Override + public void visit(IfStmt ifStmt) { + ifStmt.then_block.accept(this); + if (ifStmt.else_block != null) + ifStmt.else_block.accept(this); + } + + @Override + public void visit(InstanceOf instanceOf) { + + } + + @Override + public void visit(LocalVar localVar) { + + } + + @Override + public void visit(LocalVarDecl localVarDecl) { + + } + + @Override + public void visit(NewClass newClass) { + this.visit((MethodCall) newClass); + } + + @Override + public void visit(NewArray newArray) { + newArray.expr.forEach(expr -> expr.accept(this)); + } + + @Override + public void visit(Return aReturn) { + aReturn.retexpr.accept(this); + } + + @Override + public void visit(ReturnVoid aReturn) { + + } + + @Override + public void visit(Break aBreak) { + + } + + @Override + public void visit(StaticClassName staticClassName) { + + } + + @Override + public void visit(Super aSuper) { + + } + + @Override + public void visit(This aThis) { + + } + + @Override + public void visit(WhileStmt whileStmt) { + whileStmt.loopBlock.accept(this); + } + + @Override + public void visit(DoStmt whileStmt) { + whileStmt.loopBlock.accept(this); + } + + @Override + public void visit(AssignToField assignLeftSide) { + + } + + @Override + public void visit(AssignToLocal assignLeftSide) { + + } + + @Override + public void visit(SuperCall superCall) { + + } + + @Override + public void visit(ExpressionReceiver expressionReceiver) { + expressionReceiver.expr.accept(this); + } + + @Override + public void visit(UnaryExpr unaryExpr) { + unaryExpr.expr.accept(this); + } + + @Override + public void visit(Literal literal) { + + } + + @Override + public void visit(Throw aThrow) { + + } + + @Override + public void visit(Switch switchStmt) { + + } + + @Override + public void visit(SwitchBlock switchBlock) { + + } + + @Override + public void visit(SwitchLabel switchLabel) { + + } + + @Override + public void visit(Yield aYield) { + + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/generate/TxGenerics.java b/javatx-src/main/java/de/dhbwstuttgart/target/generate/TxGenerics.java new file mode 100644 index 0000000..b64babb --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/generate/TxGenerics.java @@ -0,0 +1,25 @@ +package de.dhbwstuttgart.target.generate; + +import de.dhbwstuttgart.syntaxtree.ClassOrInterface; +import de.dhbwstuttgart.syntaxtree.Method; +import de.dhbwstuttgart.typeinference.result.ResultSet; + +import java.util.Set; + +final class TxGenerics extends GenerateGenerics { + TxGenerics(ASTToTargetAST astToTargetAST, ResultSet constraints) { + super(astToTargetAST, constraints); + } + + @Override + void generics(ClassOrInterface owner, Method method, Set result, Set referenced) { + eliminateInfima(result, referenced); + eliminateInnerTypeVariables(referenced, result); + } + + @Override + void generics(ClassOrInterface classOrInterface, Set result, Set referenced) { + eliminateInfima(result, referenced); + eliminateInnerTypeVariablesOfClass(classOrInterface, result, referenced); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/MethodParameter.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/MethodParameter.java new file mode 100644 index 0000000..48ae091 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/MethodParameter.java @@ -0,0 +1,14 @@ +package de.dhbwstuttgart.target.tree; + +import de.dhbwstuttgart.target.tree.expression.TargetPattern; +import de.dhbwstuttgart.target.tree.expression.TargetTypePattern; +import de.dhbwstuttgart.target.tree.type.TargetType; + +public record MethodParameter(TargetPattern pattern) { + public MethodParameter(TargetType type, String name) { + this(new TargetTypePattern(type, name)); + } + public MethodParameter withType(TargetType type) { + return new MethodParameter(pattern.withType(type)); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/TargetClass.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/TargetClass.java new file mode 100644 index 0000000..cf66c4e --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/TargetClass.java @@ -0,0 +1,27 @@ +package de.dhbwstuttgart.target.tree; + +import de.dhbwstuttgart.parser.scope.JavaClassName; +import de.dhbwstuttgart.target.tree.expression.TargetBlock; +import de.dhbwstuttgart.target.tree.type.TargetRefType; +import de.dhbwstuttgart.target.tree.type.TargetType; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +public record TargetClass(int modifiers, JavaClassName qualifiedName, TargetType superType, Set generics, Set txGenerics, List implementingInterfaces, + List constructors, TargetMethod staticConstructor, List fields, List methods) implements TargetStructure { + + public TargetClass(int modifiers, JavaClassName qualifiedName) { + this(modifiers, qualifiedName, TargetType.Object, new HashSet<>(), new HashSet<>(), new ArrayList<>(), new ArrayList<>(), null, new ArrayList<>(), new ArrayList<>()); + } + public TargetClass(int modifiers, JavaClassName qualifiedName, List implementingInterfaces) { + this(modifiers, qualifiedName, TargetType.Object, new HashSet<>(), new HashSet<>(), implementingInterfaces, new ArrayList<>(), null, new ArrayList<>(), new ArrayList<>()); + } + + public void addField(int access, TargetRefType type, String name) { + this.fields.add(new TargetField(access, type, name)); + } +} + diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/TargetConstructor.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/TargetConstructor.java new file mode 100644 index 0000000..55e1810 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/TargetConstructor.java @@ -0,0 +1,24 @@ +package de.dhbwstuttgart.target.tree; + +import de.dhbwstuttgart.syntaxtree.Method; +import de.dhbwstuttgart.target.tree.expression.TargetBlock; +import de.dhbwstuttgart.target.tree.type.TargetType; + +import java.util.List; +import java.util.Set; + +public record TargetConstructor(int access, Set generics, Set txGenerics, List parameters, List txParameters, TargetBlock block, TargetBlock fieldInitializer) { + + public String getDescriptor() { + return TargetMethod.getDescriptor(null, parameters.stream().map(mp -> mp.pattern().type()).toArray(TargetType[]::new)); + } + + public String getSignature() { + return TargetMethod.getSignature(generics, parameters, null); + } + + public String getTXSignature() { + return TargetMethod.getSignature(txGenerics, txParameters, null); + } +} + diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/TargetField.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/TargetField.java new file mode 100644 index 0000000..3a22bad --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/TargetField.java @@ -0,0 +1,11 @@ +package de.dhbwstuttgart.target.tree; + +import de.dhbwstuttgart.target.tree.type.TargetType; +import org.objectweb.asm.Opcodes; + +public record TargetField(int access, TargetType type, String name) { + public boolean isStatic() { + return (access & Opcodes.ACC_STATIC) != 0; + } +} + diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/TargetGeneric.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/TargetGeneric.java new file mode 100644 index 0000000..ad70ae7 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/TargetGeneric.java @@ -0,0 +1,6 @@ +package de.dhbwstuttgart.target.tree; + +import de.dhbwstuttgart.target.tree.type.TargetType; + +public record TargetGeneric(String name, TargetType bound) { +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/TargetInterface.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/TargetInterface.java new file mode 100644 index 0000000..763636c --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/TargetInterface.java @@ -0,0 +1,24 @@ +package de.dhbwstuttgart.target.tree; + +import de.dhbwstuttgart.parser.scope.JavaClassName; +import de.dhbwstuttgart.target.tree.type.TargetType; + +import java.util.List; +import java.util.Set; + +public record TargetInterface(int modifiers, JavaClassName qualifiedName, Set generics, Set txGenerics, List methods, List implementingInterfaces, TargetMethod staticConstructor) implements TargetStructure { + @Override + public TargetType superType() { + return null; + } + + @Override + public List constructors() { + return List.of(); + } + + @Override + public List fields() { + return List.of(); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/TargetMethod.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/TargetMethod.java new file mode 100644 index 0000000..bbbe729 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/TargetMethod.java @@ -0,0 +1,59 @@ +package de.dhbwstuttgart.target.tree; + +import de.dhbwstuttgart.target.tree.expression.TargetBlock; +import de.dhbwstuttgart.target.tree.type.TargetType; +import org.objectweb.asm.Opcodes; + +import java.util.List; +import java.util.Set; + +public record TargetMethod(int access, String name, TargetBlock block, Signature signature, Signature txSignature) { + public record Signature(Set generics, List parameters, TargetType returnType) { } + + public static String getDescriptor(TargetType returnType, TargetType... parameters) { + String ret = "("; + for (var parameterType : parameters) { + ret += parameterType.toSignature(); + } + ret += ")"; + if (returnType == null) ret += "V"; + else ret += returnType.toSignature(); + return ret; + } + + public static String getSignature(Set generics, List parameters, TargetType returnType) { + String ret = ""; + if (generics.size() > 0) { + ret += "<"; + for (var generic : generics) { + ret += generic.name() + ":" + generic.bound().toDescriptor(); + } + ret += ">"; + } + ret += "("; + for (var param : parameters) { + ret += param.pattern().type().toDescriptor(); + } + ret += ")"; + if (returnType == null) ret += "V"; + else ret += returnType.toDescriptor(); + return ret; + } + + public String getDescriptor() { + return getDescriptor(signature.returnType, signature.parameters.stream().map(mp -> mp.pattern().type()).toArray(TargetType[]::new)); + } + + public String getSignature() { + return getSignature(signature.generics, signature.parameters, signature.returnType); + } + + public String getTXSignature() { + return getSignature(txSignature.generics, txSignature.parameters, txSignature.returnType); + } + + public boolean isStatic() { + return (access & Opcodes.ACC_STATIC) != 0; + } +} + diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/TargetRecord.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/TargetRecord.java new file mode 100644 index 0000000..976f832 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/TargetRecord.java @@ -0,0 +1,16 @@ +package de.dhbwstuttgart.target.tree; + +import de.dhbwstuttgart.parser.scope.JavaClassName; +import de.dhbwstuttgart.target.tree.type.TargetRefType; +import de.dhbwstuttgart.target.tree.type.TargetType; + +import java.util.List; +import java.util.Set; + +public record TargetRecord(int modifiers, JavaClassName qualifiedName, Set generics, Set txGenerics, List implementingInterfaces, List constructors, TargetMethod staticConstructor, List fields, List methods) implements TargetStructure { + + public static final TargetType RECORD = new TargetRefType("java.lang.Record"); + public TargetType superType() { + return RECORD; + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/TargetStructure.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/TargetStructure.java new file mode 100644 index 0000000..783bf86 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/TargetStructure.java @@ -0,0 +1,44 @@ +package de.dhbwstuttgart.target.tree; + +import de.dhbwstuttgart.parser.scope.JavaClassName; +import de.dhbwstuttgart.target.tree.expression.TargetBlock; +import de.dhbwstuttgart.target.tree.type.TargetType; + +import java.util.List; +import java.util.Set; + +public interface TargetStructure { + int modifiers(); + JavaClassName qualifiedName(); + TargetType superType(); + Set generics(); + Set txGenerics(); + List implementingInterfaces(); + List constructors(); + + TargetMethod staticConstructor(); + + List fields(); + List methods(); + + default String getName() { + return qualifiedName().toString().replaceAll("\\.", "/"); + } + + // These methods are only meant to be used for test cases, a Class record should be immutable! + default void addMethod(int access, String name, Set generics, List parameterTypes, TargetType returnType, TargetBlock block) { + this.methods().add(new TargetMethod(access, name, block, new TargetMethod.Signature(generics, parameterTypes, returnType), null)); + } + + default void addMethod(int access, String name, List parameterTypes, TargetType returnType, TargetBlock block) { + addMethod(access, name, Set.of(), parameterTypes, returnType, block); + } + + default void addConstructor(int access, Set generics, List paramterTypes, TargetBlock block) { + this.constructors().add(new TargetConstructor(access, generics, Set.of(), paramterTypes, List.of(), block, null)); + } + + default void addConstructor(int access, List paramterTypes, TargetBlock block) { + addConstructor(access, Set.of(), paramterTypes, block); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetAssign.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetAssign.java new file mode 100644 index 0000000..609de79 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetAssign.java @@ -0,0 +1,6 @@ +package de.dhbwstuttgart.target.tree.expression; + +import de.dhbwstuttgart.target.tree.type.TargetType; + +public record TargetAssign(TargetType type, TargetExpression left, TargetExpression right) implements TargetStatementExpression { +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetBinaryOp.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetBinaryOp.java new file mode 100644 index 0000000..545bc85 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetBinaryOp.java @@ -0,0 +1,85 @@ +package de.dhbwstuttgart.target.tree.expression; + +import de.dhbwstuttgart.target.tree.expression.TargetExpression; +import de.dhbwstuttgart.target.tree.type.TargetType; + +public sealed interface TargetBinaryOp extends TargetExpression { + TargetExpression left(); + + TargetExpression right(); + + // Arithmetic + record Add(TargetType type, TargetExpression left, TargetExpression right) implements TargetBinaryOp { + } + + record Sub(TargetType type, TargetExpression left, TargetExpression right) implements TargetBinaryOp { + } + + record Div(TargetType type, TargetExpression left, TargetExpression right) implements TargetBinaryOp { + } + + record Mul(TargetType type, TargetExpression left, TargetExpression right) implements TargetBinaryOp { + } + + record Rem(TargetType type, TargetExpression left, TargetExpression right) implements TargetBinaryOp { + } + + // Bitwise + record BAnd(TargetType type, TargetExpression left, TargetExpression right) implements TargetBinaryOp { + } + + record BOr(TargetType type, TargetExpression left, TargetExpression right) implements TargetBinaryOp { + } + + record XOr(TargetType type, TargetExpression left, TargetExpression right) implements TargetBinaryOp { + } + + record Shl(TargetType type, TargetExpression left, TargetExpression right) implements TargetBinaryOp { + } + + record Shr(TargetType type, TargetExpression left, TargetExpression right) implements TargetBinaryOp { + } + + record UShr(TargetType type, TargetExpression left, TargetExpression right) implements TargetBinaryOp { + } + + // Conditional + record And(TargetType type, TargetExpression left, TargetExpression right) implements TargetBinaryOp { + } + + record Or(TargetType type, TargetExpression left, TargetExpression right) implements TargetBinaryOp { + } + + record Instof(TargetType type, TargetExpression left, TargetExpression right) implements TargetBinaryOp { + } + + sealed interface TargetRelationalOp extends TargetBinaryOp { + @Override + default TargetType type() { + return TargetType.Boolean; + } + + TargetType exprType(); + } + + // Comparison + // exprType is the type that both arguments get converted to before comparison + record Equal(TargetType exprType, TargetExpression left, TargetExpression right) implements TargetRelationalOp { + } + + record Greater(TargetType exprType, TargetExpression left, TargetExpression right) implements TargetRelationalOp { + } + + record GreaterOrEqual(TargetType exprType, TargetExpression left, TargetExpression right) implements TargetRelationalOp { + } + + record Less(TargetType exprType, TargetExpression left, TargetExpression right) implements TargetRelationalOp { + } + + record LessOrEqual(TargetType exprType, TargetExpression left, TargetExpression right) implements TargetRelationalOp { + } + + record NotEqual(TargetType exprType, TargetExpression left, TargetExpression right) implements TargetRelationalOp { + } + +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetBlock.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetBlock.java new file mode 100644 index 0000000..670ebf6 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetBlock.java @@ -0,0 +1,8 @@ +package de.dhbwstuttgart.target.tree.expression; + +import de.dhbwstuttgart.target.tree.type.TargetType; + +import java.util.List; + +public record TargetBlock(List statements) implements TargetExpression { +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetBreak.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetBreak.java new file mode 100644 index 0000000..6cf1b3a --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetBreak.java @@ -0,0 +1,7 @@ +package de.dhbwstuttgart.target.tree.expression; + +import de.dhbwstuttgart.target.tree.type.TargetType; + +// TODO This needs a label +public record TargetBreak() implements TargetExpression { +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetCast.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetCast.java new file mode 100644 index 0000000..f95bc9a --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetCast.java @@ -0,0 +1,6 @@ +package de.dhbwstuttgart.target.tree.expression; + +import de.dhbwstuttgart.target.tree.type.TargetType; + +public record TargetCast(TargetType type, TargetExpression expr) implements TargetExpression { +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetClassName.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetClassName.java new file mode 100644 index 0000000..7131aca --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetClassName.java @@ -0,0 +1,6 @@ +package de.dhbwstuttgart.target.tree.expression; + +import de.dhbwstuttgart.target.tree.type.TargetType; + +public record TargetClassName(TargetType type) implements TargetExpression { +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetComplexPattern.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetComplexPattern.java new file mode 100644 index 0000000..6ce331f --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetComplexPattern.java @@ -0,0 +1,12 @@ +package de.dhbwstuttgart.target.tree.expression; + +import de.dhbwstuttgart.target.tree.type.TargetType; + +import java.util.List; + +public record TargetComplexPattern(TargetType type, String name, List subPatterns) implements TargetPattern { + @Override + public TargetComplexPattern withType(TargetType type) { + return new TargetComplexPattern(type, name, subPatterns); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetContinue.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetContinue.java new file mode 100644 index 0000000..6c49006 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetContinue.java @@ -0,0 +1,6 @@ +package de.dhbwstuttgart.target.tree.expression; + +import de.dhbwstuttgart.target.tree.type.TargetType; + +public record TargetContinue() implements TargetExpression { +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetExpression.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetExpression.java new file mode 100644 index 0000000..e0bbc52 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetExpression.java @@ -0,0 +1,11 @@ +package de.dhbwstuttgart.target.tree.expression; + +import de.dhbwstuttgart.target.tree.type.*; + +public sealed interface TargetExpression + permits TargetBinaryOp, TargetBlock, TargetBreak, TargetCast, TargetClassName, TargetContinue, TargetFieldVar, TargetFor, TargetForEach, TargetIf, TargetInstanceOf, TargetLambdaExpression, TargetLiteral, TargetLocalVar, TargetPattern, TargetReturn, TargetStatementExpression, TargetSuper, TargetSwitch, TargetTernary, TargetThis, TargetThrow, TargetUnaryOp, TargetVarDecl, TargetWhile, TargetYield { + + default TargetType type() { + return null; + }; +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetFieldVar.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetFieldVar.java new file mode 100644 index 0000000..5b82f22 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetFieldVar.java @@ -0,0 +1,7 @@ +package de.dhbwstuttgart.target.tree.expression; + +import de.dhbwstuttgart.target.tree.type.TargetRefType; +import de.dhbwstuttgart.target.tree.type.TargetType; + +public record TargetFieldVar(TargetType type, TargetType owner, boolean isStatic, TargetExpression left, String right) implements TargetExpression { +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetFor.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetFor.java new file mode 100644 index 0000000..b3ce467 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetFor.java @@ -0,0 +1,6 @@ +package de.dhbwstuttgart.target.tree.expression; + +import java.util.List; + +public record TargetFor(List init, TargetExpression termination, List increment, TargetExpression body) implements TargetExpression { +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetForEach.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetForEach.java new file mode 100644 index 0000000..e7928af --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetForEach.java @@ -0,0 +1,4 @@ +package de.dhbwstuttgart.target.tree.expression; + +public record TargetForEach(TargetExpression vardecl, TargetExpression expression, TargetExpression body) implements TargetExpression { +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetGuard.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetGuard.java new file mode 100644 index 0000000..14466bf --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetGuard.java @@ -0,0 +1,10 @@ +package de.dhbwstuttgart.target.tree.expression; + +import de.dhbwstuttgart.target.tree.type.TargetType; + +public record TargetGuard(TargetPattern inner, TargetExpression expression) implements TargetPattern { + @Override + public TargetGuard withType(TargetType type) { + return new TargetGuard(inner.withType(type), expression); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetIf.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetIf.java new file mode 100644 index 0000000..1961177 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetIf.java @@ -0,0 +1,6 @@ +package de.dhbwstuttgart.target.tree.expression; + +import de.dhbwstuttgart.target.tree.type.TargetType; + +public record TargetIf(TargetExpression cond, TargetExpression if_body, TargetExpression else_body) implements TargetExpression { +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetInstanceOf.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetInstanceOf.java new file mode 100644 index 0000000..e6b2853 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetInstanceOf.java @@ -0,0 +1,12 @@ +package de.dhbwstuttgart.target.tree.expression; + +import de.dhbwstuttgart.syntaxtree.statement.Expression; +import de.dhbwstuttgart.target.tree.type.TargetType; + +public record TargetInstanceOf(TargetExpression left, TargetExpression right) implements TargetExpression { + + @Override + public TargetType type() { + return TargetType.Boolean; + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetLambdaExpression.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetLambdaExpression.java new file mode 100644 index 0000000..718fb66 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetLambdaExpression.java @@ -0,0 +1,10 @@ +package de.dhbwstuttgart.target.tree.expression; + +import de.dhbwstuttgart.target.tree.MethodParameter; +import de.dhbwstuttgart.target.tree.TargetField; +import de.dhbwstuttgart.target.tree.type.TargetType; + +import java.util.List; + +public record TargetLambdaExpression(TargetType type, List captures, List params, TargetType returnType, TargetBlock block) implements TargetExpression { +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetLiteral.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetLiteral.java new file mode 100644 index 0000000..c120f96 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetLiteral.java @@ -0,0 +1,68 @@ +package de.dhbwstuttgart.target.tree.expression; + +import de.dhbwstuttgart.target.tree.type.TargetType; + +public sealed interface TargetLiteral extends TargetExpression { + Object value(); + + record BooleanLiteral(Boolean value) implements TargetLiteral { + @Override + public TargetType type() { + return TargetType.Boolean; + } + } + + record CharLiteral(Character value) implements TargetLiteral { + @Override + public TargetType type() { + return TargetType.Char; + } + } + + record IntLiteral(Integer value) implements TargetLiteral { + @Override + public TargetType type() { + return TargetType.Integer; + } + } + + record LongLiteral(Long value) implements TargetLiteral { + @Override + public TargetType type() { + return TargetType.Long; + } + } + + record FloatLiteral(Float value) implements TargetLiteral { + @Override + public TargetType type() { + return TargetType.Float; + } + } + + record DoubleLiteral(Double value) implements TargetLiteral { + @Override + public TargetType type() { + return TargetType.Double; + } + } + + record StringLiteral(String value) implements TargetLiteral { + @Override + public TargetType type() { + return TargetType.String; + } + } + + record Null() implements TargetLiteral { + @Override + public TargetType type() { + return TargetType.Object; + } + + @Override + public Object value() { + return null; + } + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetLocalVar.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetLocalVar.java new file mode 100644 index 0000000..e4fa977 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetLocalVar.java @@ -0,0 +1,6 @@ +package de.dhbwstuttgart.target.tree.expression; + +import de.dhbwstuttgart.target.tree.type.TargetType; + +public record TargetLocalVar(TargetType type, String name) implements TargetExpression { +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetMethodCall.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetMethodCall.java new file mode 100644 index 0000000..50a3147 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetMethodCall.java @@ -0,0 +1,19 @@ +package de.dhbwstuttgart.target.tree.expression; + +import de.dhbwstuttgart.target.tree.MethodParameter; +import de.dhbwstuttgart.target.tree.TargetMethod; +import de.dhbwstuttgart.target.tree.type.TargetRefType; +import de.dhbwstuttgart.target.tree.type.TargetType; + +import java.util.List; + +public record TargetMethodCall(TargetType type, TargetType returnType, List parameterTypes, TargetExpression expr, List args, TargetType owner, String name, boolean isStatic, boolean isInterface) implements TargetStatementExpression { + public TargetMethodCall(TargetType type, TargetExpression expr, List args, TargetType owner, String name, boolean isStatic, boolean isInterface) { + this(type, type, args.stream().map(TargetExpression::type).toList(), expr, args, owner, name, isStatic, isInterface); + } + + + public String getDescriptor() { + return TargetMethod.getDescriptor(returnType, parameterTypes.toArray(TargetType[]::new)); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetNew.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetNew.java new file mode 100644 index 0000000..e9d4ce8 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetNew.java @@ -0,0 +1,12 @@ +package de.dhbwstuttgart.target.tree.expression; + +import de.dhbwstuttgart.target.tree.TargetMethod; +import de.dhbwstuttgart.target.tree.type.TargetType; + +import java.util.List; + +public record TargetNew(TargetType type, List params) implements TargetStatementExpression { + public String getDescriptor() { + return TargetMethod.getDescriptor(null, params.stream().map(TargetExpression::type).toArray(TargetType[]::new)); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetPattern.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetPattern.java new file mode 100644 index 0000000..58efa37 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetPattern.java @@ -0,0 +1,11 @@ +package de.dhbwstuttgart.target.tree.expression; + +import de.dhbwstuttgart.target.tree.type.TargetType; + +public sealed interface TargetPattern extends TargetExpression permits TargetComplexPattern, TargetGuard, TargetTypePattern { + default String name() { + return null; + } + + TargetPattern withType(TargetType type); +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetReturn.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetReturn.java new file mode 100644 index 0000000..99682ec --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetReturn.java @@ -0,0 +1,6 @@ +package de.dhbwstuttgart.target.tree.expression; + +import de.dhbwstuttgart.target.tree.type.TargetType; + +public record TargetReturn(TargetExpression expression) implements TargetExpression { +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetStatementExpression.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetStatementExpression.java new file mode 100644 index 0000000..2d804d6 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetStatementExpression.java @@ -0,0 +1,4 @@ +package de.dhbwstuttgart.target.tree.expression; + +public sealed interface TargetStatementExpression extends TargetExpression permits TargetAssign, TargetMethodCall, TargetNew, TargetUnaryOp.PostDecrement, TargetUnaryOp.PostIncrement, TargetUnaryOp.PreDecrement, TargetUnaryOp.PreIncrement { +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetSuper.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetSuper.java new file mode 100644 index 0000000..ddffe38 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetSuper.java @@ -0,0 +1,6 @@ +package de.dhbwstuttgart.target.tree.expression; + +import de.dhbwstuttgart.target.tree.type.TargetType; + +public record TargetSuper(TargetType type) implements TargetExpression { +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetSwitch.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetSwitch.java new file mode 100644 index 0000000..65dd592 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetSwitch.java @@ -0,0 +1,30 @@ +package de.dhbwstuttgart.target.tree.expression; + +import de.dhbwstuttgart.target.tree.type.TargetType; + +import java.util.List; + +public record TargetSwitch(TargetExpression expr, List cases, Case default_, TargetType type, boolean isExpression) implements TargetExpression { + + public TargetSwitch(TargetExpression expr, List cases, Case default_) { + this(expr, cases, default_, null, false); + } + + public TargetSwitch(TargetExpression expr, List cases, Case default_, TargetType type) { + this(expr, cases, default_, type, true); + } + + public TargetSwitch(TargetExpression expr, List cases, Case default_, boolean isExpression) { + this(expr, cases, default_, null, isExpression); + } + + public record Case(List labels, TargetBlock body, boolean isSingleExpression) { + public Case(List labels, TargetBlock body) { + this(labels, body, false); + } + public Case(TargetBlock body, boolean isSingleExpression) { + this(List.of(), body, isSingleExpression); + } + } + +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetTernary.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetTernary.java new file mode 100644 index 0000000..1734948 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetTernary.java @@ -0,0 +1,6 @@ +package de.dhbwstuttgart.target.tree.expression; + +import de.dhbwstuttgart.target.tree.type.TargetType; + +public record TargetTernary(TargetType type, TargetExpression cond, TargetExpression ifTrue, TargetExpression ifFalse) implements TargetExpression { +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetThis.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetThis.java new file mode 100644 index 0000000..fe9b722 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetThis.java @@ -0,0 +1,6 @@ +package de.dhbwstuttgart.target.tree.expression; + +import de.dhbwstuttgart.target.tree.type.TargetType; + +public record TargetThis(TargetType type) implements TargetExpression { +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetThrow.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetThrow.java new file mode 100644 index 0000000..080d06a --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetThrow.java @@ -0,0 +1,4 @@ +package de.dhbwstuttgart.target.tree.expression; + +public record TargetThrow(TargetExpression expr) implements TargetExpression { +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetTypePattern.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetTypePattern.java new file mode 100644 index 0000000..e8353ef --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetTypePattern.java @@ -0,0 +1,10 @@ +package de.dhbwstuttgart.target.tree.expression; + +import de.dhbwstuttgart.target.tree.type.TargetType; + +public record TargetTypePattern(TargetType type, String name) implements TargetPattern { + @Override + public TargetTypePattern withType(TargetType type) { + return new TargetTypePattern(type, name); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetUnaryOp.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetUnaryOp.java new file mode 100644 index 0000000..92e5764 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetUnaryOp.java @@ -0,0 +1,16 @@ +package de.dhbwstuttgart.target.tree.expression; + +import de.dhbwstuttgart.target.tree.type.TargetType; + +public sealed interface TargetUnaryOp extends TargetExpression { + TargetExpression expr(); + + record Negate(TargetType type, TargetExpression expr) implements TargetUnaryOp {} + record Add(TargetType type, TargetExpression expr) implements TargetUnaryOp {} + record Not(TargetType type, TargetExpression expr) implements TargetUnaryOp {} + + record PreIncrement(TargetType type, TargetExpression expr) implements TargetStatementExpression, TargetUnaryOp {} + record PostIncrement(TargetType type, TargetExpression expr) implements TargetStatementExpression, TargetUnaryOp {} + record PreDecrement(TargetType type, TargetExpression expr) implements TargetStatementExpression, TargetUnaryOp {} + record PostDecrement(TargetType type, TargetExpression expr) implements TargetStatementExpression, TargetUnaryOp {} +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetVarDecl.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetVarDecl.java new file mode 100644 index 0000000..b1eda5e --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetVarDecl.java @@ -0,0 +1,11 @@ +package de.dhbwstuttgart.target.tree.expression; + +import de.dhbwstuttgart.target.tree.type.TargetType; + +public record TargetVarDecl(TargetType varType, String name, TargetExpression value) implements TargetExpression { + + @Override + public TargetType type() { + return null; + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetWhile.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetWhile.java new file mode 100644 index 0000000..e1a3690 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetWhile.java @@ -0,0 +1,6 @@ +package de.dhbwstuttgart.target.tree.expression; + +import de.dhbwstuttgart.target.tree.type.TargetType; + +public record TargetWhile(TargetExpression cond, TargetExpression body) implements TargetExpression { +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetYield.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetYield.java new file mode 100644 index 0000000..10e85bb --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/expression/TargetYield.java @@ -0,0 +1,10 @@ +package de.dhbwstuttgart.target.tree.expression; + +import de.dhbwstuttgart.target.tree.type.TargetType; + +public record TargetYield(TargetExpression expression) implements TargetExpression { + @Override + public TargetType type() { + return expression.type(); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/type/TargetExtendsWildcard.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/type/TargetExtendsWildcard.java new file mode 100644 index 0000000..db7c1ee --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/type/TargetExtendsWildcard.java @@ -0,0 +1,24 @@ +package de.dhbwstuttgart.target.tree.type; + +public record TargetExtendsWildcard(TargetType innerType) implements TargetType { + @Override + public String toSignature() { + return innerType.toSignature(); + } + + @Override + public String toDescriptor() { + return "+" + innerType.toDescriptor(); + } + + @Override + public String getInternalName() { + return innerType.getInternalName(); + } + + @Override + public String name() { + return innerType.name(); + } +} + diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/type/TargetFunNType.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/type/TargetFunNType.java new file mode 100644 index 0000000..f35f104 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/type/TargetFunNType.java @@ -0,0 +1,27 @@ +package de.dhbwstuttgart.target.tree.type; + +import de.dhbwstuttgart.bytecode.FunNGenerator; + +import java.util.List; + +public record TargetFunNType(String name, List params) implements TargetSpecializedType { + + public static TargetFunNType fromParams(List params) { + return fromParams(params, params); + } + + public static TargetFunNType fromParams(List params, List realParams) { + var name = FunNGenerator.getSpecializedClassName(FunNGenerator.getArguments(params), FunNGenerator.getReturnType(params)); + return new TargetFunNType(name, realParams); + } + + @Override + public String getInternalName() { + return name; + } + + @Override + public String toSignature() { + return "L" + getInternalName() + ";"; + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/type/TargetGenericType.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/type/TargetGenericType.java new file mode 100644 index 0000000..f3f4982 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/type/TargetGenericType.java @@ -0,0 +1,18 @@ +package de.dhbwstuttgart.target.tree.type; + +public record TargetGenericType(String name) implements TargetType { + @Override + public String toSignature() { + return "Ljava/lang/Object;"; // TODO Use bounds for this? + } + + @Override + public String toDescriptor() { + return "T" + getInternalName() + ";"; + } + + @Override + public String getInternalName() { + return name; + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/type/TargetPrimitiveType.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/type/TargetPrimitiveType.java new file mode 100644 index 0000000..fe41a34 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/type/TargetPrimitiveType.java @@ -0,0 +1,19 @@ +package de.dhbwstuttgart.target.tree.type; + +public record TargetPrimitiveType(String name) implements TargetType { + + @Override + public String toSignature() { + return getInternalName(); + } + + @Override + public String toDescriptor() { + return toSignature(); + } + + @Override + public String getInternalName() { + return name; + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/type/TargetRefType.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/type/TargetRefType.java new file mode 100644 index 0000000..0d04355 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/type/TargetRefType.java @@ -0,0 +1,33 @@ +package de.dhbwstuttgart.target.tree.type; + +import java.util.List; +import java.util.Objects; + +public record TargetRefType(String name, List params) implements TargetSpecializedType { + public TargetRefType(String name) { + this(name, List.of()); + } + + public String getInternalName() { + return this.name.replaceAll("\\.", "/"); + } + + @Override + public String toSignature() { + return "L" + getInternalName() + ";"; + } + + // Type erasure means we need to override hashCode and equals to only consider the name + @Override + public int hashCode() { + return Objects.hashCode(name); + } + + @Override + public boolean equals(Object other) { + if (other instanceof TargetRefType refType) { + return refType.name.equals(name); + } + return false; + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/type/TargetSpecializedType.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/type/TargetSpecializedType.java new file mode 100644 index 0000000..45e84fd --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/type/TargetSpecializedType.java @@ -0,0 +1,21 @@ +package de.dhbwstuttgart.target.tree.type; + +import java.util.List; + +public sealed interface TargetSpecializedType extends TargetType permits TargetFunNType, TargetRefType { + List params(); + + @Override + default String toDescriptor() { + String ret = "L" + getInternalName(); + if (params().size() > 0) { + ret += "<"; + for (var param : params()) { + ret += param.toDescriptor(); + } + ret += ">"; + } + ret += ";"; + return ret; + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/type/TargetSuperWildcard.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/type/TargetSuperWildcard.java new file mode 100644 index 0000000..594ee2d --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/type/TargetSuperWildcard.java @@ -0,0 +1,25 @@ +package de.dhbwstuttgart.target.tree.type; + +public record TargetSuperWildcard(TargetType innerType) implements TargetType { + @Override + public String toSignature() { + return innerType.toSignature(); + } + + @Override + public String toDescriptor() { + return "-" + innerType.toDescriptor(); + } + + @Override + public String getInternalName() { + return innerType.getInternalName(); + } + + @Override + public String name() { + return innerType.name(); + } +} + + diff --git a/javatx-src/main/java/de/dhbwstuttgart/target/tree/type/TargetType.java b/javatx-src/main/java/de/dhbwstuttgart/target/tree/type/TargetType.java new file mode 100644 index 0000000..1cb57f9 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/target/tree/type/TargetType.java @@ -0,0 +1,75 @@ +package de.dhbwstuttgart.target.tree.type; + +import de.dhbwstuttgart.syntaxtree.type.RefType; + +public sealed interface TargetType + permits TargetExtendsWildcard, TargetGenericType, TargetSpecializedType, TargetSuperWildcard, TargetPrimitiveType { + + // Builtin types + TargetRefType Boolean = new TargetRefType("java.lang.Boolean"); + TargetRefType Char = new TargetRefType("java.lang.Character"); + TargetRefType Byte = new TargetRefType("java.lang.Byte"); + TargetRefType Short = new TargetRefType("java.lang.Short"); + TargetRefType Integer = new TargetRefType("java.lang.Integer"); + TargetRefType Long = new TargetRefType("java.lang.Long"); + TargetRefType Float = new TargetRefType("java.lang.Float"); + TargetRefType Double = new TargetRefType("java.lang.Double"); + TargetRefType String = new TargetRefType("java.lang.String"); + TargetRefType Object = new TargetRefType("java.lang.Object"); + + // Builtin types + TargetPrimitiveType boolean_ = new TargetPrimitiveType("Z"); + TargetPrimitiveType char_ = new TargetPrimitiveType("C"); + TargetPrimitiveType byte_ = new TargetPrimitiveType("B"); + TargetPrimitiveType short_ = new TargetPrimitiveType("S"); + TargetPrimitiveType int_ = new TargetPrimitiveType("I"); + TargetPrimitiveType long_ = new TargetPrimitiveType("J"); + TargetPrimitiveType float_ = new TargetPrimitiveType("F"); + TargetPrimitiveType double_ = new TargetPrimitiveType("D"); + + static TargetType toPrimitive(TargetType type) { + if (type.equals(Boolean)) return boolean_; + if (type.equals(Char)) return char_; + if (type.equals(Byte)) return byte_; + if (type.equals(Short)) return short_; + if (type.equals(Integer)) return int_; + if (type.equals(Long)) return long_; + if (type.equals(Float)) return float_; + if (type.equals(Double)) return double_; + return type; + } + + static TargetType toPrimitive(RefType type) { + return switch(type.getName().toString()) { + case "java.lang.Boolean" -> boolean_; + case "java.lang.Character" -> char_; + case "java.lang.Byte" -> byte_; + case "java.lang.Short" -> short_; + case "java.lang.Integer" -> int_; + case "java.lang.Long" -> long_; + case "java.lang.Float" -> float_; + case "java.lang.Double" -> double_; + default -> null; + }; + } + + static TargetType toTargetType(Class clazz) { + if (clazz.isPrimitive()) { + if (clazz.equals(boolean.class)) return boolean_; + if (clazz.equals(char.class)) return char_; + if (clazz.equals(byte.class)) return byte_; + if (clazz.equals(short.class)) return short_; + if (clazz.equals(int.class)) return int_; + if (clazz.equals(long.class)) return long_; + if (clazz.equals(float.class)) return float_; + if (clazz.equals(double.class)) return double_; + } + if (clazz.equals(void.class)) return null; + return new TargetRefType(clazz.getName()); + } + + String toSignature(); + String toDescriptor(); + String getInternalName(); + String name(); +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typedeployment/KindOfTypeInsertPoint.java b/javatx-src/main/java/de/dhbwstuttgart/typedeployment/KindOfTypeInsertPoint.java new file mode 100644 index 0000000..25b118e --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typedeployment/KindOfTypeInsertPoint.java @@ -0,0 +1,7 @@ +package de.dhbwstuttgart.typedeployment; + +public enum KindOfTypeInsertPoint { + NORMAL_INSERT, + GENERIC_CLASS_INSERT, + GENERERIC_METHOD_INSERT +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typedeployment/TypeInsert.java b/javatx-src/main/java/de/dhbwstuttgart/typedeployment/TypeInsert.java new file mode 100644 index 0000000..131c9f9 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typedeployment/TypeInsert.java @@ -0,0 +1,82 @@ +package de.dhbwstuttgart.typedeployment; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.Set; +import java.util.TreeSet; + +import org.antlr.v4.parse.BlockSetTransformer.setAlt_return; + +import de.dhbwstuttgart.syntaxtree.statement.This; +import de.dhbwstuttgart.typeinference.result.ResultPair; + +public class TypeInsert { + /** + * point wird hauptsächlich zur Anzeige einer Annotation im Eclipse-plugin benutzt. + */ + public final TypeInsertPoint point; + Set inserts; + ResultPair resultPair; + + public TypeInsert(TypeInsertPoint point, Set additionalPoints, ResultPair resultPair){ + this.point = point; + inserts = additionalPoints; + this.resultPair = resultPair; + } + + public String insert(String intoSource){ + List offsets = new ArrayList<>(); + String ret = intoSource; + + List insertsSorted = new ArrayList<>(); + insertsSorted.add(point); + insertsSorted.addAll(inserts); + Collections.sort(insertsSorted, new TypeInsertPoint.TypeInsertPointPositionComparator().reversed()); + + for(TypeInsertPoint insertPoint : insertsSorted) { + ret = insertPoint.insert(ret, new ArrayList<>()); + offsets.add(insertPoint); + } + return ret; + } + + public String getInsertString(){ + return point.getInsertString(); + } + + public ResultPair getResultPair() { + return this.resultPair; + } + + /* PL 2018-06-18 + * Zwei TypeInsert's sind gleich, wenn ihre point's und ihre inserts' gleich sind + * eingefuegt damit man TypeReplaceMarker vergleichen kann + * @see java.lang.Object#equals(java.lang.Object) + */ + public boolean equals(Object obj) { + if(!(obj instanceof TypeInsert)) { + return false; + } + else { + return ((TypeInsert)obj).point.equals(this.point); + + } + } + + public Set getAdditionalPoints() { + TypeInsertPoint.TypeInsertPointPositionComparator comparator = new TypeInsertPoint.TypeInsertPointPositionComparator(); + TreeSet result = new TreeSet<>(comparator.reversed()); + result.addAll(inserts); + return result; + } + + public Set getAdditionalPointsUnsorted() { + return inserts; + } + + public String toString() { + return point.toString(); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typedeployment/TypeInsertFactory.java b/javatx-src/main/java/de/dhbwstuttgart/typedeployment/TypeInsertFactory.java new file mode 100644 index 0000000..bfe4d56 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typedeployment/TypeInsertFactory.java @@ -0,0 +1,204 @@ +package de.dhbwstuttgart.typedeployment; + +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; + +import de.dhbwstuttgart.target.generate.GenerateGenerics; +import de.dhbwstuttgart.target.generate.GenericsResult; +import de.dhbwstuttgart.target.generate.GenericsResultSet; +import de.dhbwstuttgart.typeinference.result.*; +import org.antlr.v4.runtime.Token; + +import de.dhbwstuttgart.syntaxtree.ClassOrInterface; +import de.dhbwstuttgart.syntaxtree.Method; +import de.dhbwstuttgart.syntaxtree.SourceFile; +import de.dhbwstuttgart.syntaxtree.type.ExtendsWildcardType; +import de.dhbwstuttgart.syntaxtree.type.GenericRefType; +import de.dhbwstuttgart.syntaxtree.type.RefType; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import de.dhbwstuttgart.syntaxtree.type.SuperWildcardType; +import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; + +/** + * TODO: + * Falls in Feldern Generics entstehen, dann werden diese als Klassenparameter eingesetzt + * Für die Instanzierung von Klassen kann man dann beispielsweise nur noch den Diamond-Operator verwenden + * + * Es müssen zu einem TPH alle in Beziehung stehenden Constraints gefunden werden + * + * Anmekung: Es wird nur ein RefType gleichzeitug eingesetzt. + * Steht dieser mit anderen Typen in Verbindung, so müssen diese nicht eingesetzt werden + * im Result set können nur TPHs mit <. Beziehung stehen + * Steht ein Typ A über TPHs mit anderen Typen B in Verbindung, so lassen sich diese auch im nächsten Durchgang + * inferieren, wenn A bereits eingesetzt wurde. Es werden dann eben zusätzliche Generics entstehen + */ +public class TypeInsertFactory { + + public static Set createTypeInsertPoints(SourceFile forSourcefile, ResultSet withResults, GenericsResult generics) { + return new TypeInsertPlacer().getTypeInserts(forSourcefile, withResults, generics); + } + + public static TypeInsert createInsertPoints(RefTypeOrTPHOrWildcardOrGeneric type, Token offset, ClassOrInterface cl, Method m, + ResultSet resultSet, GenericsResultSet constraints, GenericsResultSet classConstraints) { + + /* PL 2020-04-11 auskommentiert + * try { + */ + ResolvedType resolvedType = resultSet.resolveType(type); + TypeInsertPoint insertPoint = new TypeInsertPoint(offset, + new TypeToInsertString(resolvedType.resolvedType, constraints, classConstraints).insert, KindOfTypeInsertPoint.NORMAL_INSERT); + /* PL 2020-04-11 auskommentiert + List simplifyResults = JavaTXCompiler.INSTANCE.getGeneratedGenericResultsForAllSourceFiles(newResults); + for (GenericGenratorResultForSourceFile simplifyResultsEntries : simplifyResults) { + GenericsGeneratorResultForClass genericResultsForClass = simplifyResultsEntries.getSimplifyResultsByName(cl.getClassName()); + return new TypeInsert(insertPoint, createGenericInsert(genericResultsForClass, cl, m, resultSet, offset), resolvedType.getResultPair()); + } + + return new TypeInsert(insertPoint, new HashSet<>(), resolvedType.getResultPair()); + */ + //GenericsGeneratorResultForClass genericResultsForClass = genericResult.getSimplifyResultsByName("", cl.getClassName().toString()); + return new TypeInsert(insertPoint, createGenericInsert(constraints, classConstraints, cl, m, resultSet, offset), resolvedType.getResultPair()); + + /* PL 2020-04-11 auskommentiert + } catch (ClassNotFoundException e) { + e.printStackTrace(); + return null; + } + */ + } + + private static synchronized Set createGenericInsert(GenericsResultSet methodConstraints, GenericsResultSet classConstraints,ClassOrInterface cl, Method m, ResultSet resultSet, Token mOffset){ + Set result = createGenericClassInserts(classConstraints, cl); + + if (m != null) { + //List methodConstraints = genericResult.getMethodConstraintsByID(MethodUtility.createID(resolver, m)); + result.addAll(createMethodConstraints(methodConstraints, m.getOffset() != null ? m.getOffset() : mOffset)); + } + + return result; + } + + private static Set createMethodConstraints(GenericsResultSet constraints, Token mOffset) { + Set result = new HashSet<>(); + Token offset = mOffset; + + if (constraints.size() == 0) { + return result; + } + + String insert = " <"; + + for (var genericInsertConstraint : constraints) { + if (genericInsertConstraint instanceof GenerateGenerics.PairEQ peq) { + insert += peq.left.resolve().getName(); + } else if (genericInsertConstraint instanceof GenerateGenerics.PairLT psm) { + insert += psm.left.resolve().getName() + " extends " + psm.right.resolve().getName(); + } + insert += ", "; + } + + insert = insert.substring(0, insert.length() -2); + insert += ">"; + + result.add(new TypeInsertPoint(offset, insert, KindOfTypeInsertPoint.GENERERIC_METHOD_INSERT)); + return result; + } + + private static Set createGenericClassInserts(GenericsResultSet classConstraints, ClassOrInterface cl) { + Set result = new HashSet<>(); + Token offset = cl.getGenerics().getOffset(); + + if (classConstraints == null || classConstraints.size() == 0) { + return result; + } + + String insert = " <"; + + for (var genericInsertConstraint : classConstraints) { + if (genericInsertConstraint instanceof GenerateGenerics.PairEQ peq) { + insert += peq.left.resolve().getName(); + } else if (genericInsertConstraint instanceof GenerateGenerics.PairLT psm) { + insert += psm.left.resolve().getName() + " extends " + psm.right.resolve().getName(); + } + insert += ", "; + } + + insert = insert.substring(0, insert.length() -2); + insert += ">"; + + result.add(new TypeInsertPoint(offset, insert, KindOfTypeInsertPoint.GENERIC_CLASS_INSERT)); + + return result; + } +} + +class TypeToInsertString implements ResultSetVisitor{ + String insert = ""; + private GenericsResultSet constraints; + private GenericsResultSet classConstraints; + + + TypeToInsertString(RefTypeOrTPHOrWildcardOrGeneric type, GenericsResultSet constraints, GenericsResultSet classConstraints){ + this.constraints = constraints; + this.classConstraints = classConstraints; + type.accept(this); + } + + @Override + public void visit(PairTPHsmallerTPH p) { + + } + + @Override + public void visit(PairTPHequalRefTypeOrWildcardType p) { + + } + + @Override + public void visit(PairTPHEqualTPH p) { + + } + + @Override + public void visit(RefType resolved) { + insert = resolved.getName().toString(); + if(resolved.getParaList().size() > 0){ + insert += "<"; + Iterator iterator = resolved.getParaList().iterator(); + while(iterator.hasNext()){ + RefTypeOrTPHOrWildcardOrGeneric typeParam = iterator.next(); + insert += new TypeToInsertString(typeParam, constraints, classConstraints).insert; + if(iterator.hasNext())insert += ", "; + } + insert += ">"; + } + } + + @Override + public void visit(GenericRefType genericRefType) { + insert += genericRefType.getParsedName(); + } + + @Override + public void visit(SuperWildcardType superWildcardType) { + insert += "? super " + new TypeToInsertString(superWildcardType.getInnerType(), constraints, classConstraints).insert; + } + + @Override + public void visit(TypePlaceholder typePlaceholder) { + ResultPair resultPair = null; + if (constraints != null) + resultPair = constraints.getResultPairFor(typePlaceholder).orElse(null); + if (resultPair == null) + resultPair = classConstraints.getResultPairFor(typePlaceholder).orElse(null); + + if (resultPair != null) + insert += ((TypePlaceholder)resultPair.getLeft()).getName(); + } + + @Override + public void visit(ExtendsWildcardType extendsWildcardType) { + insert += "? extends " + new TypeToInsertString(extendsWildcardType.getInnerType(), constraints, classConstraints).insert; + } +} \ No newline at end of file diff --git a/javatx-src/main/java/de/dhbwstuttgart/typedeployment/TypeInsertPlacer.java b/javatx-src/main/java/de/dhbwstuttgart/typedeployment/TypeInsertPlacer.java new file mode 100644 index 0000000..bbeda06 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typedeployment/TypeInsertPlacer.java @@ -0,0 +1,88 @@ +package de.dhbwstuttgart.typedeployment; + +import de.dhbwstuttgart.syntaxtree.*; +import de.dhbwstuttgart.syntaxtree.statement.LambdaExpression; +import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; +import de.dhbwstuttgart.target.generate.GenericsResult; +import de.dhbwstuttgart.target.generate.GenericsResultSet; +import de.dhbwstuttgart.typeinference.result.ResultPair; +import de.dhbwstuttgart.typeinference.result.ResultSet; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +public class TypeInsertPlacer extends AbstractASTWalker{ + Set inserts = new HashSet<>(); + private ResultSet withResults; + String pkgName; + private GenericsResult genericsResult; + + public Set getTypeInserts(SourceFile forSourceFile, ResultSet withResults, GenericsResult genericsResult){ + this.withResults = withResults; + this.genericsResult = genericsResult; + pkgName = forSourceFile.getPkgName(); + forSourceFile.accept(this); + return inserts; + } + + @Override + public void visit(ClassOrInterface classOrInterface) { + TypeInsertPlacerClass cl = new TypeInsertPlacerClass(classOrInterface, withResults, genericsResult); + this.inserts.addAll(cl.inserts); + } +} + +class TypeInsertPlacerClass extends AbstractASTWalker{ + protected final ResultSet results; + private GenericsResult generatedGenerics; + protected final ClassOrInterface cl; + public final Set inserts = new HashSet<>(); + private Method method; + + GenericsResultSet constraints; + GenericsResultSet classConstraints; + + TypeInsertPlacerClass(ClassOrInterface forClass, ResultSet withResults, GenericsResult generatedGenerics){ + this.cl = forClass; + this.method = null; + this.results = withResults; + this.generatedGenerics = generatedGenerics; + forClass.accept(this); + } + + @Override + public void visit(Method method) { + this.method = method; + constraints = generatedGenerics.get(method); + classConstraints = generatedGenerics.get(cl); + if(method.getReturnType() instanceof TypePlaceholder) + inserts.add(TypeInsertFactory.createInsertPoints( + method.getReturnType(), method.getReturnType().getOffset(), cl, method, results, constraints, classConstraints)); + super.visit(method); + } + + @Override + public void visit(Field field) { + if(field.getType() instanceof TypePlaceholder){ + classConstraints = generatedGenerics.get(cl); + inserts.add(TypeInsertFactory.createInsertPoints( + field.getType(), field.getType().getOffset(), cl, method, results, null, classConstraints)); + } + super.visit(field); + } + + @Override + public void visit(FormalParameter param) { + if(param.getType() instanceof TypePlaceholder) + inserts.add(TypeInsertFactory.createInsertPoints( + param.getType(), param.getType().getOffset(), cl, method, results, constraints, classConstraints)); + super.visit(param); + } + + @Override + public void visit(LambdaExpression lambdaExpression) { + //Lambda-Ausdrücke brauchen keine Typeinsetzungen + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typedeployment/TypeInsertPoint.java b/javatx-src/main/java/de/dhbwstuttgart/typedeployment/TypeInsertPoint.java new file mode 100644 index 0000000..0efb66e --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typedeployment/TypeInsertPoint.java @@ -0,0 +1,93 @@ +package de.dhbwstuttgart.typedeployment; + +import java.util.Comparator; +import java.util.List; +import java.util.Set; + +import org.antlr.v4.runtime.Token; + +public class TypeInsertPoint { + public Token point; + private String insertString; + private int extraOffset = 0; + private KindOfTypeInsertPoint kind; + + public TypeInsertPoint(Token point, String toInsert, KindOfTypeInsertPoint kind){ + this.point = point; + this.kind = kind; + this.insertString = (toInsert.endsWith(" ")) ? toInsert : toInsert + " " ; + } + + public boolean isGenericClassInsertPoint() { + return kind == KindOfTypeInsertPoint.GENERIC_CLASS_INSERT; + } + + public String insert(String intoSource, List additionalOffset){ + return new StringBuilder(intoSource).insert(point.getStartIndex()+extraOffset, insertString).toString(); + } + + public String getInsertString() { + return insertString; + } + + public void addExtraOffset(int toAdd) { + this.extraOffset += toAdd; + } + + public int getPositionInCode() { + return point.getStartIndex() + extraOffset; + } + + /* PL 2018-06-19 + * Zwei TypeInsertPoint's sind gleich, wenn ihre point's gleich sind + * eingefuegt damit man TypeReplaceMarker vergleichen kann + * @see java.lang.Object#equals(java.lang.Object) + */ + public boolean equals(Object obj) { + return this == obj; + /* + if(!(obj instanceof TypeInsertPoint)) { + return false; + } + else { + return + ((TypeInsertPoint)obj).getPositionInCode() == this.getPositionInCode() && + ((TypeInsertPoint)obj).insertString.equals(this.insertString); + } + */ + } + + public int hashCode() { + return getPositionInCode() * 11 * insertString.hashCode(); + } + + public Set getAdditionalPoints() { + return this.getAdditionalPoints(); + } + + public String toString() { + return point.getLine() + ":" + point.getCharPositionInLine() + ":" + insertString; + } + + public static final class TypeInsertPointPositionComparator implements Comparator { + + @Override + public int compare(TypeInsertPoint o1, TypeInsertPoint o2) { + if (o1.point == null && o2.point == null) { + return 0; + } else if (o2.point == null) { + return 1; + } else if (o1.point == null) { + return -1; + } + + if (o1.getPositionInCode() > o2.getPositionInCode()) { + return 1; + } else if (o1.getPositionInCode() < o2.getPositionInCode()) { + return -1; + } + return 0; + } + + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/assumptions/Assumption.jav b/javatx-src/main/java/de/dhbwstuttgart/typeinference/assumptions/Assumption.jav new file mode 100644 index 0000000..bdcf727 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/assumptions/Assumption.jav @@ -0,0 +1,15 @@ +package de.dhbwstuttgart.typeinference.assumptions; + +import de.dhbwstuttgart.syntaxtree.TypeScope; + +public class Assumption { + private final TypeScope typeScope; + + public Assumption (typeScope) { + this.typeScope = typeScope; + } + + public getTypeScope() { + return typeScope; + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/assumptions/FieldAssumption.jav b/javatx-src/main/java/de/dhbwstuttgart/typeinference/assumptions/FieldAssumption.jav new file mode 100644 index 0000000..468e898 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/assumptions/FieldAssumption.jav @@ -0,0 +1,84 @@ +package de.dhbwstuttgart.typeinference.assumptions; + +import de.dhbwstuttgart.exceptions.NotImplementedException; +import de.dhbwstuttgart.parser.NullToken; +import de.dhbwstuttgart.syntaxtree.ClassOrInterface; +import de.dhbwstuttgart.syntaxtree.GenericTypeVar; +import de.dhbwstuttgart.syntaxtree.TypeScope; +import de.dhbwstuttgart.syntaxtree.type.GenericRefType; +import de.dhbwstuttgart.syntaxtree.type.RefType; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import de.dhbwstuttgart.typeinference.constraints.GenericsResolver; + +import de.dhbwstuttgart.typeinference.assumptions.Assumption; +import de.dhbwstuttgart.typeinference.assumptions.FunNClass; +import java.util.ArrayList; +import java.util.List; +import java.lang.Boolean; +import java.lang.String; + +//imports of jav imports +import de.dhbwstuttgart.syntaxtree.TypeScope; + +import de.dhbwstuttgart.parser.NullToken; +import de.dhbwstuttgart.parser.scope.JavaClassName; +import de.dhbwstuttgart.syntaxtree.ClassOrInterface; +import de.dhbwstuttgart.syntaxtree.GenericDeclarationList; +import de.dhbwstuttgart.syntaxtree.GenericTypeVar; +import de.dhbwstuttgart.syntaxtree.Method; +import de.dhbwstuttgart.syntaxtree.factory.ASTFactory; +import de.dhbwstuttgart.syntaxtree.factory.NameGenerator; +import de.dhbwstuttgart.syntaxtree.type.GenericRefType; +import de.dhbwstuttgart.syntaxtree.type.RefType; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; +import de.dhbwstuttgart.syntaxtree.Constructor; +import de.dhbwstuttgart.syntaxtree.Method; +import de.dhbwstuttgart.syntaxtree.ASTVisitor; + +import org.antlr.v4.runtime.Token; + +import javax.swing.text.html.Option; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +import java.util.Objects; +import java.lang.Integer; +import java.lang.String; +import java.lang.Boolean; + +public class FieldAssumption extends Assumption{ + private ClassOrInterface receiverClass; + private RefTypeOrTPHOrWildcardOrGeneric type; + private String name; + + public FieldAssumption(fieldName, receiverType, type, scope){ + super(scope); + this.type = type; + this.receiverClass = receiverType; + this.name = fieldName; + } + + public getReceiverClass() { + return receiverClass; + } + + public getType(resolver) { + return resolver.resolve(type); + } + +//Hier inferiert Java-TX RefType, obwohl RefTypeOrTPHOrWildcardOrGeneric genereller sein sollte + public RefTypeOrTPHOrWildcardOrGeneric getReceiverType(resolver) { + List params = new ArrayList<>(); + for(gtv : receiverClass.getGenerics()){ + //Hier wird ein GenericRefType gebildet, welcher einen für dieses Feld eindeutigen Namen hat + GenericRefType genericRefType = + new GenericRefType(gtv.getName() + , new NullToken()); + //Dieser wird dann korrekt aufgelöst vom Resolver: + params.add(resolver.resolve(genericRefType)); + } + return new RefType(receiverClass.getClassName(), params, new NullToken()); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/assumptions/FunNClass.jav b/javatx-src/main/java/de/dhbwstuttgart/typeinference/assumptions/FunNClass.jav new file mode 100644 index 0000000..d851a2d --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/assumptions/FunNClass.jav @@ -0,0 +1,52 @@ +package de.dhbwstuttgart.typeinference.assumptions; + +import de.dhbwstuttgart.parser.NullToken; +import de.dhbwstuttgart.parser.scope.JavaClassName; +import de.dhbwstuttgart.syntaxtree.ClassOrInterface; +import de.dhbwstuttgart.syntaxtree.GenericDeclarationList; +import de.dhbwstuttgart.syntaxtree.GenericTypeVar; +import de.dhbwstuttgart.syntaxtree.Method; +import de.dhbwstuttgart.syntaxtree.factory.ASTFactory; +import de.dhbwstuttgart.syntaxtree.factory.NameGenerator; +import de.dhbwstuttgart.syntaxtree.type.GenericRefType; +import de.dhbwstuttgart.syntaxtree.type.RefType; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; +import de.dhbwstuttgart.syntaxtree.Constructor; +import de.dhbwstuttgart.syntaxtree.Method; +import de.dhbwstuttgart.syntaxtree.ASTVisitor; + +import org.antlr.v4.runtime.Token; + +import javax.swing.text.html.Option; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +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) { + super(0, new JavaClassName("Fun" + (funNParams.size() - 1).toString()), new ArrayList<>(), Optional.empty(), Optional.empty() /* eingefuegt PL 2018-11-24 */, createMethods(funNParams), new ArrayList<>(), createGenerics(funNParams), ASTFactory.createObjectType(), true, false, new ArrayList<>(), new ArrayList<>(), new NullToken(), null); + } + + private static createGenerics(funNParams) { + // PL 2018-06-22: so geaendert, dass generierte Generics den Namen der funParams entsprechen. + var generics = new ArrayList<>(); + for (param : funNParams) { + generics.add(new GenericTypeVar(param.getParsedName(), // NameGenerator.makeNewName(), + new ArrayList<>(), new NullToken(), new NullToken())); + } + return new GenericDeclarationList(generics, new NullToken()); + } + + private static createMethods(funNParams) { + return null; + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/assumptions/MethodAssumption.jav b/javatx-src/main/java/de/dhbwstuttgart/typeinference/assumptions/MethodAssumption.jav new file mode 100644 index 0000000..dbb474f --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/assumptions/MethodAssumption.jav @@ -0,0 +1,124 @@ +package de.dhbwstuttgart.typeinference.assumptions; + +import de.dhbwstuttgart.parser.NullToken; +import de.dhbwstuttgart.parser.scope.JavaClassName; +import de.dhbwstuttgart.syntaxtree.ClassOrInterface; +import de.dhbwstuttgart.syntaxtree.GenericTypeVar; +import de.dhbwstuttgart.syntaxtree.TypeScope; +import de.dhbwstuttgart.syntaxtree.type.GenericRefType; +import de.dhbwstuttgart.syntaxtree.type.RefType; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import de.dhbwstuttgart.syntaxtree.type.Void; +import de.dhbwstuttgart.typeinference.constraints.GenericsResolver; + +import de.dhbwstuttgart.typeinference.assumptions.Assumption; +import de.dhbwstuttgart.typeinference.assumptions.FunNClass; +import java.util.ArrayList; +import java.util.List; +import java.lang.Boolean; +import java.lang.String; + +//imports of jav imports +import de.dhbwstuttgart.syntaxtree.TypeScope; + +import de.dhbwstuttgart.parser.NullToken; +import de.dhbwstuttgart.parser.scope.JavaClassName; +import de.dhbwstuttgart.syntaxtree.ClassOrInterface; +import de.dhbwstuttgart.syntaxtree.GenericDeclarationList; +import de.dhbwstuttgart.syntaxtree.GenericTypeVar; +import de.dhbwstuttgart.syntaxtree.Method; +import de.dhbwstuttgart.syntaxtree.factory.ASTFactory; +import de.dhbwstuttgart.syntaxtree.factory.NameGenerator; +import de.dhbwstuttgart.syntaxtree.type.GenericRefType; +import de.dhbwstuttgart.syntaxtree.type.RefType; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; +import de.dhbwstuttgart.syntaxtree.Constructor; +import de.dhbwstuttgart.syntaxtree.Method; +import de.dhbwstuttgart.syntaxtree.ASTVisitor; + +import org.antlr.v4.runtime.Token; + +import javax.swing.text.html.Option; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +import java.util.Objects; +import java.lang.Integer; +import java.lang.String; +import java.lang.Boolean; + +public class MethodAssumption extends Assumption{ + private ClassOrInterface receiver; + private RefTypeOrTPHOrWildcardOrGeneric retType; + List params; + private final Boolean isInherited; + + public MethodAssumption(receiver, retType, params, scope, isInherited){ + super(scope); + this.receiver = receiver; + this.retType = retType; + this.params = params; + this.isInherited = isInherited; + } + + /* + public RefType getReceiverType() { + + return receiver; + } + */ + + public getReceiver(){ + return receiver; + } + + public getReturnType() { + return retType; + } + + public getArgTypes(){ + return params; + } + + public getReturnType(resolver) { + return resolver.resolve(retType); + } + + public getArgTypes(resolver) { + List ret = new ArrayList<>(); + for(param : params){ + param = resolver.resolve(param); + ret.add(param); + } + return ret; + } + + /** + * + * @param resolver + * @return + */ + public getReceiverType(resolver) { + if (receiver == null) return null; + List params = new ArrayList<>(); + for(gtv : receiver.getGenerics()){ + //Die Generics werden alle zu TPHs umgewandelt. + params.add(resolver.resolve(new GenericRefType(gtv.getName(), new NullToken()))); + } + RefTypeOrTPHOrWildcardOrGeneric receiverType; + + if(receiver instanceof FunNClass){ + receiverType = new RefType(new JavaClassName(receiver.getClassName().toString()+"$$"), params, new NullToken()); // new FunN(params); + }else{ + receiverType = new RefType(receiver.getClassName(), params, new NullToken()); + } + + return receiverType; + } + + public isInherited() { + return isInherited; + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/assumptions/TypeInferenceBlockInformation.jav b/javatx-src/main/java/de/dhbwstuttgart/typeinference/assumptions/TypeInferenceBlockInformation.jav new file mode 100644 index 0000000..b0fc930 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/assumptions/TypeInferenceBlockInformation.jav @@ -0,0 +1,39 @@ +package de.dhbwstuttgart.typeinference.assumptions; + +import com.google.common.collect.Iterables; +import com.google.common.collect.Iterators; +import de.dhbwstuttgart.syntaxtree.ClassOrInterface; +import de.dhbwstuttgart.syntaxtree.GenericTypeVar; +import de.dhbwstuttgart.syntaxtree.Method; +import de.dhbwstuttgart.syntaxtree.TypeScope; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; + +import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceInformation; +import de.dhbwstuttgart.typeinference.assumptions.TypeScopeContainer; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Set; +import java.util.Stack; +import java.util.stream.Collectors; + +public class TypeInferenceBlockInformation extends TypeInferenceInformation { + private TypeScope methodContext; + private ClassOrInterface currentClass; + + public TypeInferenceBlockInformation(Collection availableClasses, ClassOrInterface currentClass, TypeScope methodContext) { + super(availableClasses); + this.methodContext = new TypeScopeContainer(currentClass, methodContext); + this.currentClass = currentClass; + } + + public TypeInferenceBlockInformation(TypeInferenceBlockInformation oldScope, TypeScope newScope) { + this(oldScope.getAvailableClasses(), oldScope.currentClass, new TypeScopeContainer(oldScope.methodContext, newScope)); + } + public getCurrentClass() { + return currentClass; + } + public getCurrentTypeScope() { + return methodContext; + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/assumptions/TypeInferenceInformation.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/assumptions/TypeInferenceInformation.java new file mode 100644 index 0000000..989e0ae --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/assumptions/TypeInferenceInformation.java @@ -0,0 +1,67 @@ +//TODO: Somehow this file is not compiling with javatx + +package de.dhbwstuttgart.typeinference.assumptions; + +import de.dhbwstuttgart.exceptions.NotImplementedException; +import de.dhbwstuttgart.parser.NullToken; +import de.dhbwstuttgart.syntaxtree.*; +import de.dhbwstuttgart.syntaxtree.statement.ArgumentList; +import de.dhbwstuttgart.syntaxtree.type.GenericRefType; +import de.dhbwstuttgart.syntaxtree.type.RefType; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; +import de.dhbwstuttgart.typeinference.constraints.Constraint; +import de.dhbwstuttgart.typeinference.constraints.Pair; + +import de.dhbwstuttgart.typeinference.assumptions.FieldAssumption; +import de.dhbwstuttgart.typeinference.assumptions.TypeScopeContainer; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Set; +import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; + +/* +Anmerkung: +Zwei Möglichkeiten, die TypeAssumptions zu speichern. +1. Die Klassen mit bedeutenden Informationen generieren diese und übergeben sie dann dieser Klasse. +2. Oder es werden nur Referenzen auf den SyntaxTree übergeben, welche diese Klasse hier dann verarbeitet. + +Bei Änderungen des SyntaxTrees müssen beide Methoden angepasst werden. +Zweiteres hat den Vorteil, dass bei der Entwicklung leichter Dinge hinzugefügt werden können. +Die ganze Logik steckt in dieser Klasse. + */ + +public class TypeInferenceInformation { + private Collection classes; + + public TypeInferenceInformation(Collection availableClasses){ + classes = availableClasses; + } + + public RefTypeOrTPHOrWildcardOrGeneric checkGTV(RefTypeOrTPHOrWildcardOrGeneric type){ + if(type instanceof GenericRefType){ + return TypePlaceholder.fresh(new NullToken()); + }else{ + return type; + } + } + + public List getFields(String name){ + List ret = new ArrayList<>(); + for(ClassOrInterface cl : classes){ + for(var m : cl.getFieldDecl()){ + if(m.getName().equals(name)){ + ret.add(new FieldAssumption(name, cl, m.getType(), new TypeScopeContainer(cl, m))); + } + } + } + return ret; + } + + public Collection getAvailableClasses() { + return classes; + } + +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/assumptions/TypeScopeContainer.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/assumptions/TypeScopeContainer.java new file mode 100644 index 0000000..b9d98a0 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/assumptions/TypeScopeContainer.java @@ -0,0 +1,34 @@ +package de.dhbwstuttgart.typeinference.assumptions; + +import com.google.common.collect.Iterables; +import de.dhbwstuttgart.syntaxtree.GenericTypeVar; +import de.dhbwstuttgart.syntaxtree.TypeScope; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; + +import java.util.ArrayList; +import java.util.Stack; +import java.util.stream.Collectors; + +import java.lang.Iterable; + +public class TypeScopeContainer implements TypeScope { + ArrayList scopes = new ArrayList<>(); + Stack types = new Stack<>(); + public TypeScopeContainer(TypeScope scope1, TypeScope scope2){ + scopes.add(scope1); + scopes.add(scope2); + types.push(scope1.getReturnType()); + types.push(scope2.getReturnType()); + } + + @Override + public Iterable getGenerics() { + return Iterables.concat(scopes.stream(). + map(TypeScope::getGenerics).collect(Collectors.toList()).toArray(new Iterable[0])); + } + + @Override + public RefTypeOrTPHOrWildcardOrGeneric getReturnType() { + return types.peek(); + } +} \ No newline at end of file diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/constraints/Constraint.jav b/javatx-src/main/java/de/dhbwstuttgart/typeinference/constraints/Constraint.jav new file mode 100644 index 0000000..c6b6297 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/constraints/Constraint.jav @@ -0,0 +1,75 @@ +package de.dhbwstuttgart.typeinference.constraints; + +import de.dhbwstuttgart.typeinference.unify.model.UnifyPair; + +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; + +import java.lang.String; +import java.lang.Boolean; +import java.lang.Long; + +public class Constraint
extends HashSet { + private static final Long serialVersionUID = 1L; + private Boolean isInherited = false;//wird nur für die Method-Constraints benoetigt + + + /* + * wird verwendet um bei der Codegenerierung die richtige Methoden - Signatur + * auszuwaehlen + */ + /*private*/ Set methodSignatureConstraint = new HashSet<>(); + + private Constraint extendConstraint = null; + + public Constraint() { + super(); + } + + public Constraint(isInherited) { + this.isInherited = isInherited; + } + + public Constraint(isInherited, Constraint extendConstraint, Set methodSignatureConstraint) { + this.isInherited = isInherited; + this.extendConstraint = extendConstraint; + this.methodSignatureConstraint = methodSignatureConstraint; + } + + public setIsInherited(isInherited) { + this.isInherited = isInherited; + } + + public isInherited() { + return isInherited; + } + + public getExtendConstraint() { + return extendConstraint; + } + + public setExtendConstraint(c) { + extendConstraint = c; + } + + public getmethodSignatureConstraint() { + return methodSignatureConstraint; + } + + public setmethodSignatureConstraint(c) { + methodSignatureConstraint = c; + } + + public toString() { + return super.toString() + "\nisInherited = " + isInherited.toString() + //" + extendsContraint: " + (extendConstraint != null ? extendConstraint.toStringBase() : "null" ) + + "\n" ; + } + + public toStringBase() { + return super.toString(); + } + +} + diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/constraints/ConstraintSet.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/constraints/ConstraintSet.java new file mode 100644 index 0000000..f52001b --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/constraints/ConstraintSet.java @@ -0,0 +1,129 @@ +package de.dhbwstuttgart.typeinference.constraints; + + +import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; +import de.dhbwstuttgart.typeinference.unify.GuavaSetOperations; +import de.dhbwstuttgart.typeinference.unify.model.UnifyPair; + +import java.util.*; +import java.util.function.BinaryOperator; +import java.util.function.Consumer; +import java.util.function.Function; +import java.util.stream.Collectors; + +public class ConstraintSet { + Constraint undConstraints = new Constraint<>(); + List>> oderConstraints = new ArrayList<>(); + + public void addUndConstraint(A p){ + undConstraints.add(p); + } + + public void addOderConstraint(Set> methodConstraints) { + oderConstraints.add(methodConstraints); + } + + public void addAllUndConstraint(Constraint allUndConstraints){ + undConstraints.addAll(allUndConstraints); + } + + public void addAllOderConstraint(List>> allOderConstraints){ + this.oderConstraints.addAll(allOderConstraints); + } + + public void addAll(ConstraintSet constraints) { + this.addAllUndConstraint(constraints.undConstraints); + this.addAllOderConstraint(constraints.oderConstraints); + } + + @Override + public String toString(){ + BinaryOperator b = (x,y) -> x+y; + return "\nUND:" + this.undConstraints.toString() + "\n" + + "ODER:" + this.oderConstraints.stream().reduce("", (x,y) -> x.toString()+ "\n" +y, b); + //cartesianProduct().toString(); + } + + public Set>> cartesianProduct(){ + Set> toAdd = new HashSet<>(); + toAdd.add(undConstraints); + List>> allConstraints = new ArrayList<>(); + allConstraints.add(toAdd); + allConstraints.addAll(oderConstraints); + return new GuavaSetOperations().cartesianProduct(allConstraints); + } + + public ConstraintSet map(Function o) { + Hashtable,Constraint> CSA2CSB = new Hashtable<>(); + ConstraintSet ret = new ConstraintSet<>(); + ret.undConstraints = undConstraints.stream().map(o).collect(Collectors.toCollection(Constraint::new)); + List>> newOder = new ArrayList<>(); + /* + for(Set> oderConstraint : oderConstraints){ + oderConstraint.forEach(as -> { + Constraint newConst = as.stream() + .map(o) + .collect(Collectors.toCollection( + () -> new Constraint (as.isInherited()))); + CSA2CSB.put(as, newConst);} ); + } + */ + + for(Set> oderConstraint : oderConstraints){ + newOder.add( + oderConstraint.parallelStream().map((Constraint as) -> { + + Constraint newConst = as.stream() + .map(o) + .collect(Collectors.toCollection(( + () -> new Constraint (as.isInherited(), + (as.getExtendConstraint() != null) + ? as.getExtendConstraint().stream().map(o).collect(Collectors.toCollection(Constraint::new)) + : null, + as.getmethodSignatureConstraint().stream().map(o).collect(Collectors.toCollection(HashSet::new)))) + )); + + //CSA2CSB.put(as, newConst); + + return newConst; + + /* + Constraint bs = CSA2CSB.get(as); + if (as.getExtendConstraint() != null) { + bs.setExtendConstraint(CSA2CSB.get(as.getExtendConstraint())); + } + return bs; + */ + }).collect(Collectors.toSet()) + ); + } + + ret.oderConstraints = newOder; + return ret; + } + + public void forEach (Consumer c) { + undConstraints.stream().forEach(c); + for(Set> oderConstraint : oderConstraints){ + oderConstraint.parallelStream().forEach((Constraint as) -> + as.stream().forEach(c)); + } + } + + public Set getAll () { + Set ret = new HashSet<>(); + ret.addAll(undConstraints); + for(Set> oderConstraint : oderConstraints){ + oderConstraint.parallelStream().forEach((Constraint as) -> ret.addAll(as)); + } + return ret; + } + + public List>> getOderConstraints() { + return oderConstraints; + } + + public Set getUndConstraints() { + return undConstraints; + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/constraints/GenericsResolver.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/constraints/GenericsResolver.java new file mode 100644 index 0000000..59bcd4b --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/constraints/GenericsResolver.java @@ -0,0 +1,14 @@ +package de.dhbwstuttgart.typeinference.constraints; + +import de.dhbwstuttgart.syntaxtree.GenericTypeVar; +import de.dhbwstuttgart.syntaxtree.type.GenericRefType; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; + +/** + * Wird für Generics benötigt + * TODO: Erklörung! + */ +public interface GenericsResolver { + public RefTypeOrTPHOrWildcardOrGeneric resolve(RefTypeOrTPHOrWildcardOrGeneric generic); +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/constraints/Pair.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/constraints/Pair.java new file mode 100644 index 0000000..a485ba5 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/constraints/Pair.java @@ -0,0 +1,155 @@ +package de.dhbwstuttgart.typeinference.constraints; +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +import de.dhbwstuttgart.parser.NullToken; +import de.dhbwstuttgart.parser.SourceLoc; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; +import de.dhbwstuttgart.typeinference.unify.model.PairOperator; +import org.antlr.v4.runtime.Token; + + +public class Pair implements Serializable +{ + public final RefTypeOrTPHOrWildcardOrGeneric TA1; + public final RefTypeOrTPHOrWildcardOrGeneric TA2; + + private SourceLoc location; + + private PairOperator eOperator = PairOperator.SMALLER; + private Boolean noUnification = false; + + + private Pair(RefTypeOrTPHOrWildcardOrGeneric TA1, RefTypeOrTPHOrWildcardOrGeneric TA2 ) + { + this.TA1 = TA1; + this.TA2 = TA2; + if(TA1 == null || TA2 == null) + throw new NullPointerException(); + eOperator = PairOperator.SMALLER; + } + + public Pair(RefTypeOrTPHOrWildcardOrGeneric TA1, RefTypeOrTPHOrWildcardOrGeneric TA2, PairOperator eOp) + { + // Konstruktor + this(TA1,TA2); + this.eOperator = eOp; + } + + public Pair(RefTypeOrTPHOrWildcardOrGeneric TA1, RefTypeOrTPHOrWildcardOrGeneric TA2, PairOperator e0p, SourceLoc location) { + this(TA1, TA2, e0p); + this.location = location; + } + + public Pair(RefTypeOrTPHOrWildcardOrGeneric TA1, RefTypeOrTPHOrWildcardOrGeneric TA2, PairOperator eOp, Boolean noUnification) + { + // Konstruktor + this(TA1,TA2); + this.eOperator = eOp; + this.noUnification = noUnification; + } + + public SourceLoc getLocation() { + return this.location; + } + + public String toString() + { + // otth: Gibt ein Paar als String aus --> zum Debuggen und Vergleichen + String strElement1 = "NULL"; + String strElement2 = "NULL"; + String Operator = "<."; + + if( TA1 != null ) + strElement1 = TA1.toString(); + + if( TA2 != null ) + strElement2 = TA2.toString(); + + /* PL ausskommentiert 2018-05-24 + if(OperatorEqual()) + Operator = "="; + if(OperatorSmaller()) + Operator = "<."; + if(OperatorSmallerExtends()) + Operator = "Author: J�rg B�uerle + * @param obj + * @return + */ + public boolean equals(Object obj) + { + boolean ret = true; + ret &= (obj instanceof Pair); + if(!ret)return ret; + ret &= ((Pair)obj).TA1.equals(this.TA1); + ret &= ((Pair)obj).TA2.equals(this.TA2); + return ret; + } + + /** + * Author: Arne Lüdtke
+ * Abfrage, ob Operator vom Typ Equal ist. + */ + public boolean OperatorEqual() + { + return eOperator == PairOperator.EQUALSDOT; + } + + /** + * Author: Arne Lüdtke
+ * Abfrage, ob Operator vom Typ Smaller ist. + */ + public boolean OperatorSmaller() + { + return eOperator == PairOperator.SMALLER; + } + + /** + * Author: Arne Lüdtke
+ * Abfrage, ob Operator vom Typ SmallerExtends ist. + */ + public boolean OperatorSmallerExtends() + { + return eOperator == PairOperator.SMALLERDOTWC; + } + + /** + * Author: Arne Lüdtke
+ * Gibt den Operator zurück. + */ + public PairOperator GetOperator() + { + return eOperator; + } + + public boolean OperatorSmallerDot() { + return eOperator == PairOperator.SMALLERDOT; + } + + + static public Map generateTPHMap(ConstraintSet constraints) { + HashMap ret = new HashMap<>(); + constraints.map((Pair p) -> { + if (p.TA1 instanceof TypePlaceholder) { + ret.put(((TypePlaceholder) p.TA1).getName(), (TypePlaceholder) p.TA1); + } + if (p.TA2 instanceof TypePlaceholder) { + ret.put(((TypePlaceholder) p.TA2).getName(), (TypePlaceholder) p.TA2); + } + return null; + }); + return ret; + } +} +// ino.end diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/result/GenericInsertPair.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/result/GenericInsertPair.java new file mode 100644 index 0000000..f864905 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/result/GenericInsertPair.java @@ -0,0 +1,31 @@ +package de.dhbwstuttgart.typeinference.result; + +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; +import de.dhbwstuttgart.typeinference.constraints.Pair; + +public class GenericInsertPair { + public TypePlaceholder TA1; + public TypePlaceholder TA2; + + public GenericInsertPair(TypePlaceholder additionalTPH, TypePlaceholder superType) { + TA1 = additionalTPH; + TA2 = superType; + } + + public GenericInsertPair(Pair pair) { + TA1 = (TypePlaceholder) pair.TA1; + TA2 = (TypePlaceholder) pair.TA2; + } + + public boolean contains(TypePlaceholder additionalTPH) { + if(TA1.equals(additionalTPH))return true; + if(TA2.equals(additionalTPH))return true; + return false; + } + + @Override + public String toString() { + return "GenIns(" + TA1.toString() + " < " + TA2.toString() + ")"; + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/result/PairNoResult.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/result/PairNoResult.java new file mode 100644 index 0000000..63b3137 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/result/PairNoResult.java @@ -0,0 +1,32 @@ +package de.dhbwstuttgart.typeinference.result; + +import de.dhbwstuttgart.exceptions.NotImplementedException; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; + +/** + * enthaelt alle Paare, die in einem Ergebnis nicht vorkommen koennen + * sie sind noetig fuer origPairs in PairTPHsmallerTPH, da hier auch + * Paare vorkommen koennen die keine Result sind (z.B. bei FunN$$) + */ +public class PairNoResult extends ResultPair{ + //public final TypePlaceholder left; + //public final TypePlaceholder right; + + /* + * urspruengliches Paar aus diesem dieses Resultpair erzeugt wurde + * wichtig fuer generated Generics + */ + ResultPair origPair; + + public PairNoResult(RefTypeOrTPHOrWildcardOrGeneric left, RefTypeOrTPHOrWildcardOrGeneric right){ + super(left, right); + } + + /* noch nicht implementiert. */ + @Override + public void accept(ResultPairVisitor visitor) { + throw new NotImplementedException(); + //visitor.visit(this); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/result/PairTPHEqualTPH.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/result/PairTPHEqualTPH.java new file mode 100644 index 0000000..c24fe21 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/result/PairTPHEqualTPH.java @@ -0,0 +1,15 @@ +package de.dhbwstuttgart.typeinference.result; + +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; + +public class PairTPHEqualTPH extends ResultPair { + public PairTPHEqualTPH(TypePlaceholder tl, TypePlaceholder tr) { + super(tl, tr); + } + + @Override + public void accept(ResultPairVisitor visitor) { + visitor.visit(this); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/result/PairTPHequalRefTypeOrWildcardType.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/result/PairTPHequalRefTypeOrWildcardType.java new file mode 100644 index 0000000..0c0a587 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/result/PairTPHequalRefTypeOrWildcardType.java @@ -0,0 +1,29 @@ +package de.dhbwstuttgart.typeinference.result; + +import de.dhbwstuttgart.syntaxtree.type.RefType; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; + +/** + * Steht für A =. RefType + */ +public class PairTPHequalRefTypeOrWildcardType extends ResultPair{ + public final TypePlaceholder left; + public final RefTypeOrTPHOrWildcardOrGeneric right; + + public PairTPHequalRefTypeOrWildcardType(TypePlaceholder left, RefTypeOrTPHOrWildcardOrGeneric right){ + super(left, right); + this.left = left; + this.right = right; + } + + @Override + public void accept(ResultPairVisitor visitor) { + visitor.visit(this); + } + + @Override + public String toString() { + return "(" + left.toString() + " = " + right.toString() + ")"; + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/result/PairTPHsmallerTPH.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/result/PairTPHsmallerTPH.java new file mode 100644 index 0000000..1df94e6 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/result/PairTPHsmallerTPH.java @@ -0,0 +1,39 @@ +package de.dhbwstuttgart.typeinference.result; + +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; + +/** + * Steht für: A <. B + */ +public class PairTPHsmallerTPH extends ResultPair{ + public final TypePlaceholder left; + public final TypePlaceholder right; + + /* + * urspruengliches Paar aus diesem dieses Resultpair erzeugt wurde + * wichtig fuer generated Generics + */ + ResultPair origPair; + + public PairTPHsmallerTPH(TypePlaceholder left, TypePlaceholder right){ + super(left, right); + this.left = left; + this.right = right; + } + + public PairTPHsmallerTPH(TypePlaceholder left, TypePlaceholder right, ResultPair origPair){ + this(left, right); + this.origPair = origPair; + } + + @Override + public void accept(ResultPairVisitor visitor) { + visitor.visit(this); + } + + @Override + public String toString() { + return "(" + left.toString() + " < " + right.toString() + ")"; + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/result/ResolvedType.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/result/ResolvedType.java new file mode 100644 index 0000000..8e7e845 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/result/ResolvedType.java @@ -0,0 +1,27 @@ +package de.dhbwstuttgart.typeinference.result; + +import de.dhbwstuttgart.syntaxtree.type.GenericRefType; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; + +import java.util.Set; + +public class ResolvedType{ + private ResultPair resultPair; + + public final RefTypeOrTPHOrWildcardOrGeneric resolvedType; + //public final Set additionalGenerics; + + public ResolvedType(RefTypeOrTPHOrWildcardOrGeneric resolvedType, Set additionalGenerics){ + this.resolvedType = resolvedType; + //this.additionalGenerics = additionalGenerics; + } + + public void setResultPair(ResultPair resultPair) { + this.resultPair = resultPair; + } + + public ResultPair getResultPair() { + return resultPair; + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/result/ResultPair.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/result/ResultPair.java new file mode 100644 index 0000000..490e6f9 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/result/ResultPair.java @@ -0,0 +1,62 @@ +package de.dhbwstuttgart.typeinference.result; + +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; + +/** + * Paare, welche das Unifikationsergebnis darstellen + */ +public abstract class ResultPair
{ + private final A left; + private final B right; + + public abstract void accept(ResultPairVisitor visitor); + + public ResultPair(A left, B right){ + this.left = left; + this.right = right; + } + + public A getLeft() { + return left; + } + + public B getRight() { + return right; + } + + public String toString() { + return "(" + left.toString() + ", " + right.toString() + ")"; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((left == null) ? 0 : left.getOffset().hashCode()); + result = prime * result + ((right == null) ? 0 : right.getOffset().hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ResultPair other = (ResultPair) obj; + if (left == null) { + if (other.left != null) + return false; + } else if (!left.getOffset().equals(other.left.getOffset())) + return false; + if (right == null) { + if (other.right != null) + return false; + } else if (!right.getOffset().equals(other.right.getOffset())) + return false; + return true; + } + +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/result/ResultPairVisitor.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/result/ResultPairVisitor.java new file mode 100644 index 0000000..e137233 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/result/ResultPairVisitor.java @@ -0,0 +1,10 @@ +package de.dhbwstuttgart.typeinference.result; + +public interface ResultPairVisitor { + void visit(PairTPHsmallerTPH p); + void visit(PairTPHequalRefTypeOrWildcardType p); + void visit(PairTPHEqualTPH p); + + //bisher nicht umgesetzt + //void visit(PairNoResult p); +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/result/ResultSet.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/result/ResultSet.java new file mode 100644 index 0000000..a46b9ed --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/result/ResultSet.java @@ -0,0 +1,309 @@ +package de.dhbwstuttgart.typeinference.result; + +import java.util.HashSet; +import java.util.Set; + +import de.dhbwstuttgart.exceptions.NotImplementedException; +import de.dhbwstuttgart.syntaxtree.type.ExtendsWildcardType; +import de.dhbwstuttgart.syntaxtree.type.GenericRefType; +import de.dhbwstuttgart.syntaxtree.type.RefType; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import de.dhbwstuttgart.syntaxtree.type.SuperWildcardType; +import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; + +@SuppressWarnings("rawtypes") +public class ResultSet { + + public final Set results; + public Set> genIns; + + public ResultSet(Set set){ + this.results = set; + this.genIns = new HashSet<>(); + results.forEach(x -> { if (x instanceof PairTPHsmallerTPH) { this.genIns.add(x);}} ); + } + + public boolean contains(ResultPair toCheck) { + return this.results.contains(toCheck); + } + + public void remove(ResultPair toCheck) { + results.remove(toCheck); + } + + public ResolvedType resolveType(RefTypeOrTPHOrWildcardOrGeneric type) { + if(type instanceof TypePlaceholder) + return new Resolver(this).resolve((TypePlaceholder)type); + if(type instanceof GenericRefType)return new ResolvedType(type, new HashSet<>()); + if(type instanceof RefType) { + RelatedTypeWalker related = new RelatedTypeWalker(null, this); + type.accept(related); + return new ResolvedType(type, related.relatedTPHs); + } else { + throw new NotImplementedException(); + //return new ResolvedType(type,new HashSet<>()); + } + } + + public String toString() { + return results.toString(); + } + + @Override + public boolean equals(Object o) { + if (o instanceof ResultSet) { + ResultSet other = (ResultSet)o; + return this.results.equals(other.results); + } else { + return false; + } + } + + @Override + public int hashCode() { + return results.hashCode(); + } +} + +class Resolver implements ResultSetVisitor { + private final ResultSet result; + private TypePlaceholder toResolve; + private RefTypeOrTPHOrWildcardOrGeneric resolved; + private final Set additionalTPHs = new HashSet<>(); + private ResultPair currentPair; + + public Resolver(ResultSet resultPairs){ + this.result = resultPairs; + } + + public ResolvedType resolve(TypePlaceholder tph){ + toResolve = tph; + resolved = null; + System.out.println(tph.toString()); + for(ResultPair resultPair : result.results) { + if(resultPair instanceof PairTPHEqualTPH && ((PairTPHEqualTPH) resultPair).getLeft().equals(toResolve)){ + currentPair = resultPair; + return resolve(((PairTPHEqualTPH) resultPair).getRight()); + } + } + for(ResultPair resultPair : result.results){ + currentPair = resultPair; + resultPair.accept(this); + } + if(resolved==null){//TPH kommt nicht im Result vor: + resolved = tph; + } + + ResolvedType result = new ResolvedType(resolved, additionalTPHs);//resolved; + result.setResultPair(currentPair); + return result; + } + + @Override + public void visit(PairTPHsmallerTPH p) { + currentPair = p; + if(p.left.equals(toResolve)){ + additionalTPHs.add(new GenericInsertPair(p.left, p.right)); + additionalTPHs.addAll(new RelatedTypeWalker(p.right, result).relatedTPHs); + } + if(p.right.equals(toResolve)) + additionalTPHs.addAll(new RelatedTypeWalker(p.left, result).relatedTPHs); + } + + @Override + public void visit(PairTPHequalRefTypeOrWildcardType p) { + currentPair = p; + if(p.left.equals(toResolve)){ + resolved = p.right; + RelatedTypeWalker related = new RelatedTypeWalker(null, result); + p.right.accept(related); + additionalTPHs.addAll(related.relatedTPHs); + } + } + + @Override + public void visit(PairTPHEqualTPH p) { + //Do nothing. Dieser Fall wird in der resolve-Methode abgefangen + } + + @Override + public void visit(RefType refType) { + + } + + @Override + public void visit(GenericRefType genericRefType) { + + } + + @Override + public void visit(SuperWildcardType superWildcardType) { + + } + + @Override + public void visit(TypePlaceholder typePlaceholder) { + + } + + @Override + public void visit(ExtendsWildcardType extendsWildcardType) { + + } + + + +} + +/** + * Sucht aus dem Result Set den Sub/supertyp für einen TPH + */ +@SuppressWarnings("rawtypes") +class TPHResolver implements ResultSetVisitor { + + private final TypePlaceholder tph; + Set resolved = new HashSet<>(); + private final ResultSet resultSet; + + TPHResolver(TypePlaceholder tph, ResultSet resultSet){ + this.resultSet = resultSet; + this.tph = tph; + for(ResultPair p : resultSet.results){ + p.accept(this); + } + if(resolved.size() == 0){ + resolved.add(new GenericInsertPair(tph, null)); + } + } + + @Override + public void visit(PairTPHsmallerTPH p) { + if(p.left.equals(tph) || p.right.equals(tph)){ + resolved.add(new GenericInsertPair(p.left, p.right)); + } + } + + @Override + public void visit(PairTPHequalRefTypeOrWildcardType p) { + TypePlaceholder otherSide = null; + if(p.right.equals(tph)){ + otherSide = p.left; + } + if(otherSide != null){ + Set newResultSet = new HashSet<>(this.resultSet.results); + newResultSet.remove(p); + resolved.addAll(new TPHResolver(otherSide, new ResultSet(newResultSet)).resolved); + } + } + + @Override + public void visit(PairTPHEqualTPH p) { + //ignorieren. Wird vom Resolver behandelt + } + + @Override + public void visit(RefType refType) { + + } + + @Override + public void visit(GenericRefType genericRefType) { + + } + + @Override + public void visit(SuperWildcardType superWildcardType) { + + } + + @Override + public void visit(TypePlaceholder typePlaceholder) { + + } + + @Override + public void visit(ExtendsWildcardType extendsWildcardType) { + + } +} + +@SuppressWarnings("rawtypes") +class RelatedTypeWalker implements ResultSetVisitor { + + final Set relatedTPHs = new HashSet<>(); + private final TypePlaceholder toResolve; + private final ResultSet resultSet; + + /** + * Läuft über das resultSet und speichert alle TPHs, welche mit start in Verbindung stehen + * @param start - kann null sein, wenn der Walker für einen RefType benutzt wird + * @param resultSet + */ + RelatedTypeWalker(TypePlaceholder start, ResultSet resultSet){ + this.toResolve = start; + this.resultSet = resultSet; + int resolved = 0; + do{ + resolved = relatedTPHs.size(); + for(ResultPair p : resultSet.results){ + p.accept(this); + p.accept(this); + } + }while(resolved - relatedTPHs.size() > 0); + } + + @Override + public void visit(PairTPHsmallerTPH p) { + if(p.getRight().equals(toResolve)){ + relatedTPHs.addAll(new TPHResolver(p.right, resultSet).resolved); + //relatedTPHs.addAll(new RelatedTypeWalker(p.right, resultSet).relatedTPHs); + } + if(p.getLeft().equals(toResolve)){ + relatedTPHs.addAll(new TPHResolver(p.left, resultSet).resolved); + //relatedTPHs.addAll(new RelatedTypeWalker(p.left, resultSet).relatedTPHs); + } + } + + @Override + public void visit(PairTPHequalRefTypeOrWildcardType p) { + if(p.getLeft().equals(toResolve)){ + p.getRight().accept(this); + } + } + + @Override + public void visit(PairTPHEqualTPH p) { + //Kann ignoriert werden. Diese Fälle werden vom Resolver behandelt + } + + /* + Die folgenden Funktionen fügen alle TPHs an die relatedTPHs an, denen sie begegnen: + Das wird verwendet, wenn alle relatedTPHs aus den Parametern eines RefTypes angefügt werden sollen + */ + + @Override + public void visit(RefType refType) { + for(RefTypeOrTPHOrWildcardOrGeneric param : refType.getParaList()){ + param.accept(this); + } + } + + @Override + public void visit(SuperWildcardType superWildcardType) { + superWildcardType.getInnerType().accept(this); + } + + @Override + public void visit(TypePlaceholder typePlaceholder) { + relatedTPHs.addAll(new TPHResolver(typePlaceholder, resultSet).resolved); + } + + @Override + public void visit(ExtendsWildcardType extendsWildcardType) { + extendsWildcardType.getInnerType().accept(this); + } + + @Override + public void visit(GenericRefType genericRefType) { + } +} \ No newline at end of file diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/result/ResultSetVisitor.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/result/ResultSetVisitor.java new file mode 100644 index 0000000..105fc8a --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/result/ResultSetVisitor.java @@ -0,0 +1,17 @@ +package de.dhbwstuttgart.typeinference.result; + +import de.dhbwstuttgart.syntaxtree.type.*; + +public interface ResultSetVisitor extends ResultPairVisitor{ + + void visit(RefType refType); + + void visit(GenericRefType genericRefType); + + void visit(SuperWildcardType superWildcardType); + + void visit(TypePlaceholder typePlaceholder); + + void visit(ExtendsWildcardType extendsWildcardType); + +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/typeAlgo/GenericsResolverSameName.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/typeAlgo/GenericsResolverSameName.java new file mode 100644 index 0000000..2bb131f --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/typeAlgo/GenericsResolverSameName.java @@ -0,0 +1,56 @@ +package de.dhbwstuttgart.typeinference.typeAlgo; + +import de.dhbwstuttgart.syntaxtree.StatementVisitor; +import de.dhbwstuttgart.syntaxtree.type.*; +import de.dhbwstuttgart.typeinference.constraints.GenericsResolver; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +/** + * Ein GenericsResolver, welcher Generics mit dem selben Namen den selben TPH zuordnet + */ +public class GenericsResolverSameName implements GenericsResolver, TypeVisitor{ + + HashMap map = new HashMap<>(); + + @Override + public RefTypeOrTPHOrWildcardOrGeneric resolve(RefTypeOrTPHOrWildcardOrGeneric generic) { + return generic.acceptTV(this); + } + + @Override + public RefTypeOrTPHOrWildcardOrGeneric visit(RefType refType) { + List params = new ArrayList<>(); + for(RefTypeOrTPHOrWildcardOrGeneric param : refType.getParaList()){ + params.add(param.acceptTV(this)); + } + RefType ret = new RefType(refType.getName(), params, refType.getOffset()); + return ret; + } + + @Override + public RefTypeOrTPHOrWildcardOrGeneric visit(SuperWildcardType superWildcardType) { + return new SuperWildcardType(superWildcardType.getInnerType().acceptTV(this), superWildcardType.getOffset()); + } + + @Override + public RefTypeOrTPHOrWildcardOrGeneric visit(TypePlaceholder typePlaceholder) { + return typePlaceholder; + } + + @Override + public RefTypeOrTPHOrWildcardOrGeneric visit(ExtendsWildcardType extendsWildcardType) { + return new ExtendsWildcardType(extendsWildcardType.getInnerType().acceptTV(this), extendsWildcardType.getOffset()); + } + + @Override + public RefTypeOrTPHOrWildcardOrGeneric visit(GenericRefType genericRefType) { + String name = genericRefType.getParsedName(); + if(!map.containsKey(name)){ + map.put(name, TypePlaceholder.fresh(genericRefType.getOffset())); + } + return map.get(name); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/typeAlgo/TYPE.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/typeAlgo/TYPE.java new file mode 100644 index 0000000..e12e7b0 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/typeAlgo/TYPE.java @@ -0,0 +1,96 @@ +package de.dhbwstuttgart.typeinference.typeAlgo; + +import de.dhbwstuttgart.exceptions.DebugException; +import de.dhbwstuttgart.parser.scope.JavaClassName; +import de.dhbwstuttgart.syntaxtree.*; +import de.dhbwstuttgart.syntaxtree.factory.ASTFactory; +import de.dhbwstuttgart.syntaxtree.statement.Statement; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceBlockInformation; +import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceInformation; +import de.dhbwstuttgart.typeinference.constraints.ConstraintSet; +import de.dhbwstuttgart.util.BiRelation; + +import java.util.*; + +public class TYPE { + + private final Collection sfs; + private final Set allAvailableClasses; + + public TYPE(Collection sourceFiles, Set allAvailableClasses){ + sfs = sourceFiles; + this.allAvailableClasses = allAvailableClasses; + } + + public ConstraintSet getConstraints() { + ConstraintSet ret = new ConstraintSet(); + for(SourceFile sf : sfs) + for (ClassOrInterface cl : sf.KlassenVektor) { + System.out.println(sf.availableClasses); + var allClasses = new HashSet(); + allClasses.addAll(allAvailableClasses); + allClasses.addAll(sf.availableClasses); + ret.addAll(getConstraintsClass(cl, new TypeInferenceInformation(allClasses))); + } + return ret; + } + + private ConstraintSet getConstraintsClass(ClassOrInterface cl, TypeInferenceInformation info) { + ConstraintSet ret = new ConstraintSet(); + ConstraintSet methConstrains; + for(Method m : cl.getMethods()){ + ret.addAll(methConstrains = getConstraintsMethod(m,info, cl)); + 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)); + } + + return ret; + } + /* + TODO: Hier eine Information erstellen nur mit den importierte Klassen einer einzigen SourceFile + private TypeInferenceInformation getTypeInferenceInformation(sourceFile) { + DirectoryClassLoader classLoader = DirectoryClassLoader.getSystemClassLoader(); + Set classes = new HashSet<>(); + + for(SourceFile sourceFile : sfs){ + for(JavaClassName importName : sourceFile.imports){ + System.out.println(importName); + try { + classes.add(ASTFactory.createClass(classLoader.loadClass(importName.toString()))); + } catch (ClassNotFoundException e) { + throw new DebugException("Klasse " + importName + " konnte nicht geladen werden"); + } + } + classes.addAll(sourceFile.KlassenVektor); + } + + return new TypeInferenceInformation(classes); + } + */ + + 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 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; + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java new file mode 100644 index 0000000..3811c59 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java @@ -0,0 +1,798 @@ +//PL 2018-12-19: Merge chekcen +package de.dhbwstuttgart.typeinference.typeAlgo; + +import java.util.*; +import java.util.stream.Collectors; + +import de.dhbwstuttgart.exceptions.NotImplementedException; +import de.dhbwstuttgart.exceptions.TypeinferenceException; +import de.dhbwstuttgart.parser.NullToken; +import de.dhbwstuttgart.parser.SourceLoc; +import de.dhbwstuttgart.parser.SyntaxTreeGenerator.AssignToLocal; +import de.dhbwstuttgart.parser.scope.JavaClassName; +import de.dhbwstuttgart.syntaxtree.*; +import de.dhbwstuttgart.syntaxtree.factory.ASTFactory; +import de.dhbwstuttgart.syntaxtree.factory.NameGenerator; +import de.dhbwstuttgart.syntaxtree.statement.*; +import de.dhbwstuttgart.syntaxtree.type.ExtendsWildcardType; +import de.dhbwstuttgart.syntaxtree.type.GenericRefType; +import de.dhbwstuttgart.syntaxtree.type.RefType; +import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; +import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; +import de.dhbwstuttgart.syntaxtree.type.Void; +import de.dhbwstuttgart.typeinference.assumptions.FieldAssumption; +import de.dhbwstuttgart.typeinference.assumptions.FunNClass; +import de.dhbwstuttgart.typeinference.assumptions.MethodAssumption; +import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceBlockInformation; +import de.dhbwstuttgart.typeinference.constraints.Constraint; +import de.dhbwstuttgart.typeinference.constraints.ConstraintSet; +import de.dhbwstuttgart.typeinference.constraints.GenericsResolver; +import de.dhbwstuttgart.typeinference.constraints.Pair; +import de.dhbwstuttgart.typeinference.unify.model.PairOperator; +import org.antlr.v4.runtime.Token; + +public class TYPEStmt implements StatementVisitor { + + private final TypeInferenceBlockInformation info; + private final ConstraintSet constraintsSet = new ConstraintSet(); + private final Stack switchStack = new Stack<>(); + + public TYPEStmt(TypeInferenceBlockInformation info) { + this.info = info; + } + + public ConstraintSet getConstraints() { + return constraintsSet; + } + + private SourceLoc loc(Token token) { + return new SourceLoc(info.getCurrentClass().getFileName(), token.getLine()); + }; + + /** + * Erstellt einen neuen GenericResolver Die Idee dieser Datenstruktur ist es, GTVs einen eindeutigen TPH zuzuweisen. Bei Methodenaufrufen oder anderen Zugriffen, bei denen alle benutzten GTVs jeweils einen einheitlichen TPH bekommen müssen kann diese Klasse eingesetzt werden. Wichtig ist, dass hierfür jeweils eine frische Instanz benutzt wird. + * + * @return + */ + private static GenericsResolver getResolverInstance() { + return new GenericsResolverSameName(); + } + + private static TypeScope createTypeScope(ClassOrInterface cl, Method method) { + return null; + } + + @Override + public void visit(ArgumentList arglist) { + for (int i = 0; i < arglist.getArguments().size(); i++) { + arglist.getArguments().get(i).accept(this); + } + } + + @Override + public void visit(LambdaExpression lambdaExpression) { + TypePlaceholder tphRetType = TypePlaceholder.fresh(new NullToken()); + List lambdaParams = lambdaExpression.params.getFormalparalist().stream().map((formalParameter -> formalParameter.getType())).collect(Collectors.toList()); + lambdaParams.add(tphRetType); + // lambdaParams.add(0,tphRetType); + constraintsSet.addUndConstraint(new Pair(lambdaExpression.getType(), new RefType(new JavaClassName("Fun" + (lambdaParams.size() - 1) + "$$"), lambdaParams, new NullToken()), + // new FunN(lambdaParams), + PairOperator.EQUALSDOT, loc(lambdaExpression.getOffset()))); + constraintsSet.addUndConstraint(new Pair(lambdaExpression.getReturnType(), tphRetType, PairOperator.EQUALSDOT, loc(lambdaExpression.getOffset()))); + + // Constraints des Bodys generieren: + TYPEStmt lambdaScope = new TYPEStmt(new TypeInferenceBlockInformation(info, lambdaExpression)); + lambdaExpression.methodBody.accept(lambdaScope); + constraintsSet.addAll(lambdaScope.getConstraints()); + } + + @Override + public void visit(Assign assign) { + assign.lefSide.accept(this); + assign.rightSide.accept(this); + constraintsSet.addUndConstraint(new Pair(assign.rightSide.getType(), assign.lefSide.getType(), PairOperator.SMALLERDOT, loc(assign.getOffset()))); + } + + @Override + public void visit(Block block) { + for (Statement stmt : block.getStatements()) { + stmt.accept(this); + } + } + + @Override + public void visit(CastExpr castExpr) { + castExpr.expr.accept(this); + constraintsSet.addUndConstraint(new Pair(castExpr.getType(), castExpr.expr.getType(), PairOperator.SMALLERDOT)); + } + + @Override + public void visit(EmptyStmt emptyStmt) { + // Nothing :) + } + + @Override + public void visit(FieldVar fieldVar) { + fieldVar.receiver.accept(this); + Set oderConstraints = new HashSet<>(); + for (FieldAssumption fieldAssumption : info.getFields(fieldVar.fieldVarName)) { + Constraint constraint = new Constraint(); + GenericsResolver resolver = getResolverInstance(); + constraint.add(new Pair(fieldVar.receiver.getType(), fieldAssumption.getReceiverType(resolver), PairOperator.SMALLERDOT, loc(fieldVar.getOffset()))); // PL 2019-12-09: SMALLERDOT eingefuegt, EQUALSDOT entfernt, wenn ds Field privat ist muesste es EQUALSDOT lauten + constraint.add(new Pair(fieldVar.getType(), fieldAssumption.getType(resolver), PairOperator.EQUALSDOT, loc(fieldVar.getOffset()))); + oderConstraints.add(constraint); + } + if (oderConstraints.size() == 0) + throw new TypeinferenceException("Kein Feld " + fieldVar.fieldVarName + " gefunden", fieldVar.getOffset()); + constraintsSet.addOderConstraint(oderConstraints); + } + + @Override + public void visit(ForStmt forStmt) { + forStmt.initializer.forEach(s -> s.accept(this)); + if (forStmt.condition != null) + forStmt.condition.accept(this); + forStmt.loopExpr.forEach(e -> e.accept(this)); + forStmt.block.accept(this); + } + + @Override + public void visit(ForEachStmt forEachStmt) { + var iterableType = new RefType(ASTFactory.createClass(java.lang.Iterable.class).getClassName(), Arrays.asList(new ExtendsWildcardType(forEachStmt.statement.getType(), new NullToken())), new NullToken()); + constraintsSet.addUndConstraint(new Pair(forEachStmt.expression.getType(), iterableType, PairOperator.SMALLERDOT, loc(forEachStmt.getOffset()))); + forEachStmt.statement.accept(this); + forEachStmt.expression.accept(this); + forEachStmt.block.accept(this); + } + + @Override + public void visit(IfStmt ifStmt) { + RefType booleanType = new RefType(ASTFactory.createClass(java.lang.Boolean.class).getClassName(), new NullToken()); + // Expression inferieren: + ifStmt.expr.accept(this); + // Expression muss boolean sein: + constraintsSet.addUndConstraint(new Pair(ifStmt.expr.getType(), booleanType, PairOperator.EQUALSDOT, loc(ifStmt.getOffset()))); + // Blöcke inferieren: + ifStmt.then_block.accept(this); + // Beide Blöcke müssen den gleichen Supertyp haben, welcher den Rückgabetyp des If-Stmts darstellt + //constraintsSet.addUndConstraint(new Pair(ifStmt.else_block.getType(), ifStmt.getType(), PairOperator.SMALLERDOT)); + if (ifStmt.else_block != null) { + ifStmt.else_block.accept(this); + constraintsSet.addUndConstraint(new Pair(ifStmt.else_block.getType(), ifStmt.getType(), PairOperator.SMALLERDOT, loc(ifStmt.getOffset()))); + } + + } + + @Override + public void visit(InstanceOf instanceOf) { + instanceOf.getExpression().accept(this); + } + + @Override + public void visit(LocalVar localVar) { + // Es werden nur bei Feldvariablen Constraints generiert. Lokale Variablen sind eindeutig + } + + @Override + public void visit(LocalVarDecl localVarDecl) { + // Hier ist nichts zu tun. Allen lokalen Variablen bekommen beim parsen schon den korrekten Typ + } + + @Override + // Es wird in OderConstraints davon ausgegangen dass die Bedingungen für die Typen der Argumente links stehen + // und die Typen der Rückgabewerte immer rechts stehen (vgl. JavaTXCompiler) + public void visit(MethodCall methodCall) { + + methodCall.receiver.accept(this); + // Overloading: + Set> methodConstraints = new HashSet<>(); + for (MethodAssumption m : this.getMethods(methodCall.name, methodCall.arglist, info)) { + GenericsResolver resolver = getResolverInstance(); + Set> oneMethodConstraints = generateConstraint(methodCall, m, info, resolver); + methodConstraints.addAll(oneMethodConstraints); + + /* + * pl 2023-01-20: in generateConstraint bereits umgesetzt Constraint extendsOneMethodConstraint = oneMethodConstraint.stream() .map(x -> (x.TA1 instanceof TypePlaceholder && x.GetOperator() == PairOperator.EQUALSDOT && !(x.TA2 instanceof TypePlaceholder)) ? new Pair(x.TA1, new ExtendsWildcardType(x.TA2, x.TA2.getOffset()), PairOperator.EQUALSDOT) : x) .collect(Collectors.toCollection(() -> new Constraint(oneMethodConstraint.isInherited()))); + * oneMethodConstraint.setExtendConstraint(extendsOneMethodConstraint); extendsOneMethodConstraint.setExtendConstraint(oneMethodConstraint); methodConstraints.add(extendsOneMethodConstraint); + */ + } + if (methodConstraints.size() < 1) { + throw new TypeinferenceException("Methode " + methodCall.name + " ist nicht vorhanden!", methodCall.getOffset()); + } + constraintsSet.addOderConstraint(methodConstraints); + } + + @Override + public void visit(NewClass methodCall) { + // Overloading: + Set methodConstraints = new HashSet<>(); + for (MethodAssumption m : this.getConstructors(info, (RefType) methodCall.getType(), methodCall.getArgumentList())) { + methodConstraints.add(generateConstructorConstraint(methodCall, m, info, getResolverInstance())); + } + if (methodConstraints.size() < 1) { + throw new TypeinferenceException("Konstruktor in Klasse " + methodCall.getType().toString() + " ist nicht vorhanden!", methodCall.getOffset()); + } + constraintsSet.addOderConstraint(methodConstraints); + } + + @Override + public void visit(NewArray newArray) { + throw new NotImplementedException(); + } + + @Override + public void visit(ExpressionReceiver receiver) { + receiver.expr.accept(this); + } + + private final RefType number = new RefType(ASTFactory.createClass(Number.class).getClassName(), new NullToken()); + private final RefType longg = new RefType(ASTFactory.createClass(Long.class).getClassName(), new NullToken()); + private final RefType integer = new RefType(ASTFactory.createClass(Integer.class).getClassName(), new NullToken()); + private final RefType shortt = new RefType(ASTFactory.createClass(Short.class).getClassName(), new NullToken()); + private final RefType bytee = new RefType(ASTFactory.createClass(Byte.class).getClassName(), new NullToken()); + private final RefType floatt = new RefType(ASTFactory.createClass(Float.class).getClassName(), new NullToken()); + private final RefType doublee = new RefType(ASTFactory.createClass(Double.class).getClassName(), new NullToken()); + private final RefType string = new RefType(ASTFactory.createClass(String.class).getClassName(), new NullToken()); + private final RefType bool = new RefType(ASTFactory.createClass(Boolean.class).getClassName(), new NullToken()); + + private final RefType charr = new RefType(ASTFactory.createClass(Character.class).getClassName(), new NullToken()); + + @Override + public void visit(UnaryExpr unaryExpr) { + if (unaryExpr.operation == UnaryExpr.Operation.POSTDECREMENT || unaryExpr.operation == UnaryExpr.Operation.POSTINCREMENT || unaryExpr.operation == UnaryExpr.Operation.PREDECREMENT || unaryExpr.operation == UnaryExpr.Operation.PREINCREMENT) { + // @see: https://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.14.2 + // Expression muss zu Numeric Convertierbar sein. also von Numeric erben + constraintsSet.addUndConstraint(new Pair(unaryExpr.expr.getType(), number, PairOperator.SMALLERNEQDOT, loc(unaryExpr.getOffset()))); + // The type of the postfix increment expression is the type of the variable + constraintsSet.addUndConstraint(new Pair(unaryExpr.expr.getType(), unaryExpr.getType(), PairOperator.EQUALSDOT, loc(unaryExpr.getOffset()))); + } else { + throw new NotImplementedException(); + } + } + + @Override + // Es wird in OderConstraints davon ausgegangen dass die Bedingungen für die Typen der Argumente links stehen + // und die Typen der Rückgabewerte immer rechts stehen (vgl. JavaTXCompiler) + public void visit(BinaryExpr binary) { + binary.lexpr.accept(this); + binary.rexpr.accept(this); + if (binary.operation.equals(BinaryExpr.Operator.DIV) || binary.operation.equals(BinaryExpr.Operator.MUL) || binary.operation.equals(BinaryExpr.Operator.MOD) || binary.operation.equals(BinaryExpr.Operator.ADD) || binary.operation.equals(BinaryExpr.Operator.SUB)) { + Set> numericAdditionOrStringConcatenation = new HashSet<>(); + + // TODO PL 2018-11-06 + + // Auf importierte Typen einschraenken + // pruefen, ob Typen richtig bestimmt werden. + + // Zuerst der Fall für Numerische AusdrücPairOpnumericeratorke, das sind Mul, Mod und Div immer: + // see: https://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.17 + // Expression muss zu Numeric Convertierbar sein. also von Numeric erben + Constraint numeric; + // PL eingefuegt 2018-07-17 + if (info.getAvailableClasses().stream().map(x -> x.getClassName()).collect(Collectors.toCollection(HashSet::new)).contains(bytee.getName())) { + numeric = new Constraint<>(); + numeric.add(new Pair(binary.lexpr.getType(), bytee, PairOperator.SMALLERDOT, loc(binary.getOffset()))); + numeric.add(new Pair(binary.rexpr.getType(), bytee, PairOperator.SMALLERDOT, loc(binary.getOffset()))); + numeric.add(new Pair(binary.getType(), integer, PairOperator.EQUALSDOT, loc(binary.getOffset()))); + numericAdditionOrStringConcatenation.add(numeric); + } + // PL eingefuegt 2018-07-17 + if (info.getAvailableClasses().stream().map(x -> x.getClassName()).collect(Collectors.toCollection(HashSet::new)).contains(shortt.getName())) { + numeric = new Constraint<>(); + numeric.add(new Pair(binary.lexpr.getType(), shortt, PairOperator.SMALLERDOT, loc(binary.getOffset()))); + numeric.add(new Pair(binary.rexpr.getType(), shortt, PairOperator.SMALLERDOT, loc(binary.getOffset()))); + numeric.add(new Pair(binary.getType(), integer, PairOperator.EQUALSDOT, loc(binary.getOffset()))); + numericAdditionOrStringConcatenation.add(numeric); + } + // PL eingefuegt 2018-07-17 + if (info.getAvailableClasses().stream().map(x -> x.getClassName()).collect(Collectors.toCollection(HashSet::new)).contains(integer.getName())) { + numeric = new Constraint<>(); + numeric.add(new Pair(binary.lexpr.getType(), integer, PairOperator.SMALLERDOT, loc(binary.getOffset()))); + numeric.add(new Pair(binary.rexpr.getType(), integer, PairOperator.SMALLERDOT, loc(binary.getOffset()))); + numeric.add(new Pair(integer, binary.getType(), PairOperator.EQUALSDOT, loc(binary.getOffset()))); + numericAdditionOrStringConcatenation.add(numeric); + } + // PL eingefuegt 2018-07-17 + if (info.getAvailableClasses().stream().map(x -> x.getClassName()).collect(Collectors.toCollection(HashSet::new)).contains(longg.getName())) { + numeric = new Constraint<>(); + numeric.add(new Pair(binary.lexpr.getType(), longg, PairOperator.SMALLERDOT, loc(binary.getOffset()))); + numeric.add(new Pair(binary.rexpr.getType(), longg, PairOperator.SMALLERDOT, loc(binary.getOffset()))); + numeric.add(new Pair(longg, binary.getType(), PairOperator.EQUALSDOT, loc(binary.getOffset()))); + numericAdditionOrStringConcatenation.add(numeric); + } + // PL eingefuegt 2018-07-17 + if (info.getAvailableClasses().stream().map(x -> x.getClassName()).collect(Collectors.toCollection(HashSet::new)).contains(floatt.getName())) { + numeric = new Constraint<>(); + numeric.add(new Pair(binary.lexpr.getType(), floatt, PairOperator.SMALLERDOT, loc(binary.getOffset()))); + numeric.add(new Pair(binary.rexpr.getType(), floatt, PairOperator.SMALLERDOT, loc(binary.getOffset()))); + numeric.add(new Pair(floatt, binary.getType(), PairOperator.EQUALSDOT, loc(binary.getOffset()))); + numericAdditionOrStringConcatenation.add(numeric); + } + // PL eingefuegt 2018-07-17 + if (info.getAvailableClasses().stream().map(x -> x.getClassName()).collect(Collectors.toCollection(HashSet::new)).contains(doublee.getName())) { + numeric = new Constraint<>(); + numeric.add(new Pair(binary.lexpr.getType(), doublee, PairOperator.SMALLERDOT, loc(binary.getOffset()))); + numeric.add(new Pair(binary.rexpr.getType(), doublee, PairOperator.SMALLERDOT, loc(binary.getOffset()))); + numeric.add(new Pair(doublee, binary.getType(), PairOperator.EQUALSDOT, loc(binary.getOffset()))); + numericAdditionOrStringConcatenation.add(numeric); + } + /* + * PL auskommentiert Anfang 2018-07-17 /* In Java passiert bei den binären Operatoren eine sogenannte Type Promotion: https://docs.oracle.com/javase/specs/jls/se7/html/jls-5.html#jls-5.6.2 Das bedeutet, dass Java die Typen je nach belieben castet, so lange sie nur von Number erben + * + * numeric = new Constraint<>(); numeric.add(new Pair(binary.getType(), number, PairOperator.SMALLERDOT)); numericAdditionOrStringConcatenation.add(numeric); PL auskommentiert Ende 2018-07-17 + */ + + if (binary.operation.equals(BinaryExpr.Operator.ADD)) { + // Dann kann der Ausdruck auch das aneinanderfügen zweier Strings sein: ("a" + "b") oder (1 + 2) + if (info.getAvailableClasses().stream().map(x -> x.getClassName()).collect(Collectors.toCollection(HashSet::new)).contains(string.getName())) { + Constraint stringConcat = new Constraint<>(); + stringConcat.add(new Pair(binary.lexpr.getType(), string, PairOperator.EQUALSDOT, loc(binary.getOffset()))); + stringConcat.add(new Pair(binary.rexpr.getType(), string, PairOperator.EQUALSDOT, loc(binary.getOffset()))); + stringConcat.add(new Pair(string, binary.getType(), PairOperator.EQUALSDOT, loc(binary.getOffset()))); + numericAdditionOrStringConcatenation.add(stringConcat); + } + } + if (numericAdditionOrStringConcatenation.size() < 1) { + throw new TypeinferenceException("Kein Typ für " + binary.operation.toString() + " vorhanden", binary.getOffset()); + } + constraintsSet.addOderConstraint(numericAdditionOrStringConcatenation); + } else if (binary.operation.equals(BinaryExpr.Operator.LESSEQUAL) || binary.operation.equals(BinaryExpr.Operator.BIGGEREQUAL) || binary.operation.equals(BinaryExpr.Operator.BIGGERTHAN) || binary.operation.equals(BinaryExpr.Operator.LESSTHAN)) { + /* + * //eingefuegt PL 2018-05-24 Set> numericRelationConcatenation = new HashSet<>(); Constraint numeric = new Constraint<>(); numeric.add(new Pair(binary.lexpr.getType(), bytee, PairOperator.SMALLERDOT)); numeric.add(new Pair(binary.rexpr.getType(), bytee, PairOperator.SMALLERDOT)); numeric.add(new Pair(binary.getType(), bool, PairOperator.SMALLERDOT)); numericRelationConcatenation.add(numeric); numeric = new Constraint<>(); numeric.add(new Pair(binary.lexpr.getType(), + * shortt, PairOperator.SMALLERDOT)); numeric.add(new Pair(binary.rexpr.getType(), shortt, PairOperator.SMALLERDOT)); numeric.add(new Pair(binary.getType(), bool, PairOperator.SMALLERDOT)); numericRelationConcatenation.add(numeric); numeric = new Constraint<>(); numeric.add(new Pair(binary.lexpr.getType(), integer, PairOperator.SMALLERDOT)); numeric.add(new Pair(binary.rexpr.getType(), integer, PairOperator.SMALLERDOT)); numeric.add(new Pair(binary.getType(), bool, PairOperator.SMALLERDOT)); + * numericRelationConcatenation.add(numeric); numeric = new Constraint<>(); numeric.add(new Pair(binary.lexpr.getType(), longg, PairOperator.SMALLERDOT)); numeric.add(new Pair(binary.rexpr.getType(), longg, PairOperator.SMALLERDOT)); numeric.add(new Pair(binary.getType(), bool, PairOperator.SMALLERDOT)); numericRelationConcatenation.add(numeric); numeric = new Constraint<>(); numeric.add(new Pair(binary.lexpr.getType(), floatt, PairOperator.SMALLERDOT)); numeric.add(new + * Pair(binary.rexpr.getType(), floatt, PairOperator.SMALLERDOT)); numeric.add(new Pair(binary.getType(), bool, PairOperator.SMALLERDOT)); numericRelationConcatenation.add(numeric); numeric = new Constraint<>(); numeric.add(new Pair(binary.lexpr.getType(), doublee, PairOperator.SMALLERDOT)); numeric.add(new Pair(binary.rexpr.getType(), doublee, PairOperator.SMALLERDOT)); numeric.add(new Pair(binary.getType(), bool, PairOperator.SMALLERDOT)); numericRelationConcatenation.add(numeric); + * + * //***ACHTUNG: Moeglicherweise oder und und-Contraint falsch constraintsSet.addOderConstraint(numericRelationConcatenation); //***ACHTUNG: Moeglicherweise oder und und-Contraint falsch + */ + // Testeise eingefuegt PL 2018-05-24 + // Hier sollte evtl. noch importe angefragt werden PL 2019-05-07 + constraintsSet.addUndConstraint(new Pair(binary.lexpr.getType(), number, PairOperator.SMALLERNEQDOT, loc(binary.getOffset()))); + constraintsSet.addUndConstraint(new Pair(binary.rexpr.getType(), number, PairOperator.SMALLERNEQDOT, loc(binary.getOffset()))); + // Rückgabetyp ist Boolean + constraintsSet.addUndConstraint(new Pair(bool, binary.getType(), PairOperator.EQUALSDOT, loc(binary.getOffset()))); + + // auskommentiert PL 2018-05-24 + // constraintsSet.addUndConstraint(new Pair(binary.lexpr.getType(), number, PairOperator.SMALLERDOT)); + // constraintsSet.addUndConstraint(new Pair(binary.rexpr.getType(), number, PairOperator.SMALLERDOT)); + // Rückgabetyp ist Boolean + // constraintsSet.addUndConstraint(new Pair(bool, binary.getType(), PairOperator.EQUALSDOT)); + } else if (binary.operation.equals(BinaryExpr.Operator.EQUAL) || binary.operation.equals(BinaryExpr.Operator.NOTEQUAL)) { + /* + * Auszug aus https://docs.oracle.com/javase/specs/jls/se9/html/jls-15.html#jls-15.21 The equality operators may be used to compare two operands that are convertible (§5.1.8) to numeric type, or two operands of type boolean or Boolean, or two operands that are each of either reference type or the null type. All other cases result in a compile-time error. + */ + // Der Equals Operator geht mit fast allen Typen, daher werden hier keine Constraints gesetzt + constraintsSet.addUndConstraint(new Pair(bool, binary.getType(), PairOperator.EQUALSDOT, loc(binary.getOffset()))); + } else { + throw new NotImplementedException(); + } + } + + @Override + public void visit(BoolExpression expr) { + + constraintsSet.addUndConstraint(new Pair(bool, expr.getType(), PairOperator.EQUALSDOT, loc(expr.getOffset()))); + constraintsSet.addUndConstraint(new Pair(bool, expr.lexpr.getType(), PairOperator.EQUALSDOT, loc(expr.getOffset()))); + constraintsSet.addUndConstraint(new Pair(bool, expr.rexpr.getType(), PairOperator.EQUALSDOT, loc(expr.getOffset()))); + + // TODO + return; + } + + @Override + public void visit(Literal literal) { + // Nothing to do here. Literale erzeugen keine Constraints + // PL 2018-06-23 Sie haben einen Typ. Der muesste hier eingefuegt werden + // wie hier fuer double gezeigt. Im Momment auskommentiert, weil zu wenige Literaltypen + // funktionieren + if (literal.value instanceof Short) { + constraintsSet.addUndConstraint(new Pair(literal.getType(), shortt, PairOperator.EQUALSDOT, loc(literal.getOffset()))); + return; + } + if (literal.value instanceof Byte) { + constraintsSet.addUndConstraint(new Pair(literal.getType(), bytee, PairOperator.EQUALSDOT, loc(literal.getOffset()))); + return; + } + if (literal.value instanceof Float) { + constraintsSet.addUndConstraint(new Pair(literal.getType(), floatt, PairOperator.EQUALSDOT, loc(literal.getOffset()))); + return; + } + if (literal.value instanceof Double) { + constraintsSet.addUndConstraint(new Pair(literal.getType(), doublee, PairOperator.EQUALSDOT, loc(literal.getOffset()))); + return; + } + if (literal.value instanceof Long) { + constraintsSet.addUndConstraint(new Pair(literal.getType(), longg, PairOperator.EQUALSDOT, loc(literal.getOffset()))); + return; + } + if (literal.value instanceof Integer) { + // constraintsSet.addUndConstraint(new Pair(literal.getType(),integer, PairOperator.EQUALSDOT)); + // /* + HashSet clNames = info.getAvailableClasses().stream().map(x -> x.getClassName()).collect(Collectors.toCollection(HashSet::new)); + Set oderConstraints = new HashSet<>(); + Constraint constraint = new Constraint(); + constraint.add(new Pair(literal.getType(), integer, PairOperator.EQUALSDOT, loc(literal.getOffset()))); + oderConstraints.add(constraint); + if (clNames.stream().filter(x -> x.toString().equals("java.lang.Double")).findAny().isPresent()) { + constraint = new Constraint(); + constraint.add(new Pair(literal.getType(), doublee, PairOperator.EQUALSDOT, loc(literal.getOffset()))); + oderConstraints.add(constraint); + } + if (clNames.stream().filter(x -> x.toString().equals("java.lang.Long")).findAny().isPresent()) { + constraint = new Constraint(); + constraint.add(new Pair(literal.getType(), longg, PairOperator.EQUALSDOT, loc(literal.getOffset()))); + oderConstraints.add(constraint); + } + if (clNames.stream().filter(x -> x.toString().equals("java.lang.Float")).findAny().isPresent()) { + constraint = new Constraint(); + constraint.add(new Pair(literal.getType(), floatt, PairOperator.EQUALSDOT, loc(literal.getOffset()))); + oderConstraints.add(constraint); + } + if (clNames.stream().filter(x -> x.toString().equals("java.lang.Short")).findAny().isPresent()) { + constraint = new Constraint(); + constraint.add(new Pair(literal.getType(), shortt, PairOperator.EQUALSDOT, loc(literal.getOffset()))); + oderConstraints.add(constraint); + } + if (clNames.stream().filter(x -> x.toString().equals("java.lang.Byte")).findAny().isPresent()) { + constraint = new Constraint(); + constraint.add(new Pair(literal.getType(), bytee, PairOperator.EQUALSDOT, loc(literal.getOffset()))); + oderConstraints.add(constraint); + } + constraintsSet.addOderConstraint(oderConstraints); + // */ + return; + } + if (literal.value instanceof Short) { + constraintsSet.addUndConstraint(new Pair(literal.getType(), shortt, PairOperator.EQUALSDOT, loc(literal.getOffset()))); + return; + } + if (literal.value instanceof Byte) { + constraintsSet.addUndConstraint(new Pair(literal.getType(), bytee, PairOperator.EQUALSDOT, loc(literal.getOffset()))); + return; + } + if (literal.value instanceof Float) { + constraintsSet.addUndConstraint(new Pair(literal.getType(), floatt, PairOperator.EQUALSDOT, loc(literal.getOffset()))); + return; + } + if (literal.value instanceof String) { + constraintsSet.addUndConstraint(new Pair(literal.getType(), string, PairOperator.EQUALSDOT, loc(literal.getOffset()))); + return; + } + if (literal.value instanceof Boolean) { + constraintsSet.addUndConstraint(new Pair(literal.getType(), bool, PairOperator.EQUALSDOT, loc(literal.getOffset()))); + return; + } + if (literal.value instanceof Character) { + constraintsSet.addUndConstraint(new Pair(literal.getType(), charr, PairOperator.EQUALSDOT, loc(literal.getOffset()))); + return; + } + if (literal.value != null) { + throw new NotImplementedException(); + } + } + + @Override + public void visit(Throw aThrow) { + aThrow.expr.accept(this); + } + + @Override + public void visit(Return returnExpr) { + returnExpr.retexpr.accept(this); + constraintsSet.addUndConstraint(new Pair(returnExpr.getType(), info.getCurrentTypeScope().getReturnType(), PairOperator.SMALLERDOT, loc(returnExpr.getOffset()))); + } + + @Override + public void visit(ReturnVoid aReturn) { + visit((Return) aReturn); + } + + @Override + public void visit(Break aBreak) { + + } + + @Override + public void visit(StaticClassName staticClassName) { + // Hier entstehen keine Constraints + } + + @Override + public void visit(Super aSuper) { + throw new NotImplementedException(); + } + + @Override + public void visit(This aThis) { + // Im Falle von this, müssen die Generics in der Klasse als RefTypes behandelt werden. + ClassOrInterface currentClass = info.getCurrentClass(); + List params = new ArrayList<>(); + for (GenericTypeVar gtv : currentClass.getGenerics()) { + params.add(new GenericRefType(gtv.getName(), aThis.getOffset())); + } + RefType thisType = new RefType(currentClass.getClassName(), params, aThis.getOffset()); + constraintsSet.addUndConstraint(new Pair(aThis.getType(), thisType, PairOperator.EQUALSDOT, loc(aThis.getOffset()))); + } + + private static TypeScope createNullTypeScope() { + return new TypeScope() { + @Override + public Iterable getGenerics() { + return new ArrayList<>(); + } + + @Override + public RefTypeOrTPHOrWildcardOrGeneric getReturnType() { + return null; + } + }; + } + + @Override + public void visit(WhileStmt whileStmt) { + RefType booleanType = new RefType(ASTFactory.createClass(java.lang.Boolean.class).getClassName(), new NullToken()); + // Expression inferieren: + whileStmt.expr.accept(this); + // Expression muss boolean sein: + constraintsSet.addUndConstraint(new Pair(whileStmt.expr.getType(), booleanType, PairOperator.EQUALSDOT, loc(whileStmt.expr.getOffset()))); + // LoopBlock inferieren: + whileStmt.loopBlock.accept(this); + } + + @Override + public void visit(DoStmt whileStmt) { + throw new NotImplementedException(); + } + + @Override + public void visit(AssignToField assignLeftSide) { + // Hier ist kein Code nötig. Es werden keine extra Constraints generiert + // HIER muss Code rein PL 2018-10-24 + assignLeftSide.field.accept(this); + } + + @Override + public void visit(AssignToLocal assignLeftSide) { + // Hier ist kein Code nötig. Es werden keine extra Constraints generiert + } + + @Override + public void visit(SuperCall superCall) { + Set> methodConstraints = new HashSet<>(); + for (var clazz : info.getAvailableClasses()) { + if (clazz.getClassName().equals(info.getCurrentClass().getSuperClass().getName())) { + for (var ctor : clazz.getConstructors()) { + var params = convertParams(ctor.getParameterList(), info); + if (params.size() != superCall.arglist.getArguments().size()) continue; + var assumption = new MethodAssumption(null, new Void(new NullToken()), params, createTypeScope(clazz, ctor), ctor.isInherited); + + GenericsResolver resolver = getResolverInstance(); + Set> oneMethodConstraints = generateConstraint(superCall, assumption, info, resolver); + methodConstraints.addAll(oneMethodConstraints); + } + break; + } + } + constraintsSet.addOderConstraint(methodConstraints); + } + + /* + * METHOD CALL Section: + */ + + protected Set> generateConstraint(MethodCall forMethod, MethodAssumption assumption, TypeInferenceBlockInformation info, GenericsResolver resolver) { + Constraint methodConstraint, extendsMethodConstraint; + methodConstraint = new Constraint<>(assumption.isInherited()); + extendsMethodConstraint = new Constraint<>(assumption.isInherited());// PL 2023-01-24: Ersetzt die Dopplung in visit(MethodCall) + + ClassOrInterface receiverCl = assumption.getReceiver(); + /* + * List params = new ArrayList<>(); for(GenericTypeVar gtv : receiverCl.getGenerics()){ //Die Generics werden alle zu TPHs umgewandelt. params.add(resolver.resolve(gtv.getName())); } + * + * RefTypeOrTPHOrWildcardOrGeneric receiverType = new RefType(assumption.getReceiver().getClassName(), params, forMethod.getOffset()); + */ + + RefTypeOrTPHOrWildcardOrGeneric receiverType = assumption.getReceiverType(resolver); + if (receiverType != null) { + methodConstraint.add(new Pair(forMethod.receiver.getType(), receiverType, PairOperator.EQUALSDOT, loc(forMethod.getOffset())));// PL 2020-03-17 SMALLERDOT in EQUALSDOT umgewandelt, weil alle geerbten Methoden in den jeweilen Klassen enthalten sind. + + // PL 2023-01-24: dafuer ? extends receiverType noch ergaenzt + extendsMethodConstraint.add(new Pair(forMethod.receiver.getType(), new ExtendsWildcardType(receiverType, receiverType.getOffset()), PairOperator.EQUALSDOT, loc(forMethod.getOffset()))); + } + + // gegenseite Verschraenkung der beiden Mengen von Typannahmen + methodConstraint.setExtendConstraint(extendsMethodConstraint); + extendsMethodConstraint.setExtendConstraint(methodConstraint); + + // Fuer Bytecodegenerierung PL 2020-03-09 wird derzeit nicht benutzt ANFANG + // methodConstraint.add(new Pair(forMethod.receiverType, retType, + // PairOperator.EQUALSDOT)); + // Fuer Bytecodegenerierung PL 2020-03-09 wird derzeit nicht benutzt ENDE + + methodConstraint.add(new Pair(assumption.getReturnType(resolver), forMethod.getType(), PairOperator.SMALLERDOT, loc(forMethod.getOffset()))); + extendsMethodConstraint.add(new Pair(assumption.getReturnType(resolver), forMethod.getType(), PairOperator.SMALLERDOT, loc(forMethod.getOffset()))); + + // methodConstraint.add(new Pair(assumption.getReturnType(resolver), forMethod.getType(), PairOperator.EQUALSDOT)); + // extendsMethodConstraint.add(new Pair(assumption.getReturnType(resolver), forMethod.getType(), PairOperator.EQUALSDOT)); + + if (forMethod.getType() instanceof TypePlaceholder tph) + tph.setOrCons((byte) -1);// fuer Maximums-Bestimmung + + Set parameterContraints = generateParameterConstraints(forMethod, assumption, info, resolver); + + methodConstraint.addAll(parameterContraints); + extendsMethodConstraint.addAll(parameterContraints); + + Set methodSignatureConstraint = generatemethodSignatureConstraint(forMethod, assumption, info, resolver); + + System.out.println("methodSignatureConstraint; " + methodSignatureConstraint); + + methodConstraint.setmethodSignatureConstraint(methodSignatureConstraint); + extendsMethodConstraint.setmethodSignatureConstraint(methodSignatureConstraint); + + Set> ret = new HashSet<>(); + ret.add(methodConstraint); + ret.add(extendsMethodConstraint); + return ret; + } + + protected Set generateParameterConstraints(MethodCall foMethod, MethodAssumption assumption, TypeInferenceBlockInformation info, GenericsResolver resolver) { + Set ret = new HashSet<>(); + for (int i = 0; i < foMethod.arglist.getArguments().size(); i++) { + foMethod.arglist.getArguments().get(i).accept(this); + RefTypeOrTPHOrWildcardOrGeneric argType = foMethod.arglist.getArguments().get(i).getType(); + RefTypeOrTPHOrWildcardOrGeneric assType = assumption.getArgTypes(resolver).get(i); + + ret.add(new Pair(argType, assType, PairOperator.SMALLERDOT, loc(foMethod.getOffset()))); + + // Fuer Bytecodegenerierung PL 2020-03-09 wird derzeit nicht benutzt ANFANG + // ret.add(new Pair(foMethod.argTypes.get(i), assType, PairOperator.EQUALSDOT)); + // Fuer Bytecodegenerierung PL 2020-03-09 wird derzeit nicht benutzt ENDE + } + return ret; + } + + protected Set generatemethodSignatureConstraint(MethodCall foMethod, MethodAssumption assumption, TypeInferenceBlockInformation info, GenericsResolver resolver) { + Set ret = new HashSet<>(); + + for (int i = 0; i < foMethod.arglist.getArguments().size(); i++) { + + // Zuordnung von MethoCall.signature (Argumenttypen) zu der Argumenttypen der ausgewaehlten Methode (assumption.params) + ret.add(new Pair(foMethod.signature.get(i), assumption.getArgTypes().get(i), PairOperator.EQUALSDOT)); + + } + + // Zuordnung von MethodCall.signature(ReturnType) zu dem ReturnType der ausgewaehlten Methode (assumption.returnType) + ret.add(new Pair(foMethod.signature.get(foMethod.signature.size() - 1), assumption.getReturnType(), PairOperator.EQUALSDOT)); + return ret; + } + + public static List getMethods(String name, int numArgs, TypeInferenceBlockInformation info) { + List ret = new ArrayList<>(); + // TODO: apply Methoden wieder anfügen. Diese könnten möglicherweise auch in den Assumptions auftauchen (überdenken) + if (name.equals("apply")) { + List funNParams = new ArrayList<>(); + for (int i = 0; i < numArgs + 1; i++) { + // funNParams.add(TypePlaceholder.fresh(new NullToken())); + funNParams.add(new GenericRefType(NameGenerator.makeNewName(), new NullToken())); + } + funNParams.get(funNParams.size() - 1); + ret.add(new MethodAssumption(new FunNClass(funNParams), funNParams.get(funNParams.size() - 1), funNParams.subList(0, funNParams.size() - 1), new TypeScope() { + @Override + public Iterable getGenerics() { + throw new NotImplementedException(); + } + + @Override + public RefTypeOrTPHOrWildcardOrGeneric getReturnType() { + throw new NotImplementedException(); + } + }, false)); + } + for (ClassOrInterface cl : info.getAvailableClasses()) { + for (Method m : cl.getMethods()) { + if (m.getName().equals(name) && m.getParameterList().getFormalparalist().size() == numArgs) { + RefTypeOrTPHOrWildcardOrGeneric retType = m.getReturnType();// info.checkGTV(m.getReturnType()); + + ret.add(new MethodAssumption(cl, retType, convertParams(m.getParameterList(), info), createTypeScope(cl, m), m.isInherited)); + } + } + } + return ret; + } + + public static List getMethods(String name, ArgumentList arglist, TypeInferenceBlockInformation info) { + return getMethods(name, arglist.getArguments().size(), info); + } + + protected static List convertParams(ParameterList parameterList, TypeInferenceBlockInformation info) { + // TODO: Hier müssen die Parameter mit den TPHs in den GEnerics des Receivers verknüpft werden + /* + * BEispiel: auto test = new List(); test.add("hallo"); + * + * Hier kriegt der Receiver ja den COnstraint TPH REceiver <. List Dann mus bei dem Parameter der COnstraint entstehen: TPH A <. String + */ + List params = new ArrayList<>(); + for (Pattern fp : parameterList.getFormalparalist()) { + params.add(fp.getType()); // info.checkGTV(fp.getType())); //PL 2018-06-22 GTV sollen in Argumenten erhalten bleiben + } + return params; + } + + public List getConstructors(TypeInferenceBlockInformation info, RefType ofType, ArgumentList argList) { + List ret = new ArrayList<>(); + for (ClassOrInterface cl : info.getAvailableClasses()) { + if (cl.getClassName().equals(ofType.getName())) { + for (Method m : cl.getConstructors()) { + if (m.getParameterList().getFormalparalist().size() == argList.getArguments().size()) { + ret.add(new MethodAssumption(cl, cl.generateTypeOfThisClass(), convertParams(m.getParameterList(), info), createTypeScope(cl, m), m.isInherited)); + } + } + } + } + return ret; + } + + protected Constraint generateConstructorConstraint(NewClass forConstructor, MethodAssumption assumption, TypeInferenceBlockInformation info, GenericsResolver resolver) { + Constraint methodConstraint = new Constraint(); + // WELCHEN SINN MACHT DIESER CONSTRAINT??? + // Ist er nicht immer classname <. classname und damit redundant? + methodConstraint.add(new Pair(assumption.getReturnType(resolver), forConstructor.getType(), PairOperator.SMALLERDOT, loc(forConstructor.getOffset()))); + // WELCHEN SINN MACHT DIESER CONSTRAINT??? + methodConstraint.addAll(generateParameterConstraints(forConstructor, assumption, info, resolver)); + return methodConstraint; + } + + @Override + public void visit(Switch switchStmt) { + switchStack.push(switchStmt); + + RefTypeOrTPHOrWildcardOrGeneric caseExpressionType = null; + for (var child : switchStmt.getBlocks()) { + for (var label : child.getLabels()) { + if (!(label.getPattern() instanceof FormalParameter) && !(label.getType() instanceof Void)) { + if (caseExpressionType != null && !caseExpressionType.equals(label.getType())) + throw new TypeinferenceException("Case labels must all have the same Type if they are expressions", label); + caseExpressionType = label.getType(); + } + } + } + if (caseExpressionType == null) { + for (var child : switchStmt.getBlocks()) { + for (var label : child.getLabels()) { + if (label.getPattern() instanceof FormalParameter) { + constraintsSet.addUndConstraint(new Pair(label.getPattern().getType(), switchStmt.getSwitch().getType(), PairOperator.SMALLERDOT, loc(label.getOffset()))); + } + } + } + } else { + constraintsSet.addUndConstraint(new Pair(caseExpressionType, switchStmt.getSwitch().getType(), PairOperator.EQUALSDOT, loc(switchStmt.getSwitch().getOffset()))); + } + + for (var child : switchStmt.getBlocks()) { + child.accept(this); + constraintsSet.addUndConstraint(new Pair(child.getType(), switchStmt.getType(), PairOperator.SMALLERDOT, loc(switchStmt.getOffset()))); + } + + switchStack.pop(); + } + + @Override + public void visit(SwitchBlock switchBlock) { + for (var stmt : switchBlock.statements) { + stmt.accept(this); + } + } + + @Override + public void visit(SwitchLabel switchLabel) { + // TODO Auto-generated method stub + } + + @Override + public void visit(Yield aYield) { + aYield.retexpr.accept(this); + constraintsSet.addUndConstraint(new Pair(aYield.getType(), switchStack.peek().getType(), PairOperator.EQUALSDOT, loc(aYield.getOffset()))); + // TODO Auto-generated method stub + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/GuavaSetOperations.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/GuavaSetOperations.java new file mode 100644 index 0000000..19e7c48 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/GuavaSetOperations.java @@ -0,0 +1,23 @@ +package de.dhbwstuttgart.typeinference.unify; + +import java.util.List; +import java.util.Set; + +import com.google.common.collect.Sets; + +import de.dhbwstuttgart.typeinference.unify.interfaces.ISetOperations; + +/** + * Implements set operations using google guava. + * @author DH10STF + * + */ +public class GuavaSetOperations implements ISetOperations { + + @Override + public Set> cartesianProduct(List> sets) { + // Wraps the call to google guava + return Sets.cartesianProduct(sets); + } + +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/MartelliMontanariUnify.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/MartelliMontanariUnify.java new file mode 100644 index 0000000..2fceb24 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/MartelliMontanariUnify.java @@ -0,0 +1,108 @@ +package de.dhbwstuttgart.typeinference.unify; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; + +import de.dhbwstuttgart.typeinference.unify.interfaces.IUnify; +import de.dhbwstuttgart.typeinference.unify.model.PairOperator; +import de.dhbwstuttgart.typeinference.unify.model.PlaceholderType; +import de.dhbwstuttgart.typeinference.unify.model.TypeParams; +import de.dhbwstuttgart.typeinference.unify.model.Unifier; +import de.dhbwstuttgart.typeinference.unify.model.UnifyPair; +import de.dhbwstuttgart.typeinference.unify.model.UnifyType; + +/** + * Implementation of the Martelli-Montanari unification algorithm. + * @author Florian Steurer + */ +public class MartelliMontanariUnify implements IUnify { + + @Override + public Optional unify(Set terms) { + // Sets with less than 2 terms are trivially unified + if(terms.size() < 2) + return Optional.of(Unifier.identity()); + + // For the the set of terms {t1,...,tn}, + // build a list of equations {(t1 = t2), (t2 = t3), (t3 = t4), ....} + ArrayList termsList = new ArrayList(); + Iterator iter = terms.iterator(); + UnifyType prev = iter.next(); + while(iter.hasNext()) { + UnifyType next = iter.next(); + termsList.add(new UnifyPair(prev, next, PairOperator.EQUALSDOT)); + prev = next; + } + + // Start with the identity unifier. Substitutions will be added later. + Unifier mgu = Unifier.identity(); + + // Apply rules while possible + int idx = 0; + while(idx < termsList.size()) { + UnifyPair pair = termsList.get(idx); + UnifyType rhsType = pair.getRhsType(); + UnifyType lhsType = pair.getLhsType(); + TypeParams rhsTypeParams = rhsType.getTypeParams(); + TypeParams lhsTypeParams = lhsType.getTypeParams(); + + // REDUCE - Rule + if(!(rhsType instanceof PlaceholderType) && !(lhsType instanceof PlaceholderType)) { + Set result = new HashSet<>(); + + // f<...> = g<...> with f != g are not unifiable + if(!rhsType.getName().equals(lhsType.getName())) + return Optional.empty(); // conflict + // f = f are not unifiable + if(rhsTypeParams.size() != lhsTypeParams.size()) + return Optional.empty(); // conflict + // f = g is not unifiable (cannot be f = f because erase rule would have been applied) + //if(rhsTypeParams.size() == 0) + //return Optional.empty(); + + // Unpack the arguments + for(int i = 0; i < rhsTypeParams.size(); i++) + result.add(new UnifyPair(rhsTypeParams.get(i), lhsTypeParams.get(i), PairOperator.EQUALSDOT)); + + termsList.remove(idx); + termsList.addAll(result); + continue; + } + + // DELETE - Rule + if(pair.getRhsType().equals(pair.getLhsType())) { + termsList.remove(idx); + continue; + } + + // SWAP - Rule + if(!(lhsType instanceof PlaceholderType) && (rhsType instanceof PlaceholderType)) { + termsList.remove(idx); + termsList.add(new UnifyPair(rhsType, lhsType, PairOperator.EQUALSDOT)); + continue; + } + + // OCCURS-CHECK + if(pair.getLhsType() instanceof PlaceholderType + && pair.getRhsType().getTypeParams().occurs((PlaceholderType) pair.getLhsType())) + return Optional.empty(); + + // SUBST - Rule + if(lhsType instanceof PlaceholderType) { + mgu.add((PlaceholderType) lhsType, rhsType); + //PL 2018-04-01 nach checken, ob es richtig ist, dass keine Substitutionen uebergeben werden muessen. + termsList = termsList.stream().map(x -> mgu.apply(x)).collect(Collectors.toCollection(ArrayList::new)); + idx = idx+1 == termsList.size() ? 0 : idx+1; + continue; + } + + idx++; + } + + return Optional.of(mgu); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/Match.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/Match.java new file mode 100644 index 0000000..9140661 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/Match.java @@ -0,0 +1,92 @@ +package de.dhbwstuttgart.typeinference.unify; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; + +import de.dhbwstuttgart.typeinference.unify.interfaces.IMatch; +import de.dhbwstuttgart.typeinference.unify.model.PairOperator; +import de.dhbwstuttgart.typeinference.unify.model.PlaceholderType; +import de.dhbwstuttgart.typeinference.unify.model.TypeParams; +import de.dhbwstuttgart.typeinference.unify.model.Unifier; +import de.dhbwstuttgart.typeinference.unify.model.UnifyPair; +import de.dhbwstuttgart.typeinference.unify.model.UnifyType; + +/** + * Implementation of match derived from unification algorithm. + * @author Martin Pluemicke + */ +public class Match implements IMatch { + + @Override + //vorne muss das Pattern stehen + //A =. A ==> True + //A =. A ==> False + public Optional match(ArrayList termsList) { + + // Start with the identity unifier. Substitutions will be added later. + Unifier mgu = Unifier.identity(); + + // Apply rules while possible + int idx = 0; + while(idx < termsList.size()) { + UnifyPair pair = termsList.get(idx); + UnifyType rhsType = pair.getRhsType(); + UnifyType lhsType = pair.getLhsType(); + TypeParams rhsTypeParams = rhsType.getTypeParams(); + TypeParams lhsTypeParams = lhsType.getTypeParams(); + + // REDUCE - Rule + if(!(rhsType instanceof PlaceholderType) && !(lhsType instanceof PlaceholderType)) { + Set result = new HashSet<>(); + + // f<...> = g<...> with f != g are not unifiable + if(!rhsType.getName().equals(lhsType.getName())) + return Optional.empty(); // conflict + // f = f are not unifiable + if(rhsTypeParams.size() != lhsTypeParams.size()) + return Optional.empty(); // conflict + // f = g is not unifiable (cannot be f = f because erase rule would have been applied) + //if(rhsTypeParams.size() == 0) + //return Optional.empty(); + + // Unpack the arguments + for(int i = 0; i < rhsTypeParams.size(); i++) + result.add(new UnifyPair(lhsTypeParams.get(i), rhsTypeParams.get(i), PairOperator.EQUALSDOT)); + + termsList.remove(idx); + termsList.addAll(result); + continue; + } + + // DELETE - Rule + if(pair.getRhsType().equals(pair.getLhsType())) { + termsList.remove(idx); + continue; + } + + // SWAP - Rule + if(!(lhsType instanceof PlaceholderType) && (rhsType instanceof PlaceholderType)) { + return Optional.empty(); // conflict + } + + // OCCURS-CHECK + //deleted + + // SUBST - Rule + if(lhsType instanceof PlaceholderType) { + mgu.add((PlaceholderType) lhsType, rhsType); + termsList = termsList.stream().map(mgu::applyleft).collect(Collectors.toCollection(ArrayList::new)); + idx = idx+1 == termsList.size() ? 0 : idx+1; + continue; + } + + idx++; + } + + return Optional.of(mgu); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/RuleSet.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/RuleSet.java new file mode 100644 index 0000000..1669b76 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/RuleSet.java @@ -0,0 +1,1093 @@ +package de.dhbwstuttgart.typeinference.unify; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Optional; +import java.util.Queue; +import java.util.Set; +import java.util.Stack; +import java.util.function.Function; +import java.util.stream.Collectors; + +import de.dhbwstuttgart.exceptions.DebugException; +import de.dhbwstuttgart.syntaxtree.type.ExtendsWildcardType; +import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure; +import de.dhbwstuttgart.typeinference.unify.interfaces.IRuleSet; +import de.dhbwstuttgart.typeinference.unify.model.ExtendsType; +import de.dhbwstuttgart.typeinference.unify.model.FunNType; +import de.dhbwstuttgart.typeinference.unify.model.PairOperator; +import de.dhbwstuttgart.typeinference.unify.model.PlaceholderType; +import de.dhbwstuttgart.typeinference.unify.model.ReferenceType; +import de.dhbwstuttgart.typeinference.unify.model.SuperType; +import de.dhbwstuttgart.typeinference.unify.model.TypeParams; +import de.dhbwstuttgart.typeinference.unify.model.Unifier; +import de.dhbwstuttgart.typeinference.unify.model.UnifyPair; +import de.dhbwstuttgart.typeinference.unify.model.UnifyType; +import de.dhbwstuttgart.typeinference.unify.model.WildcardType; +import de.dhbwstuttgart.typeinference.constraints.Constraint; +import de.dhbwstuttgart.typeinference.unify.distributeVariance; + +import java.io.FileWriter; +import java.io.IOException; +import java.io.Writer; +import java.io.OutputStreamWriter; + +import org.apache.commons.io.output.NullOutputStream; + +/** + * Implementation of the type inference rules. + * @author Florian Steurer + * + */ +public class RuleSet implements IRuleSet{ + + Writer logFile; + + public RuleSet() { + super(); + logFile = new OutputStreamWriter(new NullOutputStream()); + } + + RuleSet(Writer logFile) { + this.logFile = logFile; + } + + @Override + public Optional reduceUp(UnifyPair pair) { + // Check if reduce up is applicable + if(pair.getPairOp() != PairOperator.SMALLERDOT) + return Optional.empty(); + + UnifyType rhsType = pair.getRhsType(); + if(!(rhsType instanceof SuperType)) + return Optional.empty(); + + UnifyType lhsType = pair.getLhsType(); + if(!(lhsType instanceof ReferenceType) && !(lhsType instanceof PlaceholderType)) + return Optional.empty(); + + // Rule is applicable, unpack the SuperType + return Optional.of(new UnifyPair(lhsType, ((SuperType) rhsType).getSuperedType(), PairOperator.SMALLERDOT, pair.getSubstitution(), pair.getBasePair())); + } + + @Override + public Optional reduceLow(UnifyPair pair) { + // Check if rule is applicable + if(pair.getPairOp() != PairOperator.SMALLERDOT) + return Optional.empty(); + + UnifyType lhsType = pair.getLhsType(); + if(!(lhsType instanceof ExtendsType)) + return Optional.empty(); + + UnifyType rhsType = pair.getRhsType(); + if(!(rhsType instanceof ReferenceType) && !(rhsType instanceof PlaceholderType)) + return Optional.empty(); + + // Rule is applicable, unpack the ExtendsType + return Optional.of(new UnifyPair(((ExtendsType) lhsType).getExtendedType(), rhsType, PairOperator.SMALLERDOT, pair.getSubstitution(), pair.getBasePair())); + } + + @Override + public Optional reduceUpLow(UnifyPair pair) { + // Check if rule is applicable + if(pair.getPairOp() != PairOperator.SMALLERDOT) + return Optional.empty(); + + UnifyType lhsType = pair.getLhsType(); + if(!(lhsType instanceof ExtendsType)) + return Optional.empty(); + + UnifyType rhsType = pair.getRhsType(); + if(!(rhsType instanceof SuperType)) + return Optional.empty(); + + // Rule is applicable, unpack both sides + return Optional.of(new UnifyPair(((ExtendsType) lhsType).getExtendedType(),((SuperType) rhsType).getSuperedType(), PairOperator.SMALLERDOT, pair.getSubstitution(), pair.getBasePair())); + } + + @Override + public Optional> reduceExt(UnifyPair pair, IFiniteClosure fc) { + if(pair.getPairOp() != PairOperator.SMALLERDOTWC) + return Optional.empty(); + + UnifyType x = pair.getLhsType(); + UnifyType sTypeX; + + if(x instanceof ReferenceType) + sTypeX = x; + else if(x instanceof ExtendsType) + sTypeX = ((ExtendsType) x).getExtendedType(); + else + return Optional.empty(); + + UnifyType extY = pair.getRhsType(); + + if(!(extY instanceof ExtendsType)) + return Optional.empty(); + + if(x.getTypeParams().empty() || extY.getTypeParams().size() != x.getTypeParams().size()) + return Optional.empty(); + + UnifyType xFromFc = fc.getLeftHandedType(sTypeX.getName()).orElse(null); + + if(xFromFc == null || !xFromFc.getTypeParams().arePlaceholders()) + return Optional.empty(); + + if(x instanceof ExtendsType) + xFromFc = new ExtendsType(xFromFc); + + UnifyType extYFromFc = fc.grArg(xFromFc, new HashSet<>()).stream().filter(t -> t.getName().equals(extY.getName())).filter(t -> t.getTypeParams().arePlaceholders()).findAny().orElse(null); + + if(extYFromFc == null || extYFromFc.getTypeParams() != xFromFc.getTypeParams()) + return Optional.empty(); + + TypeParams extYParams = extY.getTypeParams(); + TypeParams xParams = x.getTypeParams(); + + int[] pi = pi(xParams, extYParams); + + if(pi.length == 0) + return Optional.empty(); + + Set result = new HashSet<>(); + + for(int rhsIdx = 0; rhsIdx < extYParams.size(); rhsIdx++) + result.add(new UnifyPair(xParams.get(pi[rhsIdx]), extYParams.get(rhsIdx), PairOperator.SMALLERDOTWC, pair.getSubstitution(), pair.getBasePair())); + + return Optional.of(result); + } + + @Override + public Optional> reduceSup(UnifyPair pair, IFiniteClosure fc) { + if(pair.getPairOp() != PairOperator.SMALLERDOTWC) + return Optional.empty(); + + UnifyType x = pair.getLhsType(); + UnifyType sTypeX; + + if(x instanceof ReferenceType) + sTypeX = x; + else if(x instanceof SuperType) + sTypeX = ((SuperType) x).getSuperedType(); + else + return Optional.empty(); + + UnifyType supY = pair.getRhsType(); + + if(!(supY instanceof SuperType)) + return Optional.empty(); + + if(x.getTypeParams().empty() || supY.getTypeParams().size() != x.getTypeParams().size()) + return Optional.empty(); + + UnifyType xFromFc = fc.getLeftHandedType(sTypeX.getName()).orElse(null); + + if(xFromFc == null || !xFromFc.getTypeParams().arePlaceholders()) + return Optional.empty(); + + if(x instanceof SuperType) + xFromFc = new SuperType(xFromFc); + + UnifyType supYFromFc = fc.grArg(xFromFc, new HashSet<>()).stream().filter(t -> t.getName().equals(supY.getName())).filter(t -> t.getTypeParams().arePlaceholders()).findAny().orElse(null); + + if(supYFromFc == null || supYFromFc.getTypeParams() != xFromFc.getTypeParams()) + return Optional.empty(); + + TypeParams supYParams = supY.getTypeParams(); + TypeParams xParams = x.getTypeParams(); + Set result = new HashSet<>(); + + int[] pi = pi(xParams, supYParams); + + if(pi.length == 0) + return Optional.empty(); + + for(int rhsIdx = 0; rhsIdx < supYParams.size(); rhsIdx++) + result.add(new UnifyPair(supYParams.get(rhsIdx), xParams.get(pi[rhsIdx]), PairOperator.SMALLERDOTWC, pair.getSubstitution(), pair.getBasePair())); + + return Optional.of(result); + } + + @Override + public Optional> reduceEq(UnifyPair pair) { + if(pair.getPairOp() != PairOperator.SMALLERDOTWC) + return Optional.empty(); + + UnifyType lhsType = pair.getLhsType(); + if(lhsType instanceof PlaceholderType || lhsType.getTypeParams().empty()) + return Optional.empty(); + + UnifyType rhsType = pair.getRhsType(); + + if(!rhsType.getName().equals(lhsType.getName())) + return Optional.empty(); + + if(rhsType instanceof PlaceholderType || lhsType instanceof PlaceholderType || rhsType.getTypeParams().empty()) + return Optional.empty(); + + if(rhsType.getTypeParams().size() != lhsType.getTypeParams().size()) + return Optional.empty(); + + // Keine Permutation wie im Paper nötig + Set result = new HashSet<>(); + TypeParams lhsTypeParams = lhsType.getTypeParams(); + TypeParams rhsTypeParams = rhsType.getTypeParams(); + + for(int i = 0; i < lhsTypeParams.size(); i++) + result.add(new UnifyPair(lhsTypeParams.get(i), rhsTypeParams.get(i), PairOperator.EQUALSDOT, pair.getSubstitution(), pair.getBasePair())); + + return Optional.of(result); + } + + @Override + public Optional> reduce1(UnifyPair pair, IFiniteClosure fc) { + if(pair.getPairOp() != PairOperator.SMALLERDOT) + return Optional.empty(); + + UnifyType c = pair.getLhsType(); + if(!(c instanceof ReferenceType)) + return Optional.empty(); + + UnifyType d = pair.getRhsType(); + if(!(d instanceof ReferenceType)) + return Optional.empty(); + + ReferenceType lhsSType = (ReferenceType) c; + ReferenceType rhsSType = (ReferenceType) d; + + //try { + // logFile.write("PAIR Rules: " + pair + "\n"); + // logFile.flush(); + //} + //catch (IOException e) { } + + if(lhsSType.getTypeParams().empty() || lhsSType.getTypeParams().size() != rhsSType.getTypeParams().size()) + return Optional.empty(); + + UnifyType cFromFc = fc.getLeftHandedType(c.getName()).orElse(null); + //2018-02-23: liefert Vector>: Das kann nicht sein. + + //NOCHMAL UEBERPRUEFEN + //PL 18-02-09 Eingfuegt Anfang + //C und D koennen auch gleich sein. + if (c.getName().equals(d.getName())) { + Set result = new HashSet<>(); + TypeParams rhsTypeParams = d.getTypeParams(); + TypeParams lhsTypeParams = c.getTypeParams(); + for(int rhsIdx = 0; rhsIdx < c.getTypeParams().size(); rhsIdx++) + result.add(new UnifyPair(lhsTypeParams.get(rhsIdx), rhsTypeParams.get(rhsIdx), PairOperator.SMALLERDOTWC, pair.getSubstitution(), pair.getBasePair())); + + return Optional.of(result); + } + //PL 18-02-09 Eingfuegt ENDE + + //try { + // logFile.write("cFromFc: " + cFromFc); + // logFile.flush(); + //} + //catch (IOException e) { } + + if(cFromFc == null || !cFromFc.getTypeParams().arePlaceholders()) + return Optional.empty(); + + UnifyType dFromFc = fc.getAncestors(cFromFc).stream().filter(x -> x.getName().equals(d.getName())).findAny().orElse(null); + + //try { + // logFile.write("cFromFc: " + cFromFc); + // logFile.flush(); + //} + //catch (IOException e) { } + + if(dFromFc == null || !dFromFc.getTypeParams().arePlaceholders() || dFromFc.getTypeParams().size() != cFromFc.getTypeParams().size()) + return Optional.empty(); + //System.out.println("cFromFc: " + cFromFc); + //System.out.println("dFromFc: " + dFromFc); + int[] pi = pi(cFromFc.getTypeParams(), dFromFc.getTypeParams()); + + if(pi.length == 0) + return Optional.empty(); + + TypeParams rhsTypeParams = d.getTypeParams(); + TypeParams lhsTypeParams = c.getTypeParams(); + Set result = new HashSet<>(); + + for(int rhsIdx = 0; rhsIdx < rhsTypeParams.size(); rhsIdx++) + result.add(new UnifyPair(lhsTypeParams.get(pi[rhsIdx]), rhsTypeParams.get(rhsIdx), PairOperator.SMALLERDOTWC, pair.getSubstitution(), pair.getBasePair())); + + return Optional.of(result); + } + + @Override + public Optional> reduce2(UnifyPair pair) { + if(pair.getPairOp() != PairOperator.EQUALSDOT) + return Optional.empty(); + + UnifyType lhsType = pair.getLhsType(); + ReferenceType lhsSType; + UnifyType rhsType = pair.getRhsType(); + ReferenceType rhsSType; + + if ((lhsType instanceof ReferenceType) && (rhsType instanceof ReferenceType)) { + lhsSType = (ReferenceType) lhsType; + rhsSType = (ReferenceType) rhsType; + } + else if (((lhsType instanceof ExtendsType) && (rhsType instanceof ExtendsType)) + || ((lhsType instanceof SuperType) && (rhsType instanceof SuperType))) { + UnifyType lhsSTypeRaw = ((WildcardType) lhsType).getWildcardedType(); + UnifyType rhsSTypeRaw = ((WildcardType) rhsType).getWildcardedType(); + if ((lhsSTypeRaw instanceof ReferenceType) && (rhsSTypeRaw instanceof ReferenceType)) { + lhsSType = (ReferenceType) lhsSTypeRaw; + rhsSType = (ReferenceType) rhsSTypeRaw; + } + else + return Optional.empty(); + } + else + return Optional.empty(); + + if(lhsSType.getTypeParams().empty()) + return Optional.empty(); + + /* PL 2018-01-22 in obere Teil integriert + UnifyType rhsType = pair.getRhsType(); + ReferenceType rhsSType; + + if(rhsType instanceof ReferenceType) + rhsSType = (ReferenceType) rhsType; + else if(rhsType instanceof WildcardType) { + UnifyType rhsSTypeRaw = ((WildcardType) rhsType).getWildcardedType(); + if(rhsSTypeRaw instanceof ReferenceType) + rhsSType = (ReferenceType) rhsSTypeRaw; + else + return Optional.empty(); + } + else + return Optional.empty(); + */ + + if(!rhsSType.getName().equals(lhsSType.getName())) + return Optional.empty(); + + if(!(lhsSType.getTypeParams().size()==rhsSType.getTypeParams().size()))throw new DebugException("Fehler in Unifizierung"+ " " + lhsSType.toString() + " " + rhsSType.toString()); + //if(rhsSType.getTypeParams().size() != lhsSType.getTypeParams().size()) + // return Optional.empty(); + + Set result = new HashSet<>(); + + TypeParams rhsTypeParams = rhsSType.getTypeParams(); + TypeParams lhsTypeParams = lhsSType.getTypeParams(); + for(int i = 0; i < rhsTypeParams.size(); i++) + result.add(new UnifyPair(lhsTypeParams.get(i), rhsTypeParams.get(i), PairOperator.EQUALSDOT, pair.getSubstitution(), pair.getBasePair())); + + return Optional.of(result); + } + + @Override + public boolean erase1(UnifyPair pair, IFiniteClosure fc) { + if((pair.getPairOp() != PairOperator.SMALLERDOT) && (pair.getPairOp() != PairOperator.SMALLERNEQDOT)) + return false; + + UnifyType lhsType = pair.getLhsType(); + UnifyType rhsType = pair.getRhsType(); + + /* + * ty <. ? extends ty' is wrong + */ + if (rhsType instanceof ExtendsType) { + return false; + } + + /* + * ? super ty <. ty' is wrong + * except Ty' = Object or ty' = ? super Object + */ + if ((lhsType instanceof SuperType) && + (!(rhsType.equals(new ReferenceType("java.lang.Object", false)))) && + !(rhsType.equals(new SuperType (new ReferenceType("java.lang.Object", false))))) { + return false; + } + + /* + * ? extends ty <. ty' is equivalent to ty < ty' + */ + if (lhsType instanceof ExtendsType) { + lhsType = ((WildcardType)lhsType).getWildcardedType(); + } + + /* + * ty <. ? super ty' ist equivalent to ty <. ty' + */ + if (rhsType instanceof SuperType) { + rhsType = ((WildcardType)rhsType).getWildcardedType(); + } + + /* + * SMALLERNEQDOT => type must not be equal + */ + if (pair.getPairOp() == PairOperator.SMALLERNEQDOT && lhsType.equals(rhsType)){ + return false; + } + + if(!(lhsType instanceof ReferenceType) && !(lhsType instanceof PlaceholderType)) + return false; + + + if(!(rhsType instanceof ReferenceType) && !(rhsType instanceof PlaceholderType)) + return false; + + return fc.greater(lhsType, new HashSet<>(), pair.getLocation()).contains(rhsType); + } + + @Override + public boolean erase2(UnifyPair pair, IFiniteClosure fc) { + if(pair.getPairOp() != PairOperator.SMALLERDOTWC) + return false; + + UnifyType lhsType = pair.getLhsType(); + UnifyType rhsType = pair.getRhsType(); + + return fc.grArg(lhsType, new HashSet<>()).contains(rhsType); + } + + @Override + public boolean erase3(UnifyPair pair) { + if(pair.getPairOp() != PairOperator.EQUALSDOT) + return false; + + return pair.getLhsType().equals(pair.getRhsType()); + } + + @Override + public Optional swap(UnifyPair pair) { + if(pair.getPairOp() != PairOperator.EQUALSDOT) + return Optional.empty(); + + if(pair.getLhsType() instanceof PlaceholderType) + return Optional.empty(); + + if(!(pair.getRhsType() instanceof PlaceholderType)) + return Optional.empty(); + + return Optional.of(new UnifyPair(pair.getRhsType(), pair.getLhsType(), PairOperator.EQUALSDOT, pair.getSubstitution(), pair.getBasePair())); + } + + @Override + public Optional adapt(UnifyPair pair, IFiniteClosure fc) { + if(pair.getPairOp() != PairOperator.SMALLERDOT) + return Optional.empty(); + + UnifyType typeD = pair.getLhsType(); + if(!(typeD instanceof ReferenceType)) + return Optional.empty(); + + UnifyType typeDs = pair.getRhsType(); + if(!(typeDs instanceof ReferenceType)) + return Optional.empty(); + + /*if(typeD.getTypeParams().size() == 0 || typeDs.getTypeParams().size() == 0) + return Optional.empty();*/ + + if(typeD.getName().equals(typeDs.getName())) + return Optional.empty(); + + + Optional opt = fc.getLeftHandedType(typeD.getName()); + if(!opt.isPresent()) + return Optional.empty(); + + // The generic Version of Type D (D) + UnifyType typeDgen = opt.get(); + + // Actually greater+ because the types are ensured to have different names + Set greater = fc.getAncestors(typeDgen); + opt = greater.stream().filter(x -> x.getName().equals(typeDs.getName())).findAny(); + + if(!opt.isPresent()) + return Optional.empty(); + + UnifyType newLhs = opt.get(); + + TypeParams typeDParams = typeD.getTypeParams(); + TypeParams typeDgenParams = typeDgen.getTypeParams(); + + //System.out.println("Pair: " +pair); + //System.out.println("typeD: " +typeD); + //System.out.println("typeDParams: " +typeDParams); + //System.out.println("typeDgen: " +typeD); + //System.out.println("typeDgenParams: " +typeDgenParams); + Unifier unif = Unifier.identity(); + for(int i = 0; i < typeDParams.size(); i++) { + //System.out.println("ADAPT" +typeDgenParams); + if (typeDgenParams.get(i) instanceof PlaceholderType) + unif.add((PlaceholderType) typeDgenParams.get(i), typeDParams.get(i)); + else System.out.println("ERROR"); + } + return Optional.of(new UnifyPair(unif.apply(newLhs), typeDs, PairOperator.SMALLERDOT, pair.getSubstitution(), pair.getBasePair())); + } + + @Override + public Optional adaptExt(UnifyPair pair, IFiniteClosure fc) { + if(pair.getPairOp() != PairOperator.SMALLERDOTWC) + return Optional.empty(); + + UnifyType typeD = pair.getLhsType(); + if(!(typeD instanceof ReferenceType) && !(typeD instanceof ExtendsType)) + return Optional.empty(); + + UnifyType typeExtDs = pair.getRhsType(); + if(!(typeExtDs instanceof ExtendsType)) + return Optional.empty(); + + if(typeD.getTypeParams().size() == 0 || typeExtDs.getTypeParams().size() == 0) + return Optional.empty(); + + UnifyType typeDgen; + if(typeD instanceof ReferenceType) + typeDgen = fc.getLeftHandedType(typeD.getName()).orElse(null); + else { + Optional opt = fc.getLeftHandedType(((ExtendsType) typeD).getExtendedType().getName()); + typeDgen = opt.isPresent() ? new ExtendsType(opt.get()) : null; + } + + if(typeDgen == null) + return Optional.empty(); + + Set grArg = fc.grArg(typeDgen, new HashSet<>()); + + Optional opt = grArg.stream().filter(x -> x.getName().equals(typeExtDs.getName())).findAny(); + + if(!opt.isPresent()) + return Optional.empty(); + + UnifyType newLhs = ((ExtendsType) opt.get()).getExtendedType(); + + TypeParams typeDParams = typeD.getTypeParams(); + TypeParams typeDgenParams = typeDgen.getTypeParams(); + + Unifier unif = new Unifier((PlaceholderType) typeDgenParams.get(0), typeDParams.get(0)); + for(int i = 1; i < typeDParams.size(); i++) + unif.add((PlaceholderType) typeDgenParams.get(i), typeDParams.get(i)); + + return Optional.of(new UnifyPair(unif.apply(newLhs), typeExtDs, PairOperator.SMALLERDOTWC, pair.getSubstitution(), pair.getBasePair())); + } + + @Override + public Optional adaptSup(UnifyPair pair, IFiniteClosure fc) { + if(pair.getPairOp() != PairOperator.SMALLERDOTWC) + return Optional.empty(); + + UnifyType typeDs = pair.getLhsType(); + if(!(typeDs instanceof ReferenceType) && !(typeDs instanceof SuperType)) + return Optional.empty(); + + UnifyType typeSupD = pair.getRhsType(); + if(!(typeSupD instanceof SuperType)) + return Optional.empty(); + + if(typeDs.getTypeParams().size() == 0 || typeSupD.getTypeParams().size() == 0) + return Optional.empty(); + + + Optional opt = fc.getLeftHandedType(((SuperType) typeSupD).getSuperedType().getName()); + + if(!opt.isPresent()) + return Optional.empty(); + + UnifyType typeDgen = opt.get(); + UnifyType typeSupDgen = new SuperType(typeDgen); + + // Use of smArg instead of grArg because + // a in grArg(b) => b in smArg(a) + Set smArg = fc.smArg(typeSupDgen, new HashSet<>()); + opt = smArg.stream().filter(x -> x.getName().equals(typeDs.getName())).findAny(); + + if(!opt.isPresent()) + return Optional.empty(); + + // New RHS + UnifyType newRhs = null; + if(typeDs instanceof ReferenceType) + newRhs = new ExtendsType(typeDs); + else + newRhs = new ExtendsType(((SuperType) typeDs).getSuperedType()); + + // New LHS + UnifyType newLhs = opt.get(); + TypeParams typeDParams = typeSupD.getTypeParams(); + TypeParams typeSupDsgenParams = typeSupDgen.getTypeParams(); + + Unifier unif = new Unifier((PlaceholderType) typeSupDsgenParams.get(0), typeDParams.get(0)); + for(int i = 1; i < typeDParams.size(); i++) + unif.add((PlaceholderType) typeSupDsgenParams.get(i), typeDParams.get(i)); + + return Optional.of(new UnifyPair(unif.apply(newLhs), newRhs, PairOperator.SMALLERDOTWC, pair.getSubstitution(), pair.getBasePair())); + } + + /** + * Finds the permutation pi of the type arguments of two types based on the finite closure + * @param cArgs The type which arguments are permuted + * @param dArgs The other type + * @return An array containing the values of pi for every type argument of C or an empty array if the search failed. + */ + private int[] pi(TypeParams cArgs, TypeParams dArgs) { + if(!(cArgs.size()==dArgs.size()))throw new DebugException("Fehler in Unifizierung"); + + int[] permutation = new int[dArgs.size()]; + + boolean succ = true; + for (int dArgIdx = 0; dArgIdx < dArgs.size() && succ; dArgIdx++) { + UnifyType dArg = dArgs.get(dArgIdx); + succ = false; + for (int pi = 0; pi < cArgs.size(); pi++) + if (cArgs.get(pi).getName().equals(dArg.getName())) { + permutation[dArgIdx] = pi; + succ = true; + break; + } + } + + return succ ? permutation : new int[0]; + } + + public Optional> subst(Set pairs) { + return subst(pairs, new ArrayList<>()); + } + + @Override + public Optional> subst(Set pairs, List>> oderConstraints) { + HashMap typeMap = new HashMap<>(); + + Stack occuringTypes = new Stack<>(); + + for(UnifyPair pair : pairs) { + occuringTypes.push(pair.getLhsType()); + occuringTypes.push(pair.getRhsType()); + } + + while(!occuringTypes.isEmpty()) { + UnifyType t1 = occuringTypes.pop(); + if(!typeMap.containsKey(t1)) + typeMap.put(t1, 0); + typeMap.put(t1, typeMap.get(t1)+1); + + if(t1 instanceof ExtendsType) + occuringTypes.push(((ExtendsType) t1).getExtendedType()); + if(t1 instanceof SuperType) + occuringTypes.push(((SuperType) t1).getSuperedType()); + else + t1.getTypeParams().forEach(x -> occuringTypes.push(x)); + } + Queue result1 = new LinkedList(pairs); + ArrayList result = new ArrayList(); + boolean applied = false; + + while(!result1.isEmpty()) { + UnifyPair pair = result1.poll(); + PlaceholderType lhsType = null; + UnifyType rhsType; + + if(pair.getPairOp() == PairOperator.EQUALSDOT + && pair.getLhsType() instanceof PlaceholderType) + lhsType = (PlaceholderType) pair.getLhsType(); + rhsType = pair.getRhsType(); //PL eingefuegt 2017-09-29 statt !((rhsType = pair.getRhsType()) instanceof PlaceholderType) + + if(lhsType != null + //&& !((rhsType = pair.getRhsType()) instanceof PlaceholderType) //PL geloescht am 2017-09-29 Begründung: auch Typvariablen muessen ersetzt werden. + && typeMap.get(lhsType) > 1 // The type occurs in more pairs in the set than just the recent pair. + && !rhsType.getTypeParams().occurs(lhsType) + && !((rhsType instanceof WildcardType) && ((WildcardType)rhsType).getWildcardedType().equals(lhsType))) //PL eigefuegt 2018-02-18 + { + Unifier uni = new Unifier(lhsType, rhsType); + result = result.stream().map(x -> uni.apply(pair,x)).collect(Collectors.toCollection(ArrayList::new)); + result1 = result1.stream().map(x -> uni.apply(pair,x)).collect(Collectors.toCollection(LinkedList::new)); + + Function,? extends Constraint> applyUni = b -> b.stream().map( + x -> uni.apply(pair,x)).collect(Collectors.toCollection((b.getExtendConstraint() != null) + ? () -> new Constraint( + b.isInherited(), + b.getExtendConstraint().stream().map(x -> uni.apply(pair,x)).collect(Collectors.toCollection(Constraint::new)), + b.getmethodSignatureConstraint().stream().map(x -> uni.apply(pair,x)).collect(Collectors.toCollection(HashSet::new))) + : () -> new Constraint(b.isInherited()) + )); + oderConstraints.replaceAll(oc -> oc.stream().map(applyUni).collect(Collectors.toCollection(HashSet::new))); + /* + oderConstraints = oderConstraints.stream().map( + a -> a.stream().map(applyUni + //b -> b.stream().map( + // x -> uni.apply(pair,x)).collect(Collectors.toCollection(HashSet::new) ) + ).collect(Collectors.toCollection(HashSet::new)) + ).collect(Collectors.toList(ArrayList::new)); + } + */ + applied = true; + } + result.add(pair); + } + + return applied ? Optional.of(new HashSet<>(result)) : Optional.empty(); + } + + @Override + public Optional reduceWildcardLow(UnifyPair pair) { + if(pair.getPairOp() != PairOperator.SMALLERDOTWC) + return Optional.empty(); + + UnifyType lhsType = pair.getLhsType(); + UnifyType rhsType = pair.getRhsType(); + if(!(lhsType instanceof ExtendsType) || !(rhsType instanceof ExtendsType)) + return Optional.empty(); + + return Optional.of(new UnifyPair(((ExtendsType) lhsType).getExtendedType(), ((ExtendsType) rhsType).getExtendedType(), PairOperator.SMALLERDOT, pair.getSubstitution(), pair.getBasePair())); + } + + @Override + public Optional reduceWildcardLowRight(UnifyPair pair) { + if(pair.getPairOp() != PairOperator.SMALLERDOTWC) + return Optional.empty(); + + UnifyType lhsType = pair.getLhsType(); + UnifyType rhsType = pair.getRhsType(); + if(!(lhsType instanceof ReferenceType) || !(rhsType instanceof ExtendsType)) + return Optional.empty(); + + return Optional.of(new UnifyPair(lhsType, ((ExtendsType) rhsType).getExtendedType(), PairOperator.SMALLERDOT, pair.getSubstitution(), pair.getBasePair())); + } + + @Override + public Optional reduceWildcardUp(UnifyPair pair) { + if(pair.getPairOp() != PairOperator.SMALLERDOTWC) + return Optional.empty(); + + UnifyType lhsType = pair.getLhsType(); + UnifyType rhsType = pair.getRhsType(); + if(!(lhsType instanceof SuperType) || !(rhsType instanceof SuperType)) + return Optional.empty(); + + return Optional.of(new UnifyPair(((SuperType) rhsType).getSuperedType(), ((SuperType) lhsType).getSuperedType(), PairOperator.SMALLERDOT, pair.getSubstitution(), pair.getBasePair())); + } + + @Override + public Optional reduceWildcardUpRight(UnifyPair pair) { + if(pair.getPairOp() != PairOperator.SMALLERDOTWC) + return Optional.empty(); + + UnifyType lhsType = pair.getLhsType(); + UnifyType rhsType = pair.getRhsType(); + if(!(lhsType instanceof ReferenceType) || !(rhsType instanceof SuperType)) + return Optional.empty(); + + return Optional.of(new UnifyPair(((SuperType) rhsType).getSuperedType(), lhsType, PairOperator.SMALLERDOTWC, pair.getSubstitution(), pair.getBasePair())); + } + + /* PL 2018-03-06 auskommentiert sind mutmaßlich falsch + * vgl. JAVA_BSP/Wildcard6.java + @Override + public Optional reduceWildcardLowUp(UnifyPair pair) { + if(pair.getPairOp() != PairOperator.SMALLERDOTWC) + return Optional.empty(); + + UnifyType lhsType = pair.getLhsType(); + UnifyType rhsType = pair.getRhsType(); + if(!(lhsType instanceof ExtendsType) || !(rhsType instanceof SuperType)) + return Optional.empty(); + + return Optional.of(new UnifyPair(((ExtendsType) lhsType).getExtendedType(), ((SuperType) rhsType).getSuperedType(), PairOperator.EQUALSDOT)); + } + + @Override + public Optional reduceWildcardUpLow(UnifyPair pair) { + if(pair.getPairOp() != PairOperator.SMALLERDOTWC) + return Optional.empty(); + + UnifyType lhsType = pair.getLhsType(); + UnifyType rhsType = pair.getRhsType(); + if(!(lhsType instanceof SuperType) || !(rhsType instanceof ExtendsType)) + return Optional.empty(); + + return Optional.of(new UnifyPair(((SuperType) lhsType).getSuperedType(), ((ExtendsType) rhsType).getExtendedType(), PairOperator.EQUALSDOT)); + } + + + @Override + public Optional reduceWildcardLeft(UnifyPair pair) { + if(pair.getPairOp() != PairOperator.SMALLERDOTWC) + return Optional.empty(); + + UnifyType rhsType = pair.getRhsType(); + if(!(rhsType instanceof ReferenceType)) + return Optional.empty(); + + UnifyType lhsType = pair.getLhsType(); + + if(lhsType instanceof WildcardType) + return Optional.of(new UnifyPair(((WildcardType) lhsType).getWildcardedType(), rhsType, PairOperator.EQUALSDOT)); + + return Optional.empty(); + } + */ + @Override + public Optional> reduceFunN(UnifyPair pair) { + if((pair.getPairOp() != PairOperator.SMALLERDOT) + && (pair.getPairOp() != PairOperator.EQUALSDOT)) //PL 2017-10-03 hinzugefuegt + //da Regel auch fuer EQUALSDOT anwendbar + //TODO: fuer allen anderen Relationen noch pruefen + return Optional.empty(); + + UnifyType lhsType = pair.getLhsType(); + UnifyType rhsType = pair.getRhsType(); + + if(!(lhsType instanceof FunNType) || !(rhsType instanceof FunNType)) + return Optional.empty(); + + FunNType funNLhsType = (FunNType) lhsType; + FunNType funNRhsType = (FunNType) rhsType; + + if(funNLhsType.getN() != funNRhsType.getN()) + return Optional.empty(); + + Set result = new HashSet(); + if (pair.getPairOp() == PairOperator.SMALLERDOT) { + result.add(new UnifyPair(funNLhsType.getTypeParams().get(funNLhsType.getTypeParams().size()-1), funNRhsType.getTypeParams().get(funNRhsType.getTypeParams().size()-1), PairOperator.SMALLERDOT, pair.getSubstitution(), pair.getBasePair())); + for(int i = 0; i < funNLhsType.getTypeParams().size()-1; i++) { + result.add(new UnifyPair(funNRhsType.getTypeParams().get(i), funNLhsType.getTypeParams().get(i), PairOperator.SMALLERDOT, pair.getSubstitution(), pair.getBasePair())); + } + } + else {// pair.getPairOp() == PairOperator.EQUALDOT + result.add(new UnifyPair(funNLhsType.getTypeParams().get(funNLhsType.getTypeParams().size()-1), funNRhsType.getTypeParams().get(funNRhsType.getTypeParams().size()-1), PairOperator.EQUALSDOT, pair.getSubstitution(), pair.getBasePair())); + for(int i = 0; i < funNLhsType.getTypeParams().size()-1; i++) { + result.add(new UnifyPair(funNRhsType.getTypeParams().get(i), funNLhsType.getTypeParams().get(i), PairOperator.EQUALSDOT, pair.getSubstitution(), pair.getBasePair())); + } + } + result.stream().forEach(x -> { UnifyType l = x.getLhsType(); + if (l instanceof PlaceholderType) { ((PlaceholderType)l).disableWildcardtable(); } + UnifyType r = x.getRhsType(); + if (r instanceof PlaceholderType) { ((PlaceholderType)r).disableWildcardtable(); } + } ); + try { + logFile.write("FUNgreater: " + pair + "\n"); + logFile.write("FUNred: " + result + "\n"); + logFile.flush(); + } + catch (IOException e) { + System.out.println("logFile-Error"); + } + return Optional.of(result); + } + + + @Override + public Optional> greaterFunN(UnifyPair pair, IFiniteClosure fc) { + if(pair.getPairOp() != PairOperator.SMALLERDOT) + return Optional.empty(); + + UnifyType lhsType = pair.getLhsType(); + UnifyType rhsType = pair.getRhsType(); + + if(!(lhsType instanceof FunNType)) + return Optional.empty(); + + //FunN$$<...> <. FunctinalInterface<...> wird umgewandelt in FunN$$<...> <. FunN$$<... args aus FuntionalInterface ...> + if (rhsType instanceof ReferenceType) { + + UnifyType typeFI = pair.getRhsType(); + + Optional opt = fc.getRightHandedFunctionalInterfaceType(typeFI.getName()); + if(!opt.isPresent()) + return Optional.empty(); + + // The generic Version of typeFI (FI) + UnifyType typeDgen = opt.get(); + + // Actually greater+ because the types are ensured to have different names + Set smaller = fc.getChildren(typeDgen); + opt = smaller.stream().filter(x -> x.getName().equals(pair.getLhsType().getName())).findAny(); + + if(!opt.isPresent()) + return Optional.empty(); + + TypeParams typeDParams = typeFI.getTypeParams(); + TypeParams typeDgenParams = typeDgen.getTypeParams(); + + Unifier unif = Unifier.identity(); + for(int i = 0; i < typeDParams.size(); i++) { + if (typeDgenParams.get(i) instanceof PlaceholderType) + unif.add((PlaceholderType) typeDgenParams.get(i), typeDParams.get(i)); + else System.out.println("ERROR"); + } + + UnifyType newRhsType = opt.get(); + + Set result = new HashSet<>(); + result.add(new UnifyPair(lhsType, unif.apply(newRhsType), PairOperator.SMALLERDOT, pair.getSubstitution(), pair.getBasePair())); + + return Optional.of(result); + } + + else { + if(!(rhsType instanceof PlaceholderType)) + return Optional.empty(); + } + + FunNType funNLhsType = (FunNType) lhsType; + + Set result = new HashSet(); + + Integer variance = ((PlaceholderType)rhsType).getVariance(); + Integer inversVariance = distributeVariance.inverseVariance(variance); + + UnifyType[] freshPlaceholders = new UnifyType[funNLhsType.getTypeParams().size()]; + for(int i = 0; i < freshPlaceholders.length-1; i++) { + freshPlaceholders[i] = PlaceholderType.freshPlaceholder(); + ((PlaceholderType)freshPlaceholders[i]).setVariance(inversVariance); + } + freshPlaceholders[freshPlaceholders.length-1] = PlaceholderType.freshPlaceholder(); + ((PlaceholderType)freshPlaceholders[freshPlaceholders.length-1]).setVariance(variance); + result.add(new UnifyPair(funNLhsType.getTypeParams().get(funNLhsType.getTypeParams().size()-1), freshPlaceholders[funNLhsType.getTypeParams().size()-1], PairOperator.SMALLERDOT, pair.getSubstitution(), pair.getBasePair())); + + for(int i = 0; i < funNLhsType.getTypeParams().size()-1; i++) { + result.add(new UnifyPair(freshPlaceholders[i], funNLhsType.getTypeParams().get(i), PairOperator.SMALLERDOT, pair.getSubstitution(), pair.getBasePair())); + } + + result.add(new UnifyPair(rhsType, funNLhsType.setTypeParams(new TypeParams(freshPlaceholders)), PairOperator.EQUALSDOT, pair.getSubstitution(), pair.getBasePair())); + + result.stream().forEach(x -> { UnifyType l = x.getLhsType(); + if (l instanceof PlaceholderType) { ((PlaceholderType)l).disableWildcardtable(); } + UnifyType r = x.getRhsType(); + if (r instanceof PlaceholderType) { ((PlaceholderType)r).disableWildcardtable(); } + } ); + try { + logFile.write("FUNgreater: " + pair + "\n"); + logFile.write("FUNgreater: " + result + "\n"); + logFile.flush(); + } + catch (IOException e) { + System.out.println("lofFile-Error"); + } + return Optional.of(result); + } + + @Override + public Optional> smallerFunN(UnifyPair pair) { + if(pair.getPairOp() != PairOperator.SMALLERDOT) + return Optional.empty(); + + UnifyType lhsType = pair.getLhsType(); + UnifyType rhsType = pair.getRhsType(); + + if(!(lhsType instanceof PlaceholderType) || !(rhsType instanceof FunNType)) + return Optional.empty(); + + FunNType funNRhsType = (FunNType) rhsType; + + Set result = new HashSet(); + + Integer variance = ((PlaceholderType)lhsType).getVariance(); + Integer inversVariance = distributeVariance.inverseVariance(variance); + + UnifyType[] freshPlaceholders = new UnifyType[funNRhsType.getTypeParams().size()]; + for(int i = 0; i < freshPlaceholders.length-1; i++) { + freshPlaceholders[i] = PlaceholderType.freshPlaceholder(); + ((PlaceholderType)freshPlaceholders[i]).setVariance(inversVariance); + } + freshPlaceholders[freshPlaceholders.length-1] = PlaceholderType.freshPlaceholder(); + ((PlaceholderType)freshPlaceholders[freshPlaceholders.length-1]).setVariance(variance); + + result.add(new UnifyPair(freshPlaceholders[funNRhsType.getTypeParams().size()-1], funNRhsType.getTypeParams().get(funNRhsType.getTypeParams().size()-1), PairOperator.SMALLERDOT, pair.getSubstitution(), pair.getBasePair())); + + for(int i = 0; i < funNRhsType.getTypeParams().size()-1; i++) { + result.add(new UnifyPair(funNRhsType.getTypeParams().get(i), freshPlaceholders[i], PairOperator.SMALLERDOT, pair.getSubstitution(), pair.getBasePair())); + } + + result.add(new UnifyPair(lhsType, funNRhsType.setTypeParams(new TypeParams(freshPlaceholders)), PairOperator.EQUALSDOT, pair.getSubstitution(), pair.getBasePair())); + + result.stream().forEach(x -> { UnifyType l = x.getLhsType(); + if (l instanceof PlaceholderType) { ((PlaceholderType)l).disableWildcardtable(); } + UnifyType r = x.getRhsType(); + if (r instanceof PlaceholderType) { ((PlaceholderType)r).disableWildcardtable(); } + } ); + try { + logFile.write("FUNgreater: " + pair + "\n"); + logFile.write("FUNsmaller: " + result + "\n"); + logFile.flush(); + } + catch (IOException e) { + System.out.println("lofFile-Error"); + } + return Optional.of(result); + } + + @Override + public Optional reduceTph(UnifyPair pair) { + if(pair.getPairOp() != PairOperator.SMALLERDOTWC) + return Optional.empty(); + + UnifyType lhsType = pair.getLhsType(); + UnifyType rhsType = pair.getRhsType(); + if(!(lhsType instanceof PlaceholderType) || !(rhsType instanceof ReferenceType)) + return Optional.empty(); + + return Optional.of(new UnifyPair(lhsType, rhsType, PairOperator.EQUALSDOT, pair.getSubstitution(), pair.getBasePair())); + } + + @Override + public Optional> reduceTphExt(UnifyPair pair) { + if(pair.getPairOp() != PairOperator.SMALLERDOTWC) + return Optional.empty(); + + UnifyType lhsType = pair.getLhsType(); + UnifyType rhsType = pair.getRhsType(); + if(!(lhsType instanceof ExtendsType) || !(rhsType instanceof PlaceholderType)) + return Optional.empty(); + + UnifyType extendedType = ((ExtendsType)lhsType).getExtendedType(); + + if (extendedType.equals(rhsType)) return Optional.empty(); //PL 2019-02-18 eingefügt ? extends a <.? a + + boolean isGen = extendedType instanceof PlaceholderType && !((PlaceholderType) extendedType).isGenerated(); + + Set result = new HashSet<>(); + if(isGen) + result.add(new UnifyPair(rhsType, lhsType, PairOperator.EQUALSDOT, pair.getSubstitution(), pair.getBasePair())); + else { + UnifyType freshTph = PlaceholderType.freshPlaceholder(); + result.add(new UnifyPair(rhsType, new ExtendsType(freshTph), PairOperator.EQUALSDOT, pair.getSubstitution(), pair.getBasePair())); + result.add(new UnifyPair(extendedType, freshTph, PairOperator.SMALLERDOT, pair.getSubstitution(), pair.getBasePair())); + } + + return Optional.of(result); + } + + @Override + public Optional> reduceTphSup(UnifyPair pair) { + if(pair.getPairOp() != PairOperator.SMALLERDOTWC) + return Optional.empty(); + + UnifyType lhsType = pair.getLhsType(); + UnifyType rhsType = pair.getRhsType(); + if(!(lhsType instanceof SuperType) || !(rhsType instanceof PlaceholderType)) + return Optional.empty(); + + UnifyType superedType = ((SuperType)lhsType).getSuperedType(); + + if (superedType.equals(rhsType)) return Optional.empty(); //PL 2019-02-18 eingefügt ? super a <.? a + + boolean isGen = superedType instanceof PlaceholderType && !((PlaceholderType) superedType).isGenerated(); + + Set result = new HashSet<>(); + if(isGen) + result.add(new UnifyPair(rhsType, lhsType, PairOperator.EQUALSDOT, pair.getSubstitution(), pair.getBasePair())); + else { + UnifyType freshTph = PlaceholderType.freshPlaceholder(); + result.add(new UnifyPair(rhsType, new SuperType(freshTph), PairOperator.EQUALSDOT, pair.getSubstitution(), pair.getBasePair())); + Set fBounded = pair.getfBounded(); + fBounded.add(lhsType); + result.add(new UnifyPair(freshTph, superedType, PairOperator.SMALLERDOT, pair.getSubstitution(), pair.getBasePair(), fBounded)); + } + + return Optional.of(result); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnify.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnify.java new file mode 100644 index 0000000..d78d8c8 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnify.java @@ -0,0 +1,121 @@ +package de.dhbwstuttgart.typeinference.unify; + +import java.io.FileWriter; +import java.io.IOException; +import java.io.Writer; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; +import java.util.concurrent.ForkJoinPool; + +import de.dhbwstuttgart.core.JavaTXCompiler; +import de.dhbwstuttgart.typeinference.constraints.Constraint; +import de.dhbwstuttgart.typeinference.constraints.ConstraintSet; +import de.dhbwstuttgart.typeinference.constraints.Pair; +import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure; +import de.dhbwstuttgart.typeinference.unify.model.FiniteClosure; +import de.dhbwstuttgart.typeinference.unify.model.UnifyPair; + +public class TypeUnify { + + /** + * unify parallel ohne result modell + * @param undConstrains + * @param oderConstraints + * @param fc + * @param logFile + * @param log + * @param cons + * @return + */ + public Set> unify(Set undConstrains, List>> oderConstraints, IFiniteClosure fc, Writer logFile, Boolean log, UnifyResultModel ret, UnifyTaskModel usedTasks) { + TypeUnifyTask unifyTask = new TypeUnifyTask(undConstrains, oderConstraints, fc, true, logFile, log, 0, ret, usedTasks); + ForkJoinPool pool = new ForkJoinPool(); + pool.invoke(unifyTask); + Set> res = unifyTask.join(); + try { + logFile.write("\nnoShortendElements: " + unifyTask.noShortendElements + "\n"); + logFile.flush(); + } + catch (IOException e) { + System.err.println("no log-File"); + } + return res; + } + + /** + * unify asynchron mit Rückgabe UnifyResultModel ohne dass alle results gesammelt sind + * @param undConstrains + * @param oderConstraints + * @param fc + * @param logFile + * @param log + * @param cons + * @param ret + * @return + */ + public UnifyResultModel unifyAsync(Set undConstrains, List>> oderConstraints, IFiniteClosure fc, Writer logFile, Boolean log, UnifyResultModel ret, UnifyTaskModel usedTasks) { + TypeUnifyTask unifyTask = new TypeUnifyTask(undConstrains, oderConstraints, fc, true, logFile, log, 0, ret, usedTasks); + ForkJoinPool pool = new ForkJoinPool(); + pool.invoke(unifyTask); + return ret; + } + + /** + * unify parallel mit Rückgabe UnifyResultModel nachdem alle results gesammelt sind + * @param undConstrains + * @param oderConstraints + * @param fc + * @param logFile + * @param log + * @param cons + * @param ret + * @return + */ + public UnifyResultModel unifyParallel(Set undConstrains, List>> oderConstraints, IFiniteClosure fc, Writer logFile, Boolean log, UnifyResultModel ret, UnifyTaskModel usedTasks) { + TypeUnifyTask unifyTask = new TypeUnifyTask(undConstrains, oderConstraints, fc, true, logFile, log, 0, ret, usedTasks); + ForkJoinPool pool = new ForkJoinPool(); + pool.invoke(unifyTask); + Set> res = unifyTask.join(); + try { + logFile.write("\nnoShortendElements: " + unifyTask.noShortendElements +"\n"); + logFile.flush(); + } + catch (IOException e) { + System.err.println("no log-File"); + } + return ret; + } + + /* + public Set> unifySequential(Set eq, IFiniteClosure fc, FileWriter logFile, Boolean log) { + TypeUnifyTask unifyTask = new TypeUnifyTask(eq, fc, false, logFile, log); + Set> res = unifyTask.compute(); + return res; + } + */ + + /** + * unify sequentiell mit oderconstraints + * @param undConstrains + * @param oderConstraints + * @param fc + * @param logFile + * @param log + * @param cons + * @return + */ + public Set> unifyOderConstraints(Set undConstrains, List>> oderConstraints, IFiniteClosure fc, Writer logFile, Boolean log, UnifyResultModel ret, UnifyTaskModel usedTasks) { + TypeUnifyTask unifyTask = new TypeUnifyTask(undConstrains, oderConstraints, fc, false, logFile, log, 0, ret, usedTasks); + Set> res = unifyTask.compute(); + try { + logFile.write("\nnoShortendElements: " + unifyTask.noShortendElements +"\n"); + logFile.flush(); + } + catch (IOException e) { + System.err.println("no log-File"); + } + return res; + } + +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnify2Task.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnify2Task.java new file mode 100644 index 0000000..20820ee --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnify2Task.java @@ -0,0 +1,66 @@ +package de.dhbwstuttgart.typeinference.unify; + +import java.io.FileWriter; +import java.io.IOException; +import java.io.Writer; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import de.dhbwstuttgart.typeinference.constraints.Constraint; +import de.dhbwstuttgart.typeinference.constraints.ConstraintSet; +import de.dhbwstuttgart.typeinference.constraints.Pair; +import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure; +import de.dhbwstuttgart.typeinference.unify.model.UnifyPair; + +public class TypeUnify2Task extends TypeUnifyTask { + + Set> setToFlatten; + Set methodSignatureConstraintUebergabe; + + public TypeUnify2Task(Set> setToFlatten, Set eq, List>> oderConstraints, Set nextSetElement, IFiniteClosure fc, boolean parallel, Writer logFile, Boolean log, int rekTiefe, UnifyResultModel urm, UnifyTaskModel usedTasks, Set methodSignatureConstraintUebergabe) { + super(eq, oderConstraints, fc, parallel, logFile, log, rekTiefe, urm, usedTasks); + this.setToFlatten = setToFlatten; + this.nextSetElement = nextSetElement; + this.methodSignatureConstraintUebergabe = methodSignatureConstraintUebergabe; + } + + Set getNextSetElement() { + return nextSetElement; + } + + @Override + protected Set> compute() { + if (one) { + System.out.println("two"); + } + one = true; + Set> res = unify2(setToFlatten, eq, oderConstraintsField, fc, parallel, rekTiefeField, methodSignatureConstraintUebergabe); + /*if (isUndefinedPairSetSet(res)) { + return new HashSet<>(); } + else + */ + //writeLog("xxx"); + //noOfThread--; + synchronized (usedTasks) { + if (this.myIsCancelled()) { + return new HashSet<>(); + } + else { + return res; + } + } + } + + public void closeLogFile() { + + try { + logFile.close(); + } + catch (IOException ioE) { + System.err.println("no log-File" + thNo); + } + + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java new file mode 100644 index 0000000..110886d --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java @@ -0,0 +1,2609 @@ +//PL 2018-12-19: Merge checken +package de.dhbwstuttgart.typeinference.unify; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedHashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map.Entry; +import java.util.Optional; +import java.util.Set; +import java.util.concurrent.RecursiveTask; +import java.util.function.BiFunction; +import java.util.function.BinaryOperator; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import org.apache.commons.io.output.NullOutputStream; + +import de.dhbwstuttgart.exceptions.TypeinferenceException; +import de.dhbwstuttgart.parser.NullToken; +import de.dhbwstuttgart.syntaxtree.factory.UnifyTypeFactory; +import de.dhbwstuttgart.typeinference.constraints.Constraint; +import de.dhbwstuttgart.typeinference.constraints.ConstraintSet; +import de.dhbwstuttgart.typeinference.result.ResultSet; +import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure; +import de.dhbwstuttgart.typeinference.unify.interfaces.IMatch; +import de.dhbwstuttgart.typeinference.unify.interfaces.IRuleSet; +import de.dhbwstuttgart.typeinference.unify.interfaces.ISetOperations; +import de.dhbwstuttgart.typeinference.unify.interfaces.IUnify; +import de.dhbwstuttgart.typeinference.unify.model.ExtendsType; +import de.dhbwstuttgart.typeinference.unify.model.FunNType; +import de.dhbwstuttgart.typeinference.unify.model.OrderingExtend; +import de.dhbwstuttgart.typeinference.unify.model.PairOperator; +import de.dhbwstuttgart.typeinference.unify.model.PlaceholderType; +import de.dhbwstuttgart.typeinference.unify.model.ReferenceType; +import de.dhbwstuttgart.typeinference.unify.model.SuperType; +import de.dhbwstuttgart.typeinference.unify.model.TypeParams; +import de.dhbwstuttgart.typeinference.unify.model.Unifier; +import de.dhbwstuttgart.typeinference.unify.model.UnifyPair; +import de.dhbwstuttgart.typeinference.unify.model.UnifyType; +import de.dhbwstuttgart.typeinference.unify.model.WildcardType; +import de.dhbwstuttgart.util.Pair; +import de.dhbwstuttgart.typeinference.unify.model.OrderingUnifyPair; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.Writer; + +import com.google.common.collect.Ordering; + + +/** + * Implementation of the type unification algorithm + * @author Florian Steurer + */ +public class TypeUnifyTask extends RecursiveTask>> { + + private static final long serialVersionUID = 1L; + private static int i = 0; + private boolean printtag = false; + Boolean log = true; //gibt an ob ein Log-File nach System.getProperty("user.dir")+"/test/logFiles/log" geschrieben werden soll? + + /** + * Element, das aus dem nextSet den Gleichunen dieses Threads hinzugefuegt wurde + */ + Set nextSetElement; + + /** + * Fuer die Threads + */ + UnifyResultModel urm; + protected static int noOfThread = 0; + private static int totalnoOfThread = 0; + int thNo; + protected boolean one = false; + Integer MaxNoOfThreads = 8; + + public static final String rootDirectory = System.getProperty("user.dir")+"/test/logFiles/"; + Writer logFile; + + /** + * The implementation of setOps that will be used during the unification + */ + protected ISetOperations setOps = new GuavaSetOperations(); + + /** + * The implementation of the standard unify that will be used during the unification + */ + protected IUnify stdUnify = new MartelliMontanariUnify(); + + /** + * The implementation of the rules that will be used during the unification. + */ + protected IRuleSet rules; + + protected Set eq; //und-constraints + + protected List>> oderConstraintsField; + + protected IFiniteClosure fc; + + protected OrderingExtend> oup; + + protected boolean parallel; + + //Gives if unify is not called from checkA + private boolean finalresult = true; + + int rekTiefeField; + + Integer nOfUnify = 0; + + Integer noUndefPair = 0; + + Integer noAllErasedElements = 0; + + static Integer noou = 0; + + static int noBacktracking; + + static Integer noShortendElements = 0; + + Boolean myIsCanceled = false; + + volatile UnifyTaskModel usedTasks; + + public TypeUnifyTask() { + rules = new RuleSet(); + } + + /* + public TypeUnifyTask(Set eq, IFiniteClosure fc, boolean parallel, FileWriter logFile, Boolean log) { + this.eq = eq; + this.fc = fc; + this.oup = new OrderingUnifyPair(fc); + this.parallel = parallel; + this.logFile = logFile; + this.log = log; + rules = new RuleSet(logFile); + noOfThread++; + thNo = noOfThread; + } + */ + + + public TypeUnifyTask(Set eq, List>> oderConstraints, IFiniteClosure fc, boolean parallel, Writer logFile, Boolean log, int rekTiefe, UnifyResultModel urm, UnifyTaskModel usedTasks) { + synchronized (this) { + this.eq = eq; + //this.oderConstraints = oderConstraints.stream().map(x -> x.stream().map(y -> new HashSet<>(y)).collect(Collectors.toSet(HashSet::new))).collect(Collectors.toList(ArrayList::new)); + this.oderConstraintsField = oderConstraints; /*.stream().map(x -> { + Set> ret = new HashSet<>(); + for (Constraint y : x) { + ret.add(new HashSet<>(y)); + } + return ret; + }).collect(Collectors.toCollection(ArrayList::new)); + */ + + //x.stream().map(y -> new HashSet<>(y)).collect(Collectors.toSet(HashSet::new))).collect(Collectors.toList(ArrayList::new)); + this.nextSetElement = nextSetElement; + this.fc = fc; + this.oup = new OrderingUnifyPair(fc); + this.parallel = parallel; + this.logFile = logFile; + this.log = log; + + noOfThread++; + totalnoOfThread++; + //writeLog("thNo1 " + thNo); + thNo = totalnoOfThread; + writeLog("thNo2 " + thNo); + try { + this.logFile = log ? new FileWriter(new File(System.getProperty("user.dir") + "/logFiles/" + "Thread_"+thNo)) + : new OutputStreamWriter(new NullOutputStream()); + logFile.write(""); + } + catch (IOException e) { + System.err.println("log-File nicht vorhanden"); + } + /*Abbruchtest + if (thNo > 10) { + System.out.println("cancel"); + usedTasks.cancel(); + writeLog(nOfUnify.toString() + "cancel"); + System.out.println("cancel"); + try { + logFile.write("Abbruch"); + } + catch (IOException e) { + System.err.println("log-File nicht vorhanden"); + } + } + */ + rules = new RuleSet(logFile); + this.rekTiefeField = rekTiefe; + this.urm = urm; + this.usedTasks = usedTasks; + this.usedTasks.add(this); + } + } + + /** + * Vererbt alle Variancen + * @param eq The set of constraints + */ + /* PL 2018-05- 17 verschoben nach JavaTXCompiler + private void varianceInheritance(Set eq) { + Set usedTPH = new HashSet<>(); + Set phSet = eq.stream().map(x -> { + Set pair = new HashSet<>(); + if (x.getLhsType() instanceof PlaceholderType) pair.add((PlaceholderType)x.getLhsType()); + if (x.getRhsType() instanceof PlaceholderType) pair.add((PlaceholderType)x.getRhsType()); + return pair; + }).reduce(new HashSet<>(), (a,b) -> { a.addAll(b); return a;} , (c,d) -> { c.addAll(d); return c;}); + + ArrayList phSetVariance = new ArrayList<>(phSet); + phSetVariance.removeIf(x -> (x.getVariance() == 0)); + while(!phSetVariance.isEmpty()) { + PlaceholderType a = phSetVariance.remove(0); + usedTPH.add(a); + //HashMap ht = new HashMap<>(); + //ht.put(a, a.getVariance()); + Set eq1 = new HashSet<>(eq); + eq1.removeIf(x -> !(x.getLhsType() instanceof PlaceholderType && ((PlaceholderType)x.getLhsType()).equals(a))); + eq1.stream().forEach(x -> { x.getRhsType().accept(new distributeVariance(), a.getVariance());}); + eq1 = new HashSet<>(eq); + eq1.removeIf(x -> !(x.getRhsType() instanceof PlaceholderType && ((PlaceholderType)x.getRhsType()).equals(a))); + eq1.stream().forEach(x -> { x.getLhsType().accept(new distributeVariance(), a.getVariance());}); + phSetVariance = new ArrayList<>(phSet); + phSetVariance.removeIf(x -> (x.getVariance() == 0 || usedTPH.contains(x))); + } +} +*/ + void myCancel(Boolean b) { + myIsCanceled = true; + } + + public boolean myIsCancelled() { + return myIsCanceled; + } + + protected Set> compute() { + if (one) { + System.out.println("two"); + } + one = true; + Set neweq = new HashSet<>(eq); + /* 1-elementige Oder-Constraints werden in und-Constraints umgewandelt */ + oderConstraintsField.stream() + .filter(x -> x.size()==1) + .map(y -> y.stream().findFirst().get()).forEach(x -> neweq.addAll(x)); + ArrayList>> remainingOderconstraints = oderConstraintsField.stream() + .filter(x -> x.size()>1) + .collect(Collectors.toCollection(ArrayList::new)); + Set> res = unify(neweq, remainingOderconstraints, fc, parallel, rekTiefeField, new HashSet<>()); + noOfThread--; + try { + logFile.close(); + } + catch (IOException ioE) { + System.err.println("no log-File"); + } + if (isUndefinedPairSetSet(res)) { + //fuer debug-Zwecke + ArrayList al = res.stream().map(x -> x.stream().collect(Collectors.toCollection(ArrayList::new))) + .collect(Collectors.toCollection(ArrayList::new)); + throw new TypeinferenceException("Unresolved constraints: " + res.toString(), new NullToken()); //return new HashSet<>(); + } + else { + synchronized (usedTasks) { + if (this.myIsCancelled()) { + return new HashSet<>(); + } + else { + return res; + } + } + } + } +/* + @Override + protected Set> compute() { + Set> fstElems = new HashSet<>(); + fstElems.add(eq); + Set> res = computeCartesianRecursiveOderConstraints(fstElems, oderConstraints, fc, parallel); + if (isUndefinedPairSetSet(res)) { return new HashSet<>(); } + else return res; + } +*/ + + + + + /** + * Computes all principal type unifiers for a set of constraints. + * @param eq The set of constraints + * @param fc The finite closure + * @return The set of all principal type unifiers + */ + protected Set> unify(final Set eq, List>> oderConstraints, IFiniteClosure fc, boolean parallel, int rekTiefe, Set methodSignatureConstraint) { + //Set aas = eq.stream().filter(x -> x.getLhsType().getName().equals("AA") //&& x.getPairOp().equals(PairOperator.SMALLERDOT) + // ).collect(Collectors.toCollection(HashSet::new)); + //writeLog(nOfUnify.toString() + " AA: " + aas.toString()); + //if (aas.isEmpty()) { + // System.out.println(""); + //} + + //.collect(Collectors.toCollection(HashSet::new))); + + synchronized (usedTasks) { + if (this.myIsCancelled()) { + return new HashSet<>(); + } + } + + rekTiefe++; + nOfUnify++; + writeLog(nOfUnify.toString() + " Unifikation: " + eq.toString()); + writeLog(nOfUnify.toString() + " Oderconstraints: " + oderConstraints.toString()); + + /* + * Variancen auf alle Gleichungen vererben + */ + //PL 2018-05-17 nach JavaTXCompiler verschoben + //varianceInheritance(eq); + + /* + * ? extends ? extends Theta rausfiltern + */ + Set doubleExt = eq.stream().filter(x -> (x.wrongWildcard())).map(x -> { x.setUndefinedPair(); return x;}) + .collect(Collectors.toCollection(HashSet::new)); + if (doubleExt.size() > 0) { + Set> ret = new HashSet<>(); + ret.add(doubleExt); + return ret; + } + + /* + * Occurs-Check durchfuehren + */ + + Set ocurrPairs = eq.stream().filter(x -> { + UnifyType lhs, rhs; + return (lhs = x.getLhsType()) instanceof PlaceholderType + && !((rhs = x.getRhsType()) instanceof PlaceholderType) + && rhs.getTypeParams().occurs((PlaceholderType)lhs);}) + .map(x -> { x.setUndefinedPair(); return x;}) + .collect(Collectors.toCollection(HashSet::new)); + writeLog("ocurrPairs: " + ocurrPairs); + if (ocurrPairs.size() > 0) { + Set> ret = new HashSet<>(); + ret.add(ocurrPairs); + return ret; + } + + + + /* + * Step 1: Repeated application of reduce, adapt, erase, swap + */ + Set eq0; + Set eq0Prime; + Optional> eqSubst = Optional.of(eq); + do { + eq0Prime = eqSubst.get(); + eq0 = applyTypeUnificationRules(eq0Prime, fc); + /* In commit dfd91b5f8b7fca1cb5f302eec4b0ba3330271c9b eingefuegt ANFANG */ + Set occurcheck = new HashSet<>(eq0); + occurcheck.removeAll(eq0Prime); + ocurrPairs = occurcheck.stream().filter(x -> { + UnifyType lhs, rhs; + return (lhs = x.getLhsType()) instanceof PlaceholderType + && !((rhs = x.getRhsType()) instanceof PlaceholderType) + && rhs.getTypeParams().occurs((PlaceholderType)lhs);}) + .map(x -> { x.setUndefinedPair(); return x;}) + .collect(Collectors.toCollection(HashSet::new)); + writeLog("ocurrPairs: " + ocurrPairs); + if (ocurrPairs.size() > 0) { + Set> ret = new HashSet<>(); + ret.add(ocurrPairs); + return ret; + } + /* In commit dfd91b5f8b7fca1cb5f302eec4b0ba3330271c9b eingefuegt ENDE */ + eqSubst = rules.subst(eq0, oderConstraints); + } while (eqSubst.isPresent()); + + eq0.forEach(x -> x.disableCondWildcards()); + + writeLog(nOfUnify.toString() + " Unifikation nach applyTypeUnificationRules: " + eq.toString()); + writeLog(nOfUnify.toString() + " Oderconstraints nach applyTypeUnificationRules: " + oderConstraints.toString()); + + /* + * Step 2 and 3: Create a subset eq1s of pairs where both sides are TPH and eq2s of the other pairs + */ + Set eq1s = new HashSet<>(); + Set eq2s = new HashSet<>(); + splitEq(eq0, eq1s, eq2s); + + /* + * Step 4: Create possible typings + * + * "Manche Autoren identifizieren die Paare (a, (b,c)) und ((a,b),c) + * mit dem geordneten Tripel (a,b,c), wodurch das kartesische Produkt auch assoziativ wird." - Wikipedia + */ + + // There are up to 10 toplevel set. 8 of 10 are the result of the + // cartesian product of the sets created by pattern matching. + List>> topLevelSets = new ArrayList<>(); + + //System.out.println(eq2s); + + if(eq1s.size() != 0) { // Do not add empty sets or the cartesian product will always be empty. + Set> wrap = new HashSet<>(); + wrap.add(eq1s); + topLevelSets.add(wrap); // Add Eq1' + } + + // Add the set of [a =. Theta | (a=. Theta) in Eq2'] + //TODO: Occurscheck anwenden als Fehler identifizieren + Set bufferSet = eq2s.stream() + .filter(x -> x.getPairOp() == PairOperator.EQUALSDOT && x.getLhsType() instanceof PlaceholderType) + .collect(Collectors.toSet()); + + if(bufferSet.size() != 0) { // Do not add empty sets or the cartesian product will always be empty. + Set> wrap = new HashSet<>(); + wrap.add(bufferSet); + topLevelSets.add(wrap); + eq2s.removeAll(bufferSet); + } + + // Sets that originate from pair pattern matching + // Sets of the "second level" + Set undefinedPairs = new HashSet<>(); + if (printtag) System.out.println("eq2s " + eq2s); + //writeLog("BufferSet: " + bufferSet.toString()+"\n"); + List>> oderConstraintsOutput = new ArrayList<>();//new ArrayList<>(oderConstraints); + Set>>> secondLevelSets = calculatePairSets(eq2s, oderConstraints, fc, undefinedPairs, oderConstraintsOutput); + //PL 2017-09-20: Im calculatePairSets wird möglicherweise O .< java.lang.Integer + //nicht ausgewertet Faculty Beispiel im 1. Schritt + //PL 2017-10-03 geloest, muesste noch mit FCs mit kleineren + //Typen getestet werden. + writeLog(nOfUnify.toString() + " Oderconstraints2: " + oderConstraintsOutput.toString()); + if (printtag) System.out.println("secondLevelSets:" +secondLevelSets); + // If pairs occured that did not match one of the cartesian product cases, + // those pairs are contradictory and the unification is impossible. + if(!undefinedPairs.isEmpty()) { + noUndefPair++; + for (UnifyPair up : undefinedPairs) { + writeLog(noUndefPair.toString() + " UndefinedPairs; " + up); + writeLog("BasePair; " + up.getBasePair()); + } + Set> error = new HashSet<>(); + undefinedPairs = undefinedPairs.stream().map(x -> { x.setUndefinedPair(); return x;}).collect(Collectors.toCollection(HashSet::new)); + error.add(undefinedPairs); + undefinedPairs.forEach(x -> writeLog("AllSubst: " +x.getAllSubstitutions().toString())); + return error; + } + + /* Up to here, no cartesian products are calculated. + * filters for pairs and sets can be applied here */ + + // Alternative: Sub cartesian products of the second level (pattern matched) sets + // "the big (x)" + /* for(Set>> secondLevelSet : secondLevelSets) { + //System.out.println("secondLevelSet "+secondLevelSet.size()); + List>> secondLevelSetList = new ArrayList<>(secondLevelSet); + Set>> cartResult = setOps.cartesianProduct(secondLevelSetList); + //System.out.println("CardResult: "+cartResult.size()); + // Flatten and add to top level sets + Set> flat = new HashSet<>(); + int j = 0; + for(List> s : cartResult) { + j++; + //System.out.println("s from CardResult: "+cartResult.size() + " " + j); + Set flat1 = new HashSet<>(); + for(Set s1 : s) + flat1.addAll(s1); + flat.add(flat1); + } + //topLevelSets.add(flat); + } + */ + + //Alternative KEIN KARTESISCHES PRODUKT der secondlevel Ebene bilden + for(Set>> secondLevelSet : secondLevelSets) { + for (Set> secondlevelelem : secondLevelSet) { + topLevelSets.add(secondlevelelem); + } + } + //System.out.println(topLevelSets); + //System.out.println(); + + + //Aufruf von computeCartesianRecursive ANFANG + //writeLog("topLevelSets: " + topLevelSets.toString()); + return computeCartesianRecursive(new ArrayList<>(topLevelSets), eq, oderConstraintsOutput, fc, parallel, rekTiefe, methodSignatureConstraint); + + } + + + Set> unify2(Set> setToFlatten, Set eq, List>> oderConstraints, IFiniteClosure fc, boolean parallel, int rekTiefe, Set methodSignatureConstraint) { + //Aufruf von computeCartesianRecursive ENDE + + //keine Ahnung woher das kommt + //Set> setToFlatten = topLevelSets.stream().map(x -> x.iterator().next()).collect(Collectors.toCollection(HashSet::new)); + + //Muss auskommentiert werden, wenn computeCartesianRecursive ANFANG + // Cartesian product over all (up to 10) top level sets + //Set>> eqPrimeSet = setOps.cartesianProduct(topLevelSets) + // .stream().map(x -> new HashSet<>(x)) + // .collect(Collectors.toCollection(HashSet::new)); + //Muss auskommentiert werden, wenn computeCartesianRecursive ENDE + + synchronized (usedTasks) { + if (this.myIsCancelled()) { + return new HashSet<>(); + } + } + + Set> eqPrimePrimeSet = new HashSet<>(); + + Set forks = new HashSet<>(); + + //Muss auskommentiert werden, wenn computeCartesianRecursive ANFANG + //for(Set> setToFlatten : eqPrimeSet) { + // Flatten the cartesian product + //Muss auskommentiert werden, wenn computeCartesianRecursive ENDE + Set eqPrime = new HashSet<>(); + setToFlatten.stream().forEach(x -> eqPrime.addAll(x)); + + /* + * Step 5: Substitution + */ + //writeLog("vor Subst: " + eqPrime); + writeLog("vor Subst: " + oderConstraints); + String ocString = oderConstraints.toString(); + List>> newOderConstraints = new ArrayList<>(oderConstraints); + Optional> eqPrimePrime = rules.subst(eqPrime, newOderConstraints); + Set> unifyres1 = null; + Set> unifyres2 = null; + if (!ocString.equals(newOderConstraints.toString())) writeLog("nach Subst: " + newOderConstraints); + //writeLog("nach Subst: " + eqPrimePrime); + /* + * Step 6 a) Restart (fork) for pairs where subst was applied + */ + /* + if(parallel) { + if (eqPrime.equals(eq) && !eqPrimePrime.isPresent() + && oderConstraints.isEmpty()) //PL 2017-09-29 //(!eqPrimePrime.isPresent()) auskommentiert und durch + //PL 2017-09-29 dies ersetzt //(!eqPrimePrime.isPresent()) + //PL 2018-05-18 beide Bedingungen muessen gelten, da eqPrime Veränderungen in allem ausser subst + //eqPrimePrime Veraenderungen in subst repraesentieren. + eqPrimePrimeSet.add(eqPrime); + else if(eqPrimePrime.isPresent()) { + //System.out.println("nextStep: " + eqPrimePrime.get()); + TypeUnifyTask fork = new TypeUnifyTask(eqPrimePrime.get(), fc, true, logFile, log); + forks.add(fork); + fork.fork(); + } + else { + //System.out.println("nextStep: " + eqPrime); + TypeUnifyTask fork = new TypeUnifyTask(eqPrime, fc, true, logFile, log); + forks.add(fork); + fork.fork(); + } + } + else */ + {// sequentiell (Step 6b is included) + if (printtag) System.out.println("nextStep: " + eqPrimePrime); + if (eqPrime.equals(eq) && !eqPrimePrime.isPresent() + && oderConstraints.isEmpty()) { //PL 2017-09-29 //(!eqPrimePrime.isPresent()) auskommentiert und durch + //PL 2017-09-29 dies ersetzt //(!eqPrimePrime.isPresent()) + //PL 2018-05-18 beide Bedingungen muessen gelten, da eqPrime Veränderungen in allem ausser subst + //eqPrimePrime Veraenderungen in subst repraesentieren. + //try { + //if (isSolvedForm(eqPrime)) { + // writeLog("eqPrime:" + eqPrime.toString()+"\n"); + //} + //} + //catch (IOException e) { + // System.err.println("log-File nicht vorhanden"); + //} + eqPrimePrimeSet.add(eqPrime); + if (finalresult && isSolvedForm(eqPrime)) { + writeLog("eqPrime:" + eqPrime.toString()+"\n"); + + /* methodconstraintsets werden zum Ergebnis hinzugefuegt + * Anfang + */ + //System.out.println("methodSignatureConstraint Return: " + methodSignatureConstraint); + eqPrimePrimeSet.forEach(x -> x.addAll(methodSignatureConstraint)); + + //Substitutionen in methodcontraintsets werdne ausgeführt + eqPrimePrimeSet = eqPrimePrimeSet.stream().map( + x -> { Optional> help = rules.subst(x); + return help.isPresent() ? + help.get(): + x; }).collect(Collectors.toSet()); + /* + * Ende + */ + + + urm.notify(eqPrimePrimeSet); + } + } + else if(eqPrimePrime.isPresent()) { + Set> unifyres = unifyres1 = unify(eqPrimePrime.get(), newOderConstraints, fc, parallel, rekTiefe, methodSignatureConstraint); + + eqPrimePrimeSet.addAll(unifyres); + } + else { + Set> unifyres = unifyres2 = unify(eqPrime, newOderConstraints, fc, parallel, rekTiefe, methodSignatureConstraint); + + + eqPrimePrimeSet.addAll(unifyres); + } + } + //Muss auskommentiert werden, wenn computeCartesianRecursive ANFANG + //} + //Muss auskommentiert werden, wenn computeCartesianRecursive ENDE + + /* + * Step 6 b) Build the union over everything. + */ + /* + * PL 2019-01-22: geloescht + + if(parallel) + for(TypeUnifyTask fork : forks) + eqPrimePrimeSet.addAll(fork.join()); + */ + /* + * Step 7: Filter empty sets; + */ + eqPrimePrimeSet = eqPrimePrimeSet.stream().filter(x -> isSolvedForm(x) || this.isUndefinedPairSet(x)).collect(Collectors.toCollection(HashSet::new)); + if (!eqPrimePrimeSet.isEmpty() && !isUndefinedPairSetSet(eqPrimePrimeSet)) { + writeLog("Result1 " + eqPrimePrimeSet.toString()); + } + return eqPrimePrimeSet; + } + + + /** + * Computes the cartesian product of topLevelSets step by step. + * @param topLevelSets List of Sets of Sets, where a cartesian product have to be built + * Ex.: [{{a =. Integer}, {a = Object}}, {{a = Vector, b =. Integer}, {a = Vector, b =. Object}}] + * @param eq Original set of equations which should be unified + * @param oderConstraints Remaining or-constraints + * @param fc The finite closure + * @param parallel If the algorithm should be parallelized run + * @param rekTiefe Deep of recursive calls + * @return The set of all principal type unifiers + */ + Set> computeCartesianRecursive(ArrayList>> topLevelSets, Set eq, List>> oderConstraints, IFiniteClosure fc, boolean parallel, int rekTiefe, Set methodSignatureConstraint) { + + //oneElems: Alle 1-elementigen Mengen, die nur ein Paar + //a <. theta, theta <. a oder a =. theta enthalten + Set> oneElems = new HashSet<>(); + oneElems.addAll(topLevelSets.stream() + .filter(x -> x.size()==1) + .map(y -> y.stream().findFirst().get()) + .collect(Collectors.toCollection(HashSet::new))); + oneElems.forEach(x -> { if (x instanceof Constraint) methodSignatureConstraint.addAll(((Constraint)x).getmethodSignatureConstraint());}); + //optNextSet: Eine mehrelementige Menge, wenn vorhanden + Optional>> optNextSet = topLevelSets.stream().filter(x -> x.size()>1).findAny(); + + if (!optNextSet.isPresent()) {//Alle Elemente sind 1-elementig + Set> result = unify2(oneElems, eq, oderConstraints, fc, parallel, rekTiefe, methodSignatureConstraint); + return result; + } + + Set> nextSet = optNextSet.get(); + //writeLog("nextSet: " + nextSet.toString()); + List> nextSetasList =new ArrayList<>(nextSet); + /* + try { + //List> + //nextSetasList = oup.sortedCopy(nextSet);//new ArrayList<>(nextSet); + } + catch (java.lang.IllegalArgumentException e) { + System.out.print(""); + } + */ + Set> result = new HashSet<>(); + int variance = 0; + + /* Varianzbestimmung Anfang + * Oderconstraint, wenn entweder kein Basepair oder unterschiedliche Basepairs => oderConstraint = true; + * Varianz = 1 => Argumentvariable + * Varianz = -1 => Rückgabevariable + * Varianz = 0 => unklar + * Varianz = 2 => Operatoren oderConstraints */ + ArrayList zeroNextElem = new ArrayList<>(nextSetasList.get(0)); + UnifyPair fstBasePair = zeroNextElem.remove(0).getBasePair(); + Boolean oderConstraint = false; + + if (fstBasePair != null) { + Boolean sameBase = true; + for (UnifyPair ele : nextSetasList.get(0)) {//check ob a <. ty base oder ob Ueberladung + sameBase = sameBase && ele.getBasePair() != null && ele.getBasePair().equals(fstBasePair); + } + if (sameBase) { //angefuegt PL 2020-02-30 + Optional xi = nextSetasList.stream().map(x -> x.stream().filter(y -> (y.getLhsType() instanceof PlaceholderType && !(y.getRhsType() instanceof PlaceholderType))) + .filter(z -> ((PlaceholderType)z.getLhsType()).getVariance() != 0) + .map(c -> ((PlaceholderType)c.getLhsType()).getVariance()) + .reduce((a,b)-> {if (a==b) return a; else return 0; })) //2 kommt insbesondere bei Oder-Constraints vor + .filter(d -> d.isPresent()) + .map(e -> e.get()) + .findAny(); + if (xi.isPresent()) { + variance = xi.get(); + } + } + else { + oderConstraint = true; + } + } + else { + oderConstraint = true; + } + + //Varianz-Bestimmung Oder-Constraints + if (oderConstraint) { + if (printtag) System.out.println("nextSetasList " + nextSetasList); + Optional optVariance = + nextSetasList.iterator() + .next() + .stream() + .filter(x -> x.getGroundBasePair().getLhsType() instanceof PlaceholderType && + ! (x.getRhsType() instanceof PlaceholderType) && + x.getPairOp() == PairOperator.EQUALSDOT) + .map(x -> + ((PlaceholderType)x.getGroundBasePair().getLhsType()).getVariance()) + .reduce((n,m) -> { if ((n == 0) && (m==0)) return 0; + else if (n !=0) return n; //es muss mindestens eine Variance != 0 sein + else return m; + }); + //Fuer Operatorenaufrufe wird variance auf 2 gesetzt. + //da kein Receiver existiert also kein x.getGroundBasePair().getLhsType() instanceof PlaceholderType + //Bei Varianz = 2 werden alle Elemente des Kartesischen Produkts abgearbeitet + variance = optVariance.isPresent() ? optVariance.get() : 2; + } + /* Varianzbestimmung Ende */ + + //writeLog("nextSetasList: " + nextSetasList.toString()); + Set nextSetElem = nextSetasList.get(0); + //writeLog("BasePair1: " + nextSetElem + " " + nextSetElem.iterator().next().getBasePair()); + + /* sameEqSet-Bestimmung: Wenn a = ty \in nextSet dann enthaelt sameEqSet + * alle Paare a < ty1 oder ty2 < a aus oneElems */ + Set sameEqSet = new HashSet<>(); + + //optOrigPair enthaelt ggf. das Paar a = ty \in nextSet + Optional optOrigPair = null; + if (!oderConstraint) { + optOrigPair = nextSetElem.stream().filter(x -> ( + //x.getBasePair() != null && ist gegeben wenn variance != 2 + //x.getBasePair().getPairOp().equals(PairOperator.SMALLERDOT) && + (x.getPairOp().equals(PairOperator.EQUALSDOT) + /* + (x.getBasePair().getLhsType() instanceof PlaceholderType + && x.getLhsType().equals(x.getBasePair().getLhsType())) + || (x.getBasePair().getRhsType() instanceof PlaceholderType + && x.getLhsType().equals(x.getBasePair().getRhsType()) + */ + ))).filter(x -> //Sicherstellen, dass bei a = ty a auch wirklich die gesuchte Typvariable ist + x.getLhsType().equals(x.getBasePair().getLhsType()) || + x.getLhsType().equals(x.getBasePair().getRhsType()) + ).findFirst(); + writeLog("optOrigPair: " + optOrigPair); + if (optOrigPair.isPresent()) { + UnifyPair origPair = optOrigPair.get(); + UnifyType tyVar; + if (!((tyVar = origPair.getLhsType()) instanceof PlaceholderType)) { + tyVar = origPair.getRhsType(); + } + UnifyType tyVarEF = tyVar; + sameEqSet = oneElems.stream().map(xx -> xx.iterator().next()) + .filter(x -> (((x.getLhsType().equals(tyVarEF) && !(x.getRhsType() instanceof PlaceholderType)) + || (x.getRhsType().equals(tyVarEF) && !(x.getLhsType() instanceof PlaceholderType))))) + .collect(Collectors.toCollection(HashSet::new)); + } + } + /* sameEqSet-Bestimmung Ende */ + + Set a = null; + while (nextSetasList.size() > 0) { + Set a_last = a; + + /* Liste der Faelle für die parallele Verarbeitung + * Enthaelt Elemente, die nicht in Relation zu aktuellem Fall in der + * Variablen a stehen. Diese muesse auf alle Faelle bearbeitet werden, + * Deshalb wird ihre Berechnung parallel angestossen. + */ + List> nextSetasListRest = new ArrayList<>(); + + /* Liste der Faelle, bei dem Receiver jeweils "? extends" enthaelt bzw. nicht enthaelt + * In der Regel ist dies genau ein Element + * Dieses Element wird später aus nextSetasList geloescht, wenn das jeweils andere Element zum Erfolg + * gefuehrt hat. + */ + List> nextSetasListOderConstraints = new ArrayList<>(); + + writeLog("nextSet: " + nextSet.toString()); + writeLog("nextSetasList: " + nextSetasList.toString()); + if (variance == 1) { + a = oup.max(nextSetasList.iterator()); + nextSetasList.remove(a); + if (oderConstraint) { + nextSetasListOderConstraints.add(((Constraint)a).getExtendConstraint()); + } + writeLog("nextSetasListOderConstraints 1: " + nextSetasListOderConstraints); + nextSetasListRest = new ArrayList<>(nextSetasList); + Iterator> nextSetasListItRest = new ArrayList>(nextSetasListRest).iterator(); + while (nextSetasListItRest.hasNext()) { + Set a_next = nextSetasListItRest.next(); + if (//a.equals(a_next) || + (oup.compare(a, a_next) == 1)) { + nextSetasListRest.remove(a_next); + } + } + + //Alle maximale Elemente in nextSetasListRest bestimmen + //nur für diese wird parallele Berechnung angestossen. + nextSetasListRest = oup.maxElements(nextSetasListRest); + } + else if (variance == -1) { + a = oup.min(nextSetasList.iterator()); + writeLog("Min: a in " + variance + " "+ a); + if (oderConstraint) { + nextSetasListOderConstraints.add(((Constraint)a).getExtendConstraint()); + } + writeLog("nextSetasListOderConstraints -1: " + nextSetasListOderConstraints); + nextSetasList.remove(a); + nextSetasListRest = new ArrayList<>(nextSetasList); + Iterator> nextSetasListItRest = new ArrayList>(nextSetasListRest).iterator(); + while (nextSetasListItRest.hasNext()) { + Set a_next = nextSetasListItRest.next(); + if (//a.equals(a_next) || + (oup.compare(a, a_next) == -1)) { + nextSetasListRest.remove(a_next); + } + } + //Alle minimalen Elemente in nextSetasListRest bestimmen + //nur für diese wird parallele Berechnung angestossen. + nextSetasListRest = oup.minElements(nextSetasListRest); + } + else if (variance == 2) { + a = nextSetasList.remove(0); + + //Fuer alle Elemente wird parallele Berechnung angestossen. + nextSetasListRest = new ArrayList<>(nextSetasList); + } + else if (variance == 0) { + //wenn a <. theta dann ist ein maximales Element sehr wahrscheinlich + //wenn theta <. a dann ist ein minimales Element sehr wahrscheinlich + if (!oderConstraint && optOrigPair != null && optOrigPair.isPresent()) { + if (optOrigPair.get().getBasePair().getLhsType() instanceof PlaceholderType) { + a = oup.max(nextSetasList.iterator()); + } + else { + a = oup.min(nextSetasList.iterator()); + } + nextSetasList.remove(a); + } + else { + if (oderConstraint) { + a = oup.max(nextSetasList.iterator()); + nextSetasList.remove(a); + nextSetasListOderConstraints.add(((Constraint)a).getExtendConstraint()); + } + else { + a = nextSetasList.remove(0); + } + } + } + + if (oderConstraint) {//Methodconstraints werden abgespeichert für die Bytecodegenerierung von Methodenaufrufen + methodSignatureConstraint.addAll(((Constraint)a).getmethodSignatureConstraint()); + //System.out.println("ERSTELLUNG: " +methodSignatureConstraint); + } + + i++; + Set> elems = new HashSet>(oneElems); + writeLog("a1: " + rekTiefe + " "+ "variance: "+ variance + " " + a.toString()+ "\n"); + + //Ergebnisvariable für den aktuelle Thread + Set> res = new HashSet<>(); + + //Menge der Ergebnisse der geforkten Threads + Set>> add_res = new HashSet<>(); + + + Set> aParDef = new HashSet<>(); + + /* Wenn bei (a \in theta) \in a zu Widerspruch in oneElems wird + * a verworfen und zu nächstem Element von nextSetasList gegangen + */ + if (!oderConstraint && !sameEqSet.isEmpty() && !checkNoContradiction(a, sameEqSet, result)) { + a = null; + noShortendElements++; + continue; + } + + /* Wenn parallel gearbeitet wird, wird je nach Varianz ein neuer Thread + * gestartet, der parallel weiterarbeitet. + */ + if(parallel && (variance == 1) && noOfThread <= MaxNoOfThreads) { + Set forks = new HashSet<>(); + Set newEqOrig = new HashSet<>(eq); + Set> newElemsOrig = new HashSet<>(elems); + List>> newOderConstraintsOrig = new ArrayList<>(oderConstraints); + newElemsOrig.add(a); + + /* FORK ANFANG */ + TypeUnify2Task forkOrig = new TypeUnify2Task(newElemsOrig, newEqOrig, newOderConstraintsOrig, a, fc, parallel, logFile, log, rekTiefe, urm, usedTasks, methodSignatureConstraint); + //forks.add(forkOrig); + synchronized(usedTasks) { + if (this.myIsCancelled()) { + return new HashSet<>(); + } + forkOrig.fork(); + } + /* FORK ENDE */ + + synchronized (this) { + writeLog("a in " + variance + " "+ a); + writeLog("nextSetasListRest: " + nextSetasListRest.toString()); + } + while (!nextSetasListRest.isEmpty()) { + Set nSaL = nextSetasListRest.remove(0); + synchronized (this) { nextSetasList.remove(nSaL); + writeLog("1 RM" + nSaL.toString()); + } + + if (!oderConstraint) { + //ueberpruefung ob zu a =. ty \in nSaL in sameEqSet ein Widerspruch besteht + if (!sameEqSet.isEmpty() && !checkNoContradiction(nSaL, sameEqSet, result)) { + nSaL = null; + noShortendElements++; + continue; + } + } + else { + nextSetasListOderConstraints.add(((Constraint)nSaL).getExtendConstraint()); + } + Set newEq = new HashSet<>(eq); + Set> newElems = new HashSet<>(elems); + List>> newOderConstraints = new ArrayList<>(oderConstraints); + newElems.add(nSaL); + TypeUnify2Task fork = new TypeUnify2Task(newElems, newEq, newOderConstraints, nSaL, fc, parallel, logFile, log, rekTiefe, urm, usedTasks, new HashSet<>(methodSignatureConstraint)); + forks.add(fork); + synchronized(usedTasks) { + if (this.myIsCancelled()) { + return new HashSet<>(); + } + fork.fork(); + } + } + //res = unify2(newElemsOrig, newEqOrig, newOderConstraintsOrig, fc, parallel, rekTiefe); + + /* FORK ANFANG */ + synchronized (this) { + writeLog("wait "+ forkOrig.thNo); + noOfThread--; + res = forkOrig.join(); + synchronized (usedTasks) { + if (this.myIsCancelled()) { + return new HashSet<>(); + } + } + //noOfThread++; + forkOrig.writeLog("final Orig 1"); + forkOrig.closeLogFile(); + //Set> fork_res = forkOrig.join(); + writeLog("JoinOrig " + new Integer(forkOrig.thNo).toString()); + //noOfThread--; an das Ende von compute verschoben + //add_res.add(fork_res); + }; + /* FORK ENDE */ + + forks.forEach(x -> writeLog("wait: " + x.thNo)); + for(TypeUnify2Task fork : forks) { + synchronized (this) { + noOfThread--; + Set> fork_res = fork.join(); + synchronized (usedTasks) { + if (this.myIsCancelled()) { + return new HashSet<>(); + } + } + //noOfThread++; + writeLog("Join " + new Integer(fork.thNo).toString()); + //noOfThread--; an das Ende von compute verschoben + writeLog("fork_res: " + fork_res.toString()); + writeLog(new Boolean((isUndefinedPairSetSet(fork_res))).toString()); + add_res.add(fork_res); + if (!isUndefinedPairSetSet(fork_res)) { + aParDef.add(fork.getNextSetElement()); + } + fork.writeLog("final 1"); + fork.closeLogFile(); + }; + } + //noOfThread++; + } else { + if(parallel && (variance == -1) && noOfThread <= MaxNoOfThreads) { + Set forks = new HashSet<>(); + Set newEqOrig = new HashSet<>(eq); + Set> newElemsOrig = new HashSet<>(elems); + List>> newOderConstraintsOrig = new ArrayList<>(oderConstraints); + newElemsOrig.add(a); + + /* FORK ANFANG */ + TypeUnify2Task forkOrig = new TypeUnify2Task(newElemsOrig, newEqOrig, newOderConstraintsOrig, a, fc, parallel, logFile, log, rekTiefe, urm, usedTasks, new HashSet<>(methodSignatureConstraint)); + //forks.add(forkOrig); + synchronized(usedTasks) { + if (this.myIsCancelled()) { + return new HashSet<>(); + } + forkOrig.fork(); + } + /* FORK ENDE */ + + synchronized (this) { + writeLog("a in " + variance + " "+ a); + writeLog("nextSetasListRest: " + nextSetasListRest.toString()); + } + while (!nextSetasListRest.isEmpty()) { + Set nSaL = nextSetasListRest.remove(0); + synchronized (this) { nextSetasList.remove(nSaL); + writeLog("-1 RM" + nSaL.toString()); + } + + if (!oderConstraint) { + //ueberpruefung ob zu a =. ty \in nSaL in sameEqSet ein Widerspruch besteht + if (!sameEqSet.isEmpty() && !checkNoContradiction(nSaL, sameEqSet, result)) { + nSaL = null; + noShortendElements++; + continue; + } + } + else { + nextSetasListOderConstraints.add(((Constraint)nSaL).getExtendConstraint()); + } + Set newEq = new HashSet<>(eq); + Set> newElems = new HashSet<>(elems); + List>> newOderConstraints = new ArrayList<>(oderConstraints); + newElems.add(nSaL); + TypeUnify2Task fork = new TypeUnify2Task(newElems, newEq, newOderConstraints, nSaL, fc, parallel, logFile, log, rekTiefe, urm, usedTasks, new HashSet<>(methodSignatureConstraint)); + forks.add(fork); + synchronized(usedTasks) { + if (this.myIsCancelled()) { + return new HashSet<>(); + } + fork.fork(); + } + } + //res = unify2(newElemsOrig, newEqOrig, newOderConstraintsOrig, fc, parallel, rekTiefe); + + /* FORK ANFANG */ + synchronized (this) { + writeLog("wait "+ forkOrig.thNo); + noOfThread--; + res = forkOrig.join(); + synchronized (usedTasks) { + if (this.myIsCancelled()) { + return new HashSet<>(); + } + } + //noOfThread++; + forkOrig.writeLog("final Orig -1"); + forkOrig.closeLogFile(); + //Set> fork_res = forkOrig.join(); + writeLog("JoinOrig " + new Integer(forkOrig.thNo).toString()); + //noOfThread--; an das Ende von compute verschoben + //add_res.add(fork_res); + }; + /* FORK ENDE */ + + forks.forEach(x -> writeLog("wait: " + x.thNo)); + for(TypeUnify2Task fork : forks) { + synchronized (this) { + noOfThread--; + Set> fork_res = fork.join(); + synchronized (usedTasks) { + if (this.myIsCancelled()) { + return new HashSet<>(); + } + } + //noOfThread++; + writeLog("Join " + new Integer(fork.thNo).toString()); + //noOfThread--; an das Ende von compute verschoben + writeLog("fork_res: " + fork_res.toString()); + writeLog(new Boolean((isUndefinedPairSetSet(fork_res))).toString()); + add_res.add(fork_res); + if (!isUndefinedPairSetSet(fork_res)) { + aParDef.add(fork.getNextSetElement()); + } + fork.writeLog("final -1"); + fork.closeLogFile(); + }; + } + //noOfThread++; + } else { + if(parallel && (variance == 2) && noOfThread <= MaxNoOfThreads) { + writeLog("var2einstieg"); + Set forks = new HashSet<>(); + Set newEqOrig = new HashSet<>(eq); + Set> newElemsOrig = new HashSet<>(elems); + List>> newOderConstraintsOrig = new ArrayList<>(oderConstraints); + newElemsOrig.add(a); + + /* FORK ANFANG */ + TypeUnify2Task forkOrig = new TypeUnify2Task(newElemsOrig, newEqOrig, newOderConstraintsOrig, a, fc, parallel, logFile, log, rekTiefe, urm, usedTasks, new HashSet<>(methodSignatureConstraint)); + //forks.add(forkOrig); + synchronized(usedTasks) { + if (this.myIsCancelled()) { + return new HashSet<>(); + } + forkOrig.fork(); + } + /* FORK ENDE */ + + synchronized (this) { + writeLog("a in " + variance + " "+ a); + writeLog("nextSetasListRest: " + nextSetasListRest.toString()); + } + while (!nextSetasListRest.isEmpty()) { + Set nSaL = nextSetasListRest.remove(0); + nextSetasList.remove(nSaL); //PL einkommentiert 20-02-03 + Set newEq = new HashSet<>(eq); + Set> newElems = new HashSet<>(elems); + List>> newOderConstraints = new ArrayList<>(oderConstraints); + newElems.add(nSaL); + TypeUnify2Task fork = new TypeUnify2Task(newElems, newEq, newOderConstraints, nSaL, fc, parallel, logFile, log, rekTiefe, urm, usedTasks, methodSignatureConstraint); + forks.add(fork); + synchronized(usedTasks) { + if (this.myIsCancelled()) { + return new HashSet<>(); + } + fork.fork(); + } + } + //res = unify2(newElemsOrig, newEqOrig, newOderConstraintsOrig, fc, parallel, rekTiefe); + + /* FORK ANFANG */ + synchronized (this) { + writeLog("wait "+ forkOrig.thNo); + noOfThread--; + res = forkOrig.join(); + synchronized (usedTasks) { + if (this.myIsCancelled()) { + return new HashSet<>(); + } + } + //noOfThread++; + forkOrig.writeLog("final Orig 2"); + forkOrig.closeLogFile(); + //Set> fork_res = forkOrig.join(); + writeLog("JoinOrig " + new Integer(forkOrig.thNo).toString()); + //noOfThread--; an das Ende von compute verschoben + //add_res.add(fork_res); //vermutlich falsch + }; + /* FORK ENDE */ + forks.forEach(x -> writeLog("wait: " + x.thNo)); + for(TypeUnify2Task fork : forks) { + synchronized (this) { + noOfThread--; + Set> fork_res = fork.join(); + synchronized (usedTasks) { + if (this.myIsCancelled()) { + return new HashSet<>(); + } + } + //noOfThread++; + writeLog("Join " + new Integer(fork.thNo).toString()); + //noOfThread--; an das Ende von compute verschoben + add_res.add(fork_res); + fork.writeLog("final 2"); + fork.closeLogFile(); + }; + } + //noOfThread++; + } else {//parallel = false oder MaxNoOfThreads ist erreicht, sequentiell weiterarbeiten + elems.add(a); //PL 2019-01-16 muss das wirklich hin steht schon in Zeile 859 ja braucht man siehe Zeile 859 + res = unify2(elems, eq, oderConstraints, fc, parallel, rekTiefe, new HashSet<>(methodSignatureConstraint)); + }}} + + //Ab hier alle parallele Berechnungen wieder zusammengeführt. + if (oderConstraint) {//Wenn weiteres Element nextSetasList genommen wird, muss die vorherige methodsignatur geloescht werden + methodSignatureConstraint.removeAll(((Constraint)a).getmethodSignatureConstraint()); + //System.out.println("REMOVE: " +methodSignatureConstraint); + } + if (!isUndefinedPairSetSet(res) && isUndefinedPairSetSet(result)) { + //wenn korrektes Ergebnis gefunden alle Fehlerfaelle loeschen + result = res; + } + else { + if ((isUndefinedPairSetSet(res) && isUndefinedPairSetSet(result)) + || (!isUndefinedPairSetSet(res) && !isUndefinedPairSetSet(result)) + || result.isEmpty()) { + + if ((!result.isEmpty() && !res.isEmpty() && !isUndefinedPairSetSet(res) && !isUndefinedPairSetSet(result)) //korrekte Loesungen aus und-constraints + && (a.stream().map(x-> (x.getBasePair() != null)).reduce(true, (x, y) -> (x && y)))) //bei oder-Constraints nicht ausfuehren + { + //TODO: PL 2019-01-15: Bug 129: Im Moment wird nur das Maximum und das Minimum des aktuellen Elements betrachtet. + //Die zu vereinigenden Mengen können mehrere Elemente enthalten. Das ist bisher nicht berücksichtigt + + //Alle Variablen bestimmen die nicht hinzugefügt wurden in a + //PL 2018-12-28: Hier gab es eine ClassCastException, war nicht reproduzierbar + System.out.println(""); + List vars_a = + a.stream().filter(x -> ((x.getLhsType().getName().equals(x.getBasePair().getLhsType().getName()) + && (x.getLhsType() instanceof PlaceholderType) && (x.getBasePair().getLhsType() instanceof PlaceholderType)) + || ((x.getLhsType().getName().equals(x.getBasePair().getRhsType().getName())) + && (x.getLhsType() instanceof PlaceholderType) && (x.getBasePair().getRhsType() instanceof PlaceholderType))) + ) + .map(y -> (PlaceholderType)y.getLhsType()).collect(Collectors.toCollection(ArrayList::new)); + Set fstElemRes = res.iterator().next(); + Set compRes = fstElemRes.stream().filter(x -> vars_a.contains(((PlaceholderType)x.getLhsType()))).collect(Collectors.toCollection(HashSet::new)); + + //Alle Variablen bestimmen die nicht hinzugefügt wurden in a_last + //System.out.println(a_last); + + try {//PL eingefuegt 2019-03-06 da bei map mmer wieder Nullpointer kamen + a_last.forEach(x -> {writeLog("a_last_elem:" + x + " basepair: " + x.getBasePair());});//PL 2019-05-13 ins try hinzugefuegt Nullpointer-Exception ist in der Zeile aufgetaucht. + List varsLast_a = + a_last.stream().filter(x -> ((x.getLhsType().getName().equals(x.getBasePair().getLhsType().getName()) + && (x.getLhsType() instanceof PlaceholderType) && (x.getBasePair().getLhsType() instanceof PlaceholderType)) + || ((x.getLhsType().getName().equals(x.getBasePair().getRhsType().getName()))) + && (x.getLhsType() instanceof PlaceholderType) && (x.getBasePair().getRhsType() instanceof PlaceholderType))) + .map(y -> (PlaceholderType)y.getLhsType()).collect(Collectors.toCollection(ArrayList::new)); + //[(java.util.Vector <. gen_aq, , 1), (CEK =. ? extends gen_aq, 1)] KANN VORKOMMEN + //erstes Element genügt, da vars immer auf die gleichen Elemente zugeordnet werden muessen + Set fstElemResult = result.iterator().next(); + Set compResult = fstElemResult.stream().filter(x -> varsLast_a.contains(((PlaceholderType)x.getLhsType()))).collect(Collectors.toCollection(HashSet::new));; + if (variance == 1) { + writeLog("a_last:" + a_last + " a: " + a); + writeLog("varsLast_a:" + varsLast_a + " vars_a: " + vars_a); + writeLog("compResult:" + compResult + " compRes: " + compRes); + int resOfCompare = oup.compare(compResult, compRes); + if (resOfCompare == -1) { + writeLog("Geloescht result: " + result); + result = res; + } else { + if (resOfCompare == 0) { + result.addAll(res); + } //else { + if (resOfCompare == 1) { + writeLog("Geloescht res: " + res); + //result = result; + }}} + else { if (variance == -1) { + writeLog("a_last:" + a_last + " a: " + a); + writeLog("varsLast_a:" + varsLast_a + " vars_a: " + vars_a); + writeLog("compResult:" + compResult + " compRes: " + compRes); + int resOfCompare = oup.compare(compResult, compRes); + if (resOfCompare == 1) { + writeLog("Geloescht result: " + result); + result = res; + } else { + if (resOfCompare == 0) { + result.addAll(res); + } else { + if (resOfCompare == -1) { + writeLog("Geloescht res: " + res); + //result = result; + }}}} + else { if (variance == 0) { + writeLog("RES var=1 ADD:" + result.toString() + " " + res.toString()); + result.addAll(res); + }}} + } + catch (NullPointerException e) { + writeLog("NullPointerException: " + a_last.toString()); + } + } + else { + //alle Fehlerfaelle und alle korrekten Ergebnis jeweils adden + writeLog("RES Fst: result: " + result.toString() + " res: " + res.toString()); + result.addAll(res); + } + } + //else { + //wenn Korrekte Ergebnisse da und Feherfälle dazukommen Fehlerfälle ignorieren + // if (isUndefinedPairSetSet(res) && !isUndefinedPairSetSet(result)) { + // result = result; + // } + //} + } + + if (parallel) { + for (Set> par_res : add_res) { + if (!isUndefinedPairSetSet(par_res) && isUndefinedPairSetSet(result)) { + //wenn korrektes Ergebnis gefunden alle Fehlerfaelle loeschen + result = par_res; + if (!par_res.isEmpty() && par_res.iterator().next() instanceof WildcardType) { + System.out.println(""); + } + } + else { + if ((isUndefinedPairSetSet(par_res) && isUndefinedPairSetSet(result)) + || (!isUndefinedPairSetSet(par_res) && !isUndefinedPairSetSet(result)) + || result.isEmpty()) { + //alle Fehlerfaelle und alle korrekten Ergebnis jeweils adden + writeLog("RES var1 ADD:" + result.toString() + " " + par_res.toString()); + result.addAll(par_res); + } + } + } + //break; + } + + /* auskommentiert um alle Max und min Betrachtung auszuschalten ANFANG */ + if (!result.isEmpty() && (!isUndefinedPairSetSet(res) || !aParDef.isEmpty())) { + if (nextSetasList.iterator().hasNext() && nextSetasList.iterator().next().stream().filter(x -> x.getLhsType().getName().equals("B")).findFirst().isPresent() && nextSetasList.size()>1) + System.out.print(""); + Iterator> nextSetasListIt = new ArrayList>(nextSetasList).iterator(); + if (variance == 1) { + System.out.println(""); + writeLog("a: " + rekTiefe + " variance: " + variance + a.toString()); + writeLog("aParDef: " + aParDef.toString()); + aParDef.add(a); + Iterator> aParDefIt = aParDef.iterator(); + if (oderConstraint) { + nextSetasList.removeAll(nextSetasListOderConstraints); + nextSetasListOderConstraints = new ArrayList<>(); + writeLog("Removed: " + nextSetasListOderConstraints); + while(aParDefIt.hasNext()) { + Set a_new = aParDefIt.next(); + List> smallerSetasList = oup.smallerThan(a_new, nextSetasList); + List> notInherited = smallerSetasList.stream() + .filter(x -> !((Constraint)x).isInherited()) + .collect(Collectors.toCollection(ArrayList::new)); + List> notErased = new ArrayList<>(); + notInherited.stream().forEach(x -> { notErased.addAll(oup.smallerEqThan(x, smallerSetasList)); }); + List> erased = new ArrayList<>(smallerSetasList); + erased.removeAll(notErased); + nextSetasList.removeAll(erased); + + writeLog("Removed: " + erased); + + writeLog("Not Removed: " + nextSetasList); + + } + } + else { + while(aParDefIt.hasNext()) { + //nextSetasListIt = nextSetasList.iterator(); Sollte eingefuegt werden PL 2020-04-28 + Set a_new = aParDefIt.next(); + List> erased = oup.smallerEqThan(a_new, nextSetasList); + nextSetasList.removeAll(erased); + + writeLog("Removed: " + erased); + + writeLog("Not Removed: " + nextSetasList); + } + } + } + else { if (variance == -1) { + System.out.println(""); + writeLog("a: " + rekTiefe + " variance: " + variance + a.toString()); + writeLog("aParDef: " + aParDef.toString()); + aParDef.add(a); + Iterator> aParDefIt = aParDef.iterator(); + if (oderConstraint) { + nextSetasList.removeAll(nextSetasListOderConstraints); + writeLog("Removed: " + nextSetasListOderConstraints); + nextSetasListOderConstraints = new ArrayList<>(); + while(aParDefIt.hasNext()) { + Set a_new = aParDefIt.next(); + List> greaterSetasList = oup.greaterThan(a_new, nextSetasList); + + //a_new muss hingefuegt werden, wenn es nicht vererbt ist, dann wird es spaeter wieder geloescht + if (!((Constraint)a_new).isInherited()) { + greaterSetasList.add(a_new); + } + List> notInherited = greaterSetasList.stream() + .filter(x -> !((Constraint)x).isInherited()) + .collect(Collectors.toCollection(ArrayList::new)); + List> notErased = new ArrayList<>(); + + //Wenn x nicht vererbt ist, beginnt beim naechstgroesseren Element die naechste Ueberladung + notInherited.stream().forEach(x -> { notErased.addAll(oup.greaterEqThan(x, greaterSetasList)); }); + + //das kleineste Element ist das Element von dem a_new geerbt hat + //muss deshalb geloescht werden + Iterator> notErasedIt = notErased.iterator(); + if (notErasedIt.hasNext()) { + Set min = oup.min(notErasedIt); + notErased.remove(min); + notErased.remove(((Constraint)min).getExtendConstraint()); + } + + List> erased = new ArrayList<>(greaterSetasList); + erased.removeAll(notErased); + nextSetasList.removeAll(erased); + + writeLog("Removed: " + erased); + + writeLog("Not Removed: " + nextSetasList); + + } + } + else { + while(aParDefIt.hasNext()) { + //nextSetasListIt = nextSetasList.iterator(); Sollte eingefuegt werden PL 2020-04-28 + Set a_new = aParDefIt.next(); + List> erased = oup.greaterEqThan(a_new, nextSetasList); + + nextSetasList.removeAll(erased); + + writeLog("Removed: " + erased); + + writeLog("Not Removed: " + nextSetasList); + } + } + } + else { if (variance == 0) { + writeLog("a: " + rekTiefe + " variance: " + variance + a.toString()); + if (!oderConstraint) { + break; + } + else { + nextSetasList.removeAll(nextSetasListOderConstraints); + nextSetasListOderConstraints = new ArrayList<>(); + writeLog("Removed: " + nextSetasListOderConstraints); + List> smallerSetasList = oup.smallerThan(a, nextSetasList); + List> notInherited = smallerSetasList.stream() + .filter(x -> !((Constraint)x).isInherited()) + .collect(Collectors.toCollection(ArrayList::new)); + List> notErased = new ArrayList<>(); + notInherited.stream().forEach(x -> { notErased.addAll(oup.smallerEqThan(x, smallerSetasList)); }); + List> erased = new ArrayList<>(smallerSetasList); + erased.removeAll(notErased); + nextSetasList.removeAll(erased); + + writeLog("Removed: " + erased); + + writeLog("Not Removed: " + nextSetasList); + + } + + } + else { if (variance == 2) { + }}} + writeLog("a: " + rekTiefe + " variance: " + variance + a.toString()); + } + } + /* auskommentiert um alle Max und min Betrachtung auszuschalten ENDE */ + + if (isUndefinedPairSetSet(res) && aParDef.isEmpty()) { + int nofstred= 0; + Set abhSubst = res.stream() + .map(b -> + b.stream() + .map(x -> x.getAllSubstitutions()) + .reduce((y,z) -> { y.addAll(z); return y;}).get()) + .reduce((y,z) -> { y.addAll(z); return y;}).get(); + abhSubst.addAll( + res.stream() + .map(b -> + b.stream() + .map(x -> x.getThisAndAllBases()) //getAllBases durch getThisAndAllBases ersetzt, weil auch im UnifyPair selbst schon ein Fehler liegen kann. + .reduce((y,z) -> { y.addAll(z); return y;}).get()) + .reduce((y,z) -> { y.addAll(z); return y;}).get() + ); + Set b = a;//effective final a + Set durchschnitt = abhSubst.stream() + .filter(x -> b.contains(x)) + //.filter(y -> abhSubst.contains(y)) + .collect(Collectors.toCollection(HashSet::new)); + //Set vars = durchschnitt.stream().map(x -> (PlaceholderType)x.getLhsType()).collect(Collectors.toCollection(HashSet::new)); + int len = nextSetasList.size(); + Set undefRes = res.stream().reduce((y,z) -> { y.addAll(z); return y;}).get(); //flatten aller undef results + Set, UnifyPair>> reducedUndefResSubstGroundedBasePair = undefRes.stream() + .map(x -> { Set su = x.getAllSubstitutions(); //alle benutzten Substitutionen + su.add(x.getGroundBasePair()); // urspruengliches Paar + su.removeAll(durchschnitt); //alle aktuell genänderten Paare entfernen + return new Pair<>(su, x.getGroundBasePair());}) + .collect(Collectors.toCollection(HashSet::new)); + if (res.size() > 1) { + System.out.println(); + } + writeLog("nextSetasList vor filter-Aufruf: " + nextSetasList); + if (!oderConstraint) {//PL 2023-02-08 eingefuegt: Bei oderconstraints sind Subststitutionen nicht als Substitutionen in idesem Sinne zu sehen + nextSetasList = nextSetasList.stream().filter(x -> { + //Boolean ret = false; + //for (PlaceholderType var : vars) { + // ret = ret || x.stream().map(b -> b.getLhsType().equals(var)).reduce((c,d) -> c || d).get(); + //} + return (!x.containsAll(durchschnitt)); + })//.filter(y -> couldBecorrect(reducedUndefResSubstGroundedBasePair, y)) //fuer testzwecke auskommentiert um nofstred zu bestimmen PL 2018-10-10 + .collect(Collectors.toCollection(ArrayList::new)); + } + writeLog("nextSetasList nach filter-Aufruf: " + nextSetasList); + nofstred = nextSetasList.size(); + //NOCH NICHT korrekt PL 2018-10-12 + //nextSetasList = nextSetasList.stream().filter(y -> couldBecorrect(reducedUndefResSubstGroundedBasePair, y)) + // .collect(Collectors.toCollection(ArrayList::new)); + writeLog("res (undef): " + res.toString()); + writeLog("abhSubst: " + abhSubst.toString()); + writeLog("a2: " + rekTiefe + " " + a.toString()); + writeLog("Durchschnitt: " + durchschnitt.toString()); + writeLog("nextSet: " + nextSet.toString()); + writeLog("nextSetasList: " + nextSetasList.toString()); + writeLog("Number first erased Elements (undef): " + (len - nofstred)); + writeLog("Number second erased Elements (undef): " + (nofstred- nextSetasList.size())); + writeLog("Number erased Elements (undef): " + (len - nextSetasList.size())); + noAllErasedElements = noAllErasedElements + (len - nextSetasList.size()); + writeLog("Number of all erased Elements (undef): " + noAllErasedElements.toString()); + noBacktracking++; + writeLog("Number of Backtracking: " + noBacktracking); + System.out.println(""); + } + //if (nextSetasList.size() == 0 && isUndefinedPairSetSet(result) && nextSet.size() > 1) { + // return result; + //} + //else { + // result.removeIf(y -> isUndefinedPairSet(y)); + //} + //else result.stream().filter(y -> !isUndefinedPairSet(y)); + writeLog("res: " + res.toString()); + } + //2020-02-02: if (variance ==2) Hier Aufruf von filterOverriding einfuegen + writeLog("Return computeCR: " + result.toString()); + return result; + } + + /** + * checks if there is for (a = ty) \in a in sameEqSet a constradiction + * @param a Set of actual element of constraints with a =. ty \in a + * @param sameEqSet Set of constraints where a <. ty' and ty' <. a + * @param result set of results which contains correct solution s and the + * the error constraints. Error constraints are added + * @result contradiction of (a = ty) in sameEqSet + */ + protected Boolean checkNoContradiction(Set a, Set sameEqSet, Set> result) { + + //optAPair enthaelt ggf. das Paar a = ty' \in a + //unterscheidet sich von optOrigPair, da dort a = ty + Optional optAPair = + a.stream().filter(x -> (x.getPairOp().equals(PairOperator.EQUALSDOT))) + .filter(x -> //Sicherstellen, dass bei a = ty a auch wirklich die gesuchte Typvariable ist + x.getLhsType().equals(x.getBasePair().getLhsType()) || + x.getLhsType().equals(x.getBasePair().getRhsType())) + .findFirst(); + + if (optAPair.isPresent()) {//basepair ist entweder a <. Ty oder ty <. a + UnifyPair aPair = optAPair.get(); + //writeLog("optOrigPair: " + optOrigPair + " " + "aPair: " + aPair+ " " + "aPair.basePair(): " + aPair.getBasePair()); + + writeLog("checkA: " + aPair + "sameEqSet: " + sameEqSet); + for (UnifyPair sameEq : sameEqSet) { + if (sameEq.getLhsType() instanceof PlaceholderType) { + Set localEq = new HashSet<>(); + Set unitedSubst = new HashSet<>(aPair.getAllSubstitutions()); + unitedSubst.addAll(aPair.getAllBases()); + unitedSubst.addAll(sameEq.getAllSubstitutions()); + unitedSubst.addAll(sameEq.getAllBases()); + localEq.add(new UnifyPair(aPair.getRhsType(), sameEq.getRhsType(), sameEq.getPairOp(), unitedSubst, null)); + finalresult = false; + Set> localRes = unify(localEq, new ArrayList<>(), fc, false, 0, new HashSet<>()); + finalresult = true; + if (isUndefinedPairSetSet(localRes)) { + if (result.isEmpty() || isUndefinedPairSetSet(result)) { + result.addAll(localRes); + } + writeLog("FALSE: " + aPair + "sameEqSet: " + sameEqSet); + return false; + } + } + else { + Set localEq = new HashSet<>(); + Set unitedSubst = new HashSet<>(aPair.getAllSubstitutions()); + unitedSubst.addAll(aPair.getAllBases()); + unitedSubst.addAll(sameEq.getAllSubstitutions()); + unitedSubst.addAll(sameEq.getAllBases()); + localEq.add(new UnifyPair(sameEq.getLhsType(), aPair.getRhsType(), sameEq.getPairOp(), unitedSubst, null)); + finalresult = false; + Set> localRes = unify(localEq, new ArrayList<>(), fc, false, 0, new HashSet<>()); + finalresult = true; + if (isUndefinedPairSetSet(localRes)) { + if (result.isEmpty() || isUndefinedPairSetSet(result)) { + result.addAll(localRes); + } + writeLog("FALSE: " + aPair + "sameEqSet: " + sameEqSet); + return false; + } + } + } + writeLog("TRUE: " + aPair + "sameEqSet: " + sameEqSet); + return true; + } + return true; + } + + + protected boolean couldBecorrect(Set, UnifyPair>> reducedUndefResSubstGroundedBasePair, Set nextElem) { + return reducedUndefResSubstGroundedBasePair.stream() + .map(pair -> { + Set reducedAbhSubst = pair.getKey(); + reducedAbhSubst.addAll(nextElem); + Optional> substRes = rules.subst(reducedAbhSubst); + if (!substRes.isPresent()) { + return true; + } + //PL 2018-10-12 + //Evtl. zurest applyTypeUnification aufrufen + //evtl auch unify aufrufen + else { + UnifyPair checkPair = substRes.get().stream() + .filter(x -> x.getGroundBasePair().equals(pair.getValue().get())).findFirst().get(); + if (((checkPair.getLhsType() instanceof PlaceholderType) || (checkPair.getRhsType() instanceof PlaceholderType)) + && (checkPair.getPairOp() == PairOperator.SMALLERDOT || checkPair.getPairOp() == PairOperator.SMALLERDOTWC)) + { + /* + Set setCheckPair = new HashSet<>(); + setCheckPair.add(checkPair); + Set setReturnCheckPair = applyTypeUnificationRules(setCheckPair, fc); + UnifyPair checkPair1 = setReturnCheckPair.iterator().next(); + Set up = new HashSet<>(); + up.add(checkPair1); + Set undef = new HashSet<>(); + */ + PairOperator pairOp = checkPair.getPairOp(); + UnifyType lhsType = checkPair.getLhsType(); + UnifyType rhsType = checkPair.getRhsType(); + ///* Case 1: (a <. Theta') + if ((((pairOp == PairOperator.SMALLERDOT) || (pairOp == PairOperator.SMALLERNEQDOT)) && lhsType instanceof PlaceholderType) + // Case 2: (a <.? ? ext Theta') + || (pairOp == PairOperator.SMALLERDOTWC && lhsType instanceof PlaceholderType && rhsType instanceof ExtendsType) + // Case 3: (a <.? ? sup Theta') + || (pairOp == PairOperator.SMALLERDOTWC && lhsType instanceof PlaceholderType && rhsType instanceof SuperType) + + // Case 4 was replaced by an inference rule + // Case 4: (a <.? Theta') + || (pairOp == PairOperator.SMALLERDOTWC && lhsType instanceof PlaceholderType) + // Case 5: (Theta <. a) + || ((pairOp == PairOperator.SMALLERDOT) && rhsType instanceof PlaceholderType) + // Case 6 was replaced by an inference rule. + // Case 6: (? ext Theta <.? a) + || (pairOp == PairOperator.SMALLERDOTWC && lhsType instanceof ExtendsType && rhsType instanceof PlaceholderType) + // Case 7 was replaced by an inference rule + // Case 7: (? sup Theta <.? a) + || (pairOp == PairOperator.SMALLERDOTWC && lhsType instanceof SuperType && rhsType instanceof PlaceholderType) + // Case 8: (Theta <.? a) + || (pairOp == PairOperator.SMALLERDOTWC && rhsType instanceof PlaceholderType) + //reduceWildcardLow + || (pairOp == PairOperator.SMALLERDOTWC && (lhsType instanceof ExtendsType) && (rhsType instanceof ExtendsType)) + //reduceWildcardLowRight + || ((pairOp == PairOperator.SMALLERDOTWC) && (lhsType instanceof ReferenceType) && (rhsType instanceof ExtendsType)) + //reduceWildcardUp + || ((pairOp == PairOperator.SMALLERDOTWC) && (lhsType instanceof SuperType) && (rhsType instanceof SuperType)) + //reduceWildcardUpRight + || ((pairOp == PairOperator.SMALLERDOTWC) && (lhsType instanceof ReferenceType) && (rhsType instanceof SuperType)) + //reduceFunN + || (((pairOp == PairOperator.SMALLERDOT) || (pairOp == PairOperator.EQUALSDOT)) + //PL 2017-10-03 hinzugefuegt + //da Regel auch fuer EQUALSDOT anwendbar + && (lhsType instanceof FunNType) && (rhsType instanceof FunNType)) + //greaterFunN + || ((pairOp== PairOperator.SMALLERDOT) && (lhsType instanceof FunNType) && (rhsType instanceof PlaceholderType)) + //smallerFunN + || ((pairOp == PairOperator.SMALLERDOT) && (lhsType instanceof PlaceholderType && rhsType instanceof FunNType)) + //reduceTph + || ((pairOp == PairOperator.SMALLERDOTWC) && (lhsType instanceof PlaceholderType && rhsType instanceof ReferenceType)) + //reduceTphExt + || ((pairOp == PairOperator.SMALLERDOTWC) && (lhsType instanceof ExtendsType) && rhsType instanceof PlaceholderType) + //reduceTphSup + || ((pairOp == PairOperator.SMALLERDOTWC) && (lhsType instanceof SuperType) && rhsType instanceof PlaceholderType)) { + return true; + } + // Case unknown: If a pair fits no other case, then the type unification has failed. + // Through application of the rules, every pair should have one of the above forms. + // Pairs that do not have one of the aboves form are contradictory. + else { + writeLog("Second erase:" +checkPair.toString()); + return false; + } + //*/ + } else { + //Pair type <. ? extends ? extends type betrachten TODO PL 2018-10-09 + }} + return true;}).reduce((xx, yy) -> xx || yy).get(); + } + + protected boolean isUndefinedPairSet(Set s) { + if (s.size() >= 1 ) { + Boolean ret = s.stream().map(x -> x.isUndefinedPair()).reduce(true, (x,y)-> (x && y)); + return ret; + } + else { + return false; + } + } + + protected boolean isUndefinedPairSetSet(Set> s) { + if (s.size() >= 1) { + Boolean ret = s.stream(). map(x -> isUndefinedPairSet(x)).reduce(true, (x,y)-> (x && y)); + return ret; + } + return false; + + } + /** + * Checks whether a set of pairs is in solved form. + * @param eqPrimePrime The set of pair + * @return True if in solved form, false otherwise. + */ + protected boolean isSolvedForm(Set eqPrimePrime) { + for(UnifyPair pair : eqPrimePrime) { + UnifyType lhsType = pair.getLhsType(); + UnifyType rhsType = pair.getRhsType(); + + if(!(lhsType instanceof PlaceholderType)) + return false; + + // If operator is not equals, both sides must be placeholders + if(pair.getPairOp() != PairOperator.EQUALSDOT && !(rhsType instanceof PlaceholderType)) + return false; + } + return true; + } + + /** + * Repeatedly applies type unification rules to a set of equations. + * This is step one of the unification algorithm. + * @return The set of pairs that results from repeated application of the inference rules. + */ + public Set applyTypeUnificationRules(Set eq, IFiniteClosure fc) { + + /* + * Rule Application Strategy: + * + * 1. Swap all pairs and erase all erasable pairs + * 2. Apply all possible rules to a single pair, then move it to the result set. + * Iterating over pairs first, then iterating over rules prevents the application + * of rules to a "finished" pair over and over. + * 2.1 Apply all rules repeatedly except for erase rules. If + * the application of a rule creates new pairs, check immediately + * against the erase rules. + */ + + + LinkedHashSet targetSet = new LinkedHashSet(); + LinkedList eqQueue = new LinkedList<>(); + + /* + * Swap all pairs and erase all erasable pairs + */ + eq.forEach(x -> swapAddOrErase(x, fc, eqQueue)); + + /* + * Apply rules until the queue is empty + */ + while(!eqQueue.isEmpty()) { + UnifyPair pair = eqQueue.pollFirst(); + + // ReduceUp, ReduceLow, ReduceUpLow + Optional opt = rules.reduceUpLow(pair); + opt = opt.isPresent() ? opt : rules.reduceLow(pair); + opt = opt.isPresent() ? opt : rules.reduceUp(pair); + opt = opt.isPresent() ? opt : rules.reduceWildcardLow(pair); + opt = opt.isPresent() ? opt : rules.reduceWildcardLowRight(pair); + opt = opt.isPresent() ? opt : rules.reduceWildcardUp(pair); + opt = opt.isPresent() ? opt : rules.reduceWildcardUpRight(pair); + //PL 2018-03-06 auskommentiert muesste falsch sein vgl. JAVA_BSP/Wildcard6.java + //opt = opt.isPresent() ? opt : rules.reduceWildcardLowUp(pair); + //opt = opt.isPresent() ? opt : rules.reduceWildcardUpLow(pair); + //opt = opt.isPresent() ? opt : rules.reduceWildcardLeft(pair); + + // Reduce TPH + opt = opt.isPresent() ? opt : rules.reduceTph(pair); + + // One of the rules has been applied + if(opt.isPresent()) { + swapAddOrErase(opt.get(), fc, eqQueue); + continue; + } + + // Reduce1, Reduce2, ReduceExt, ReduceSup, ReduceEq + //try { + // logFile.write("PAIR1 " + pair + "\n"); + // logFile.flush(); + //} + //catch (IOException e) { } + + Optional> optSet = rules.reduce1(pair, fc); + optSet = optSet.isPresent() ? optSet : rules.reduce2(pair); + optSet = optSet.isPresent() ? optSet : rules.reduceExt(pair, fc); + optSet = optSet.isPresent() ? optSet : rules.reduceSup(pair, fc); + optSet = optSet.isPresent() ? optSet : rules.reduceEq(pair); + + // ReduceTphExt, ReduceTphSup + optSet = optSet.isPresent() ? optSet : rules.reduceTphExt(pair); + optSet = optSet.isPresent() ? optSet : rules.reduceTphSup(pair); + + + // FunN Rules + optSet = optSet.isPresent() ? optSet : rules.reduceFunN(pair); + optSet = optSet.isPresent() ? optSet : rules.greaterFunN(pair, fc); + optSet = optSet.isPresent() ? optSet : rules.smallerFunN(pair); + + // One of the rules has been applied + if(optSet.isPresent()) { + optSet.get().forEach(x -> swapAddOrErase(x, fc, eqQueue)); + continue; + } + + // Adapt, AdaptExt, AdaptSup + //try { + // logFile.write("PAIR2 " + pair + "\n"); + // logFile.flush(); + //} + //catch (IOException e) { } + opt = rules.adapt(pair, fc); + opt = opt.isPresent() ? opt : rules.adaptExt(pair, fc); + opt = opt.isPresent() ? opt : rules.adaptSup(pair, fc); + + // One of the rules has been applied + if(opt.isPresent()) { + swapAddOrErase(opt.get(), fc, eqQueue); + continue; + } + + // None of the rules has been applied + targetSet.add(pair); + } + + return targetSet; + } + + /** + * Applies the rule swap to a pair if possible. Then adds the pair to the set if no erase rule applies. + * If an erase rule applies, the pair is not added (erased). + * @param pair The pair to swap and add or erase. + * @param collection The collection to which the pairs are added. + */ + protected void swapAddOrErase(UnifyPair pair, IFiniteClosure fc, Collection collection) { + Optional opt = rules.swap(pair); + UnifyPair pair2 = opt.isPresent() ? opt.get() : pair; + + if(rules.erase1(pair2, fc) || rules.erase3(pair2) || rules.erase2(pair2, fc)) + return; + + collection.add(pair2); + } + + /** + * Splits the equation eq into a set eq1s where both terms are type variables, + * and a set eq2s where one of both terms is not a type variable. + * @param eq Set of pairs to be splitted. + * @param eq1s Subset of eq where both terms are type variables. + * @param eq2s eq/eq1s. + */ + protected void splitEq(Set eq, Set eq1s, Set eq2s) { + for(UnifyPair pair : eq) + if(pair.getLhsType() instanceof PlaceholderType && pair.getRhsType() instanceof PlaceholderType) + eq1s.add(pair); + else + eq2s.add(pair); + } + + /** + * Creates sets of pairs specified in the fourth step. Does not calculate cartesian products. + * @param undefined All pairs that did not match one of the 8 cases are added to this set. + * @return The set of the eight cases (without empty sets). Each case is a set, containing sets generated + * from the pairs that matched the case. Each generated set contains singleton sets or sets with few elements + * (as in case 1 where sigma is added to the innermost set). + */ + protected Set>>> calculatePairSets(Set eq2s, List>> oderConstraintsInput, IFiniteClosure fc, Set undefined, List>> oderConstraintsOutput) { + writeLog("eq2s: " + eq2s.toString()); + oderConstraintsOutput.addAll(oderConstraintsInput); + List>>> result = new ArrayList<>(9); + + // Init all 8 cases + 9. Case: oderConstraints + for(int i = 0; i < 9; i++) + result.add(new HashSet<>()); + + ArrayList eq2sprime = new ArrayList<>(eq2s); + Iterator eq2sprimeit = eq2sprime.iterator(); + ArrayList eq2sAsListFst = new ArrayList<>(); + ArrayList eq2sAsListSnd = new ArrayList<>(); + ArrayList eq2sAsListThird = new ArrayList<>(); + ArrayList eq2sAsListFourth = new ArrayList<>(); + ArrayList eq2sAsListBack = new ArrayList<>(); + ArrayList eq2sAsList = new ArrayList<>(); + Boolean first = true; + while(eq2sprimeit.hasNext()) {// alle mit Variance != 0 nach vorne schieben + UnifyPair up = eq2sprimeit.next(); + if ((up.getLhsType() instanceof PlaceholderType && + ((PlaceholderType)up.getLhsType()).getVariance() == 1 && + !((PlaceholderType)up.getLhsType()).isInnerType()) || + (up.getRhsType() instanceof PlaceholderType && + ((PlaceholderType)up.getRhsType()).getVariance() == -1) && + !((PlaceholderType)up.getRhsType()).isInnerType()) + { + eq2sAsListFst.add(up); + eq2s.remove(up); + } + else if ((up.getLhsType() instanceof PlaceholderType && ((PlaceholderType)up.getLhsType()).getVariance() == 1 && ((PlaceholderType)up.getLhsType()).isInnerType()) + || (up.getRhsType() instanceof PlaceholderType && ((PlaceholderType)up.getRhsType()).getVariance() == -1) && ((PlaceholderType)up.getRhsType()).isInnerType()) { + eq2sAsListSnd.add(up); + eq2s.remove(up); + } + else if ((up.getLhsType() instanceof PlaceholderType && + ((PlaceholderType)up.getLhsType()).getVariance() == -1 && + !((PlaceholderType)up.getLhsType()).isInnerType()) || + (up.getRhsType() instanceof PlaceholderType && + ((PlaceholderType)up.getRhsType()).getVariance() == -1) && + !((PlaceholderType)up.getRhsType()).isInnerType()) + { + eq2sAsListThird.add(up); + eq2s.remove(up); + } + else if ((up.getLhsType() instanceof PlaceholderType && ((PlaceholderType)up.getLhsType()).getVariance() == -1 && ((PlaceholderType)up.getLhsType()).isInnerType()) + || (up.getRhsType() instanceof PlaceholderType && ((PlaceholderType)up.getRhsType()).getVariance() == 1) && ((PlaceholderType)up.getRhsType()).isInnerType()) { + eq2sAsListFourth.add(up); + eq2s.remove(up); + } + else if ((up.getLhsType() instanceof PlaceholderType && ((PlaceholderType)up.getLhsType()).isInnerType()) + || (up.getRhsType() instanceof PlaceholderType && ((PlaceholderType)up.getRhsType()).isInnerType())) { + eq2sAsListBack.add(up); + eq2s.remove(up); + } + } + //if (eq2sAsListFst.isEmpty()) + { + List>> oderConstraintsVariance = oderConstraintsOutput.stream() //Alle Elemente rauswerfen, die Variance 0 haben oder keine TPH in LHS oder RHS sind + .filter(x -> x.stream() + .filter(y -> + y.stream().filter(z -> ((z.getLhsType() instanceof PlaceholderType) + && (((PlaceholderType)(z.getLhsType())).getVariance() != 0)) + || ((z.getRhsType() instanceof PlaceholderType) + && (((PlaceholderType)(z.getRhsType())).getVariance() != 0)) + ).findFirst().isPresent() + ).findFirst().isPresent()).collect(Collectors.toList()); + if (!oderConstraintsVariance.isEmpty()) { + Set> ret = oderConstraintsVariance.get(0); + oderConstraintsOutput.remove(ret); + //Set retFlat = new HashSet<>(); + //ret.stream().forEach(x -> retFlat.addAll(x)); + + //Alle wildcard Faelle rausfiltern bei not wildcardable + ret = ret.stream().filter(x -> { Optional optElem; + return !((optElem=x.stream().filter(y -> (y.getLhsType()) instanceof PlaceholderType + && !((PlaceholderType)y.getLhsType()).isWildcardable() + && y.getPairOp() == PairOperator.EQUALSDOT + && !(y.getRhsType() instanceof PlaceholderType)) + .findAny()).isPresent() + && optElem.get().getRhsType() instanceof ExtendsType);}) + .collect(Collectors.toSet()); + ret.stream().forEach(x -> x.stream().forEach(y -> { Set x_new = new HashSet<>(x); //PL 2020-03-18: y selbst darf nicht in die Substitutionen + x_new.remove(y); + y.addSubstitutions(x_new); + })); + result.get(8).add(ret); + first = false; + } + } + + writeLog("eq2s: " + eq2s.toString()); + writeLog("eq2sAsListFst: " + eq2sAsListFst.toString()); + writeLog("eq2sAsListSnd: " + eq2sAsListSnd.toString()); + writeLog("eq2sAsListBack: " + eq2sAsListBack.toString()); + + eq2sAsList.addAll(eq2sAsListFst); + eq2sAsList.addAll(eq2sAsListSnd); + eq2sAsList.addAll(eq2sAsListThird); + eq2sAsList.addAll(eq2sAsListFourth); + eq2sAsList.addAll(eq2s); + eq2sAsList.addAll(eq2sAsListBack); + + if (eq2sAsList.isEmpty() && first) {//Alle eq2s sind empty und alle oderConstraints mit Variance != 0 sind bearbeitet + if (!oderConstraintsOutput.isEmpty()) { + Set> ret = oderConstraintsOutput.remove(0); + //if (ret.iterator().next().iterator().next().getLhsType().getName().equals("M")) + // System.out.println("M"); + //Set retFlat = new HashSet<>(); + //ret.stream().forEach(x -> retFlat.addAll(x)); + + //Alle wildcard Faelle rausfiltern bei not wildcardable + ret = ret.stream().filter(x -> { Optional optElem; + return !((optElem=x.stream().filter(y -> (y.getLhsType()) instanceof PlaceholderType + && !((PlaceholderType)y.getLhsType()).isWildcardable() + && y.getPairOp() == PairOperator.EQUALSDOT + && !(y.getRhsType() instanceof PlaceholderType)) + .findAny()).isPresent() + && optElem.get().getRhsType() instanceof ExtendsType);}) + .collect(Collectors.toSet()); + + ret.stream().forEach(x -> x.stream().forEach(y -> { Set x_new = new HashSet<>(x); //PL 2020-03-18: y selbst darf nicht in die Substitutionen + x_new.remove(y); + y.addSubstitutions(x_new); + })); + result.get(8).add(ret); + first = false; + } + } + /* + Bei allen die Abhaengigkeit der Elemente aus eq2sAsList als evtl. als Substitution + hinzufuegen + */ + Set consideredElements = new HashSet<>(); + for(UnifyPair pair : eq2sAsList) { + if (consideredElements.contains(pair)) { + continue; + } + PairOperator pairOp = pair.getPairOp(); + UnifyType lhsType = pair.getLhsType(); + UnifyType rhsType = pair.getRhsType(); + + // Case 1: (a <. Theta') + if (((pairOp == PairOperator.SMALLERDOT) || (pairOp == PairOperator.SMALLERNEQDOT)) && lhsType instanceof PlaceholderType) { + //System.out.println(pair); + if (first) { //writeLog(pair.toString()+"\n"); + Set> x1 = new HashSet<>(); + if (pair.getRhsType().getName().equals("void")) { + Set resultOne = new HashSet<>(); + resultOne.add(new UnifyPair (pair.getLhsType(), pair.getRhsType(), PairOperator.EQUALSDOT, pair.getSubstitution(), pair)); + x1.add(resultOne); + } + else { + x1 = unifyCase1(pair, fc); + } + if (pairOp == PairOperator.SMALLERNEQDOT) { + Set remElem = new HashSet<>(); + remElem.add(new UnifyPair(pair.getLhsType(), pair.getRhsType(), PairOperator.EQUALSDOT)); + x1.remove(remElem); + remElem = new HashSet<>(); + remElem.add(new UnifyPair(pair.getLhsType(), new ExtendsType(pair.getRhsType()), PairOperator.EQUALSDOT)); + x1.remove(remElem); + remElem = new HashSet<>(); + remElem.add(new UnifyPair(pair.getLhsType(), new SuperType(pair.getRhsType()), PairOperator.EQUALSDOT)); + x1.remove(remElem); + } + /* ZU LOESCHEN ANFANG + //System.out.println(x1); + Set sameEqSet = eq2sAsList.stream() + .filter(x -> ((x.getLhsType().equals(lhsType) || x.getRhsType().equals(lhsType)) && !x.equals(pair))) + .collect(Collectors.toCollection(HashSet::new)); + consideredElements.addAll(sameEqSet); + Set> x2 = x1; + Set> x1Res = new HashSet<>(); + writeLog("pair:\n" + pair.toString()); + writeLog("x1 Start:\n" + x1.toString()); + writeLog("sameEqSet:\n" + sameEqSet.toString()); + for (UnifyPair sameEq : sameEqSet) { + writeLog("x1 Original:\n" + x1.toString()); + if (sameEq.getLhsType() instanceof PlaceholderType) { + x1 = x1.stream().filter(y -> { + UnifyPair type = y.stream().filter(z -> z.getLhsType().equals(lhsType)).findFirst().get(); + Set localEq = new HashSet<>(); + Set unitedSubst = new HashSet<>(type.getSubstitution()); + unitedSubst.addAll(sameEq.getSubstitution()); + localEq.add(new UnifyPair(type.getRhsType(), sameEq.getRhsType(), sameEq.getPairOp(), unitedSubst, null)); + Set> localRes = unify(localEq, new ArrayList<>(), fc, false, 0, false); + Boolean localCorr = !isUndefinedPairSetSet(localRes); + if (!localCorr) { + collectErr.addAll(localRes); + } + else { + localRes.forEach(z -> z.addAll(y)); + x1Res.addAll(localRes); + } + return localCorr; + } + ).collect(Collectors.toCollection(HashSet::new)); + } + else { + x1 = x1.stream().filter(y -> { + UnifyPair type = y.stream().filter(z -> z.getLhsType().equals(lhsType)).findFirst().get(); + Set localEq = new HashSet<>(); + Set unitedSubst = new HashSet<>(type.getSubstitution()); + unitedSubst.addAll(sameEq.getSubstitution()); + localEq.add(new UnifyPair(sameEq.getLhsType(), type.getRhsType(), sameEq.getPairOp(), unitedSubst, null)); + Set> localRes = unify(localEq, new ArrayList<>(), fc, false, 0, false); + Boolean localCorr = !isUndefinedPairSetSet(localRes); + if (!localCorr) { + collectErr.addAll(localRes); + } + else { + localRes.forEach(z -> z.addAll(y)); + x1Res.addAll(localRes); + } + return localCorr; + } + ).collect(Collectors.toCollection(HashSet::new)); + } + writeLog("x1 nach Loeschung von " + sameEq.toString()+" :\n" + x1.toString()); + } + Set> x1ResPrime; + if (sameEqSet.isEmpty()) { + x1ResPrime = x1; + } + else { + x1ResPrime = x1Res; + } + result.get(0).add(x1ResPrime); + ZU LOESCHEN ENDE */ + result.get(0).add(x1); + if (x1.isEmpty()) { + undefined.add(pair); //Theta ist nicht im FC => Abbruch + } + } + else { + Set s1 = new HashSet<>(); + s1.add(pair); + Set> s2 = new HashSet<>(); + s2.add(s1); + result.get(0).add(s2); + } + + } + // Case 2: (a <.? ? ext Theta') + else if(pairOp == PairOperator.SMALLERDOTWC && lhsType instanceof PlaceholderType && rhsType instanceof ExtendsType) + if (first) { //writeLog(pair.toString()+"\n"); + Set> x1 = unifyCase2(pair, fc); + result.get(1).add(x1); + if (x1.isEmpty()) { + undefined.add(pair); //Theta ist nicht im FC + } + } + else { + Set s1 = new HashSet<>(); + s1.add(pair); + Set> s2 = new HashSet<>(); + s2.add(s1); + result.get(1).add(s2); + } + + // Case 3: (a <.? ? sup Theta') + else if(pairOp == PairOperator.SMALLERDOTWC && lhsType instanceof PlaceholderType && rhsType instanceof SuperType) + if (first) { //writeLog(pair.toString()+"\n"); + Set> x1 = unifyCase3(pair, fc); + result.get(2).add(x1); + if (x1.isEmpty()) { + undefined.add(pair); //Theta ist nicht im FC + } + } + else { + Set s1 = new HashSet<>(); + s1.add(pair); + Set> s2 = new HashSet<>(); + s2.add(s1); + result.get(2).add(s2); + } + + // Case 4 was replaced by an inference rule + // Case 4: (a <.? Theta') + //else if(pairOp == PairOperator.SMALLERDOTWC && lhsType instanceof PlaceholderType) + // result.get(3).add(unifyCase4((PlaceholderType) lhsType, rhsType, fc)); + + // Case 5: (Theta <. a) + else if ((pairOp == PairOperator.SMALLERDOT) && rhsType instanceof PlaceholderType) + if (first) { //writeLog(pair.toString()+"\n"); + Set> x1 = new HashSet<>(); + if (pair.getLhsType().getName().equals("void")) { + Set resultOne = new HashSet<>(); + resultOne.add(new UnifyPair (pair.getRhsType(), pair.getLhsType(), PairOperator.EQUALSDOT, pair.getSubstitution(), pair)); + x1.add(resultOne); + } + else { + x1 = unifyCase5(pair, fc); + } + result.get(4).add(x1); + if (x1.isEmpty()) { + undefined.add(pair); //Theta ist nicht im FC + } + } + else { + Set s1 = new HashSet<>(); + s1.add(pair); + Set> s2 = new HashSet<>(); + s2.add(s1); + result.get(4).add(s2); + } + + // Case 6 was replaced by an inference rule. + // Case 6: (? ext Theta <.? a) + //else if(pairOp == PairOperator.SMALLERDOTWC && lhsType instanceof ExtendsType && rhsType instanceof PlaceholderType) + // result.get(5).add(unifyCase6((ExtendsType) lhsType, (PlaceholderType) rhsType, fc)); + + // Case 7 was replaced by an inference rule + // Case 7: (? sup Theta <.? a) + //else if(pairOp == PairOperator.SMALLERDOTWC && lhsType instanceof SuperType && rhsType instanceof PlaceholderType) + // result.get(6).add(unifyCase7((SuperType) lhsType, (PlaceholderType) rhsType, fc)); + + // Case 8: (Theta <.? a) + else if(pairOp == PairOperator.SMALLERDOTWC && rhsType instanceof PlaceholderType) + if (first) { //writeLog(pair.toString()+"\n"); + Set> x1 = unifyCase8(pair, fc); + result.get(7).add(x1); + if (x1.isEmpty()) { + undefined.add(pair); //Theta ist nicht im FC + } + } + else { + Set s1 = new HashSet<>(); + s1.add(pair); + Set> s2 = new HashSet<>(); + s2.add(s1); + result.get(7).add(s2); + } + // Case unknown: If a pair fits no other case, then the type unification has failed. + // Through application of the rules, every pair should have one of the above forms. + // Pairs that do not have one of the aboves form are contradictory. + else { + // If a pair is not defined, the unificiation will fail, so the loop can be stopped here. + undefined.add(pair); + break; + } + first = false; + } + + // Filter empty sets or sets that only contain an empty set. + return result.stream().map(x -> x.stream().filter(y -> y.size() > 0).collect(Collectors.toCollection(HashSet::new))) + .filter(x -> x.size() > 0).collect(Collectors.toCollection(HashSet::new)); + } + + //TODO: Wenn Theta' nicht im FC muss ein Fehler produziert werden PL 18-04-20 + /** + * Cartesian product Case 1: (a <. Theta') + */ + protected Set> unifyCase1(UnifyPair pair, IFiniteClosure fc) { + PlaceholderType a = (PlaceholderType)pair.getLhsType(); + UnifyType thetaPrime = pair.getRhsType(); + + if (thetaPrime instanceof ExtendsType) { + thetaPrime = ((ExtendsType)thetaPrime).getExtendedType(); + } + + if (thetaPrime instanceof SuperType) { + //HIER MUSS NOCH WAS UEBERLEGT WERDEN + } + + Set> result = new HashSet<>(); + + if (thetaPrime instanceof ReferenceType && ((ReferenceType)thetaPrime).isGenTypeVar()) { + Set resultOne = new HashSet<>(); + resultOne.add(new UnifyPair (a, thetaPrime, PairOperator.EQUALSDOT, pair.getSubstitution(), pair)); + result.add(resultOne); + } + + boolean allGen = thetaPrime.getTypeParams().size() > 0; + for(UnifyType t : thetaPrime.getTypeParams()) + if(!(t instanceof PlaceholderType) || !((PlaceholderType) t).isGenerated()) { + allGen = false; + break; + } + //if (thetaPrime.getName().equals("java.util.Vector") //Fuer Bug 127 + // && thetaPrime instanceof ReferenceType + // && ((ReferenceType)thetaPrime).getTypeParams().iterator().next() instanceof PlaceholderType) //.getName().equals("java.util.Vector")) + // && ((ReferenceType)((ReferenceType)thetaPrime).getTypeParams().iterator().next()).getTypeParams().iterator().next().getName().equals("java.lang.Integer")) { + // { + // System.out.println(""); + //} + Set cs = fc.getAllTypesByName(thetaPrime.getName());//cs= [java.util.Vector, java.util.Vector>, ????java.util.Vector???] + + writeLog("cs: " + cs.toString()); + //PL 18-02-06 entfernt, kommt durch unify wieder rein + //cs.add(thetaPrime); + //PL 18-02-06 entfernt + + //cs muessen fresh Typvars gesetzt werden PL 2018-03-18 + Set csPHRenamed = cs.stream().map(x -> { + BinaryOperator> combiner = (aa,b) -> { aa.putAll(b); return aa;}; + HashMap hm = x.getInvolvedPlaceholderTypes().stream() + .reduce(new HashMap(), + (aa, b)-> { aa.put(b,PlaceholderType.freshPlaceholder()); return aa; }, combiner); + return x.accept(new freshPlaceholder(), hm); + }).collect(Collectors.toCollection(HashSet::new)); + + IMatch match = new Match(); + for(UnifyType c : csPHRenamed) { + //PL 18-02-05 getChildren durch smaller ersetzt in getChildren werden die Varianlen nicht ersetzt. + Set thetaQs = new HashSet<>(); + //TODO smaller wieder reinnehmen? + //thetaQs.add(c);// + thetaQs = fc.smaller(c, new HashSet<>()).stream().collect(Collectors.toCollection(HashSet::new)); + ArrayList ml = new ArrayList<>(); + ml.add(new UnifyPair(c, thetaPrime, PairOperator.EQUALSDOT)); + if (!(match.match(ml)).isPresent()) { + thetaQs.remove(c); + } + writeLog("thetaQs von " + c + ": " + thetaQs.toString()); + //Set thetaQs = fc.getChildren(c).stream().collect(Collectors.toCollection(HashSet::new)); + //thetaQs.add(thetaPrime); //PL 18-02-05 wieder geloescht + //PL 2017-10-03: War auskommentiert habe ich wieder einkommentiert, + //da children offensichtlich ein echtes kleiner und kein kleinergleich ist + + //PL 18-02-06: eingefuegt, thetaQs der Form V> <. V'> werden entfernt + //TODO PL 19-01-14 wieder reinnehmen kurzfristig auskommentiert + //thetaQs = thetaQs.stream().filter(ut -> ut.getTypeParams().arePlaceholders()).collect(Collectors.toCollection(HashSet::new)); + //PL 18-02-06: eingefuegt + + Set thetaQPrimes = new HashSet<>(); + TypeParams cParams = c.getTypeParams(); + if(cParams.size() == 0) + thetaQPrimes.add(c); + else { + ArrayList> candidateParams = new ArrayList<>(); + + for(UnifyType param : cParams) + candidateParams.add(fc.grArg(param, new HashSet<>())); + + for(TypeParams tp : permuteParams(candidateParams)) + thetaQPrimes.add(c.setTypeParams(tp)); + } + writeLog("thetaQPrimes von " + c + ": " + thetaQPrimes.toString()); + for(UnifyType tqp : thetaQPrimes) {//PL 2020-03-08 umbauen in der Schleife wird nur unifizierbarer Typ gesucht break am Ende + Collection tphs = tqp.getInvolvedPlaceholderTypes(); + Optional opt = stdUnify.unify(tqp, thetaPrime); + if (!opt.isPresent()) { + continue; + } + Unifier unifier = opt.get(); + unifier.swapPlaceholderSubstitutions(thetaPrime.getTypeParams()); + Set substitutionSet = new HashSet<>(); + for (Entry sigma : unifier) { + if (!tphs.contains(sigma.getKey())) {//eingefuegt PL 2019-02-02 Bug 127 + substitutionSet.add(new UnifyPair(sigma.getKey(), sigma.getValue(), PairOperator.EQUALSDOT, + //TODO: nochmals ueberlegen ob hier pair.getSubstitution() korrekt ist, oder ob leere Menge hin müsste + //alle folgenden New UnifyPair ebenfalls ueberpruefen PL 2018-04-19 + pair.getSubstitution(), pair)); + } + } + //List freshTphs = new ArrayList<>(); PL 18-02-06 in die For-Schleife verschoben + for (UnifyType tq : thetaQs) { + //geaendert PL 20-03-07 + Set smaller = new HashSet<>(); + smaller.add(unifier.apply(tq)); + //Set smaller = fc.smaller(unifier.apply(tq), new HashSet<>()); + //eingefuegt PL 2018-03-29 Anfang ? ext. theta hinzufuegen + if (a.isWildcardable()) { + Set smaller_ext = smaller.stream().filter(x -> !(x instanceof ExtendsType) && !(x instanceof SuperType)) + .map(x -> { + //BinaryOperator> combiner = (aa,b) -> { aa.putAll(b); return aa;}; //Variablenumbenennung rausgenommen + //HashMap hm = x.getInvolvedPlaceholderTypes().stream() //Variablen muessen wahrscheinlich erhalten bleiben + // .reduce(new HashMap(), + // (aa, b)-> { aa.put(b,PlaceholderType.freshPlaceholder()); return aa; }, combiner); + return new ExtendsType (x);})//.accept(new freshPlaceholder(), hm));} + .collect(Collectors.toCollection(HashSet::new)); + smaller.addAll(smaller_ext); + } + //eingefuegt PL 2018-03-29 Ende ? ext. theta hinzufuegen + for(UnifyType theta : smaller) { + List freshTphs = new ArrayList<>(); + Set resultPrime = new HashSet<>(); + + for(int i = 0; !allGen && i < theta.getTypeParams().size(); i++) { + if(freshTphs.size()-1 < i)//IST DAS RICHTIG??? PL 2018-12-12 + freshTphs.add(PlaceholderType.freshPlaceholder()); + freshTphs.forEach(x -> ((PlaceholderType)x).setInnerType(true)); + resultPrime.add(new UnifyPair(freshTphs.get(i), theta.getTypeParams().get(i), PairOperator.SMALLERDOTWC, pair.getSubstitution(), pair)); + } + + if(allGen) { + UnifyPair up = new UnifyPair(a, theta, PairOperator.EQUALSDOT, pair.getSubstitution(), pair); + Iterator upit = up.getRhsType().getTypeParams().iterator(); + //TODO PL 2019-01-24: upit.next() ist nicht unbedingt ein PlaceholderType -> Visitor erledigt + while (upit.hasNext()) upit.next().accept(new distributeVariance(), a.getVariance());//((PlaceholderType)upit.next()).setVariance(a.getVariance()); + resultPrime.add(up); + } + else { + UnifyPair up = new UnifyPair(a, theta.setTypeParams(new TypeParams(freshTphs.toArray(new UnifyType[0]))), PairOperator.EQUALSDOT, pair.getSubstitution(), pair); + Iterator upit = up.getRhsType().getTypeParams().iterator(); + distributeVariance dv = new distributeVariance(); + //TODO PL 2019-01-24: upit.next() ist nicht unbedingt ein PlaceholderType -> Visitor erledigt + while (upit.hasNext()) upit.next().accept(new distributeVariance(), a.getVariance()); //((PlaceholderType)upit.next()).setVariance(a.getVariance()); + resultPrime.add(up); + } + resultPrime.addAll(substitutionSet); + //writeLog("Substitution: " + substitutionSet.toString()); + result.add(resultPrime); + //writeLog("Result: " + resultPrime.toString()); + //writeLog("MAX: " + oup.max(resultPrime.iterator()).toString()); + } + } + } + } + writeLog("result von " + pair + ": " + result.toString()); + return result; + } + + /** + * Cartesian Product Case 2: (a <.? ? ext Theta') + */ + private Set> unifyCase2(UnifyPair pair, IFiniteClosure fc) { + PlaceholderType a = (PlaceholderType) pair.getLhsType(); + ExtendsType extThetaPrime = (ExtendsType) pair.getRhsType(); + Set> result = new HashSet<>(); + + UnifyType aPrime = PlaceholderType.freshPlaceholder(); + ((PlaceholderType)aPrime).setVariance(((PlaceholderType)a).getVariance()); + ((PlaceholderType)aPrime).disableWildcardtable(); + UnifyType extAPrime = new ExtendsType(aPrime); + UnifyType thetaPrime = extThetaPrime.getExtendedType(); + Set resultPrime = new HashSet<>(); + resultPrime.add(new UnifyPair(a, thetaPrime, PairOperator.SMALLERDOT, pair.getSubstitution(), pair)); + result.add(resultPrime); + + resultPrime = new HashSet<>(); + resultPrime.add(new UnifyPair(a, extAPrime, PairOperator.EQUALSDOT, pair.getSubstitution(), pair)); + resultPrime.add(new UnifyPair(aPrime, thetaPrime, PairOperator.SMALLERDOT, pair.getSubstitution(), pair)); + result.add(resultPrime); + //writeLog("Result: " + resultPrime.toString()); + return result; + } + + /** + * Cartesian Product Case 3: (a <.? ? sup Theta') + */ + private Set> unifyCase3(UnifyPair pair, IFiniteClosure fc) { + PlaceholderType a = (PlaceholderType) pair.getLhsType(); + a.reversVariance(); + SuperType subThetaPrime = (SuperType) pair.getRhsType(); + Set> result = new HashSet<>(); + + UnifyType aPrime = PlaceholderType.freshPlaceholder(); + ((PlaceholderType)aPrime).setVariance(((PlaceholderType)a).getVariance()); + ((PlaceholderType)aPrime).disableWildcardtable(); + UnifyType supAPrime = new SuperType(aPrime); + UnifyType thetaPrime = subThetaPrime.getSuperedType(); + Set resultPrime = new HashSet<>(); + resultPrime.add(new UnifyPair(thetaPrime, a, PairOperator.SMALLERDOT, pair.getSubstitution(), pair, pair.getfBounded())); + result.add(resultPrime); + //writeLog(resultPrime.toString()); + + resultPrime = new HashSet<>(); + resultPrime.add(new UnifyPair(a, supAPrime, PairOperator.EQUALSDOT, pair.getSubstitution(), pair)); + resultPrime.add(new UnifyPair(thetaPrime, aPrime, PairOperator.SMALLERDOT, pair.getSubstitution(), pair)); + result.add(resultPrime); + //writeLog(resultPrime.toString()); + + return result; + } + + /** + * Cartesian Product Case 5: (Theta <. a) + */ + private Set> unifyCase5(UnifyPair pair, IFiniteClosure fc) { + UnifyType theta = pair.getLhsType(); + PlaceholderType a = (PlaceholderType) pair.getRhsType(); + Set> result = new HashSet<>(); + + boolean allGen = theta.getTypeParams().size() > 0; + for(UnifyType t : theta.getTypeParams()) + if(!(t instanceof PlaceholderType) || !((PlaceholderType) t).isGenerated()) { + allGen = false; + break; + } + + //eingefuegt PL 2019-01-03 ANFANG + //fc.setLogTrue(); + //writeLog("FBOUNDED: " + pair.getfBounded()); + //writeLog("Pair: " + pair); + Set greater = fc.greater(theta, pair.getfBounded()); + //writeLog("GREATER: " + greater + pair + "THETA: " + theta + "FBOUNDED: " + pair.getfBounded() + " "); + if (a.isWildcardable()) { + Set greater_ext = greater.stream().filter(x -> !(x instanceof ExtendsType) && !(x instanceof SuperType)) + .map(x -> { + //BinaryOperator> combiner = (aa,b) -> { aa.putAll(b); return aa;}; //Variablenumbenennung rausgenommen + //HashMap hm = x.getInvolvedPlaceholderTypes().stream() //Variablen muessen wahrscheinlich erhalten bleiben + // .reduce(new HashMap(), + // (aa, b)-> { aa.put(b,PlaceholderType.freshPlaceholder()); return aa; }, combiner); + return new SuperType (x);})//.accept(new freshPlaceholder(), hm));} + .collect(Collectors.toCollection(HashSet::new)); + greater.addAll(greater_ext); + } + //eingefuegt PL 2019-01-03 ENDE + + //for(UnifyType thetaS : fc.greater(theta, pair.getfBounded())) { + for(UnifyType thetaS : greater) { + Set resultPrime = new HashSet<>(); + Match match = new Match(); + + UnifyType[] freshTphs = new UnifyType[thetaS.getTypeParams().size()]; + for(int i = 0; !allGen && i < freshTphs.length; i++) { + freshTphs[i] = PlaceholderType.freshPlaceholder(); + ((PlaceholderType)freshTphs[i]).setVariance(((PlaceholderType)a).getVariance()); + Set fBounded = new HashSet<>(pair.getfBounded()); //PL 2019-01-09 new HashSet eingefuegt + + int i_ef = i; + BiFunction f = (x,y) -> + { + ArrayList termList = new ArrayList(); + termList.add(new UnifyPair(y,thetaS.getTypeParams().get(i_ef), PairOperator.EQUALSDOT)); + return ((match.match(termList).isPresent()) || x); + }; + //if (parai.getName().equals("java.lang.Integer")) { + // System.out.println(""); + //} + BinaryOperator bo = (x,y) -> (x || y); + if (fBounded.stream().reduce(false,f,bo)) { + resultPrime.add(new UnifyPair(freshTphs[i], thetaS.getTypeParams().get(i), PairOperator.EQUALSDOT, pair.getSubstitution(), pair)); + } + else { + fBounded.add(thetaS.getTypeParams().get(i)); + resultPrime.add(new UnifyPair(thetaS.getTypeParams().get(i), freshTphs[i], PairOperator.SMALLERDOTWC, pair.getSubstitution(), pair, fBounded)); + } + } + + if(allGen) + resultPrime.add(new UnifyPair(a, thetaS, PairOperator.EQUALSDOT, pair.getSubstitution(), pair)); + else + resultPrime.add(new UnifyPair(a, thetaS.setTypeParams(new TypeParams(freshTphs)), PairOperator.EQUALSDOT, pair.getSubstitution(), pair)); + result.add(resultPrime); + //writeLog("FBOUNDED2: " + pair.getfBounded()); + //writeLog("resultPrime Theta < a: " + greater + pair + "THETA: " + theta + "FBOUNDED: " + pair.getfBounded() + " " + resultPrime.toString()); + } + + return result; + } + + /** + * Cartesian Product Case 8: (Theta <.? a) + */ + private Set> unifyCase8(UnifyPair pair, IFiniteClosure fc) { + UnifyType theta = pair.getLhsType(); + PlaceholderType a = (PlaceholderType) pair.getRhsType(); + Set> result = new HashSet<>(); + //for(UnifyType thetaS : fc.grArg(theta)) { + Set resultPrime = new HashSet<>(); + resultPrime.add(new UnifyPair(a, theta, PairOperator.EQUALSDOT, pair.getSubstitution(), pair)); + result.add(resultPrime); + //writeLog(resultPrime.toString()); + + UnifyType freshTph = PlaceholderType.freshPlaceholder(); + + ((PlaceholderType)freshTph).setVariance(a.getVariance()); + ((PlaceholderType)freshTph).disableWildcardtable(); + resultPrime = new HashSet<>(); + resultPrime.add(new UnifyPair(a, new ExtendsType(freshTph), PairOperator.EQUALSDOT, pair.getSubstitution(), pair)); + resultPrime.add(new UnifyPair(theta, freshTph, PairOperator.SMALLERDOT, pair.getSubstitution(), pair, pair.getfBounded())); + result.add(resultPrime); + //writeLog("resultPrime: " + resultPrime.toString()); + + resultPrime = new HashSet<>(); + resultPrime.add(new UnifyPair(a, new SuperType(freshTph), PairOperator.EQUALSDOT, pair.getSubstitution(), pair)); + resultPrime.add(new UnifyPair(freshTph, theta, PairOperator.SMALLERDOT, pair.getSubstitution(), pair)); + result.add(resultPrime); + //writeLog(resultPrime.toString()); + //} + + return result; + } + + /** + * Takes a set of candidates for each position and computes all possible permutations. + * @param candidates The length of the list determines the number of type params. Each set + * contains the candidates for the corresponding position. + */ + protected Set permuteParams(ArrayList> candidates) { + Set result = new HashSet<>(); + permuteParams(candidates, 0, result, new UnifyType[candidates.size()]); + return result; + } + + /** + * Takes a set of candidates for each position and computes all possible permutations. + * @param candidates The length of the list determines the number of type params. Each set + * contains the candidates for the corresponding position. + * @param idx Idx for the current permutatiton. + * @param result Set of all permutations found so far + * @param current The permutation of type params that is currently explored + */ + private void permuteParams(ArrayList> candidates, int idx, Set result, UnifyType[] current) { + if(candidates.size() == idx) { + result.add(new TypeParams(Arrays.copyOf(current, current.length))); + return; + } + + Set localCandidates = candidates.get(idx); + + for(UnifyType t : localCandidates) { + current[idx] = t; + permuteParams(candidates, idx+1, result, current); + } + } + + void writeLog(String str) { + synchronized ( this ) { + if (log && finalresult) { + try { + logFile.write("Thread no.:" + thNo + "\n"); + logFile.write("noOfThread:" + noOfThread + "\n"); + logFile.write("parallel:" + parallel + "\n"); + logFile.write(str+"\n\n"); + logFile.flush(); + + } + catch (IOException e) { + System.err.println("kein LogFile"); + } + } + } + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/Unifikationsalgorithmus.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/Unifikationsalgorithmus.java new file mode 100644 index 0000000..39c25e5 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/Unifikationsalgorithmus.java @@ -0,0 +1,11 @@ +package de.dhbwstuttgart.typeinference.unify; + +import java.util.Set; + +import de.dhbwstuttgart.typeinference.unify.model.UnifyPair; + +public interface Unifikationsalgorithmus { + + public Set> apply (Set E); + +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/UnifyResultEvent.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/UnifyResultEvent.java new file mode 100644 index 0000000..a79e34e --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/UnifyResultEvent.java @@ -0,0 +1,18 @@ +package de.dhbwstuttgart.typeinference.unify; + +import java.util.List; + +import de.dhbwstuttgart.typeinference.result.ResultSet; + +public class UnifyResultEvent { + + private List newTypeResult; + + public UnifyResultEvent(List newTypeResult) { + this.newTypeResult = newTypeResult; + } + + public List getNewTypeResult() { + return newTypeResult; + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/UnifyResultListener.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/UnifyResultListener.java new file mode 100644 index 0000000..f490ccd --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/UnifyResultListener.java @@ -0,0 +1,7 @@ +package de.dhbwstuttgart.typeinference.unify; + +public interface UnifyResultListener { + + void onNewTypeResultFound(UnifyResultEvent evt); + +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/UnifyResultListenerImpl.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/UnifyResultListenerImpl.java new file mode 100644 index 0000000..ea34728 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/UnifyResultListenerImpl.java @@ -0,0 +1,21 @@ +package de.dhbwstuttgart.typeinference.unify; + +import java.util.ArrayList; +import java.util.List; + +import de.dhbwstuttgart.typeinference.result.ResultSet; +import de.dhbwstuttgart.typeinference.unify.model.UnifyPair; + +public class UnifyResultListenerImpl implements UnifyResultListener { + + List results = new ArrayList<>(); + + public synchronized void onNewTypeResultFound(UnifyResultEvent evt) { + results.addAll(evt.getNewTypeResult()); + } + + public List getResults() { + return results; + } + +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/UnifyResultModel.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/UnifyResultModel.java new file mode 100644 index 0000000..7a4f0cc --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/UnifyResultModel.java @@ -0,0 +1,59 @@ +package de.dhbwstuttgart.typeinference.unify; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; + +import de.dhbwstuttgart.syntaxtree.factory.UnifyTypeFactory; +import de.dhbwstuttgart.typeinference.constraints.ConstraintSet; +import de.dhbwstuttgart.typeinference.result.ResultSet; +import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure; +import de.dhbwstuttgart.typeinference.unify.model.PairOperator; +import de.dhbwstuttgart.typeinference.unify.model.UnifyPair; + +public class UnifyResultModel { + + ConstraintSet cons; + + IFiniteClosure fc; + + public UnifyResultModel(ConstraintSet cons, + IFiniteClosure fc) { + this.cons = cons; + this.fc = fc; + } + + private List listeners = new ArrayList<>(); + + public void addUnifyResultListener(UnifyResultListener listenerToAdd) { + listeners.add(listenerToAdd); + } + + public void removeUnifyResultListener(UnifyResultListener listenerToRemove) { + listeners.remove(listenerToRemove); + } + + public void notify(Set> eqPrimePrimeSet) { + Set> eqPrimePrimeSetRet = eqPrimePrimeSet.stream().map(x -> { + Optional> res = new RuleSet().subst(x.stream().map(y -> { + if (y.getPairOp() == PairOperator.SMALLERDOTWC) y.setPairOp(PairOperator.EQUALSDOT); + return y; //alle Paare a <.? b erden durch a =. b ersetzt + }).collect(Collectors.toCollection(HashSet::new))); + if (res.isPresent()) {//wenn subst ein Erg liefert wurde was veraendert + return new TypeUnifyTask().applyTypeUnificationRules(res.get(), fc); + } + else return x; //wenn nichts veraendert wurde wird x zurueckgegeben + }).collect(Collectors.toCollection(HashSet::new)); + List newResult = eqPrimePrimeSetRet.stream().map(unifyPairs -> + new ResultSet(UnifyTypeFactory.convert(unifyPairs, de.dhbwstuttgart.typeinference.constraints.Pair.generateTPHMap(cons)))) + .collect(Collectors.toList()); + UnifyResultEvent evt = new UnifyResultEvent(newResult); + + for (UnifyResultListener listener : listeners) { + listener.onNewTypeResultFound(evt); + } + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/UnifyTaskModel.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/UnifyTaskModel.java new file mode 100644 index 0000000..e60054f --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/UnifyTaskModel.java @@ -0,0 +1,18 @@ +package de.dhbwstuttgart.typeinference.unify; + +import java.util.ArrayList; + +public class UnifyTaskModel { + + ArrayList usedTasks = new ArrayList<>(); + + public synchronized void add(TypeUnifyTask t) { + usedTasks.add(t); + } + + public synchronized void cancel() { + for(TypeUnifyTask t : usedTasks) { + t.myCancel(true); + } + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/distributeVariance.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/distributeVariance.java new file mode 100644 index 0000000..1779c94 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/distributeVariance.java @@ -0,0 +1,54 @@ +package de.dhbwstuttgart.typeinference.unify; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +import de.dhbwstuttgart.typeinference.unify.model.FunNType; +import de.dhbwstuttgart.typeinference.unify.model.PlaceholderType; +import de.dhbwstuttgart.typeinference.unify.model.TypeParams; +import de.dhbwstuttgart.typeinference.unify.model.UnifyType; + +public class distributeVariance extends visitUnifyTypeVisitor { + + public static int inverseVariance(int variance) { + Integer ret = 0; + if (variance == 1) { + ret = -1; + } + if (variance == -1) { + ret = 1; + } + return ret; + } + + + @Override + public PlaceholderType visit(PlaceholderType phty, Integer ht) { + if (ht != 0) { + if (phty.getVariance() == 0) { + phty.setVariance(ht); + } + //PL 2018-05-17 urspruengliche Variance nicht veraendern + //else if (phty.getVariance() != ht) { + // phty.setVariance(0); + //} + } + return phty; + } + + public FunNType visit(FunNType funnty, Integer ht) { + List param = new ArrayList<>(funnty.getTypeParams().get().length); + param.addAll(Arrays.asList(funnty.getTypeParams().get())); + UnifyType resultType = param.remove(param.size()-1); + Integer htInverse = inverseVariance(ht); + param = param.stream() + .map(x -> x.accept(this, htInverse)) + .collect(Collectors.toCollection(ArrayList::new)); + param.add(resultType.accept(this, ht)); + return FunNType.getFunNType(new TypeParams(param)); + } + + +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/freshPlaceholder.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/freshPlaceholder.java new file mode 100644 index 0000000..69870bd --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/freshPlaceholder.java @@ -0,0 +1,15 @@ +package de.dhbwstuttgart.typeinference.unify; + + +import java.util.HashMap; + +import de.dhbwstuttgart.typeinference.unify.model.PlaceholderType; + + +public class freshPlaceholder extends visitUnifyTypeVisitor> { + + @Override + public PlaceholderType visit(PlaceholderType phty, HashMap ht) { + return ht.get(phty); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/interfaces/IFiniteClosure.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/interfaces/IFiniteClosure.java new file mode 100644 index 0000000..dea9e53 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/interfaces/IFiniteClosure.java @@ -0,0 +1,77 @@ +package de.dhbwstuttgart.typeinference.unify.interfaces; + +import java.util.Optional; +import java.util.Set; + +import de.dhbwstuttgart.parser.SourceLoc; +import de.dhbwstuttgart.typeinference.unify.model.ExtendsType; +import de.dhbwstuttgart.typeinference.unify.model.FunNType; +import de.dhbwstuttgart.typeinference.unify.model.PairOperator; +import de.dhbwstuttgart.typeinference.unify.model.PlaceholderType; +import de.dhbwstuttgart.typeinference.unify.model.ReferenceType; +import de.dhbwstuttgart.typeinference.unify.model.SuperType; +import de.dhbwstuttgart.typeinference.unify.model.UnifyType; +import org.antlr.v4.runtime.Token; + +/** + * + * @author Florian Steurer + */ +public interface IFiniteClosure { + + public void setLogTrue(); + /** + * Returns all types of the finite closure that are subtypes of the argument. + * @return The set of subtypes of the argument. + */ + public Set smaller(UnifyType type, Set fBounded, Token position); + public default Set smaller(UnifyType type, Set fBounded) { + return this.smaller(type, fBounded, null); + } + + /** + * Returns all types of the finite closure that are supertypes of the argument. + * @return The set of supertypes of the argument. + */ + public Set greater(UnifyType type, Set fBounded, SourceLoc position); + public default Set greater(UnifyType type, Set fBounded) { + return this.greater(type, fBounded, null); + } + + /** + * Wo passt Type rein? + * @param type + * @return + */ + public Set grArg(UnifyType type, Set fBounded); + + /** + * Was passt in Type rein? + * @param type + * @return + */ + public Set smArg(UnifyType type, Set fBounded); + + public Set grArg(ReferenceType type, Set fBounded); + public Set smArg(ReferenceType type, Set fBounded); + + public Set grArg(ExtendsType type, Set fBounded); + public Set smArg(ExtendsType type, Set fBounded); + + public Set grArg(SuperType type, Set fBounded); + public Set smArg(SuperType type, Set fBounded); + + public Set grArg(PlaceholderType type, Set fBounded); + public Set smArg(PlaceholderType type, Set fBounded); + + public Set grArg(FunNType type, Set fBounded); + public Set smArg(FunNType type, Set fBounded); + + public Optional getLeftHandedType(String typeName); + public Optional getRightHandedFunctionalInterfaceType(String typeName); + public Set getAncestors(UnifyType t); + public Set getChildren(UnifyType t); + public Set getAllTypesByName(String typeName); + + public int compare(UnifyType rhsType, UnifyType rhsType2, PairOperator pairop); +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/interfaces/IMatch.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/interfaces/IMatch.java new file mode 100644 index 0000000..a60de87 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/interfaces/IMatch.java @@ -0,0 +1,29 @@ +package de.dhbwstuttgart.typeinference.unify.interfaces; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; + +import de.dhbwstuttgart.typeinference.unify.model.UnifyType; +import de.dhbwstuttgart.typeinference.unify.model.Unifier; +import de.dhbwstuttgart.typeinference.unify.model.UnifyPair; + +/** + * Match + * @author Martin Pluemicke + * abgeleitet aus IUnify.java + */ +public interface IMatch { + + /** + * Finds the most general matcher sigma of the set {t1 =. t1',...,tn =. tn'} so that + * sigma(t1) = t1' , ... sigma(tn) = tn'. + * @param terms The set of terms to be matched + * @return An optional of the most general matcher if it exists or an empty optional if there is no matcher. + */ + public Optional match(ArrayList termsList); + + +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/interfaces/IRuleSet.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/interfaces/IRuleSet.java new file mode 100644 index 0000000..9b86600 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/interfaces/IRuleSet.java @@ -0,0 +1,104 @@ +package de.dhbwstuttgart.typeinference.unify.interfaces; + +import java.util.List; +import java.util.Optional; +import java.util.Set; + +import de.dhbwstuttgart.typeinference.constraints.Constraint; +import de.dhbwstuttgart.typeinference.unify.model.UnifyPair; + +/** + * Contains the inference rules that are applied to the set Eq. + * @author Florian Steurer + */ +public interface IRuleSet { + + public Optional reduceUp(UnifyPair pair); + public Optional reduceLow(UnifyPair pair); + public Optional reduceUpLow(UnifyPair pair); + public Optional> reduceExt(UnifyPair pair, IFiniteClosure fc); + public Optional> reduceSup(UnifyPair pair, IFiniteClosure fc); + public Optional> reduceEq(UnifyPair pair); + public Optional> reduce1(UnifyPair pair, IFiniteClosure fc); + public Optional> reduce2(UnifyPair pair); + + /* + * Missing Reduce-Rules for Wildcards + */ + public Optional reduceWildcardLow(UnifyPair pair); + public Optional reduceWildcardLowRight(UnifyPair pair); + public Optional reduceWildcardUp(UnifyPair pair); + public Optional reduceWildcardUpRight(UnifyPair pair); + + /* + * vgl. JAVA_BSP/Wildcard6.java + public Optional reduceWildcardLowUp(UnifyPair pair); + public Optional reduceWildcardUpLow(UnifyPair pair); + public Optional reduceWildcardLeft(UnifyPair pair); + */ + + /* + * Additional Rules which replace cases of the cartesian product + */ + + /** + * Rule that replaces the fourth case of the cartesian product where (a <.? Theta) + */ + public Optional reduceTph(UnifyPair pair); + + /** + * Rule that replaces the sixth case of the cartesian product where (? ext Theta <.? a) + */ + public Optional> reduceTphExt(UnifyPair pair); + + /** + * Rule that replaces the fourth case of the cartesian product where (? sup Theta <.? a) + */ + public Optional> reduceTphSup(UnifyPair pair); + + /* + * FunN Rules + */ + public Optional> reduceFunN(UnifyPair pair); + public Optional> greaterFunN(UnifyPair pair, IFiniteClosure fc); + public Optional> smallerFunN(UnifyPair pair); + + /** + * Checks whether the erase1-Rule applies to the pair. + * @return True if the pair is erasable, false otherwise. + */ + public boolean erase1(UnifyPair pair, IFiniteClosure fc); + + /** + * Checks whether the erase2-Rule applies to the pair. + * @return True if the pair is erasable, false otherwise. + */ + public boolean erase2(UnifyPair pair, IFiniteClosure fc); + + /** + * Checks whether the erase3-Rule applies to the pair. + * @return True if the pair is erasable, false otherwise. + */ + public boolean erase3(UnifyPair pair); + + public Optional swap(UnifyPair pair); + + public Optional adapt(UnifyPair pair, IFiniteClosure fc); + public Optional adaptExt(UnifyPair pair, IFiniteClosure fc); + public Optional adaptSup(UnifyPair pair, IFiniteClosure fc); + + /** + * Applies the subst-Rule to a set of pairs (usually Eq'). + * @param pairs The set of pairs where the subst rule should apply. + * @return An optional of the modified set, if there were any substitutions. An empty optional if there were no substitutions. + */ + public Optional> subst(Set pairs, List>> oderConstraints); + + /** + * Applies the subst-Rule to a set of pairs (usually Eq'). + * @param pairs The set of pairs where the subst rule should apply. + * @return An optional of the modified set, if there were any substitutions. An empty optional if there were no substitutions. + */ + public Optional> subst(Set pairs); + +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/interfaces/ISetOperations.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/interfaces/ISetOperations.java new file mode 100644 index 0000000..cf0def3 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/interfaces/ISetOperations.java @@ -0,0 +1,16 @@ +package de.dhbwstuttgart.typeinference.unify.interfaces; + +import java.util.List; +import java.util.Set; + +/** + * Contains operations on sets. + * @author Florian Steurer + */ +public interface ISetOperations { + /** + * Calculates the cartesian product of the sets. + * @return The cartesian product + */ + Set> cartesianProduct(List> sets); +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/interfaces/IUnify.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/interfaces/IUnify.java new file mode 100644 index 0000000..5647e18 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/interfaces/IUnify.java @@ -0,0 +1,35 @@ +package de.dhbwstuttgart.typeinference.unify.interfaces; + +import java.util.Arrays; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; + +import de.dhbwstuttgart.typeinference.unify.model.UnifyType; +import de.dhbwstuttgart.typeinference.unify.model.Unifier; + +/** + * Standard unification algorithm (e.g. Robinson, Paterson-Wegman, Martelli-Montanari) + * @author Florian Steurer + */ +public interface IUnify { + + /** + * Finds the most general unifier sigma of the set {t1 =. t1',...,tn =. tn'} so that + * sigma(t1) = sigma(t1') , ... sigma(tn) = sigma(tn'). + * @param terms The set of terms to be unified + * @return An optional of the most general unifier if it exists or an empty optional if there is no unifier. + */ + public Optional unify(Set terms); + + /** + * Finds the most general unifier sigma of the set {t1 =. t1',...,tn =. tn'} so that + * sigma(t1) = sigma(t1') , ... sigma(tn) = sigma(tn'). + * @param terms The set of terms to be unified + * @return An optional of the most general unifier if it exists or an empty optional if there is no unifier. + */ + default public Optional unify(UnifyType... terms) { + return unify(Arrays.stream(terms).collect(Collectors.toSet())); + } + +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/interfaces/UnifyTypeVisitor.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/interfaces/UnifyTypeVisitor.java new file mode 100644 index 0000000..8d06b3e --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/interfaces/UnifyTypeVisitor.java @@ -0,0 +1,23 @@ +package de.dhbwstuttgart.typeinference.unify.interfaces; + +import java.util.HashMap; + +import de.dhbwstuttgart.typeinference.unify.model.ExtendsType; +import de.dhbwstuttgart.typeinference.unify.model.FunNType; +import de.dhbwstuttgart.typeinference.unify.model.PlaceholderType; +import de.dhbwstuttgart.typeinference.unify.model.ReferenceType; +import de.dhbwstuttgart.typeinference.unify.model.SuperType; + +public interface UnifyTypeVisitor { + + public ReferenceType visit(ReferenceType refty, T ht); + + public PlaceholderType visit(PlaceholderType phty, T ht); + + public FunNType visit(FunNType funnty, T ht); + + public SuperType visit(SuperType suty, T ht); + + public ExtendsType visit(ExtendsType extty, T ht); + +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/model/ExtendsType.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/model/ExtendsType.java new file mode 100644 index 0000000..ef7e950 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/model/ExtendsType.java @@ -0,0 +1,96 @@ +package de.dhbwstuttgart.typeinference.unify.model; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Set; + +import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure; +import de.dhbwstuttgart.typeinference.unify.interfaces.UnifyTypeVisitor; + +/** + * An extends wildcard type "? extends T". + */ +public final class ExtendsType extends WildcardType { + + public UnifyType accept(UnifyTypeVisitor visitor, T ht) { + return visitor.visit(this, ht); + } + + /** + * Creates a new extends wildcard type. + * @param extendedType The extended type e.g. Integer in "? extends Integer" + */ + public ExtendsType(UnifyType extendedType) { + super("? extends " + extendedType.getName(), extendedType); + if (extendedType instanceof ExtendsType) { + System.out.print(""); + } + } + + /** + * The extended type e.g. Integer in "? extends Integer" + */ + public UnifyType getExtendedType() { + return wildcardedType; + } + + /** + * Sets the type parameters of the wildcarded type and returns a new extendstype that extends that type. + */ + @Override + public UnifyType setTypeParams(TypeParams newTp) { + UnifyType newType = wildcardedType.setTypeParams(newTp); + if(newType == wildcardedType) + return this; // Reduced the amount of objects created + return new ExtendsType(wildcardedType.setTypeParams(newTp)); + } + + @Override + Set smArg(IFiniteClosure fc, Set fBounded) { + return fc.smArg(this, fBounded); + } + + @Override + Set grArg(IFiniteClosure fc, Set fBounded) { + return fc.grArg(this, fBounded); + } + + @Override + UnifyType apply(Unifier unif) { + UnifyType newType = wildcardedType.apply(unif); + if(newType.hashCode() == wildcardedType.hashCode() && newType.equals(wildcardedType)) + return this; // Reduced the amount of objects created + return new ExtendsType(newType); + } + + @Override + public int hashCode() { + /* + * It is important that the prime that is added is different to the prime added in hashCode() of SuperType. + * Otherwise ? extends T and ? super T have the same hashCode() for every Type T. + */ + return wildcardedType.hashCode() + 229; + } + + @Override + public boolean equals(Object obj) { + if(!(obj instanceof ExtendsType)) + return false; + + if(obj.hashCode() != this.hashCode()) + return false; + + ExtendsType other = (ExtendsType) obj; + + + return other.getWildcardedType().equals(wildcardedType); + } + + @Override + public String toString() { + return "? extends " + wildcardedType; + } + + +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/model/FiniteClosure.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/model/FiniteClosure.java new file mode 100644 index 0000000..f4c8ab2 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/model/FiniteClosure.java @@ -0,0 +1,785 @@ +package de.dhbwstuttgart.typeinference.unify.model; + +import java.io.FileWriter; +import java.io.IOException; +import java.io.Writer; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.List; +import java.util.Optional; +import java.util.Set; +import java.util.function.BiFunction; +import java.util.function.BinaryOperator; +import java.util.function.Predicate; +import java.util.stream.Collectors; + +import com.google.common.collect.Ordering; + +//PL 18-02-05/18-04-05 Unifier durch Matcher ersetzt +//muss greater noch ersetzt werden ja erledigt 18--04-05 +import de.dhbwstuttgart.parser.SourceLoc; +import de.dhbwstuttgart.typeinference.unify.MartelliMontanariUnify; + +import de.dhbwstuttgart.typeinference.unify.Match; +import de.dhbwstuttgart.typeinference.unify.TypeUnifyTask; +import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure; +import de.dhbwstuttgart.typeinference.unify.interfaces.IUnify; +import de.dhbwstuttgart.util.Pair; +import org.antlr.v4.runtime.Token; + +/** + * The finite closure for the type unification + * @author Florian Steurer + */ +public class FiniteClosure //extends Ordering //entfernt PL 2018-12-11 +implements IFiniteClosure { + + Writer logFile; + static Boolean log = false; + public void setLogTrue() { + log = true; + } + /** + * A map that maps every type to the node in the inheritance graph that contains that type. + */ + private HashMap> inheritanceGraph; + + /** + * A map that maps every typename to the nodes of the inheritance graph that contain a type with that name. + */ + private HashMap>> strInheritanceGraph; + + + /** + * The initial pairs of that define the inheritance tree + */ + private Set pairs; + + /** + * Hastable fuer die greater-Werte, damit sie nicht doppelt berechnet werden muessen + */ + Hashtable> greaterHash = new Hashtable<>(); + + /** + * Hastable fuer die smaller-Werte, damit sie nicht doppelt berechnet werden muessen + */ + Hashtable> smallerHash = new Hashtable<>(); + + /** + * Creates a new instance using the inheritance tree defined in the pairs. + */ + public FiniteClosure(Set pairs, Writer logFile) { + this.logFile = logFile; + this.pairs = new HashSet<>(pairs); + inheritanceGraph = new HashMap>(); + + // Build the transitive closure of the inheritance tree + for(UnifyPair pair : pairs) { + + /* + try { + logFile.write("Pair: " + pair + "\n"); + logFile.flush(); + } + catch (IOException e) { + System.err.println("no LogFile"); + } + */ + + if(pair.getPairOp() != PairOperator.SMALLER) + continue; + + //VERSUCH PL 18-02-06 + //koennte ggf. die FC reduzieren + //TO DO: Ueberpruefen, ob das sinnvll und korrekt ist + //if (!pair.getLhsType().getTypeParams().arePlaceholders() + // && !pair.getRhsType().getTypeParams().arePlaceholders()) + // continue; +; + // Add nodes if not already in the graph + if(!inheritanceGraph.containsKey(pair.getLhsType())) + inheritanceGraph.put(pair.getLhsType(), new Node(pair.getLhsType())); + if(!inheritanceGraph.containsKey(pair.getRhsType())) + inheritanceGraph.put(pair.getRhsType(), new Node(pair.getRhsType())); + + Node childNode = inheritanceGraph.get(pair.getLhsType()); + Node parentNode = inheritanceGraph.get(pair.getRhsType()); + + // Add edge + parentNode.addDescendant(childNode); + + // Add edges to build the transitive closure + parentNode.getPredecessors().stream().forEach(x -> x.addDescendant(childNode)); + childNode.getDescendants().stream().forEach(x -> x.addPredecessor(parentNode)); + + //PL eingefuegt 2020-05-07 File UnitTest InheritTest.java + this.inheritanceGraph.forEach((x,y) -> { if (y.getDescendants().contains(parentNode)) { y.addDescendant(childNode); y.addAllDescendant(childNode.getDescendants());}; + if (y.getPredecessors().contains(childNode)) { y.addPredecessor(parentNode); y.addAllPredecessor(parentNode.getPredecessors());};} ); + } + + // Build the alternative representation with strings as keys + strInheritanceGraph = new HashMap<>(); + for(UnifyType key : inheritanceGraph.keySet()) { + if(!strInheritanceGraph.containsKey(key.getName())) + strInheritanceGraph.put(key.getName(), new HashSet<>()); + + strInheritanceGraph.get(key.getName()).add(inheritanceGraph.get(key)); + } + } + + void testSmaller() { + UnifyType tq1, tq2, tq3; + tq1 = new ExtendsType(PlaceholderType.freshPlaceholder()); + List l1 = new ArrayList<>(); + List l2 = new ArrayList<>(); + l1.add(tq1); + tq2 = new ReferenceType("java.util.Vector", new TypeParams(l1)); + l2.add(tq2); + tq3 = new ReferenceType("java.util.Vector", new TypeParams(l2)); + Set smaller = smaller(tq3, new HashSet<>()); + } + + /** + * Returns all types of the finite closure that are subtypes of the argument. + * @return The set of subtypes of the argument. + */ + @Override + public Set smaller(UnifyType type, Set fBounded, Token position) { + + Set ret; + if ((ret = smallerHash.get(new hashKeyType(type))) != null) { + //System.out.println(greaterHash); + return new HashSet<>(ret); + } + + if(type instanceof FunNType) + return computeSmallerFunN((FunNType) type, fBounded); + + Set>> ts = new HashSet<>(); + ts.add(new Pair<>(type, fBounded)); + Set result = computeSmaller(ts); + smallerHash.put(new hashKeyType(type), result); + /* + try { + logFile.write("\ntype: " + type + "\nret: " + ret + "\nresult: " + result);//"smallerHash: " + greaterHash.toString()); + logFile.flush(); + } + catch (IOException e) { + System.err.println("no LogFile"); + }*/ + return result; + } + + /** + * Computes the smaller functions for every type except FunNTypes. + */ + private Set computeSmaller(Set>> types) { + Set>> result = new HashSet<>(); + + //PL 18-02-05 Unifier durch Matcher ersetzt + //IUnify unify = new MartelliMontanariUnify(); + Match match = new Match(); + + for(Pair> pt : types) { + UnifyType t = pt.getKey(); + Set fBounded = pt.getValue().get(); + + // if T = T' then T <* T' + try { + result.add(new Pair<>(t, fBounded)); + } + catch (StackOverflowError e) { + System.out.println(""); + } + + // if C<...> <* C<...> then ... (third case in definition of <*) + if(t.getTypeParams().size() > 0) { + ArrayList> paramCandidates = new ArrayList<>(); + for (int i = 0; i < t.getTypeParams().size(); i++) + paramCandidates.add(smArg(t.getTypeParams().get(i), fBounded)); + permuteParams(paramCandidates).forEach(x -> result.add(new Pair<>(t.setTypeParams(x), fBounded))); + } + + if(!strInheritanceGraph.containsKey(t.getName())) + continue; + + // if T <* T' then sigma(T) <* sigma(T') + Set> candidates = strInheritanceGraph.get(t.getName()); //cadidates= [???Node(java.util.Vector>)??? + // , Node(java.util.Vector) + //] + for(Node candidate : candidates) { + UnifyType theta2 = candidate.getContent(); + //PL 18-02-05 Unifier durch Matcher ersetzt ANFANG + ArrayList termList= new ArrayList(); + termList.add(new UnifyPair(theta2,t, PairOperator.EQUALSDOT)); + Optional optSigma = match.match(termList); + //PL 18-02-05 Unifier durch Matcher ersetzt ENDE + if(!optSigma.isPresent()) + continue; + + Unifier sigma = optSigma.get(); + sigma.swapPlaceholderSubstitutions(t.getTypeParams()); + + Set theta1Set = candidate.getContentOfDescendants(); + + for(UnifyType theta1 : theta1Set) + result.add(new Pair<>(theta1.apply(sigma), fBounded)); + } + } + + HashSet resut = result.stream().map(x -> x.getKey()).collect(Collectors.toCollection(HashSet::new)); + if(resut.equals(types.stream().map(x -> x.getKey()).collect(Collectors.toCollection(HashSet::new)))) + return resut; + return computeSmaller(result); + } + + /** + * Computes the smaller-Function for FunNTypes. + */ + private Set computeSmallerFunN(FunNType type, Set fBounded) { + Set result = new HashSet<>(); + + // if T = T' then T <=* T' + result.add(type); + + // Because real function types are implicitly variant + // it is enough to permute the params with the values of greater / smaller. + ArrayList> paramCandidates = new ArrayList<>(); + paramCandidates.add(smaller(type.getTypeParams().get(0), fBounded)); + for (int i = 1; i < type.getTypeParams().size(); i++) + paramCandidates.add(greater(type.getTypeParams().get(i), new HashSet<>())); + + permuteParams(paramCandidates).forEach(x -> result.add(type.setTypeParams(x))); + return result; + } + + /** + * Returns all types of the finite closure that are supertypes of the argument. + * @return The set of supertypes of the argument. + */ + @Override + //Eingefuegt PL 2018-05-24 F-Bounded Problematik + public Set greater(UnifyType type, Set fBounded, SourceLoc location) { + Set ret; + if ((ret = greaterHash.get(new hashKeyType(type))) != null) { + //System.out.println(greaterHash); + return new HashSet<>(ret); + } + + + if(type instanceof FunNType) { + return computeGreaterFunN((FunNType) type, fBounded); + } + + Set result = new HashSet<>(); + Set>> PairResultFBounded = new HashSet<>(); + + Match match = new Match(); + + + // if T = T' then T <=* T' + result.add(type); + if(!strInheritanceGraph.containsKey(type.getName())) + return result; + + // if T <* T' then sigma(T) <* sigma(T') + Set> candidates = strInheritanceGraph.get(type.getName()); + + /* + try { + if (log) logFile.write(candidates.toString()); + //log = false; + } + catch (IOException e) { + System.err.println("no LogFile"); + } + */ + + for(Node candidate : candidates) { + UnifyType theta1 = candidate.getContent(); + + //PL 18-04-05 Unifier durch Matcher ersetzt ANFANG + ArrayList termList= new ArrayList(); + termList.add(new UnifyPair(theta1,type, PairOperator.EQUALSDOT, location)); + Optional optSigma = match.match(termList); + //PL 18-04-05 Unifier durch Matcher ersetzt ENDE + if(!optSigma.isPresent()) { + continue; + } + Unifier sigma = optSigma.get(); + sigma.swapPlaceholderSubstitutionsReverse(theta1.getTypeParams()); + + Set fBoundedNew = new HashSet<>(fBounded); + fBoundedNew.add(theta1); + Set theta2Set = candidate.getContentOfPredecessors(); + //System.out.println(""); + for(UnifyType theta2 : theta2Set) { + result.add(theta2.apply(sigma)); + PairResultFBounded.add(new Pair<>(theta2.apply(sigma), fBoundedNew)); + } + } + /* + try { + if (log) logFile.write(PairResultFBounded.toString()); + log = false; + } + catch (IOException e) { + System.err.println("no LogFile"); + } + */ + for(Pair> pt : PairResultFBounded) { + UnifyType t = pt.getKey(); + Set lfBounded = pt.getValue().get(); + + // if C<...> <* C<...> then ... (third case in definition of <*) + //TypeParams typeparams = t.getTypeParams(); + if(t.getTypeParams().size() > 0) { + ArrayList> paramCandidates = new ArrayList<>(); + + for (int i = 0; i < t.getTypeParams().size(); i++) { + //UnifyType parai = t.getTypeParams().get(i); + int i_ef = i; + BiFunction f = (x,y) -> + { + ArrayList termList = new ArrayList(); + termList.add(new UnifyPair(y,t.getTypeParams().get(i_ef), PairOperator.EQUALSDOT, location)); + return ((match.match(termList).isPresent()) || x); + }; + //if (parai.getName().equals("java.lang.Integer")) { + // System.out.println(""); + //} + BinaryOperator bo = (a,b) -> (a || b); + if (lfBounded.stream().reduce(false,f,bo)) { + //F-Bounded Endlosrekursion + HashSet res = new HashSet(); + paramCandidates.add(res); + } + else { + paramCandidates.add(grArg(t.getTypeParams().get(i), new HashSet<>(fBounded) )); + } + } + permuteParams(paramCandidates).forEach(x -> result.add(t.setTypeParams(x))); + //System.out.println(""); + } + } + + greaterHash.put(new hashKeyType(type), result); + /* + try { + logFile.write("\ntype: " + type + "\nret: " + ret + "\nresult: " + result);//"greaterHash: " + greaterHash.toString()); + logFile.flush(); + } + catch (IOException e) { + System.err.println("no LogFile"); + }*/ + return result; + } + + /* auskommentiert PL 2018-05-24 + /** + * Returns all types of the finite closure that are supertypes of the argument. + * @return The set of supertypes of the argument. + * + //@Override + public Set oldgreater(UnifyType type, Set fBounded) { + if(type instanceof FunNType) + return computeGreaterFunN((FunNType) type, fBounded); + + Set>> ts = new HashSet<>(); + ts.add(new Pair<>(type, fBounded)); + return computeGreater(ts); + } + + /** + * Computes the greater function for all types except function types. + * + protected Set computeGreater(Set>> types) { + Set>> result = new HashSet<>(); + + //PL 18-04-05 Unifier durch Matcher ersetzt + //IUnify unify = new MartelliMontanariUnify(); + Match match = new Match(); + + for(Pair> pt : types) { + UnifyType t = pt.getKey(); + Set fBounded = pt.getValue().get(); + // if T = T' then T <=* T' + result.add(pt); + + // if C<...> <* C<...> then ... (third case in definition of <*) + if(t.getTypeParams().size() > 0) { + ArrayList> paramCandidates = new ArrayList<>(); + for (int i = 0; i < t.getTypeParams().size(); i++) { + UnifyType parai = t.getTypeParams().get(i); + int i_ef = i; + BiFunction f = (x,y) -> + { + ArrayList termList = new ArrayList(); + termList.add(new UnifyPair(y,t.getTypeParams().get(i_ef), PairOperator.EQUALSDOT)); + return ((match.match(termList).isPresent()) || x); + }; + if (parai.getName().equals("java.lang.Integer")) { + System.out.println(""); + } + BinaryOperator bo = (a,b) -> (a || b); + if (fBounded.stream().reduce(false,f,bo)) continue; //F-Bounded Endlosrekursion + paramCandidates.add(grArg(t.getTypeParams().get(i), new HashSet<>(fBounded) )); + } + permuteParams(paramCandidates).forEach(x -> result.add(new Pair<>(t.setTypeParams(x), new HashSet<>(fBounded)))); + } + + if(!strInheritanceGraph.containsKey(t.getName())) + continue; + + // if T <* T' then sigma(T) <* sigma(T') + Set> candidates = strInheritanceGraph.get(t.getName()); + for(Node candidate : candidates) { + UnifyType theta1 = candidate.getContent(); + + //PL 18-04-05 Unifier durch Matcher ersetzt ANFANG + ArrayList termList= new ArrayList(); + termList.add(new UnifyPair(theta1,t, PairOperator.EQUALSDOT)); + Optional optSigma = match.match(termList); + //PL 18-04-05 Unifier durch Matcher ersetzt ENDE + if(!optSigma.isPresent()) + continue; + + Unifier sigma = optSigma.get(); + sigma.swapPlaceholderSubstitutionsReverse(theta1.getTypeParams()); + + Set fBoundedNew = new HashSet<>(fBounded); + fBoundedNew.add(theta1); + Set theta2Set = candidate.getContentOfPredecessors(); + + for(UnifyType theta2 : theta2Set) + result.add(new Pair<>(theta2.apply(sigma), fBoundedNew)); + } + + } + + HashSet resut = result.stream().map(x -> x.getKey()).collect(Collectors.toCollection(HashSet::new)); + System.out.println(resut); + if(resut.equals(types.stream().map(x -> x.getKey()).collect(Collectors.toCollection(HashSet::new)))) + return resut; + return computeGreater(result); + } + */ + + /** + * Computes the greater function for FunN-Types + */ + protected Set computeGreaterFunN(FunNType type, Set fBounded) { + Set result = new HashSet<>(); + + // if T = T' then T <=* T' + result.add(type); + + // Because real function types are implicitly variant + // it is enough to permute the params with the values of greater / smaller. + ArrayList> paramCandidates = new ArrayList<>(); + paramCandidates.add(greater(type.getTypeParams().get(0), new HashSet<>())); + for (int i = 1; i < type.getTypeParams().size(); i++) + paramCandidates.add(smaller(type.getTypeParams().get(i), fBounded)); + permuteParams(paramCandidates).forEach(x -> result.add(type.setTypeParams(x))); + return result; + } + + + @Override + public Set grArg(UnifyType type, Set fBounded) { + return type.grArg(this, fBounded); + } + + @Override + public Set grArg(ReferenceType type, Set fBounded) { + Set result = new HashSet(); + result.add(type); + smaller(type, fBounded).forEach(x -> result.add(new SuperType(x))); + greater(type,fBounded).forEach(x -> result.add(new ExtendsType(x))); + return result; + } + + @Override + public Set grArg(FunNType type, Set fBounded) { + Set result = new HashSet(); + result.add(type); + smaller(type, fBounded).forEach(x -> result.add(new SuperType(x))); + greater(type, fBounded).forEach(x -> result.add(new ExtendsType(x))); + return result; + } + + @Override + public Set grArg(ExtendsType type, Set fBounded) { + Set result = new HashSet(); + result.add(type); + UnifyType t = type.getExtendedType(); + greater(t, fBounded).forEach(x -> result.add(new ExtendsType(x))); + return result; + } + + @Override + public Set grArg(SuperType type, Set fBounded) { + Set result = new HashSet(); + result.add(type); + UnifyType t = type.getSuperedType(); + smaller(t, fBounded).forEach(x -> result.add(new SuperType(x))); + return result; + } + + @Override + public Set grArg(PlaceholderType type, Set fBounded) { + HashSet result = new HashSet<>(); + result.add(type); + return result; + } + + @Override + public Set smArg(UnifyType type, Set fBounded) { + return type.smArg(this, fBounded); + } + + @Override + public Set smArg(ReferenceType type, Set fBounded) { + Set result = new HashSet(); + result.add(type); + return result; + } + + @Override + public Set smArg(FunNType type, Set fBounded) { + Set result = new HashSet(); + result.add(type); + return result; + } + + @Override + public Set smArg(ExtendsType type, Set fBounded) { + Set result = new HashSet(); + result.add(type); + UnifyType t = type.getExtendedType(); + result.add(t); + smaller(t, fBounded).forEach(x -> { + result.add(new ExtendsType(x)); + result.add(x); + }); + return result; + } + + + @Override + public Set smArg(SuperType type, Set fBounded) { + Set result = new HashSet(); + result.add(type); + UnifyType t = type.getSuperedType(); + result.add(t); +//*** ACHTUNG das koennte FALSCH sein PL 2018-05-23 evtl. HashSet durch smArg durchschleifen + greater(t, fBounded).forEach(x -> { + result.add(new SuperType(x)); + result.add(x); + }); + return result; + } + + @Override + public Set smArg(PlaceholderType type, Set fBounded) { + HashSet result = new HashSet<>(); + result.add(type); + return result; + } + + @Override + public Set getAllTypesByName(String typeName) { + if(!strInheritanceGraph.containsKey(typeName)) + return new HashSet<>(); + return strInheritanceGraph.get(typeName).stream().map(x -> x.getContent()).collect(Collectors.toCollection(HashSet::new)); + } + + @Override + public Optional getLeftHandedType(String typeName) { + if(!strInheritanceGraph.containsKey(typeName)) + return Optional.empty(); + + for(UnifyPair pair : pairs) + if(pair.getLhsType().getName().equals(typeName) && pair.getLhsType().typeParams.arePlaceholders()) + return Optional.of(pair.getLhsType()); + + return Optional.empty(); + } + + @Override + public Optional getRightHandedFunctionalInterfaceType(String typeName) { + if(!strInheritanceGraph.containsKey(typeName)) + return Optional.empty(); + + for(UnifyPair pair : pairs) + if(pair.getRhsType().getName().equals(typeName)) + return Optional.of(pair.getRhsType()); + + return Optional.empty(); + } + + @Override + public Set getAncestors(UnifyType t) { + if(!inheritanceGraph.containsKey(t)) + return new HashSet<>(); + Set result = inheritanceGraph.get(t).getContentOfPredecessors(); + result.add(t); + return result; + } + + @Override + public Set getChildren(UnifyType t) { + if(!inheritanceGraph.containsKey(t)) + return new HashSet<>(); + Set result = inheritanceGraph.get(t).getContentOfDescendants(); + result.add(t); + return result; + } + + /** + * Takes a set of candidates for each position and computes all possible permutations. + * @param candidates The length of the list determines the number of type params. Each set + * contains the candidates for the corresponding position. + */ + protected Set permuteParams(ArrayList> candidates) { + Set result = new HashSet<>(); + permuteParams(candidates, 0, result, new UnifyType[candidates.size()]); + return result; + } + + /** + * Takes a set of candidates for each position and computes all possible permutations. + * @param candidates The length of the list determines the number of type params. Each set + * contains the candidates for the corresponding position. + * @param idx Idx for the current permutatiton. + * @param result Set of all permutations found so far + * @param current The permutation of type params that is currently explored + */ + protected void permuteParams(ArrayList> candidates, int idx, Set result, UnifyType[] current) { + if(candidates.size() == idx) { + result.add(new TypeParams(Arrays.copyOf(current, current.length))); + return; + } + + Set localCandidates = candidates.get(idx); + + for(UnifyType t : localCandidates) { + current[idx] = t; + permuteParams(candidates, idx+1, result, current); + } + } + + @Override + public String toString(){ + return this.inheritanceGraph.toString(); + } + + /* entfernt PL 2018-12-11 + public int compare (UnifyType left, UnifyType right) { + return compare(left, right, PairOperator.SMALLERDOT); + } + */ + + public int compare (UnifyType left, UnifyType right, PairOperator pairop) { + //try {logFile.write("left: "+ left + " right: " + right + " pairop: " + pairop);} catch (IOException ie) {} + if (left.getName().equals("Matrix") || right.getName().equals("Matrix")) + System.out.println(""); + /* + pairop = PairOperator.SMALLERDOTWC; + List al = new ArrayList<>(); + PlaceholderType xx =new PlaceholderType("xx"); + al.add(xx); + left = new ExtendsType(new ReferenceType("Vector", new TypeParams(al))); + + List alr = new ArrayList<>(); + UnifyType exx = new ExtendsType(xx); + alr.add(exx); + right = new ExtendsType(new ReferenceType("Vector", new TypeParams(alr))); + */ + /* + List al = new ArrayList<>(); + PlaceholderType xx =new PlaceholderType("xx"); + al.add(xx); + left = new ExtendsType(xx); + right = xx; + */ + /* + List al = new ArrayList<>(); + PlaceholderType xx =new PlaceholderType("xx"); + PlaceholderType yy =new PlaceholderType("yy"); + al.add(xx); + left = yy; + right = new ExtendsType(xx); + */ + //Die Faelle abfangen, bei den Variablen verglichen werden PL 2018-12-11 + UnifyType ex; + if (left instanceof PlaceholderType) { + if ((right instanceof WildcardType) + && ((ex = ((WildcardType)right).wildcardedType) instanceof PlaceholderType) + && ((PlaceholderType)left).getName().equals(((PlaceholderType)ex).getName())) {// a <.? ? extends a oder a <.? ? super a + return -1; + } + else { + return 0; + } + } + if (right instanceof PlaceholderType) {//&& (left instanceof WildcardType)) {PL geloescht 2019-01-15 analog zu oben + if ((left instanceof WildcardType) //PL eingefuegt 2019-01-15 analog zu oben + && ((ex = ((WildcardType)left).wildcardedType) instanceof PlaceholderType) + && ((PlaceholderType)right).getName().equals(((PlaceholderType)ex).getName())) {// ? extends a <. a oder ? super a <. a + return 1; + } + else { + return 0; + } + } + UnifyPair up = new UnifyPair(left, right, pairop); + TypeUnifyTask unifyTask = new TypeUnifyTask(); + HashSet hs = new HashSet<>(); + hs.add(up); + Set smallerRes = unifyTask.applyTypeUnificationRules(hs, this); + /* + //if (left.getName().equals("Matrix") || right.getName().equals("Matrix")) + {try { + logFile.write("\nsmallerRes: " + smallerRes);//"smallerHash: " + greaterHash.toString()); + logFile.flush(); + } + catch (IOException e) { + System.err.println("no LogFile");}} + */ + //Gleichungen der Form a <./=. Theta oder Theta <./=. a oder a <./=. b sind ok. + Predicate delFun = x -> !((x.getLhsType() instanceof PlaceholderType || + x.getRhsType() instanceof PlaceholderType) + && !((x.getLhsType() instanceof WildcardType) && //? extends/super a <.? a + ((WildcardType)x.getLhsType()).getWildcardedType().equals(x.getRhsType())) + ); + long smallerLen = smallerRes.stream().filter(delFun).count(); + if (smallerLen == 0) return -1; + else { + up = new UnifyPair(right, left, pairop); + //TypeUnifyTask unifyTask = new TypeUnifyTask(); + hs = new HashSet<>(); + hs.add(up); + Set greaterRes = unifyTask.applyTypeUnificationRules(hs, this); + /* + //if (left.getName().equals("Matrix") || right.getName().equals("Matrix")) + {try { + logFile.write("\ngreaterRes: " + greaterRes);//"smallerHash: " + greaterHash.toString()); + logFile.flush(); + } + catch (IOException e) { + System.err.println("no LogFile");}} + */ + //Gleichungen der Form a <./=. Theta oder Theta <./=. a oder a <./=. b sind ok. + long greaterLen = greaterRes.stream().filter(delFun).count(); + if (greaterLen == 0) return 1; + else { + //try {logFile.write("0 left: "+ left + " right: " + right + " pairop: " + pairop);} catch (IOException ie) {} + return 0; + } + } + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/model/FunNType.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/model/FunNType.java new file mode 100644 index 0000000..f46ac91 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/model/FunNType.java @@ -0,0 +1,103 @@ +package de.dhbwstuttgart.typeinference.unify.model; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Set; + +import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure; +import de.dhbwstuttgart.typeinference.unify.interfaces.UnifyTypeVisitor; + +/** + * A real function type in java. + * @author Florian Steurer + */ +public class FunNType extends UnifyType { + + public UnifyType accept(UnifyTypeVisitor visitor, T ht) { + return visitor.visit(this, ht); + } + + /** + * Creates a FunN-Type with the specified TypeParameters. + */ + protected FunNType(TypeParams p) { + super("Fun"+(p.size()-1)+"$$", p); + } + + /** + * Creates a new FunNType. + * @param tp The parameters of the type. + * @return A FunNType. + * @throws IllegalArgumentException is thrown when there are to few type parameters or there are wildcard-types. + */ + public static FunNType getFunNType(TypeParams tp) throws IllegalArgumentException { + if(tp.size() == 0) + throw new IllegalArgumentException("FunNTypes need at least one type parameter"); + for(UnifyType t : tp) + if(t instanceof WildcardType) + throw new IllegalArgumentException("Invalid TypeParams for a FunNType: " + tp); + return new FunNType(tp); + } + + /** + * Returns the degree of the function type, e.g. 2 for FunN. + */ + public int getN() { + return typeParams.size()-1; + } + + @Override + public UnifyType setTypeParams(TypeParams newTp) { + if(newTp.hashCode() == typeParams.hashCode() && newTp.equals(typeParams)) + return this; + return getFunNType(newTp); + } + + @Override + Set smArg(IFiniteClosure fc, Set fBounded) { + return fc.smArg(this, fBounded); + } + + @Override + Set grArg(IFiniteClosure fc, Set fBounded) { + return fc.grArg(this, fBounded); + } + + @Override + UnifyType apply(Unifier unif) { + // TODO this bypasses the validation of the type parameters. + // Wildcard types can be unified into FunNTypes. + TypeParams newParams = typeParams.apply(unif); + if(newParams.hashCode() == typeParams.hashCode() && newParams.equals(typeParams)) + return this; + + return new FunNType(newParams); + } + + @Override + public Boolean wrongWildcard() { + return (new ArrayList(Arrays.asList(getTypeParams() + .get())).stream().filter(x -> (x instanceof WildcardType)).findFirst().isPresent()); + } + + @Override + public int hashCode() { + return 181 + typeParams.hashCode(); + } + + + @Override + public boolean equals(Object obj) { + if(!(obj instanceof FunNType)) + return false; + + if(obj.hashCode() != this.hashCode()) + return false; + + FunNType other = (FunNType) obj; + + return other.getTypeParams().equals(typeParams); + } + +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/model/Node.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/model/Node.java new file mode 100644 index 0000000..031130c --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/model/Node.java @@ -0,0 +1,118 @@ +package de.dhbwstuttgart.typeinference.unify.model; + +import java.util.HashSet; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * A node of a directed graph. + * @author Florian Steurer + * + * @param The type of the content of the node. + */ +class Node { + + /** + * The content of the node. + */ + private T content; + + /** + * The set of predecessors + */ + private HashSet> predecessors = new HashSet<>(); + + /** + * The set of descendants + */ + private HashSet> descendants = new HashSet<>(); + + /** + * Creates a node containing the specified content. + */ + public Node(T content) { + this.content = content; + } + + /** + * Adds a directed edge from this node to the descendant (this -> descendant) + */ + public void addDescendant(Node descendant) { + if(descendants.contains(descendant)) + return; + + descendants.add(descendant); + descendant.addPredecessor(this); + } + + /** + * Adds some directed edges from this node to the descendant (this -> descendant) + */ + public void addAllDescendant(Set> allDescendants) { + for(Node descendant: allDescendants) { + addDescendant(descendant); + } + } + + /** + * Adds a directed edge from the predecessor to this node (predecessor -> this) + */ + public void addPredecessor(Node predecessor) { + if(predecessors.contains(predecessor)) + return; + + predecessors.add(predecessor); + predecessor.addDescendant(this); + } + + /** + * Adds some directed edges from the predecessor to this node (predecessor -> this) + */ + public void addAllPredecessor(Set> allPredecessors) { + for(Node predecessor: allPredecessors) { + addPredecessor(predecessor); + } + } + + /** + * The content of this node. + */ + public T getContent() { + return content; + } + + /** + * Returns all predecessors (nodes that have a directed edge to this node) + */ + public Set> getPredecessors() { + return predecessors; + } + + /** + * Returns all descendants. All nodes M, where there is a edge from this node to the node M. + * @return + */ + public Set> getDescendants() { + return descendants; + } + + /** + * Retrieves the content of all descendants. + */ + public Set getContentOfDescendants() { + return descendants.stream().map(x -> x.getContent()).collect(Collectors.toSet()); + } + + /** + * Retrieves the content of all predecessors. + */ + public Set getContentOfPredecessors() { + return predecessors.stream().map(x -> x.getContent()).collect(Collectors.toSet()); + } + + @Override + public String toString() { + return "Elem: Node(" + content.toString() + ")\nPrec: " + getContentOfPredecessors().toString() + + "\nDesc: " + getContentOfDescendants().toString() + "\n\n"; + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/model/OrderingExtend.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/model/OrderingExtend.java new file mode 100644 index 0000000..8fa3234 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/model/OrderingExtend.java @@ -0,0 +1,89 @@ +package de.dhbwstuttgart.typeinference.unify.model; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +public abstract class OrderingExtend extends com.google.common.collect.Ordering { + + public List maxElements(Iterable iterable) { + ArrayList ret = new ArrayList<>(); + while (iterable.iterator().hasNext()) { + Set believe = new HashSet<>(); + + T max = max(iterable); + ret.add(max); + + Iterator it = iterable.iterator(); + while (it.hasNext()) { + T elem = it.next(); + if (!(compare(max, elem) == 1) && !max.equals(elem)) { + believe.add(elem); + } + } + iterable = believe; + } + return ret; + } + + public List minElements(Iterable iterable) { + ArrayList ret = new ArrayList<>(); + while (iterable.iterator().hasNext()) { + Set believe = new HashSet<>(); + + T min = min(iterable); + ret.add(min); + + Iterator it = iterable.iterator(); + while (it.hasNext()) { + T elem = it.next(); + if (!(compare(min, elem) == -1) && !min.equals(elem)) { + believe.add(elem); + } + } + iterable = believe; + } + return ret; + } + + + public List smallerEqThan(T elem, Iterable iterable) { + List ret = smallerThan(elem, iterable); + ret.add(elem); + return ret; + + } + + public List smallerThan(T elem, Iterable iterable) { + ArrayList ret = new ArrayList<>(); + Iterator it = iterable.iterator(); + while (it.hasNext()) { + T itElem = it.next(); + if (!itElem.equals(elem) && compare(elem, itElem) == 1) { + ret.add(itElem); + } + } + return ret; + } + + public List greaterEqThan(T elem, Iterable iterable) { + List ret = greaterThan(elem, iterable); + ret.add(elem); + return ret; + + } + + public List greaterThan(T elem, Iterable iterable) { + ArrayList ret = new ArrayList<>(); + Iterator it = iterable.iterator(); + while (it.hasNext()) { + T itElem = it.next(); + if (!itElem.equals(elem) && (compare(elem, itElem) == -1)) { + ret.add(itElem); + } + } + return ret; + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/model/OrderingUnifyPair.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/model/OrderingUnifyPair.java new file mode 100644 index 0000000..7e319a4 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/model/OrderingUnifyPair.java @@ -0,0 +1,457 @@ +package de.dhbwstuttgart.typeinference.unify.model; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Optional; +import java.util.Set; +import java.util.function.BinaryOperator; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import com.google.common.collect.Ordering; + +import de.dhbwstuttgart.typeinference.unify.Match; +import de.dhbwstuttgart.typeinference.unify.TypeUnifyTask; +import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure; +import de.dhbwstuttgart.util.Pair; + + + +public class OrderingUnifyPair extends OrderingExtend> { + + protected IFiniteClosure fc; + + public OrderingUnifyPair(IFiniteClosure fc) { + this.fc = fc; + } + + /* + * vergleicht Paare (a =. Theta) und (a =. Theta') + * in dem compare(Theta, Theta') aufgerufen wird. + */ + public int compareEq (UnifyPair left, UnifyPair right) { + try { + //if (left.getRhsType() instanceof WildcardType || right.getRhsType() instanceof WildcardType) {//PL 2019-01-12 ausgetauscht + if (((PlaceholderType)left.getLhsType()).isInnerType() && ((PlaceholderType)right.getLhsType()).isInnerType()) { + return fc.compare(left.getRhsType(), right.getRhsType(), PairOperator.SMALLERDOTWC); + } + else { + return fc.compare(left.getRhsType(), right.getRhsType(), PairOperator.SMALLERDOT); + }} + catch (ClassCastException e) { + try { + ((FiniteClosure)fc).logFile.write("ClassCastException: " + left.toString() + " " + left.getGroundBasePair() + "\n\n"); + ((FiniteClosure)fc).logFile.flush(); + } + catch (IOException ie) { + } + return -99; + } + } + + /* + public int compareEq (UnifyPair left, UnifyPair right) { + if (left == null || right == null) + System.out.println("Fehler"); + if (left.getLhsType() instanceof PlaceholderType) { + return fc.compare(left.getRhsType(), right.getRhsType(), left.getPairOp()); + } + else { + return fc.compare(left.getLhsType(), right.getLhsType(), left.getPairOp()); + } + } + */ + + public Pair> compare (UnifyType left, UnifyType right) { + UnifyPair up; + if (left instanceof WildcardType || right instanceof WildcardType) { + up = new UnifyPair(left, right, PairOperator.SMALLERDOTWC); + if (((left instanceof ExtendsType) + && (((ExtendsType)left).getExtendedType().getName().equals("java.util.Vector")) + && (((ReferenceType)((ExtendsType)left).getExtendedType()).getTypeParams().iterator().next() instanceof ExtendsType)) || + ((right instanceof ExtendsType) + && (((ExtendsType)right).getExtendedType().getName().equals("java.util.Vector")) + && (((ReferenceType)((ExtendsType)right).getExtendedType()).getTypeParams().iterator().next() instanceof ExtendsType))) + { + System.out.println(""); + } + if (((right instanceof SuperType) && (((SuperType)right).getSuperedType().getName().equals("java.lang.Object"))) + ||((left instanceof SuperType) && (((SuperType)left).getSuperedType().getName().equals("java.lang.Object")))) +{ + System.out.println(""); + } + } + else { + up = new UnifyPair(left, right, PairOperator.SMALLERDOT); + } + TypeUnifyTask unifyTask = new TypeUnifyTask(); + HashSet hs = new HashSet<>(); + hs.add(up); + Set smallerRes = unifyTask.applyTypeUnificationRules(hs, fc); + long smallerLen = smallerRes.stream().filter(x -> !(x.getLhsType() instanceof PlaceholderType && x.getRhsType() instanceof PlaceholderType)).count(); + if (smallerLen == 0) return new Pair<>(-1, smallerRes); + else { + if (left instanceof WildcardType || right instanceof WildcardType) { + up = new UnifyPair(right, left, PairOperator.SMALLERDOTWC); + if (((left instanceof ExtendsType) + && (((ExtendsType)left).getExtendedType().getName().equals("java.util.Vector")) + && (((ReferenceType)((ExtendsType)left).getExtendedType()).getTypeParams().iterator().next() instanceof ExtendsType)) || + ((right instanceof ExtendsType) + && (((ExtendsType)right).getExtendedType().getName().equals("java.util.Vector")) + && (((ReferenceType)((ExtendsType)right).getExtendedType()).getTypeParams().iterator().next() instanceof ExtendsType))) + { + System.out.println(""); + } + if (right instanceof SuperType) + { + System.out.println(""); + } + } + else { + up = new UnifyPair(right, left, PairOperator.SMALLERDOT); + } + //TypeUnifyTask unifyTask = new TypeUnifyTask(); + hs = new HashSet<>(); + hs.add(up); + Set greaterRes = unifyTask.applyTypeUnificationRules(hs, fc); + long greaterLen = greaterRes.stream().filter(x -> !(x.getLhsType() instanceof PlaceholderType && x.getRhsType() instanceof PlaceholderType)).count(); + if (greaterLen == 0) return new Pair<>(1, greaterRes); + else return new Pair<>(0, new HashSet<>()); + } + } + + /* TODO muss noch verifiziert werden PL 2018-03-21 + * (non-Javadoc) + * fuehrt zu Fehlern bei Arrays.sort (contract nicht erfuellt) + * @see com.google.common.collect.Ordering#compare(java.lang.Object, java.lang.Object) + */ + public int compare (Set leftpara, Set rightpara) { + + Set left = new HashSet<>(leftpara); + Set right = new HashSet<>(rightpara); + + /* + //pairop = PairOperator.SMALLERDOTWC; + List al = new ArrayList<>(); + PlaceholderType xx = PlaceholderType.freshPlaceholder(); + al.add(xx); + UnifyType t1 = new ExtendsType(new ReferenceType("Vector", new TypeParams(al))); + + //PlaceholderType yy =new PlaceholderType("yy"); + List alr = new ArrayList<>(); + UnifyType exx = new ExtendsType(xx); + alr.add(exx); + UnifyType t2 = new ExtendsType(new ReferenceType("Vector", new TypeParams(alr))); + + PlaceholderType a = PlaceholderType.freshPlaceholder(); + a.setInnerType(true); + UnifyPair p1 = new UnifyPair(a, t1, PairOperator.SMALLERDOTWC); + PlaceholderType b = PlaceholderType.freshPlaceholder(); + b.setInnerType(true); + UnifyPair p2 = new UnifyPair(b, t2, PairOperator.SMALLERDOTWC); + + List al3 = new ArrayList<>(); + al3.add(a); + + List al4 = new ArrayList<>(); + al4.add(b); + + UnifyPair p3 = new UnifyPair(new PlaceholderType("c"), new ReferenceType("Vector", new TypeParams(al3)), PairOperator.EQUALSDOT); + UnifyPair p4 = new UnifyPair(new PlaceholderType("c"), new ReferenceType("Vector", new TypeParams(al4)), PairOperator.EQUALSDOT); + + right = new HashSet<>(); + right.add(p1); + right.add(p3); + left = new HashSet<>(); + left.add(p2); + left.add(p4); + */ + + + Set lefteq = left.stream() + .filter(x -> (x.getLhsType() instanceof PlaceholderType && x.getPairOp() == PairOperator.EQUALSDOT)) + .collect(Collectors.toCollection(HashSet::new)); + Set righteq = right.stream() + .filter(x -> (x.getLhsType() instanceof PlaceholderType && x.getPairOp() == PairOperator.EQUALSDOT)) + .collect(Collectors.toCollection(HashSet::new)); + Set leftle = left.stream() + .filter(x -> ((x.getLhsType() instanceof PlaceholderType || x.getRhsType() instanceof PlaceholderType) + && x.getPairOp() == PairOperator.SMALLERDOT)) + .collect(Collectors.toCollection(HashSet::new)); + Set rightle = right.stream() + .filter(x -> ((x.getLhsType() instanceof PlaceholderType || x.getRhsType() instanceof PlaceholderType) + && x.getPairOp() == PairOperator.SMALLERDOT)) + .collect(Collectors.toCollection(HashSet::new)); + Set leftlewc = left.stream() + .filter(x -> ((x.getLhsType() instanceof PlaceholderType || x.getRhsType() instanceof PlaceholderType) + && x.getPairOp() == PairOperator.SMALLERDOTWC)) + .collect(Collectors.toCollection(HashSet::new)); + Set rightlewc = right.stream() + .filter(x -> ((x.getLhsType() instanceof PlaceholderType || x.getRhsType() instanceof PlaceholderType) + && x.getPairOp() == PairOperator.SMALLERDOTWC)) + .collect(Collectors.toCollection(HashSet::new)); + //System.out.println(left.toString()); + //Fall 2 + //if (lefteq.iterator().next().getLhsType().getName().equals("AJO")) { + // System.out.print(""); + //} + + //ODER-CONSTRAINT + Set leftBase = left.stream().map(x -> x.getGroundBasePair()).collect(Collectors.toCollection(HashSet::new)); + Set rightBase = right.stream().map(x -> x.getGroundBasePair()).collect(Collectors.toCollection(HashSet::new)); + + Set lefteqOder = left.stream() + .filter(x -> { UnifyPair y = x.getGroundBasePair(); + /*try { + ((FiniteClosure)fc).logFile.write("leftBase: " + leftBase.toString() +"\n"); + ((FiniteClosure)fc).logFile.write("rightBase: " + rightBase.toString() +"\n\n"); + ((FiniteClosure)fc).logFile.write("left: " + left.toString() +"\n"); + ((FiniteClosure)fc).logFile.write("right: " + right.toString() +"\n\n"); + ((FiniteClosure)fc).logFile.write("y: " + y.toString() +"\n"); + ((FiniteClosure)fc).logFile.write("y.getLhsType() : " + y.getLhsType() .toString() +"\n\n"); + ((FiniteClosure)fc).logFile.write("y.getRhsType(): " + y.getRhsType().toString() +"\n"); + ((FiniteClosure)fc).logFile.write("x.getPairOp(): " + x.getPairOp().toString() +"\n\n"); + } + catch (IOException ie) { + } */ + return (y.getLhsType() instanceof PlaceholderType && + !(y.getRhsType() instanceof PlaceholderType) && + x.getPairOp() == PairOperator.EQUALSDOT);}) + .collect(Collectors.toCollection(HashSet::new)); + left.removeAll(lefteqOder); + Set righteqOder = right.stream() + .filter(x -> { UnifyPair y = x.getGroundBasePair(); + return (y.getLhsType() instanceof PlaceholderType && + !(y.getRhsType() instanceof PlaceholderType) && + x.getPairOp() == PairOperator.EQUALSDOT);}) + .collect(Collectors.toCollection(HashSet::new)); + right.removeAll(righteqOder); + Set lefteqRet = left.stream() + .filter(x -> { UnifyPair y = x.getGroundBasePair(); + return (y.getRhsType() instanceof PlaceholderType && + ((PlaceholderType)y.getRhsType()).getOrCons() == (byte)-1);}) + .collect(Collectors.toCollection(HashSet::new)); + left.removeAll(lefteqRet); + Set righteqRet = right.stream() + .filter(x -> { UnifyPair y = x.getGroundBasePair(); + return (y.getRhsType() instanceof PlaceholderType && + ((PlaceholderType)y.getRhsType()).getOrCons() == (byte)-1);}) + .collect(Collectors.toCollection(HashSet::new)); + right.removeAll(righteqRet); + Set leftleOder = left.stream() + .filter(x -> (x.getPairOp() == PairOperator.SMALLERDOT)) + .collect(Collectors.toCollection(HashSet::new)); + Set rightleOder = right.stream() + .filter(x -> (x.getPairOp() == PairOperator.SMALLERDOT)) + .collect(Collectors.toCollection(HashSet::new)); + + /* + synchronized(this) { + try { + ((FiniteClosure)fc).logFile.write("leftBase: " + leftBase.toString() +"\n"); + ((FiniteClosure)fc).logFile.write("rightBase: " + rightBase.toString() +"\n\n"); + ((FiniteClosure)fc).logFile.write("left: " + left.toString() +"\n"); + ((FiniteClosure)fc).logFile.write("right: " + right.toString() +"\n\n"); + ((FiniteClosure)fc).logFile.write("lefteqOder: " + lefteqOder.toString() +"\n"); + ((FiniteClosure)fc).logFile.write("righteqOder: " + righteqOder.toString() +"\n\n"); + ((FiniteClosure)fc).logFile.write("lefteqRet: " + lefteqRet.toString() +"\n"); + ((FiniteClosure)fc).logFile.write("righteqRet: " + righteqRet.toString() +"\n\n"); + ((FiniteClosure)fc).logFile.write("leftleOder: " + leftleOder.toString() +"\n"); + ((FiniteClosure)fc).logFile.write("rightleOder: " + rightleOder.toString() +"\n\n"); + ((FiniteClosure)fc).logFile.flush(); + } + catch (IOException ie) { + } + } + */ + + + Integer compareEq; + if (lefteqOder.size() == 1 && righteqOder.size() == 1 && lefteqRet.size() == 1 && righteqRet.size() == 1) { + Match m = new Match(); + if ((compareEq = compareEq(lefteqOder.iterator().next().getGroundBasePair(), righteqOder.iterator().next().getGroundBasePair())) == -1) { + ArrayList matchList = + rightleOder.stream().map(x -> { + UnifyPair leftElem = leftleOder.stream() + .filter(y -> y.getGroundBasePair().getLhsType().equals(x.getGroundBasePair().getLhsType())) + .findAny().get(); + return new UnifyPair(x.getRhsType(), leftElem.getRhsType(), PairOperator.EQUALSDOT);}) + .collect(Collectors.toCollection(ArrayList::new)); + if (m.match(matchList).isPresent()) { + //try { ((FiniteClosure)fc).logFile.write("result1: -1 \n\n"); } catch (IOException ie) {} + return -1; + } + else { + //try { ((FiniteClosure)fc).logFile.write("result1: 0 \n\n"); } catch (IOException ie) {} + return 0; + } + } else if (compareEq == 1) { + ArrayList matchList = + leftleOder.stream().map(x -> { + UnifyPair rightElem = rightleOder.stream() + .filter(y -> + y.getGroundBasePair().getLhsType().equals(x.getGroundBasePair().getLhsType())) + .findAny().get(); + return new UnifyPair(x.getRhsType(), rightElem.getRhsType(), PairOperator.EQUALSDOT);}) + .collect(Collectors.toCollection(ArrayList::new)); + if (m.match(matchList).isPresent()) { + //try { ((FiniteClosure)fc).logFile.write("result2: 1 \n\n"); } catch (IOException ie) {} + return 1; + } + else { + //try { ((FiniteClosure)fc).logFile.write("result2: 0 \n\n"); } catch (IOException ie) {} + return 0; + } + } else { + /* + synchronized(this) { + try { + ((FiniteClosure)fc).logFile.write("leftBase: " + leftBase.toString() +"\n"); + ((FiniteClosure)fc).logFile.write("rightBase: " + rightBase.toString() +"\n\n"); + ((FiniteClosure)fc).logFile.write("left: " + left.toString() +"\n"); + ((FiniteClosure)fc).logFile.write("right: " + right.toString() +"\n\n"); + ((FiniteClosure)fc).logFile.write("lefteqOder: " + lefteqOder.toString() +"\n"); + ((FiniteClosure)fc).logFile.write("righteqOder: " + righteqOder.toString() +"\n\n"); + ((FiniteClosure)fc).logFile.write("lefteqRet: " + lefteqRet.toString() +"\n"); + ((FiniteClosure)fc).logFile.write("righteqRet: " + righteqRet.toString() +"\n\n"); + ((FiniteClosure)fc).logFile.write("leftleOder: " + leftleOder.toString() +"\n"); + ((FiniteClosure)fc).logFile.write("rightleOder: " + rightleOder.toString() +"\n\n"); + ((FiniteClosure)fc).logFile.write("result3: 0 \n\n"); + ((FiniteClosure)fc).logFile.flush(); + } + catch (IOException ie) { + } + } + */ + return 0; + } + } + + + if (lefteq.size() == 1 && lefteq.iterator().next().getRhsType() instanceof ExtendsType && leftle.size() == 1 && righteq.size() == 0 && rightle.size() == 1) { + return 1; + } + //Fall 2 + if (lefteq.size() == 0 && leftle.size() == 1 && righteq.size() == 1 && righteq.iterator().next().getRhsType() instanceof ExtendsType && rightle.size() == 1) { + return -1; + } + //Fall 3 + if (lefteq.size() == 1 && lefteq.iterator().next().getRhsType() instanceof SuperType && leftle.size() == 1 && righteq.size() == 0 && rightle.size() == 1) { + return -1; + } + //Fall 3 + if (lefteq.size() == 0 && leftle.size() == 1 && righteq.size() == 1 && righteq.iterator().next().getRhsType() instanceof SuperType && rightle.size() == 1) { + return 1; + } + //Fall 5 + if (lefteq.size() == 1 && leftle.size() == 0 && righteq.size() == 1 && rightle.size() == 1) { + return -1; + } + //Fall 5 + if (lefteq.size() == 1 && leftle.size() == 1 && righteq.size() == 1 && rightle.size() == 0) { + return 1; + } + //Fall 5 + if (lefteq.size() == 1 && leftle.size() == 1 && righteq.size() == 1 && rightle.size() == 1) { + return 0; + } + // Nur Paare a =. Theta + if (leftle.size() == 0 && rightle.size() == 0 && leftlewc.size() == 0 && rightlewc.size() ==0) { + Stream lseq = lefteq.stream(); //left.filter(x -> (x.getLhsType() instanceof PlaceholderType && x.getPairOp() == PairOperator.EQUALSDOT)); + Stream rseq = righteq.stream(); //right.filter(x -> (x.getLhsType() instanceof PlaceholderType && x.getPairOp() == PairOperator.EQUALSDOT)); + BinaryOperator> combiner = (x,y) -> { x.putAll(y); return x;}; + HashMap hm = rseq.reduce(new HashMap(), (x, y)-> { x.put(y.getLhsType(),y); return x; }, combiner); + lseq = lseq.filter(x -> !(hm.get(x.getLhsType()) == null));//NOCHMALS UEBERPRUEFEN!!!! + lseq = lseq.filter(x -> !x.equals(hm.get(x.getLhsType()))); //Elemente die gleich sind muessen nicht verglichen werden + Optional si = lseq.map(x -> compareEq(x, hm.get(x.getLhsType()))).reduce((x,y)-> { if (x == y) return x; else return 0; } ); + if (!si.isPresent()) return 0; + else return si.get(); + } + //Fall 1 und 4 + if (lefteq.size() >= 1 && righteq.size() >= 1 && (leftlewc.size() > 0 || rightlewc.size() > 0)) { + if (lefteq.iterator().next().getLhsType().getName().equals("D")) + System.out.print(""); + //Set varsleft = lefteq.stream().map(x -> (PlaceholderType)x.getLhsType()).collect(Collectors.toCollection(HashSet::new)); + //Set varsright = righteq.stream().map(x -> (PlaceholderType)x.getLhsType()).collect(Collectors.toCollection(HashSet::new)); + //filtern des Paares a = Theta, das durch a <. Thata' generiert wurde (nur im Fall 1 relevant) andere Substitutioen werden rausgefiltert + lefteq.removeIf(x -> (x.getBasePair()!=null) && !(x.getLhsType().getName().equals(x.getBasePair().getLhsType().getName()) + ||x.getLhsType().getName().equals(x.getBasePair().getRhsType().getName())));//removeIf(x -> !varsright.contains(x.getLhsType())); + righteq.removeIf(x -> (x.getBasePair()!=null) && !(x.getLhsType().getName().equals(x.getBasePair().getLhsType().getName()) + ||x.getLhsType().getName().equals(x.getBasePair().getRhsType().getName())));//.removeIf(x -> !varsleft.contains(x.getLhsType())); + UnifyPair lseq = lefteq.iterator().next(); + UnifyPair rseq = righteq.iterator().next(); + if (lseq.getRhsType().getName().equals("Object")) { + if (rseq.getRhsType().getName().equals("Object")) return 0; + else return 1; + } + else { + if (rseq.getRhsType().getName().equals("Object")) return -1; + } + if (leftlewc.size() == rightlewc.size()) { + //TODO: Hier wird bei Wildcards nicht das richtige compare aufgerufen PL 18-04-20 + Pair> int_Unifier = compare(lseq.getRhsType(), rseq.getRhsType()); + Unifier uni = new Unifier(); + int_Unifier.getValue().get().forEach(x -> uni.add((PlaceholderType) x.getLhsType(), x.getRhsType())); + if (!lseq.getRhsType().getName().equals(rseq.getRhsType().getName()) + || leftlewc.size() == 0 || rightlewc.size() == 0) return int_Unifier.getKey(); + else { + Set lsleuni = leftlewc.stream().map(x -> uni.apply(x)).collect(Collectors.toCollection(HashSet::new)); + Set rsleuni = rightlewc.stream().map(x -> uni.apply(x)).collect(Collectors.toCollection(HashSet::new)); + BinaryOperator> combiner = (x,y) -> { x.putAll(y); return x;}; + + HashMap hm; + Optional si; + //1. Fall + if (leftlewc.iterator().next().getLhsType() instanceof PlaceholderType) { + hm = rsleuni.stream().reduce(new HashMap(), (x, y)-> { x.put(y.getLhsType(),y); return x; }, combiner); + Stream lslewcstr = lsleuni.stream().filter(x -> !(hm.get(x.getLhsType()) == null)); + si = lslewcstr.map(x -> fc.compare(x.getRhsType(), hm.get(x.getLhsType()).getRhsType(), PairOperator.SMALLERDOTWC)).reduce((x,y)-> { if (x == y) return x; else return 0; } ); + } + //4. Fall + else { + hm = rsleuni.stream().reduce(new HashMap(), (x, y)-> { x.put(y.getRhsType(),y); return x; }, combiner); + Stream lslewcstr = lsleuni.stream().filter(x -> !(hm.get(x.getRhsType()) == null)); + si = lslewcstr.map(x -> fc.compare(x.getLhsType(), hm.get(x.getRhsType()).getLhsType(), PairOperator.SMALLERDOTWC)).reduce((x,y)-> { if (x == y) return x; else return 0; } ); + } + if (!si.isPresent()) return 0; + else return si.get(); + } + } else { + if (leftlewc.size() > 0) { + Set subst; + subst = leftlewc.stream().map(x -> { + if (x.getLhsType() instanceof PlaceholderType) { + return new UnifyPair(x.getLhsType(), x.getRhsType(), PairOperator.EQUALSDOT); + } + else { + return new UnifyPair(x.getRhsType(), x.getLhsType(), PairOperator.EQUALSDOT); + }}).collect(Collectors.toCollection(HashSet::new)); + Unifier uni = new Unifier(); + lseq = uni.apply(lseq); + } + else { + Set subst; + subst = rightlewc.stream().map(x -> { + if (x.getLhsType() instanceof PlaceholderType) { + return new UnifyPair(x.getLhsType(), x.getRhsType(), PairOperator.EQUALSDOT); + } + else { + return new UnifyPair(x.getRhsType(), x.getLhsType(), PairOperator.EQUALSDOT); + }}).collect(Collectors.toCollection(HashSet::new)); + Unifier uni = new Unifier(); + subst.stream().forEach(x -> uni.add((PlaceholderType) x.getLhsType(), x.getRhsType())); + rseq = uni.apply(rseq); + } + return compareEq(lseq, rseq); + } + } + return 0; + } +} + diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/model/PairOperator.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/model/PairOperator.java new file mode 100644 index 0000000..ea323c7 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/model/PairOperator.java @@ -0,0 +1,49 @@ +package de.dhbwstuttgart.typeinference.unify.model; + +/** + * Operators of pairs of the unification. + * @author Florian Steurer + */ +public enum PairOperator { + /** + * The smaller operator (T < P) is used to express a subtyping relation between + * T and P for example in the finite closure. It is necessarily true. + */ + SMALLER, + + /** + * The smallerdot operator (T <. P) is used to express a subtyping relation between + * of T and P in a CONSTRAINT during the unification. It is not necessarily true. + */ + SMALLERDOT, + + /** + * The smallernedot operator for arguments (T / ... with the Supertype Number + */ + SMALLERNEQDOT, + + /** + * The smallerdot operator for arguments (T <.? P) is used to express that + * T is an element of smArg(P) (or P is an element of grArg(T)) in a CONSTRAINT + * during the unification. It is not necessarily true. + */ + SMALLERDOTWC, + + /** + * The equalsdot operator (T =. P) is used to express that two types during the unification + * should be equal. It is not necessarily true. + */ + EQUALSDOT; + + @Override + public String toString() { + switch (this) { + case SMALLER: return "<"; + case SMALLERDOT: return "<."; + case SMALLERNEQDOT: return " EXISTING_PLACEHOLDERS = new ArrayList(); + + /** + * Prefix of auto-generated placeholder names. + */ + protected static String nextName = "gen_"; + + /** + * Random number generator used to generate fresh placeholder name. + */ + protected static Random rnd = new Random(43558747548978L); + + /** + * True if this object was auto-generated, false if this object was user-generated. + */ + private final boolean IsGenerated; + + + /** + * isWildcardable gibt an, ob ein Wildcardtyp dem PlaceholderType zugeordnet werden darf + */ + private boolean wildcardable = true; + + /** + * is innerType gibt an, ob der Type des PlaceholderType innerhalb eines Typkonstruktorsverwendet wird + */ + private boolean innerType = false; + + /** + * variance shows the variance of the pair + * -1: contravariant + * 1 covariant + * 0 invariant + * PL 2018-03-21 + */ + private int variance = 0; + + /* + * Fuer Oder-Constraints: + * orCons = 1: Receiver + * orCons = 0: Argument oder kein Oder-Constraint + * orCons = -1: RetType + */ + private byte orCons = 0; + + /** + * Creates a new placeholder type with the specified name. + */ + public PlaceholderType(String name) { + super(name, new TypeParams()); + EXISTING_PLACEHOLDERS.add(name); // Add to list of existing placeholder names + IsGenerated = false; // This type is user generated + } + + /** + * Creates a new placeholdertype + * @param isGenerated true if this placeholder is auto-generated, false if it is user-generated. + */ + protected PlaceholderType(String name, boolean isGenerated) { + super(name, new TypeParams()); + EXISTING_PLACEHOLDERS.add(name); // Add to list of existing placeholder names + IsGenerated = isGenerated; + } + + public UnifyType accept(UnifyTypeVisitor visitor, T ht) { + return visitor.visit(this, ht); + } + + /** + * Creates a fresh placeholder type with a name that does so far not exist. + * A user could later instantiate a type using the same name that is equivalent to this type. + * @return A fresh placeholder type. + */ + public synchronized static PlaceholderType freshPlaceholder() { + String name = nextName + (char) (rnd.nextInt(22) + 97); // Returns random char between 'a' and 'z' + // Add random chars while the name is in use. + while(EXISTING_PLACEHOLDERS.contains(name)) { + name += (char) (rnd.nextInt(22) + 97); // Returns random char between 'a' and 'z' + } + return new PlaceholderType(name, true); + } + + + /** + * True if this placeholder is auto-generated, false if it is user-generated. + */ + public boolean isGenerated() { + return IsGenerated; + } + + public void setVariance(int v) { + variance = v; + } + + public int getVariance() { + return variance; + } + + public void reversVariance() { + if (variance == 1) { + setVariance(-1); + } else { + if (variance == -1) { + setVariance(1); + }} + } + + public void setOrCons(byte i) { + orCons = i; + } + + public byte getOrCons() { + return orCons; + } + + public Boolean isWildcardable() { + return wildcardable; + } + public void disableWildcardtable() { + wildcardable = false; + } + + public void enableWildcardtable() { + wildcardable = true; + } + + public void setWildcardtable(Boolean wildcardable) { + this.wildcardable = wildcardable; + } + + public Boolean isInnerType() { + return innerType; + } + + public void setInnerType(Boolean innerType) { + this.innerType = innerType; + } + + @Override + Set smArg(IFiniteClosure fc, Set fBounded) { + return fc.smArg(this, fBounded); + } + + @Override + Set grArg(IFiniteClosure fc, Set fBounded) { + return fc.grArg(this, fBounded); + } + + @Override + public UnifyType setTypeParams(TypeParams newTp) { + return this; // Placeholders never have params. + } + + @Override + public int hashCode() { + return typeName.hashCode(); + } + + @Override + UnifyType apply(Unifier unif) { + if(unif.hasSubstitute(this)) { + UnifyType ret = unif.getSubstitute(this); + //PL 2018-05-17 Auskommentierung muesste korrekt sein, + //bereits in JavaTXComplier Variancen gesetzt werden. + //ret.accept(new distributeVariance(), this.getVariance()); + return ret; + } + return this; + } + + @Override + public boolean equals(Object obj) { + if(!(obj instanceof PlaceholderType)) + return false; + + return ((PlaceholderType) obj).getName().equals(typeName); + } + + + @Override + public Collection getInvolvedPlaceholderTypes() { + ArrayList ret = new ArrayList<>(); + ret.add(this); + return ret; + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/model/ReferenceType.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/model/ReferenceType.java new file mode 100644 index 0000000..62465b1 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/model/ReferenceType.java @@ -0,0 +1,100 @@ +package de.dhbwstuttgart.typeinference.unify.model; + +import java.util.HashMap; +import java.util.Set; + +import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure; +import de.dhbwstuttgart.typeinference.unify.interfaces.UnifyTypeVisitor; + +/** + * A reference type e.q. Integer or List. + * @author Florian Steurer + * + */ +public class ReferenceType extends UnifyType { + + /** + * The buffered hashCode + */ + private final int hashCode; + + /** + * gibt an, ob der ReferenceType eine generische Typvariable ist + */ + private final boolean genericTypeVar; + + + public UnifyType accept(UnifyTypeVisitor visitor, T ht) { + return visitor.visit(this, ht); + } + + public ReferenceType(String name, Boolean genericTypeVar) { + super(name, new TypeParams()); + hashCode = 31 + 17 * typeName.hashCode() + 17 * typeParams.hashCode(); + this.genericTypeVar = genericTypeVar; + } + + public ReferenceType(String name, UnifyType... params) { + super(name, new TypeParams(params)); + hashCode = 31 + 17 * typeName.hashCode() + 17 * typeParams.hashCode(); + genericTypeVar = false; + } + + public ReferenceType(String name, TypeParams params) { + super(name, params); + hashCode = 31 + 17 * typeName.hashCode() + 17 * typeParams.hashCode(); + genericTypeVar = false; + } + + public boolean isGenTypeVar () { + return genericTypeVar; + } + + @Override + Set smArg(IFiniteClosure fc, Set fBounded) { + return fc.smArg(this, fBounded); + } + + @Override + Set grArg(IFiniteClosure fc, Set fBounded) { + return fc.grArg(this, fBounded); + } + + @Override + UnifyType apply(Unifier unif) { + TypeParams newParams = typeParams.apply(unif); + + if(newParams.hashCode() == typeParams.hashCode() && newParams.equals(typeParams)) + return this; + + return new ReferenceType(typeName, newParams); + } + + @Override + public UnifyType setTypeParams(TypeParams newTp) { + if(newTp.hashCode() == typeParams.hashCode() && newTp.equals(typeParams)) + return this; // reduced the amount of objects created + return new ReferenceType(typeName, newTp); + } + + @Override + public int hashCode() { + return hashCode; + } + + @Override + public boolean equals(Object obj) { + if(!(obj instanceof ReferenceType)) + return false; + + if(obj.hashCode() != this.hashCode()) + return false; + + ReferenceType other = (ReferenceType) obj; + + if(!other.getName().equals(typeName)) + return false; + + return other.getTypeParams().equals(typeParams); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/model/SuperType.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/model/SuperType.java new file mode 100644 index 0000000..50b8dcf --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/model/SuperType.java @@ -0,0 +1,88 @@ +package de.dhbwstuttgart.typeinference.unify.model; + +import java.util.HashMap; +import java.util.Set; + +import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure; +import de.dhbwstuttgart.typeinference.unify.interfaces.UnifyTypeVisitor; + +/** + * A super wildcard type e.g. ? super Integer. + * @author Florian Steurer + */ +public final class SuperType extends WildcardType { + + public UnifyType accept(UnifyTypeVisitor visitor, T ht) { + return visitor.visit(this, ht); + } + + /** + * Creates a new instance "? extends superedType" + * @param superedType The type that is supered e.g. Integer in "? super Integer" + */ + public SuperType(UnifyType superedType) { + super("? super " + superedType.getName(), superedType); + } + + /** + * The type that is supered e.g. Integer in "? super Integer" + */ + public UnifyType getSuperedType() { + return wildcardedType; + } + + @Override + public String toString() { + return "? super " + wildcardedType; + } + + /** + * Sets the type parameters of the wildcarded type and returns a new supertype that supers that type. + */ + @Override + public UnifyType setTypeParams(TypeParams newTp) { + UnifyType newType = wildcardedType.setTypeParams(newTp); + if(newType == wildcardedType) + return this; // Reduced the amount of objects created + return new SuperType(wildcardedType.setTypeParams(newTp)); + } + + @Override + Set smArg(IFiniteClosure fc, Set fBounded) { + return fc.smArg(this, fBounded); + } + + @Override + Set grArg(IFiniteClosure fc, Set fBounded) { + return fc.grArg(this, fBounded); + } + + @Override + UnifyType apply(Unifier unif) { + UnifyType newType = wildcardedType.apply(unif); + if(newType.hashCode() == wildcardedType.hashCode() && newType.equals(wildcardedType)) + return this; // Reduced the amount of objects created + return new SuperType(newType); + } + + @Override + public int hashCode() { + /* + * It is important that the prime that is added is different to the prime added in hashCode() of ExtendsType. + * Otherwise ? extends T and ? super T have the same hashCode() for every Type T. + */ + return wildcardedType.hashCode() + 3917; + } + + @Override + public boolean equals(Object obj) { + if(!(obj instanceof SuperType)) + return false; + + if(obj.hashCode() != this.hashCode()) + return false; + + SuperType other = (SuperType) obj; + return other.getSuperedType().equals(wildcardedType); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/model/TypeParams.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/model/TypeParams.java new file mode 100644 index 0000000..f70cccb --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/model/TypeParams.java @@ -0,0 +1,191 @@ +package de.dhbwstuttgart.typeinference.unify.model; + +import java.util.*; + + +/** + * The generic or non-generic parameters of a type e.g. for List + * @author Florian Steurer + */ +public final class TypeParams implements Iterable{ + /** + * The array which backs the type parameters. + */ + private final UnifyType[] typeParams; + + /** + * Hashcode calculation is expensive and must be cached. + */ + private final int hashCode; + + /** + * Creates a new set of type parameters. + * @param types The type parameters. + */ + public TypeParams(List types){ + typeParams = new UnifyType[types.size()]; + for(int i=0;i x instanceof PlaceholderType); + } + + /** + * Returns the number of the type parameters in this object. + * @return number of type parameters, always positive (including 0). + */ + public int size() { + return typeParams.length; + } + + /** + * Returns true if this object has size() of zero, false otherwise. + */ + public boolean empty() { + return typeParams.length == 0; + } + + /** + * Applies a unifier to every parameter in this object. + * @param unif The applied unifier. + * @return A new type parameter object, where the unifier was applied to every parameter. + */ + public TypeParams apply(Unifier unif) { + UnifyType[] newParams = new UnifyType[typeParams.length]; + + // If true, a type was modified and a new typeparams object has to be created. + // Otherwise it is enough to return this object, since it is immutable + // This reduced the needed TypeParams-Instances for the lambda14-Test from + // 130.000 to 30.000 without a decrease in speed. + boolean isNew = false; + + for(int i = 0; i < typeParams.length; i++) { + UnifyType newType = typeParams[i].apply(unif); + newParams[i] = newType; + if(!isNew && (newType.hashCode() != typeParams[i].hashCode() || !newType.equals(typeParams[i]))) + isNew = true; + } + + if(!isNew) + return this; + return new TypeParams(newParams); + } + + /** + * True if the PlaceholderType t is a parameter of this object, or if any parameter + * contains t (arbitrary depth of recursion), false otherwise. + */ + public boolean occurs(PlaceholderType t) { + for(UnifyType p : typeParams) + if(p instanceof PlaceholderType) {//PL 2018-01-31 dangeling else Problem { ... } eingefuegt. + if(p.equals(t)) + return true; + } + else { + if(p.getTypeParams().occurs(t)) + return true; } + return false; + } + + /** + * Returns the i-th parameter of this object. + */ + public UnifyType get(int i) { + return typeParams[i]; + } + + /** + * Returns the parameters of this object. + * PL 2018-03-17 + */ + public UnifyType[] get() { + return typeParams; + } + + /** + * Sets the the type t as the i-th parameter and returns a new object + * that equals this object, except for the i-th type. + */ + public TypeParams set(UnifyType t, int idx) { + // Reduce the creation of new objects for less memory + // Reduced the needed instances of TypeParams in the lambda14-Test from + // 150.000 to 130.000 + if(t.hashCode() == typeParams[idx].hashCode() && t.equals(typeParams[idx])) + return this; + UnifyType[] newparams = Arrays.copyOf(typeParams, typeParams.length); + newparams[idx] = t; + return new TypeParams(newparams); + } + + @Override + public Iterator iterator() { + return Arrays.stream(typeParams).iterator(); + } + + @Override + public int hashCode() { + return hashCode; + } + + @Override + public boolean equals(Object obj) { + if(!(obj instanceof TypeParams)) + return false; + + if(obj.hashCode() != this.hashCode()) + return false; + + TypeParams other = (TypeParams) obj; + + if(other.size() != this.size()) + return false; + + for(int i = 0; i < this.size(); i++){ + //if(this.get(i) == null) + //System.out.print("s"); + } + for(int i = 0; i < this.size(); i++) + if(!(this.get(i).equals(other.get(i)))) + return false; + + return true; + } + + @Override + public String toString() { + String res = ""; + for(UnifyType t : typeParams) + res += t + ","; + return "<" + res.substring(0, res.length()-1) + ">"; + } + + public Collection getInvolvedPlaceholderTypes() { + ArrayList ret = new ArrayList<>(); + for(UnifyType t : typeParams){ + ret.addAll(t.getInvolvedPlaceholderTypes()); + } + return ret; + } +} + diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/model/Unifier.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/model/Unifier.java new file mode 100644 index 0000000..db050c0 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/model/Unifier.java @@ -0,0 +1,189 @@ +package de.dhbwstuttgart.typeinference.unify.model; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map.Entry; +import java.util.Set; +import java.util.function.Function; + +/** + * A set of substitutions (s -> t) that is an applicable function to types and pairs. + * @author Florian Steurer + */ +public class Unifier implements Function, Iterable> { + + /** + * The set of substitutions that unify a type-term + */ + private HashMap substitutions = new HashMap<>(); + + /** + * Creates a new instance with a single substitution (source -> target). + * @param The type that is replaced + * @param The type that replaces + */ + public Unifier(PlaceholderType source, UnifyType target) { + substitutions.put(source, target); + } + + /** + * Identity function as an "unifier". + */ + protected Unifier() { + + } + + /** + * Creates an unifier that is the identity function (thus has no substitutions). + */ + public static Unifier identity() { + return new Unifier(); + } + + /** + * Adds a substitution to the unifier from (source -> target) + * @param The type that is replaced + * @param The type that replaces + */ + public void add(PlaceholderType source, UnifyType target) { + Unifier tempU = new Unifier(source, target); + // Every new substitution must be applied to previously added substitutions + // otherwise the unifier needs to be applied multiple times to unify two terms + for(PlaceholderType pt : substitutions.keySet()) + substitutions.put(pt, substitutions.get(pt).apply(tempU)); + substitutions.put(source, target); + } + + @Override + public UnifyType apply(UnifyType t) { + return t.apply(this); + } + + /** + * Applies the unifier to the two terms of the pair. + * @return A new pair where the left and right-hand side are applied + */ + public UnifyPair apply(UnifyPair p) { + UnifyType newLhs = this.apply(p.getLhsType()); + UnifyType newRhs = this.apply(p.getRhsType()); + return new UnifyPair(newLhs, newRhs, p.getPairOp()); + } + + /** + * Applies the unifier to the two terms of the pair. + * works only for single subsitution + * @return A new pair where the left and right-hand side are applied + */ + public UnifyPair apply(UnifyPair thisAsPair, UnifyPair p) { + UnifyType newLhs = this.apply(p.getLhsType()); + UnifyType newRhs = this.apply(p.getRhsType()); + //Varianceweitergabe wird nicht benoetigt. + //PlaceholderType lhsph = (PlaceholderType)thisAsPair.getLhsType(); + //if (lhsph.getVariance() != 0) { + // if (p.getLhsType().equals(lhsph)) { + // if (p.getRhsType() instanceof PlaceholderType) { + // ((PlaceholderType)p.getRhsType()).setVariance(lhsph.getVariance()); + // } + // } + // if (p.getRhsType().equals(lhsph)) { + // if (p.getLhsType() instanceof PlaceholderType) { + // ((PlaceholderType)p.getLhsType()).setVariance(lhsph.getVariance()); + // } + // } + //} + if (!(p.getLhsType().equals(newLhs)) || !(p.getRhsType().equals(newRhs))) {//Die Anwendung von this hat was veraendert PL 2018-04-01 + Set suniUnifyPair = new HashSet<>(); + suniUnifyPair.addAll(thisAsPair.getAllSubstitutions()); + suniUnifyPair.add(thisAsPair); + if (p.getLhsType() instanceof PlaceholderType //&& newLhs instanceof PlaceholderType entfernt PL 2018-04-13 + && p.getPairOp() == PairOperator.EQUALSDOT) { + suniUnifyPair.add(p); //p koennte auch subsitution sein + } + return new UnifyPair(newLhs, newRhs, p.getPairOp(), suniUnifyPair, p); + } + return new UnifyPair(newLhs, newRhs, p.getPairOp(), p.getSubstitution(), p.getBasePair(), p.getfBounded(), p.getLocation()); + } + + /** + * Applies the unifier to the left terms of the pair. + * @return A new pair where the left and right-hand side are applied + */ + public UnifyPair applyleft(UnifyPair p) { + return new UnifyPair(this.apply(p.getLhsType()), p.getRhsType(), p.getPairOp()); + } + + /** + * True if the typevariable t will be substituted if the unifier is applied. + * false otherwise. + */ + public boolean hasSubstitute(PlaceholderType t) { + return substitutions.containsKey(t); + } + + /** + * Returns the type that will replace the typevariable t if the unifier is applied. + */ + public UnifyType getSubstitute(PlaceholderType t) { + return substitutions.get(t); + } + + /** + * The number of substitutions in the unifier. If zero, this is the identity function. + */ + public int size() { + return substitutions.size(); + } + + /** + * Garantuees that if there is a substitutions (a -> b) in this unifier, + * a is not an element of the targetParams. Substitutions that do not + * satisfy this condition, are swapped. + */ + public void swapPlaceholderSubstitutions(Iterable targetParams) { + for(UnifyType tph : targetParams) { + if(!(tph instanceof PlaceholderType)) + continue; + // Swap a substitutions (a -> b) if a is an element of the target params. + if(substitutions.containsKey(tph)) { + if((substitutions.get(tph) instanceof PlaceholderType)) { + PlaceholderType newLhs = (PlaceholderType) substitutions.get(tph); + substitutions.remove(tph); + substitutions.put(newLhs, tph); + } + } + } + } + + public void swapPlaceholderSubstitutionsReverse(Iterable sourceParams) { + for(UnifyType tph : sourceParams) { + if(!(tph instanceof PlaceholderType)) + continue; + if(substitutions.containsValue(tph)) { + UnifyType key = substitutions.values().stream().filter(x -> x.equals(tph)).findAny().get(); + if(key instanceof PlaceholderType) { + PlaceholderType newLhs = (PlaceholderType) tph; + substitutions.remove(key); + substitutions.put(newLhs, key); + } + } + } + } + + @Override + public String toString() { + String result = "{ "; + for(Entry entry : substitutions.entrySet()) + result += "(" + entry.getKey() + " -> " + entry.getValue() + "), "; + if(!substitutions.isEmpty()) + result = result.substring(0, result.length()-2); + result += " }"; + return result; + } + + @Override + public Iterator> iterator() { + return substitutions.entrySet().iterator(); + } +} + diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/model/UnifyPair.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/model/UnifyPair.java new file mode 100644 index 0000000..6b573e3 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/model/UnifyPair.java @@ -0,0 +1,274 @@ +package de.dhbwstuttgart.typeinference.unify.model; + +import com.google.common.collect.ObjectArrays; +import de.dhbwstuttgart.parser.SourceLoc; +import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; +import org.antlr.v4.runtime.Token; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Optional; +import java.util.Set; + + +/** + * A pair which contains two types and an operator, e.q. (Integer <. a). + * @author Florian Steurer + */ +public class UnifyPair { + + private SourceLoc location; + + /** + * The type on the left hand side of the pair. + */ + private final UnifyType lhs; + + /** + * The type on the right hand side of the pair. + */ + private final UnifyType rhs; + + /** + * The operator that determines the relation between the left and right hand side type. + */ + private PairOperator pairOp; + + private boolean undefinedPair = false; + + /** + * Unifier/substitute that generated this pair + * PL 2018-03-15 + */ + private Set substitution; + + /** + * Base on which the the unifier is applied + * PL 2018-03-15 + */ + private UnifyPair basePair; + + /** + * For pairs a <. Theta generated in the rule reduceTphSup + * to store the f-Bouned Elements to avoid endless recursion + * PL 2018-03-15 + */ + private Set fBounded = new HashSet<>(); + + private final int hashCode; + + /** + * Creates a new instance of the pair. + * @param lhs The type on the left hand side of the pair. + * @param rhs The type on the right hand side of the pair. + * @param op The operator that determines the relation between the left and right hand side type. + */ + public UnifyPair(UnifyType lhs, UnifyType rhs, PairOperator op) { + this.lhs = lhs; + this.rhs = rhs; + pairOp = op; + substitution = new HashSet<>(); + + // Caching hashcode + hashCode = 17 + 31 * lhs.hashCode() + 31 * rhs.hashCode() + 31 * pairOp.hashCode(); + } + + public UnifyPair(UnifyType lhs, UnifyType rhs, PairOperator op, SourceLoc location) { + this(lhs, rhs, op); + this.location = location; + } + + public UnifyPair(UnifyType lhs, UnifyType rhs, PairOperator op, Set uni, UnifyPair base) { + this(lhs, rhs, op, uni, base, new HashSet<>()); + } + + public UnifyPair(UnifyType lhs, UnifyType rhs, PairOperator op, Set uni, UnifyPair base, Set fBounded) { + this(lhs, rhs, op, uni, base, fBounded, null); + } + + public UnifyPair(UnifyType lhs, UnifyType rhs, PairOperator op, Set uni, UnifyPair base, Set fBounded, SourceLoc location) { + this.lhs = lhs; + this.rhs = rhs; + pairOp = op; + substitution = uni; + basePair = base; + this.location = location; + this.fBounded = fBounded; + + // Caching hashcode + hashCode = 17 + 31 * lhs.hashCode() + 31 * rhs.hashCode() + 31 * pairOp.hashCode(); + } + + public SourceLoc getLocation() { + if (location != null) return location; + else if (basePair != null) return basePair.getLocation(); + return null; + } + + /** + * Returns the type on the left hand side of the pair. + */ + public UnifyType getLhsType() { + return lhs; + } + + /** + * Returns the type on the right hand side of the pair. + */ + public UnifyType getRhsType() { + return rhs; + } + + /** + * Returns the operator that determines the relation between the left and right hand side type. + */ + public PairOperator getPairOp() { + return pairOp; + } + + public void setPairOp(PairOperator po) { + pairOp = po; + } + + public void addSubstitutions(Set sup) { + substitution.addAll(sup); + } + + public void setUndefinedPair() { + undefinedPair = true; + } + public Set getSubstitution() { + return new HashSet<>(substitution); + } + + public UnifyPair getBasePair() { + return basePair; + } + public boolean isUndefinedPair() { + return undefinedPair; + } + + public Set getAllSubstitutions () { + Set ret = new HashSet<>(); + ret.addAll(new ArrayList<>(getSubstitution())); + if (basePair != null) { + ret.addAll(new ArrayList<>(basePair.getAllSubstitutions())); + } + return ret; + } + + public Set getThisAndAllBases () { + Set ret = getAllBases(); + ret.add(this); + return ret; + } + public Set getAllBases () { + Set ret = new HashSet<>(); + if (basePair != null) { + ret.add(getBasePair()); + ret.addAll(basePair.getAllBases()); + } + return ret; + } + + public UnifyPair getGroundBasePair () { + if (basePair == null) { + return this; + } + if (basePair.getBasePair() == null) { + return basePair; + } + else { + return basePair.getGroundBasePair(); + } + } + + /** + * wenn in einem Paar bestehend aus 2 Typvariablen eine nicht wildcardtable ist, + * so beide auf nicht wildcardtable setzen + */ + public void disableCondWildcards() { + if (lhs instanceof PlaceholderType && rhs instanceof PlaceholderType + && (!((PlaceholderType)lhs).isWildcardable() || !((PlaceholderType)rhs).isWildcardable())) + { + ((PlaceholderType)lhs).disableWildcardtable(); + ((PlaceholderType)rhs).disableWildcardtable(); + } + + } + + public Boolean wrongWildcard() { + return lhs.wrongWildcard() || rhs.wrongWildcard(); + } + + public Set getfBounded() { + return this.fBounded; + } + + @Override + public boolean equals(Object obj) { + if(!(obj instanceof UnifyPair)) + return false; + + if(obj.hashCode() != this.hashCode()) + return false; + + UnifyPair other = (UnifyPair) obj; + + if (isUndefinedPair()) { + if (other.getBasePair() != basePair || (other.getBasePair() == null && basePair == null)) { + return false; + } + + if (!other.getBasePair().equals(basePair) || + !other.getAllSubstitutions().equals(getAllSubstitutions())) { + return false; + } + } + + + return other.getPairOp() == pairOp + && other.getLhsType().equals(lhs) + && other.getRhsType().equals(rhs); + } + + @Override + public int hashCode() { + return hashCode; + } + + @Override + public String toString() { + String ret = ""; + if (lhs instanceof PlaceholderType) { + ret = new Integer(((PlaceholderType)lhs).getVariance()).toString() + " " + + "WC: " + ((PlaceholderType)lhs).isWildcardable() + + ", IT: " + ((PlaceholderType)lhs).isInnerType(); + } + if (rhs instanceof PlaceholderType) { + ret = ret + ", " + new Integer(((PlaceholderType)rhs).getVariance()).toString() + " " + + "WC: " + ((PlaceholderType)rhs).isWildcardable() + + ", IT: " + ((PlaceholderType)rhs).isInnerType(); + } + var res = "(" + lhs + " " + pairOp + " " + rhs + ", " + ret + ")"; //+ ", [" + getfBounded().toString()+ "])"; + var location = this.getLocation(); + if (location != null) { + res += "@" + location.line() + " in " + location.file(); + } + + return res; + } + + /* + public List getInvolvedPlaceholderTypes() { + ArrayList ret = new ArrayList<>(); + ret.addAll(lhs.getInvolvedPlaceholderTypes()); + ret.addAll(rhs.getInvolvedPlaceholderTypes()); + return ret; + } + */ +} + + diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/model/UnifyType.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/model/UnifyType.java new file mode 100644 index 0000000..8d25309 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/model/UnifyType.java @@ -0,0 +1,120 @@ +package de.dhbwstuttgart.typeinference.unify.model; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Set; + +import de.dhbwstuttgart.syntaxtree.StatementVisitor; +import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure; +import de.dhbwstuttgart.typeinference.unify.interfaces.UnifyTypeVisitor; + +/** + * Represents a java type. + * @author Florian Steurer + */ +public abstract class UnifyType { + + /** + * The name of the type e.q. "Integer", "? extends Integer" or "List" for (List) + */ + protected final String typeName; + + /** + * The type parameters of the type. + */ + protected final TypeParams typeParams; + + /** + * Creates a new instance + * @param name Name of the type (e.q. List for List, Integer or ? extends Integer) + * @param typeParams Parameters of the type (e.q. for List) + */ + protected UnifyType(String name, TypeParams p) { + typeName = name; + typeParams = p; + } + + + abstract public UnifyType accept(UnifyTypeVisitor visitor, T ht); + + /** + * Returns the name of the type. + * @return The name e.q. List for List, Integer or ? extends Integer + */ + public String getName() { + return typeName; + } + + /** + * The parameters of the type. + * @return Parameters of the type, e.q. for List. + */ + public TypeParams getTypeParams() { + return typeParams; + } + + /** + * Returns a new type that equals this type except for the type parameters. + * @param newTp The type params of the new type. + * @return A new type object. + */ + public abstract UnifyType setTypeParams(TypeParams newTp); + + /** + * Implementation of the visitor-pattern. Returns the set of smArg + * by calling the most specific overload in the FC. + * @param fc The FC that is called. + * @return The set that is smArg(this) + */ + abstract Set smArg(IFiniteClosure fc, Set fBounded); + + /** + * Implementation of the visitor-pattern. Returns the set of grArg + * by calling the most specific overload in the FC. + * @param fc The FC that is called. + * @return The set that is grArg(this) + */ + abstract Set grArg(IFiniteClosure fc, Set fBounded); + + /** + * Applies a unifier to this object. + * @param unif The unifier + * @return A UnifyType, that may or may not be a new object, that has its subtypes substituted. + */ + abstract UnifyType apply(Unifier unif); + + @Override + public String toString() { + String params = ""; + if(typeParams.size() != 0) { + for(UnifyType param : typeParams) + params += param.toString() + ","; + params = "<" + params.substring(0, params.length()-1) + ">"; + } + + return typeName + params; + } + + public Collection getInvolvedPlaceholderTypes() { + ArrayList ret = new ArrayList<>(); + ret.addAll(typeParams.getInvolvedPlaceholderTypes()); + return ret; + } + + public Boolean wrongWildcard() {//default + return false; + } + + @Override + public int hashCode() { + return this.toString().hashCode(); + } + + @Override + public boolean equals(Object obj) { + if(obj == null)return false; + return this.toString().equals(obj.toString()); + } +} \ No newline at end of file diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/model/WildcardType.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/model/WildcardType.java new file mode 100644 index 0000000..ed706b2 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/model/WildcardType.java @@ -0,0 +1,72 @@ +package de.dhbwstuttgart.typeinference.unify.model; + +import java.util.ArrayList; +import java.util.Collection; + +/** + * A wildcard type that is either a ExtendsType or a SuperType. + * @author Florian Steurer + */ +public abstract class WildcardType extends UnifyType { + + /** + * The wildcarded type, e.q. Integer for ? extends Integer. Never a wildcard type itself. + */ + protected UnifyType wildcardedType; + + /** + * Creates a new instance. + * @param name The name of the type, e.q. ? extends Integer + * @param wildcardedType The wildcarded type, e.q. Integer for ? extends Integer. Never a wildcard type itself. + */ + protected WildcardType(String name, UnifyType wildcardedType) { + super(name, wildcardedType.getTypeParams()); + this.wildcardedType = wildcardedType; + } + + /** + * Returns the wildcarded type, e.q. Integer for ? extends Integer. + * @return The wildcarded type. Never a wildcard type itself. + */ + public UnifyType getWildcardedType() { + return wildcardedType; + } + + /** + * Returns the type parameters of the WILDCARDED TYPE. + */ + @Override + public TypeParams getTypeParams() { + return wildcardedType.getTypeParams(); + } + + @Override + public Boolean wrongWildcard () {//This is an error + return (wildcardedType instanceof WildcardType); + } + + @Override + public int hashCode() { + return wildcardedType.hashCode() + getName().hashCode() + 17; + } + + @Override + public boolean equals(Object obj) { + if(!(obj instanceof WildcardType)) + return false; + + if(obj.hashCode() != this.hashCode()) + return false; + + WildcardType other = (WildcardType) obj; + return other.getWildcardedType().equals(wildcardedType); + } + + + @Override + public Collection getInvolvedPlaceholderTypes() { + ArrayList ret = new ArrayList<>(); + ret.addAll(wildcardedType.getInvolvedPlaceholderTypes()); + return ret; + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/model/hashKeyType.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/model/hashKeyType.java new file mode 100644 index 0000000..dedfcd8 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/model/hashKeyType.java @@ -0,0 +1,25 @@ +package de.dhbwstuttgart.typeinference.unify.model; + +public class hashKeyType { + UnifyType realType; + + hashKeyType(UnifyType realType) { + this.realType= realType; + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof hashKeyType) { + return realType.equals(((hashKeyType)obj).realType); + } + else + { + return false; + } + } + + @Override + public int hashCode() { + return realType.hashCode(); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/visitUnifyTypeVisitor.java b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/visitUnifyTypeVisitor.java new file mode 100644 index 0000000..9ea3dc5 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/typeinference/unify/visitUnifyTypeVisitor.java @@ -0,0 +1,47 @@ +package de.dhbwstuttgart.typeinference.unify; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.HashMap; +import java.util.stream.Collectors; + +import de.dhbwstuttgart.typeinference.unify.interfaces.UnifyTypeVisitor; +import de.dhbwstuttgart.typeinference.unify.model.ExtendsType; +import de.dhbwstuttgart.typeinference.unify.model.FunNType; +import de.dhbwstuttgart.typeinference.unify.model.PlaceholderType; +import de.dhbwstuttgart.typeinference.unify.model.ReferenceType; +import de.dhbwstuttgart.typeinference.unify.model.SuperType; +import de.dhbwstuttgart.typeinference.unify.model.TypeParams; + +public class visitUnifyTypeVisitor implements UnifyTypeVisitor { + + public ReferenceType visit(ReferenceType refty, T ht) { + return new ReferenceType(refty.getName(), + new TypeParams( + Arrays.stream(refty.getTypeParams().get()) + .map(x -> x.accept(this, ht)) + .collect(Collectors.toCollection(ArrayList::new)))); + } + + public PlaceholderType visit(PlaceholderType phty, T ht) { + return phty; + } + + public FunNType visit(FunNType funnty, T ht) { + return FunNType.getFunNType( + new TypeParams( + Arrays.stream(funnty.getTypeParams().get()) + .map(x -> x.accept(this, ht)) + .collect(Collectors.toCollection(ArrayList::new))) + ); + } + + public SuperType visit(SuperType suty, T ht) { + return new SuperType(suty.getWildcardedType().accept(this, ht)); + } + + public ExtendsType visit(ExtendsType extty, T ht) { + return new ExtendsType(extty.getWildcardedType().accept(this, ht)); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/util/BiRelation.java b/javatx-src/main/java/de/dhbwstuttgart/util/BiRelation.java new file mode 100644 index 0000000..ba4eec5 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/util/BiRelation.java @@ -0,0 +1,19 @@ +package de.dhbwstuttgart.util; + +import java.util.ArrayList; + +public class BiRelation extends ArrayList>{ + + public void put(X x, Y y) { + this.add(new Pair<>(x,y)); + } + + public void put(Pair p) { + this.add(p); + } + + + public void putAll(BiRelation br) { + this.addAll(br); + } +} diff --git a/javatx-src/main/java/de/dhbwstuttgart/util/Pair.java b/javatx-src/main/java/de/dhbwstuttgart/util/Pair.java new file mode 100644 index 0000000..8bd5bf9 --- /dev/null +++ b/javatx-src/main/java/de/dhbwstuttgart/util/Pair.java @@ -0,0 +1,39 @@ +package de.dhbwstuttgart.util; + +import java.util.Objects; +import java.util.Optional; + +public class Pair { + private final T key; + private final T1 value; + + public Pair(T a, T1 b) { + this.value = b; + this.key = a; + } + + public Optional getValue() { + return Optional.of(value); + } + + public T getKey() { + return key; + } + + public String toString() { + return "(" + key.toString() + "," + value.toString() + ")\n"; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Pair pair = (Pair) o; + return Objects.equals(key, pair.key) && Objects.equals(value, pair.value); + } + + @Override + public int hashCode() { + return Objects.hash(key, value); + } +} diff --git a/out/tests/resources/AllgemeinTest/Assign.jav b/out/tests/resources/AllgemeinTest/Assign.jav new file mode 100644 index 0000000..001fca7 --- /dev/null +++ b/out/tests/resources/AllgemeinTest/Assign.jav @@ -0,0 +1,10 @@ +class Assign { + + assign(x, y) { + x = y; + } + + assign2(x, y) { + assign(x,y); + } +} \ No newline at end of file diff --git a/out/tests/resources/AllgemeinTest/CaptureConversion.jav b/out/tests/resources/AllgemeinTest/CaptureConversion.jav new file mode 100644 index 0000000..b1033de --- /dev/null +++ b/out/tests/resources/AllgemeinTest/CaptureConversion.jav @@ -0,0 +1,18 @@ +import java.lang.Object; +import java.util.Vector; + +class CaptureConversion { + + void assign(Vector v1, Vector v2) { + v1 = v2; + } + + void main() { + Vector v1; + v1 = new Vector(); + Vector v2; + v2 = new Vector(); + v1 = v2; + assign(v1, v2); + } +} \ No newline at end of file diff --git a/out/tests/resources/AllgemeinTest/Complex.jav b/out/tests/resources/AllgemeinTest/Complex.jav new file mode 100644 index 0000000..15d5c5d --- /dev/null +++ b/out/tests/resources/AllgemeinTest/Complex.jav @@ -0,0 +1,22 @@ +class Pair { + U a; + T b; + Pair(U x, T y) { + a = x; b = y; + } +} + +class Complex { + m(b) { + var c = b; + var d = c; + var e; + d = e; + var r1 = e; + var f = e; + var g; + f = g; + var r2 = g; + return new Pair<>(r1, r2); + } +} \ No newline at end of file diff --git a/out/tests/resources/AllgemeinTest/InfReturn.jav b/out/tests/resources/AllgemeinTest/InfReturn.jav new file mode 100644 index 0000000..d1f6211 --- /dev/null +++ b/out/tests/resources/AllgemeinTest/InfReturn.jav @@ -0,0 +1,7 @@ +public class InfReturn { + m(a) { + var ret; + a = ret; + return ret; + } +} \ No newline at end of file diff --git a/out/tests/resources/AllgemeinTest/InfReturnII.jav b/out/tests/resources/AllgemeinTest/InfReturnII.jav new file mode 100644 index 0000000..e1e9597 --- /dev/null +++ b/out/tests/resources/AllgemeinTest/InfReturnII.jav @@ -0,0 +1,8 @@ +public class InfReturnII { + m(a, b) { + var ret; + a = ret; + b = ret; + return ret; + } +} \ No newline at end of file diff --git a/out/tests/resources/AllgemeinTest/InnerInf.jav b/out/tests/resources/AllgemeinTest/InnerInf.jav new file mode 100644 index 0000000..4eaa183 --- /dev/null +++ b/out/tests/resources/AllgemeinTest/InnerInf.jav @@ -0,0 +1,7 @@ +class InnerInf { + m(a, b) { + var i; + a = i; + b = i; + } +} \ No newline at end of file diff --git a/out/tests/resources/AllgemeinTest/Iteration.jav b/out/tests/resources/AllgemeinTest/Iteration.jav new file mode 100644 index 0000000..2af750a --- /dev/null +++ b/out/tests/resources/AllgemeinTest/Iteration.jav @@ -0,0 +1,43 @@ +/* +class Pair { + T x; + U y; + + public Pair() { } + public Pair(T x, U y) { + this.x = x; + this.y = y; + } + + public T fst () { + return x; + } + + public U snd () { + return y; + } +} +*/ + +public class Iteration { + id(x) { + return x; + } + + m1(x, y) { + var help; + help = m2(x, y); + var y2 = help.snd(); + var x2 = id(x); + return new Pair<>(x2,y2); + + } + + m2(x,y) { + var help = m1(x, y); + var x2 = help.fst(); + var y2 = id(y); + return new Pair<>(x2, y2); + } +} + \ No newline at end of file diff --git a/out/tests/resources/AllgemeinTest/Overloading.jav b/out/tests/resources/AllgemeinTest/Overloading.jav new file mode 100644 index 0000000..2809813 --- /dev/null +++ b/out/tests/resources/AllgemeinTest/Overloading.jav @@ -0,0 +1,7 @@ +import java.lang.Integer; +import java.lang.Double; + +class Overloading { + m(x) { return x + x; } + m(x) { return x || x; } +} \ No newline at end of file diff --git a/out/tests/resources/AllgemeinTest/Pair.jav b/out/tests/resources/AllgemeinTest/Pair.jav new file mode 100644 index 0000000..89660b1 --- /dev/null +++ b/out/tests/resources/AllgemeinTest/Pair.jav @@ -0,0 +1,36 @@ +import java.util.Vector; +import java.lang.Boolean; +import java.lang.Object; + +class Pair { + U a; + T b; + + make(x) { + var ret = new Pair<>(); + ret.a = x.elementAt(0); + ret.b = x.elementAt(1); + return ret; + } + + + eq(a, b) { + b = a; + return a == b; + } + + + compare( p) { + return eq(p.a, p.b); + //return p.a == p.b; + } + + +/* + void m(Pair p, Vector b) + { + //this.compare(p); //1, type incorrect + this.compare(this.make(b)); //2, OK + } +*/ +} \ No newline at end of file diff --git a/out/tests/resources/AllgemeinTest/RecursionCond.jav b/out/tests/resources/AllgemeinTest/RecursionCond.jav new file mode 100644 index 0000000..1640471 --- /dev/null +++ b/out/tests/resources/AllgemeinTest/RecursionCond.jav @@ -0,0 +1,8 @@ +class RecursionCond { + m(a, b, c) { + if (1 == 2) { + b = m(a, b); + c = m(a, b); + } else return a; + } +} \ No newline at end of file diff --git a/out/tests/resources/AllgemeinTest/StreamTest.jav b/out/tests/resources/AllgemeinTest/StreamTest.jav new file mode 100644 index 0000000..cfaf23d --- /dev/null +++ b/out/tests/resources/AllgemeinTest/StreamTest.jav @@ -0,0 +1,14 @@ +import java.util.stream.Stream; +import java.util.Vector; +import java.lang.Integer; + +class StreamTest { + + m() { + var vecInt = new Vector(); + var strInt = vecInt.stream(); + var dup = x -> x*2; + strInt.map(dup); + return dup; + } +} \ No newline at end of file diff --git a/out/tests/resources/AllgemeinTest/Test.jav b/out/tests/resources/AllgemeinTest/Test.jav new file mode 100644 index 0000000..48491b8 --- /dev/null +++ b/out/tests/resources/AllgemeinTest/Test.jav @@ -0,0 +1,9 @@ +import java.lang.Boolean; +import java.lang.Integer; + +public class Test { + fac = (x) -> { + if (x == 1) { return 1; } + return x * fac.apply(x - 1); + }; +} \ No newline at end of file diff --git a/out/tests/resources/AllgemeinTest/TripleTest.jav b/out/tests/resources/AllgemeinTest/TripleTest.jav new file mode 100644 index 0000000..a0560b6 --- /dev/null +++ b/out/tests/resources/AllgemeinTest/TripleTest.jav @@ -0,0 +1,19 @@ +class Triple { + U a; + T b; + S c; + + Triple(U x, T y, S z) { + a = x; b = y; c = z; + } + + U fst() { return a; } + T snd() { return b; } + S thrd() { return c; } +} + +public class TripleTest { + m() { + return new Triple<>(m().thrd(), m().thrd(), m().thrd()); + } +} \ No newline at end of file diff --git a/out/tests/resources/AllgemeinTest/Twice2.jav b/out/tests/resources/AllgemeinTest/Twice2.jav new file mode 100644 index 0000000..87a3f23 --- /dev/null +++ b/out/tests/resources/AllgemeinTest/Twice2.jav @@ -0,0 +1,12 @@ +class Twice2 { + id1inst = new Id<>(); + id1 = id1inst.id; + id2inst = new Id<>(); + id2 = id2inst.id; + twice = id1.apply(id2); + +} + +class Id { + id = (T x) -> x; +} \ No newline at end of file diff --git a/out/tests/resources/AllgemeinTest/UseWildcardPair.jav b/out/tests/resources/AllgemeinTest/UseWildcardPair.jav new file mode 100644 index 0000000..dc91e4e --- /dev/null +++ b/out/tests/resources/AllgemeinTest/UseWildcardPair.jav @@ -0,0 +1,12 @@ +import java.util.Vector; +import java.lang.Boolean; + +class UseWildcardPair{ + + void m(Pair p, Vector b) + { + p.compare(p); //1, type incorrect + p.compare(p.make(b)); //2, OK + } + +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/AA.jav b/out/tests/resources/bytecode/javFiles/AA.jav new file mode 100644 index 0000000..3f8f172 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/AA.jav @@ -0,0 +1,8 @@ +import java.lang.Integer; +import java.lang.String; + +public class AA { + m(Integer i) { return "AA"; } + + m2(AA x) { return "AA"; } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/AddLong.jav b/out/tests/resources/bytecode/javFiles/AddLong.jav new file mode 100644 index 0000000..d6d47e9 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/AddLong.jav @@ -0,0 +1,9 @@ +import java.lang.Integer; +import java.lang.Long; + +public class AddLong{ + Long add(Integer a, Long b) { + Long c = a+b; + return c; + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/AssignToLit.jav b/out/tests/resources/bytecode/javFiles/AssignToLit.jav new file mode 100644 index 0000000..873828e --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/AssignToLit.jav @@ -0,0 +1,30 @@ +import java.lang.Integer; +import java.lang.Boolean; +import java.lang.String; +import java.lang.Byte; +import java.lang.Short; +import java.lang.Long; +import java.lang.Float; +import java.lang.Double; +import java.lang.Character; + +class AssignToLit { + void m(){ +// String s = "Test"; +// Boolean b = false; +// Byte byte1 = 5; +// Byte byte2 = 55; +// Short short1 = 5; +// Short short2 = 55; +// Integer int1 = 5; +// Integer int2 = 8888888; +// Long long1 = 1; +// Long long2 = 5; +// Long long3 = 89989898; +// Float float1 = 1; +// Float float2 = 55; +// Double d1 = 1; +// Double d2 = 55; + Character c = 'A'; + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/BB.jav b/out/tests/resources/bytecode/javFiles/BB.jav new file mode 100644 index 0000000..27856c4 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/BB.jav @@ -0,0 +1,3 @@ +import java.lang.Integer; + +public class BB extends AA { } \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/BinaryInMeth.jav b/out/tests/resources/bytecode/javFiles/BinaryInMeth.jav new file mode 100644 index 0000000..0e1ddc5 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/BinaryInMeth.jav @@ -0,0 +1,17 @@ +import java.lang.Integer; +import java.lang.Double; + +public class BinaryInMeth { + + public m(a){ + return ++a; + } + + public m2(a,b){ + return m(a+b); + } + + public m3(a) { + return m(++a); + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/Box.jav b/out/tests/resources/bytecode/javFiles/Box.jav new file mode 100644 index 0000000..4859d61 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Box.jav @@ -0,0 +1,7 @@ +class B { } +class Box_Main extends B { + m(b) { + b.m(new Box_Main()); + b.m(new B()); + } +} diff --git a/out/tests/resources/bytecode/javFiles/Box.java b/out/tests/resources/bytecode/javFiles/Box.java new file mode 100644 index 0000000..581e725 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Box.java @@ -0,0 +1,3 @@ +class Box { + void m(A a) { } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/CC.jav b/out/tests/resources/bytecode/javFiles/CC.jav new file mode 100644 index 0000000..d7d5c96 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/CC.jav @@ -0,0 +1,11 @@ +import java.lang.Integer; +import java.lang.String; + + +public class CC extends BB { + m(Integer i) { + return "CC"; + } + + m2(CC x) { return "CC"; } +} diff --git a/out/tests/resources/bytecode/javFiles/Chain.jav b/out/tests/resources/bytecode/javFiles/Chain.jav new file mode 100644 index 0000000..c6b034a --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Chain.jav @@ -0,0 +1,13 @@ +import java.lang.Integer; + +public class Chain { + x = 5; + + chain() { + return this; + } + + m() { + return this.chain().chain().chain().x; + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/ClassGenLam.jav b/out/tests/resources/bytecode/javFiles/ClassGenLam.jav new file mode 100644 index 0000000..0e9cf05 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/ClassGenLam.jav @@ -0,0 +1,8 @@ +import java.lang.Integer; + +public class ClassGenLam { + lam = x-> x; +// public ClassGenLam() { +// lam = x->x; +// } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/Cycle.jav b/out/tests/resources/bytecode/javFiles/Cycle.jav new file mode 100644 index 0000000..85f2ba9 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Cycle.jav @@ -0,0 +1,6 @@ +class Cycle { + m(x, y) { + y = x; + x = y; + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/DD.jav b/out/tests/resources/bytecode/javFiles/DD.jav new file mode 100644 index 0000000..6d49f4c --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/DD.jav @@ -0,0 +1,4 @@ +import java.lang.Integer; + +public class DD extends CC { } + diff --git a/out/tests/resources/bytecode/javFiles/DuMethod.jav b/out/tests/resources/bytecode/javFiles/DuMethod.jav new file mode 100644 index 0000000..3898a7b --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/DuMethod.jav @@ -0,0 +1,11 @@ +public class DuMethod{ + + method(a){ + return a+a; + } + + method(a){ + return a; + } + +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/EmptyClass.jav b/out/tests/resources/bytecode/javFiles/EmptyClass.jav new file mode 100644 index 0000000..8160d7d --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/EmptyClass.jav @@ -0,0 +1,3 @@ +public class EmptyClass{ + +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/EmptyMethod.jav b/out/tests/resources/bytecode/javFiles/EmptyMethod.jav new file mode 100644 index 0000000..961989d --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/EmptyMethod.jav @@ -0,0 +1,8 @@ +public class EmptyMethod{ + + public void m1(){ + System.out.println("test"); + } + + public void m2(){} +} diff --git a/out/tests/resources/bytecode/javFiles/Example.jav b/out/tests/resources/bytecode/javFiles/Example.jav new file mode 100644 index 0000000..b7455a3 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Example.jav @@ -0,0 +1,9 @@ +import java.lang.String; + +public class Example { + + public m() { + String x = "X"; + return x; + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/Exceptions.jav b/out/tests/resources/bytecode/javFiles/Exceptions.jav new file mode 100644 index 0000000..9903511 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Exceptions.jav @@ -0,0 +1,3 @@ +public class Exceptions { +// m(Integer i) throws +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/Expressions.jav b/out/tests/resources/bytecode/javFiles/Expressions.jav new file mode 100644 index 0000000..e2e992a --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Expressions.jav @@ -0,0 +1,8 @@ +class Expressions{ + +void test(){ + var x = 2; + x = x + 2; +} + +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/FC_Matrix.jav b/out/tests/resources/bytecode/javFiles/FC_Matrix.jav new file mode 100644 index 0000000..75ead47 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/FC_Matrix.jav @@ -0,0 +1,10 @@ +import java.util.Vector; + +class Matrix extends Vector> { + + methode(m) { + m.add(1); + Matrix i; + methode(i); + } + } diff --git a/out/tests/resources/bytecode/javFiles/Fac.jav b/out/tests/resources/bytecode/javFiles/Fac.jav new file mode 100644 index 0000000..1e09235 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Fac.jav @@ -0,0 +1,15 @@ +import java.lang.Integer; +import java.lang.Double; +import java.lang.String; + +public class Fac { + getFac(n) { + var res = 1; + var i = 1; + while (i <= n) { + res = res * i; + i++; + } + return res; + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/Faculty.jav b/out/tests/resources/bytecode/javFiles/Faculty.jav new file mode 100644 index 0000000..276d8df --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Faculty.jav @@ -0,0 +1,52 @@ +import java.lang.Integer; +//import java.lang.Long; +//import java.lang.Short; + +public class Faculty { + public fact; + Faculty() { + fact = (x) -> { + if (x == 1) { + return 1; + } + else { + return x * (fact.apply(x-1)); + } + }; + } + + + + public getFact(java.lang.Integer x) { + return fact.apply(x); + } +} +// m (x) { +// +//// var fact = (x) -> { +//// if (x == 1) { +//// return x; +//// } +//// else { +//// return x * (fact.apply(x-1)); +//// } +//// }; +//// return fact; +//// var x = 13; +//// if(x>22) { +//// return 0; +//// }else if(x <1){ +//// return x; +//// }else { +//// return 1; +//// } +// +// if (x < 0) { +// return 0; +// }else if(x<2) { +// return x; +// } else { +// return x * m(x-1); +// } +// } +//} diff --git a/out/tests/resources/bytecode/javFiles/Faculty2.jav b/out/tests/resources/bytecode/javFiles/Faculty2.jav new file mode 100644 index 0000000..828f06f --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Faculty2.jav @@ -0,0 +1,10 @@ +class Faculty2 { + + m () { + + var fact = (Integer x) -> { + return x; + }; + return fact; + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/FacultyIf.jav b/out/tests/resources/bytecode/javFiles/FacultyIf.jav new file mode 100644 index 0000000..3c36892 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/FacultyIf.jav @@ -0,0 +1,17 @@ +import java.lang.Integer; + +class Faculty { + + m () { + + var fact = (Integer x) -> { + if (x == 1) { + return x; + } + else { + return x * (fact.apply(x-1)); + } + }; + return fact; + } +} diff --git a/out/tests/resources/bytecode/javFiles/FacultyTyped.jav b/out/tests/resources/bytecode/javFiles/FacultyTyped.jav new file mode 100644 index 0000000..089d2f3 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/FacultyTyped.jav @@ -0,0 +1,19 @@ +import java.lang.Integer; + +class Faculty { + + Integer mul(Integer x, Integer y) { + return x; + } + + Fun1 m () { + var fact = (Integer x) -> { + return mul(x, fact.apply(x)); + }; + return fact; + } +} + +interface Fun1{ + B apply(A a); +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/Field.jav b/out/tests/resources/bytecode/javFiles/Field.jav new file mode 100644 index 0000000..0fd1133 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Field.jav @@ -0,0 +1,9 @@ +import java.lang.Integer; + +public class Field { + public x = 5; + + m(){ + return x; + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/FieldAccess.jav b/out/tests/resources/bytecode/javFiles/FieldAccess.jav new file mode 100644 index 0000000..894bb6e --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/FieldAccess.jav @@ -0,0 +1,13 @@ +class Box { +A f; +} +class B { + } + +class Box_Main extends B { + + m(b) { + b.f = new Box_Main(); + b.f = new B(); + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/FieldTph.jav b/out/tests/resources/bytecode/javFiles/FieldTph.jav new file mode 100644 index 0000000..fc74e53 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/FieldTph.jav @@ -0,0 +1,4 @@ +public class FieldTph { + a; + +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/FieldTph2.jav b/out/tests/resources/bytecode/javFiles/FieldTph2.jav new file mode 100644 index 0000000..ed0d452 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/FieldTph2.jav @@ -0,0 +1,14 @@ +import java.lang.String; + +public class FieldTph2 { + a; + + m(b){ + b = a; + return b; + } + + m2(c){ + a = c; + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/FieldTphConsMeth.jav b/out/tests/resources/bytecode/javFiles/FieldTphConsMeth.jav new file mode 100644 index 0000000..cf195bd --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/FieldTphConsMeth.jav @@ -0,0 +1,26 @@ +public class FieldTphConsMeth { + + a; + public FieldTphConsMeth(c) { + a = id(c); + } + + id(b) { + return b; + } + + setA(x) { + a = x; + return a; + } + + m(x,y) { + x = id(y); + } + + /*m2(x,y) { + x = setA(y); + return x; + }*/ + +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/FieldTphMMeth.jav b/out/tests/resources/bytecode/javFiles/FieldTphMMeth.jav new file mode 100644 index 0000000..ad97edc --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/FieldTphMMeth.jav @@ -0,0 +1,27 @@ +import java.lang.Boolean; + +public class FieldTphMMeth { + a; + + public FieldTphMMeth(c,d,e) { + a = m(c,d,e); + } + + m(b,d,e) { + if(e) { + return m3(b); + } else{ + return m3(d); + } + + } + + m2(b) { + a = m3(b); + } + + m3(b){ + return b; + } + +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/Fields.jav b/out/tests/resources/bytecode/javFiles/Fields.jav new file mode 100644 index 0000000..cd2add7 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Fields.jav @@ -0,0 +1,11 @@ +import java.lang.String; + +class Fields{ +test2 = "test"; +test; +m(){ + var test3; + return test; +} + +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/For.jav b/out/tests/resources/bytecode/javFiles/For.jav new file mode 100644 index 0000000..2d967f9 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/For.jav @@ -0,0 +1,30 @@ +import java.lang.Integer; +import java.lang.Boolean; + +class For{ + Integer m(Integer x){ + var c = x + 2; + Boolean b = true; + c = 5; + c++; + ++c; + c--; + --c; + while(x<2){ + x = x +1; + b = false; + } + for(int i = 0; i<10; i++) { + x = x + 5; + } + return x; + } + +// m2(Integer x){ +// if(x<2) { +// return 1; +// }else { +// return 2; +// } +// } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/FunOL.jav b/out/tests/resources/bytecode/javFiles/FunOL.jav new file mode 100644 index 0000000..60736e1 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/FunOL.jav @@ -0,0 +1,12 @@ +import java.util.Vector; +import java.lang.Integer; +import java.lang.String; +//import java.lang.Byte; +//import java.lang.Boolean; + +public class FunOL { + + add(f, y) { + return f.apply() + y; + } +} diff --git a/out/tests/resources/bytecode/javFiles/FunctionalInterface.jav b/out/tests/resources/bytecode/javFiles/FunctionalInterface.jav new file mode 100644 index 0000000..62120fa --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/FunctionalInterface.jav @@ -0,0 +1,15 @@ +import java.lang.Integer; +import java.util.function.Function; + +public class FunctionalInterface { + Integer accept(Function f) { + return f.apply(20); + } + + Integer m() { + var v = accept(i -> { + return i * 10; + }); + return v; + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/Gen.jav b/out/tests/resources/bytecode/javFiles/Gen.jav new file mode 100644 index 0000000..3b58b18 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Gen.jav @@ -0,0 +1,8 @@ +import java.lang.Integer; +import java.util.Vector; + +public class Gen{ + Vector m(Vector v){ + return v; + } +} diff --git a/out/tests/resources/bytecode/javFiles/Generics.jav b/out/tests/resources/bytecode/javFiles/Generics.jav new file mode 100644 index 0000000..bb7b2af --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Generics.jav @@ -0,0 +1,17 @@ + +class Generics { + Generics(B b){ + } + B mt1(B b){ + return mt1(b); + } +} + + +/* +Problem: +auto test = new List(); +auto test2 = new List(); +... //code, welcher möglicherweise test und test2 vertauscht +test.add("hallo"); +*/ \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/Generics2.jav b/out/tests/resources/bytecode/javFiles/Generics2.jav new file mode 100644 index 0000000..762890b --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Generics2.jav @@ -0,0 +1,9 @@ +import java.lang.String; +import java.lang.Integer; + +class Generics2{ + B m1(B b){ + return b; + } + +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/Generics3.jav b/out/tests/resources/bytecode/javFiles/Generics3.jav new file mode 100644 index 0000000..fb354d4 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Generics3.jav @@ -0,0 +1,7 @@ +import java.lang.String; +import java.lang.Integer; +import java.util.List; + +class Generics3> { + +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/Generics4.jav b/out/tests/resources/bytecode/javFiles/Generics4.jav new file mode 100644 index 0000000..50b0b3e --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Generics4.jav @@ -0,0 +1,12 @@ +import java.lang.String; +import java.lang.Integer; + +class Generics4 { + C m1(C b){ + return b; + } + + m2(x) { + return m1(x); + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/GreaterEqual.jav b/out/tests/resources/bytecode/javFiles/GreaterEqual.jav new file mode 100644 index 0000000..3ec69e8 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/GreaterEqual.jav @@ -0,0 +1,57 @@ +import java.lang.Integer; +import java.lang.Long; +import java.lang.Float; +import java.lang.Double; + +public class GreaterEqual { + + gE(Integer a, Integer b){ + var c = a>=b; + return c; + } + + gE(Long a, Long b){ + var c = a>=b; + return c; + } + + gE(Float a, Float b){ + var c = a>=b; + return c; + } + + gE(Double a, Double b){ + var c = a>=b; + return c; + } + + gE(Long a, Integer b){ + var c = a>=b; + return c; + } + + gE(Float a, Integer b){ + var c = a>=b; + return c; + } + + gE(Double a, Integer b){ + var c = a>=b; + return c; + } + + gE(Float a, Long b){ + var c = a>=b; + return c; + } + + gE(Double a, Long b){ + var c = a>=b; + return c; + } + + gE(Double a, Float b){ + var c = a>=b; + return c; + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/GreaterThan.jav b/out/tests/resources/bytecode/javFiles/GreaterThan.jav new file mode 100644 index 0000000..9077f5b --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/GreaterThan.jav @@ -0,0 +1,56 @@ +import java.lang.Integer; +import java.lang.Long; +import java.lang.Float; +import java.lang.Double; + +public class GreaterThan { + gT(Integer a, Integer b){ + var c = a>b; + return c; + } + + gT(Long a, Long b){ + var c = a>b; + return c; + } + + gT(Float a, Float b){ + var c = a>b; + return c; + } + + gT(Double a, Double b){ + var c = a>b; + return c; + } + + gT(Long a, Integer b){ + var c = a>b; + return c; + } + + gT(Float a, Integer b){ + var c = a>b; + return c; + } + + gT(Double a, Integer b){ + var c = a>b; + return c; + } + + gT(Float a, Long b){ + var c = a>b; + return c; + } + + gT(Double a, Long b){ + var c = a>b; + return c; + } + + gT(Double a, Float b){ + var c = a>b; + return c; + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/HelloWorld.jav b/out/tests/resources/bytecode/javFiles/HelloWorld.jav new file mode 100644 index 0000000..ff3df08 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/HelloWorld.jav @@ -0,0 +1,9 @@ +import java.lang.System; +import java.lang.String; +import java.io.PrintStream; + +public class HelloWorld { + static hello() { + System.out.println("Hello World!"); + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/Id.jav b/out/tests/resources/bytecode/javFiles/Id.jav new file mode 100644 index 0000000..f31991d --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Id.jav @@ -0,0 +1,20 @@ +public class Id { +// a; +// id(b){ +// return b; +// } + id2 = x -> x; +// id2 = () -> { +// var x = m(a); +// var y = x; +// var z = y; +// }; +// +// m(a){ +// return a; +// } + id3 (x) { + return id2.apply(x); + } +} + diff --git a/out/tests/resources/bytecode/javFiles/IfTest.jav b/out/tests/resources/bytecode/javFiles/IfTest.jav new file mode 100644 index 0000000..bbcda96 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/IfTest.jav @@ -0,0 +1,15 @@ +import java.lang.Integer; +import java.lang.Boolean; +import java.lang.String; + +public class IfTest{ + Integer m1(Boolean b) { + Integer i; + String b; + if(b) { + return i; + }else{ + return b; + } + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/Import.jav b/out/tests/resources/bytecode/javFiles/Import.jav new file mode 100644 index 0000000..c658568 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Import.jav @@ -0,0 +1,8 @@ +import java.util.Vector; + +class Import { + void methode(){ + Vector v = new Vector<>(); + v.add("X"); + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/Inf.jav b/out/tests/resources/bytecode/javFiles/Inf.jav new file mode 100644 index 0000000..6002994 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Inf.jav @@ -0,0 +1,65 @@ +public class Inf { + m(x,y,a){ + var z; + var v; + var w; + var b; + y=x; + z=x; + v=y; + w=y; + y=a; + b=a; + var c; + var d; + c = v; + d = v; + } +} + +/* +TPH M m(TPH N x, TPH O y, TPH P a)({ + TPH Q z; + TPH R v; + TPH S w; + TPH T b; + (y)::TPH O = (x)::TPH N; + (z)::TPH Q = (x)::TPH N; + (v)::TPH R = (y)::TPH O; + (w)::TPH S = (y)::TPH O; + (y)::TPH O = (a)::TPH P; + (b)::TPH T = (a)::TPH P; + TPH U c; + TPH V d; + (c)::TPH U = (v)::TPH R; + (d)::TPH V = (v)::TPH R; + return; +})::TPH W + + Inf()({ + super(()); + })::TPH Z + +} +// c::U d::V +// \ / +// v::R w::S +// \ / +// z::Q y::O b::T +// \ / \ / +// x::N a::P + +RESULT Final: [[(TPH N < TPH O), (TPH R < TPH V), (TPH N < TPH Q), (TPH P < TPH O), (TPH R < TPH U), (TPH M = void), (TPH O < TPH S), (TPH O < TPH R), (TPH P < TPH T)]] +Simplified constraints: [(TPH O < TPH S), (TPH P < TPH O), (TPH O < TPH R), (TPH P < TPH T), (TPH N < TPH O), (TPH N < TPH Q)] +m: [(TPH DDV = java.lang.Object), (TPH DDX = java.lang.Object), (TPH DDX < TPH DDV), (TPH N < TPH DDX), (TPH P < TPH DDX)] +Class Inf: [] +Inf: [] + +Unify nach Oder-Constraints-Anpassung: +UND:[(void =. M, , -1 WC: false, IT: false), (N <. O, 1 WC: false, IT: false, 1 WC: false, IT: false), (P <. O, 1 WC: false, IT: false, 1 WC: false, IT: false), (N <. Q, 1 WC: false, IT: false, 0 WC: true, IT: false), (O <. S, 1 WC: false, IT: false, 0 WC: true, IT: false), (O <. R, 1 WC: false, IT: false, 0 WC: true, IT: false), (P <. T, 1 WC: false, IT: false, 0 WC: true, IT: false)] +isInherited = false +isStatement = false + +ODER: +*/ + diff --git a/out/tests/resources/bytecode/javFiles/Infimum.jav b/out/tests/resources/bytecode/javFiles/Infimum.jav new file mode 100644 index 0000000..7c47539 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Infimum.jav @@ -0,0 +1,6 @@ +class Infimum { + m(x, y, z) { + y = x; + z = x; + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/Inherit.jav b/out/tests/resources/bytecode/javFiles/Inherit.jav new file mode 100644 index 0000000..7b5927d --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Inherit.jav @@ -0,0 +1,18 @@ +import java.util.Vector; + +import java.lang.Integer; +import java.lang.String; + + +public class Inherit { + + main(d, i) { + return d.m(i); + } + + main(v, i) { + var aa = v.elementAt(0); + return aa.m(i); + } + +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/Inherit2.jav b/out/tests/resources/bytecode/javFiles/Inherit2.jav new file mode 100644 index 0000000..fe4c506 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Inherit2.jav @@ -0,0 +1,17 @@ +import java.util.Vector; + +import java.lang.Integer; +import java.lang.String; + + +public class Inherit2 { + + main(d) { + return d.m2(d); + } + + main(v) { + var aa = v.elementAt(0); + return aa.m2(aa); + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/InstanceOf.jav b/out/tests/resources/bytecode/javFiles/InstanceOf.jav new file mode 100644 index 0000000..4cee01f --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/InstanceOf.jav @@ -0,0 +1,18 @@ +import java.lang.Number; +import java.lang.Integer; +import java.lang.Double; +import java.lang.String; + +public class InstanceOf { + main(n) { + if (n instanceof Integer i) { + takes(i); + return "Integer"; + } else if (n instanceof Double d) { + takes(d); + return "Double"; + } + } + + takes(i) {} // Should be overloaded +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/Interface1.jav b/out/tests/resources/bytecode/javFiles/Interface1.jav new file mode 100644 index 0000000..b741819 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Interface1.jav @@ -0,0 +1,3 @@ +public interface Interface1{ + public void test(); +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/Interfaces.jav b/out/tests/resources/bytecode/javFiles/Interfaces.jav new file mode 100644 index 0000000..0c4cd21 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Interfaces.jav @@ -0,0 +1,33 @@ +import java.lang.Integer; + +interface A { + void method1(); + default method2() { + } +} + +interface B { + void method3(); +} + +interface C { + Integer myInt(); +} + +class ClassX implements A { +} + +record ClassY(Integer myInt) implements C {} + +public class Interfaces implements A, B { + public void method1() { + } + public void method3() { + var intf = new Interfaces(); + intf = new ClassX(); + intf.method1(); + + C c = new ClassY(10); + c.myInt(); + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/KompTph.jav b/out/tests/resources/bytecode/javFiles/KompTph.jav new file mode 100644 index 0000000..ec34e15 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/KompTph.jav @@ -0,0 +1,13 @@ +public class KompTph { + public m(a, b, c) { + var d = a; + var e = a; + a = b; + c = b; + m2(a,c); + } + + public m2(a,b){ + m(a,a,b); + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/LamRunnable.jav b/out/tests/resources/bytecode/javFiles/LamRunnable.jav new file mode 100644 index 0000000..451858f --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/LamRunnable.jav @@ -0,0 +1,9 @@ +public class LamRunnable{ + + public LamRunnable(){ + + Runnable lam = () -> {System.out.println("lambda");}; + lam.run(); + } +} + \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/Lambda.jav b/out/tests/resources/bytecode/javFiles/Lambda.jav new file mode 100644 index 0000000..ba466b1 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Lambda.jav @@ -0,0 +1,11 @@ +import java.lang.Integer; + +public class Lambda { + + m () { + var lam1 = (x) -> { + return x; + }; + return lam1; + } +} diff --git a/out/tests/resources/bytecode/javFiles/Lambda2.jav b/out/tests/resources/bytecode/javFiles/Lambda2.jav new file mode 100644 index 0000000..92f32b7 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Lambda2.jav @@ -0,0 +1,35 @@ +import java.lang.String; + +public class Lambda2 +{ + public static void main(List args){ + var listOfStrings = new List(); + var listOfObjects; + listOfObjects = map(listOfStrings, (a) -> a); +} + +public map(a , b){ + b.apply(a); + return a; +} + +/* +public static List map(List input, Function func) { + List output; + output = new List(); + output.add(func.apply(input.get())); + return output; +} +*/ +} + +class List{ + /* A get(); + void add(A); + */ +} +/* +class Function{ + B apply(A a); +} +*/ \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/Lambda3.jav b/out/tests/resources/bytecode/javFiles/Lambda3.jav new file mode 100644 index 0000000..9c4e960 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Lambda3.jav @@ -0,0 +1,23 @@ + +public class Lambda2 +{ + /* + public static List map(List input, + Function func){ + input.add(func.apply(input.get())); + } + */ + public map(input,func){ + input.add(func.apply(input.get())); + return map(new List(), func); + } +} + +class List{ + A get(); + void add(A); +} + +class Function{ + B apply(A a); +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/Lambda4.jav b/out/tests/resources/bytecode/javFiles/Lambda4.jav new file mode 100644 index 0000000..378eb4d --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Lambda4.jav @@ -0,0 +1,18 @@ +class Lambda{ + +methode(){ + return ((f) -> f); +} +} +/* +interface Fun0{ + A apply(); +} + +interface Fun1{ + A apply(B b); +} +*/ +interface Fun2{ + A apply(B b, C c); +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/LambdaCapture.jav b/out/tests/resources/bytecode/javFiles/LambdaCapture.jav new file mode 100644 index 0000000..ab1751f --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/LambdaCapture.jav @@ -0,0 +1,12 @@ +import java.lang.Integer; +public class LambdaCapture { + Integer i = 8; + f; + public LambdaCapture(){ + Integer w = 7; + f = j ->{ + return w+i;}; + + } + +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/LambdaField.jav b/out/tests/resources/bytecode/javFiles/LambdaField.jav new file mode 100644 index 0000000..4eb5373 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/LambdaField.jav @@ -0,0 +1,6 @@ +public class LambdaField { + + f = x -> x; + +} + diff --git a/out/tests/resources/bytecode/javFiles/LambdaRunnable.jav b/out/tests/resources/bytecode/javFiles/LambdaRunnable.jav new file mode 100644 index 0000000..9dff3a8 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/LambdaRunnable.jav @@ -0,0 +1,17 @@ +import java.lang.Runnable; +import java.lang.String; +import java.lang.System; +import java.io.PrintStream; + +public class LambdaRunnable { + + public LambdaRunnable(){ + + + Runnable lam = () -> { + System.out.println("Runnable is running"); + }; + lam.run(); + } +} + diff --git a/out/tests/resources/bytecode/javFiles/LambdaVoid.jav b/out/tests/resources/bytecode/javFiles/LambdaVoid.jav new file mode 100644 index 0000000..dc16fcb --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/LambdaVoid.jav @@ -0,0 +1,9 @@ +import java.lang.Integer; + +public class Lambda { + + m () { + var lam1 = (x) -> { }; + return lam1; + } +} diff --git a/out/tests/resources/bytecode/javFiles/LessEqual.jav b/out/tests/resources/bytecode/javFiles/LessEqual.jav new file mode 100644 index 0000000..2e3b702 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/LessEqual.jav @@ -0,0 +1,56 @@ +import java.lang.Integer; +import java.lang.Long; +import java.lang.Float; +import java.lang.Double; + +public class LessEqual { + lessEqual(Integer a, Integer b){ + var c = a<=b; + return c; + } + + lessEqual(Long a, Long b){ + var c = a<=b; + return c; + } + + lessEqual(Float a, Float b){ + var c = a<=b; + return c; + } + + lessEqual(Double a, Double b){ + var c = a<=b; + return c; + } + + lessEqual(Long a, Integer b){ + var c = a<=b; + return c; + } + + lessEqual(Float a, Integer b){ + var c = a<=b; + return c; + } + + lessEqual(Double a, Integer b){ + var c = a<=b; + return c; + } + + lessEqual(Float a, Long b){ + var c = a<=b; + return c; + } + + lessEqual(Double a, Long b){ + var c = a<=b; + return c; + } + + lessEqual(Double a, Float b){ + var c = a<=b; + return c; + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/LessThan.jav b/out/tests/resources/bytecode/javFiles/LessThan.jav new file mode 100644 index 0000000..04e1e83 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/LessThan.jav @@ -0,0 +1,57 @@ +import java.lang.Integer; +import java.lang.Long; +import java.lang.Float; +import java.lang.Double; + +public class LessThan { + + lessThan(Integer a, Integer b){ + var c = a> { + + Matrix () { + } + + Matrix(vv) { + Integer i; + i = 0; + while(i < vv.size()) { +// Boolean a = this.add(vv.elementAt(i)); + this.add(vv.elementAt(i)); + i=i+1; + } + } + + mul(m) { + var ret = new Matrix(); + var i = 0; + while(i < size()) { + var v1 = this.elementAt(i); + var v2 = new Vector(); + var j = 0; + while(j < v1.size()) { + var erg = 0; + var k = 0; + while(k < v1.size()) { + erg = erg + v1.elementAt(k) + * m.elementAt(k).elementAt(j); + k++; } +// v2.addElement(new Integer(erg)); + v2.addElement(erg); + j++; } + ret.addElement(v2); + i++; + } + return ret; + } +} diff --git a/out/tests/resources/bytecode/javFiles/MatrixOP.jav b/out/tests/resources/bytecode/javFiles/MatrixOP.jav new file mode 100644 index 0000000..21d3734 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/MatrixOP.jav @@ -0,0 +1,43 @@ +import java.util.Vector; +import java.lang.Integer; +//import java.lang.Byte; +import java.lang.Boolean; + +public class MatrixOP extends Vector> { + + MatrixOP () { + } + + MatrixOP(vv) { + Integer i; + i = 0; + while(i < vv.size()) { +// Boolean a = this.add(vv.elementAt(i)); + this.add(vv.elementAt(i)); + i=i+1; + } + } + + public mul = (m1, m2) -> { + var ret = new MatrixOP(); + var i = 0; + while(i < m1.size()) { + var v1 = m1.elementAt(i); + var v2 = new Vector(); + var j = 0; + while(j < v1.size()) { + var erg = 0; + var k = 0; + while(k < v1.size()) { + erg = erg + v1.elementAt(k) + * m2.elementAt(k).elementAt(j); + k++; } +// v2.addElement(new Integer(erg)); + v2.addElement(erg); + j++; } + ret.addElement(v2); + i++; + } + return ret; + }; +} diff --git a/out/tests/resources/bytecode/javFiles/Merge.jav b/out/tests/resources/bytecode/javFiles/Merge.jav new file mode 100644 index 0000000..ad5e103 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Merge.jav @@ -0,0 +1,20 @@ +import java.util.List; +import java.lang.Integer; +//import java.util.Collection; + +class Merge { + + merge(a, b) { + a.addAll(b); + return a; + } + + + + sort(in){ + var firstHalf = in.subList(1,2); + var secondHalf = in.subList(1,2); + return merge(sort(firstHalf), sort(secondHalf)); + } + +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/Meth_Gen.jav b/out/tests/resources/bytecode/javFiles/Meth_Gen.jav new file mode 100644 index 0000000..056dd82 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Meth_Gen.jav @@ -0,0 +1,11 @@ +class Meth_Gen { + + m1(x, y) { + m2(x); + x = y; + } + + m2(y) { + m1(y, y); + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/MethodCallGenerics.jav b/out/tests/resources/bytecode/javFiles/MethodCallGenerics.jav new file mode 100644 index 0000000..0d02509 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/MethodCallGenerics.jav @@ -0,0 +1,14 @@ +import java.lang.String; + +class Generics { + // A mt1(A a, B b){ + B mt1(B a, B b){ + return mt1(a, a); + } +} + +class Test { + methode(String s){ + return new Generics().mt1(s,s); + } +} diff --git a/out/tests/resources/bytecode/javFiles/MethodWildcardGen.jav b/out/tests/resources/bytecode/javFiles/MethodWildcardGen.jav new file mode 100644 index 0000000..c982c44 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/MethodWildcardGen.jav @@ -0,0 +1,21 @@ +/* +class C{ + A f; + m(b, c){ + c.f = b; + c.m(b, c); + } +} +*/ +class C{ + X f; + m(b, c, d){ + this.f = b; + this.f = c.f; + c.m2(d); + } + + m2(a){ + a.f = this.f; + } +} diff --git a/out/tests/resources/bytecode/javFiles/Methods.jav b/out/tests/resources/bytecode/javFiles/Methods.jav new file mode 100644 index 0000000..3c46739 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Methods.jav @@ -0,0 +1,14 @@ +import java.lang.Integer; + +class Methods { + + m(a,b){ + var c=a+b; + return c; + } + + method2(x){ + Integer i = this.m(x,2); + return i; + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/MethodsEasy.jav b/out/tests/resources/bytecode/javFiles/MethodsEasy.jav new file mode 100644 index 0000000..ee6f9da --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/MethodsEasy.jav @@ -0,0 +1,7 @@ + +class Methods { + mt4(a,b,c) { return a.mt3(b).mt3(c) ; } + + mt3(a) {return a.mt3(a); } +} + diff --git a/out/tests/resources/bytecode/javFiles/OL.jav b/out/tests/resources/bytecode/javFiles/OL.jav new file mode 100644 index 0000000..afeaa2f --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/OL.jav @@ -0,0 +1,15 @@ +import java.lang.Double; +import java.lang.String; +import java.lang.Long; + +class OL { + m (x) { return x + x; } +} + +class OLMain { + main(x) { + var ol; + ol = new OL(); + return ol.m(x); + } +} diff --git a/out/tests/resources/bytecode/javFiles/OLFun.jav b/out/tests/resources/bytecode/javFiles/OLFun.jav new file mode 100644 index 0000000..50d30b7 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/OLFun.jav @@ -0,0 +1,19 @@ +import java.lang.String; +import java.lang.Integer; +import java.lang.Double; +import java.util.Vector; +import java.lang.Boolean; + +public class OLFun { + + //f = x -> {return x + x;}; + m(f, x) { + x = f.apply(x+x); + return x; + } + + m2(y) { + m(x -> x * 2, y); + return; + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/OLFun2.jav b/out/tests/resources/bytecode/javFiles/OLFun2.jav new file mode 100644 index 0000000..6b6f38a --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/OLFun2.jav @@ -0,0 +1,13 @@ +import java.lang.String; +import java.lang.Integer; +import java.lang.Double; +import java.util.Vector; +import java.lang.Boolean; + +public class OLFun2 { + + x; + m(f){ + x = f.apply(x + x); + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/Op.jav b/out/tests/resources/bytecode/javFiles/Op.jav new file mode 100644 index 0000000..082f48d --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Op.jav @@ -0,0 +1,16 @@ +import java.lang.Integer; +import java.lang.String; +import java.lang.Long; +import java.lang.Float; +import java.lang.Double; +import java.lang.Boolean; +import java.lang.Short; +import java.lang.Byte; + +public class Op { + + m(a, b) { + //var c = a+b; + return a+b; + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/Op1.jav b/out/tests/resources/bytecode/javFiles/Op1.jav new file mode 100644 index 0000000..800f58b --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Op1.jav @@ -0,0 +1,11 @@ +public class Op1{ + public Op1() { + + Runnable lam = () -> { + String test = ""; + String b = "b"; + test = b; + System.out.println(test);}; + //lam.run(); + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/Op2.jav b/out/tests/resources/bytecode/javFiles/Op2.jav new file mode 100644 index 0000000..9d446eb --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Op2.jav @@ -0,0 +1,11 @@ +import java.lang.Integer; +import java.lang.String; + +public class Op2 { + m(){ + var x = ""; + var a = 5+x; + + return a; + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/OverlaodGen.jav b/out/tests/resources/bytecode/javFiles/OverlaodGen.jav new file mode 100644 index 0000000..d594649 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/OverlaodGen.jav @@ -0,0 +1,11 @@ +import java.util.Vector; + +class OverlaodGen { + void method(Vector v) { +// Integer i = v.get(0); + } + + void method(Vector v) { +// String s = v.get(0); + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/OverloadPattern.jav b/out/tests/resources/bytecode/javFiles/OverloadPattern.jav new file mode 100644 index 0000000..5e86416 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/OverloadPattern.jav @@ -0,0 +1,50 @@ +import java.lang.Integer; +import java.lang.Number; +import java.lang.Float; + +record Point(Number x, Number y) {} + +public class OverloadPattern { + m(Point(Integer x, Integer y)) { + return x + y; + } + + m(Point(Float x, Float y)) { + return x * y; + } + + m(Integer x) { + return x; + } +} + +/* +public class OverloadPattern { + Integer m$Point$_$java$lang$Integer$_$java$lang$Integer$_$(Point point) { + var x = point.x(); + var y = point.y(); + return x + y; + } + + Float m$Point$_$java$lang$Float$_$java$lang$Float$_$(Point point) { + var x = point.x(); + var y = point.y(); + return x * y; + } + + Number m(Point point) { + return switch(point) { + case Point(Integer x, Integer y) -> + m$Point$_$java$lang$Integer$_$java$lang$Integer$_$(point); + case Point(Float x, Float y) -> + m$Point$_$java$lang$Float$_$java$lang$Float$_$(point); + default -> throw new IllegalArgumentException(); + } + } + + Integer m(Integer x) { + return x; + } +} + +*/ \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/Overloading.jav b/out/tests/resources/bytecode/javFiles/Overloading.jav new file mode 100644 index 0000000..fb48fe0 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Overloading.jav @@ -0,0 +1,18 @@ +import java.lang.String; + +public class Overloading{ + + test(x){ + return x.methode(); + } + + methode(){ + return "Overloading"; + } +} + +public class Overloading2{ + methode(){ + return "Overloading2"; + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/Package.jav b/out/tests/resources/bytecode/javFiles/Package.jav new file mode 100644 index 0000000..bbc1e51 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Package.jav @@ -0,0 +1,5 @@ +package strucType.input; + +class Neu +{ +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/Pair.jav b/out/tests/resources/bytecode/javFiles/Pair.jav new file mode 100644 index 0000000..aacb8d4 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Pair.jav @@ -0,0 +1,32 @@ +import java.util.Vector; +import java.lang.Boolean; +import java.lang.Object; + +class Pair { + U a; + T b; + + make(x) { + var ret = new Pair<>(); + ret.a = x.elementAt(0); + ret.b = x.elementAt(1); + return ret; + } + /* + eq(a, b) { + b = a; + return a == b; + } + + compare( p) { + return eq(p.a, p.b); + //return p.a == p.b; + } + + void m(Pair p, List b) + { + //this.compare(p); //1, type incorrect + this.compare(this.make(b)); //2, OK + } +*/ +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/PairNoGenerics.jav b/out/tests/resources/bytecode/javFiles/PairNoGenerics.jav new file mode 100644 index 0000000..e69de29 diff --git a/out/tests/resources/bytecode/javFiles/Plus.jav b/out/tests/resources/bytecode/javFiles/Plus.jav new file mode 100644 index 0000000..1cdecc8 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Plus.jav @@ -0,0 +1,9 @@ +import java.lang.Integer; +import java.lang.String; + +public class Plus { + + m(a,b) { + return a+b; + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/PostIncDec.jav b/out/tests/resources/bytecode/javFiles/PostIncDec.jav new file mode 100644 index 0000000..29c2ef1 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/PostIncDec.jav @@ -0,0 +1,27 @@ +import java.lang.Integer; + +public class PostIncDec { + m() { + var i = 0; + i++; + return i; + } + + m2() { + var i = 0; + var j = i++; + return j; + } + + d() { + var i = 0; + i--; + return i; + } + + d2() { + var i = 0; + var j = i--; + return j; + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/PreInc.jav b/out/tests/resources/bytecode/javFiles/PreInc.jav new file mode 100644 index 0000000..011501f --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/PreInc.jav @@ -0,0 +1,28 @@ +import java.lang.Integer; + +public class PreInc { + m() { + var i = 0; + ++i; + return i; + } + + m2() { + var i = 0; + var j = ++i; + return j; + } + + d() { + var i = 0; + --i; + return i; + } + + d2() { + var i = 0; + var j = --i; + return j; + } + +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/Put.jav b/out/tests/resources/bytecode/javFiles/Put.jav new file mode 100644 index 0000000..79a1cfa --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Put.jav @@ -0,0 +1,19 @@ +import java.util.Vector; +import java.util.Stack; + +public class Put { + + putElement(ele, v) { + v.addElement(ele); + } + + putElement(ele, s) { + s.push(ele); + } + + + main(ele, x) { + putElement(ele, x); + } + +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/RecordTest.jav b/out/tests/resources/bytecode/javFiles/RecordTest.jav new file mode 100644 index 0000000..c64c3d9 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/RecordTest.jav @@ -0,0 +1,22 @@ +import java.lang.Integer; + +record Rec(Integer a, Integer b) {} + +/*public class Rec { + x; y; + Rec(Integer a, Integer b) { + x = a; + y = b; + } +}*/ + +public class RecordTest { + a = new Rec(10, 20); + b = new Rec(10, 20); + c = new Rec(20, 40); + + doesEqual() { return a.equals(b); } + doesNotEqual() { return b.equals(c); } + hashCode() { return a.hashCode(); } + toString() { return a.toString(); } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/RecursiveMeth.jav b/out/tests/resources/bytecode/javFiles/RecursiveMeth.jav new file mode 100644 index 0000000..be35a43 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/RecursiveMeth.jav @@ -0,0 +1,5 @@ +public class RecursiveMeth{ + public Integer test(){ + return this.test(); + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/RelOps.jav b/out/tests/resources/bytecode/javFiles/RelOps.jav new file mode 100644 index 0000000..0fdd2cf --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/RelOps.jav @@ -0,0 +1,8 @@ +import java.lang.Integer; +import java.lang.Boolean; + +public class RelOps { + m(a,b){ + return a { + + Scalar(v) { + Integer i; + i = 0; + while(i < v.size()) { + this.add(v.elementAt(i)); + i=i+1; + } + } + + mul(v) { + var ret = 0; + var i = 0; + while(i < size()) { + ret = ret + this.elementAt(i) * v.elementAt(i); + i = i+1; + } + return ret; + } +} diff --git a/out/tests/resources/bytecode/javFiles/SimpleCycle.jav b/out/tests/resources/bytecode/javFiles/SimpleCycle.jav new file mode 100644 index 0000000..92f505b --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/SimpleCycle.jav @@ -0,0 +1,25 @@ +public class SimpleCycle { + + m(){ + var g; + var h; + g = h; + h = g; + /* + var y; + var z; + y=z; + z=y; + + var j = z; + var x; + b = a; + var c = b; + var f = d; + b = x; + var l = c; + a = l; + */ + } + +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/Sorting.jav b/out/tests/resources/bytecode/javFiles/Sorting.jav new file mode 100644 index 0000000..345819d --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Sorting.jav @@ -0,0 +1,23 @@ +import java.util.List; +import java.util.ArrayList; +import java.lang.String; + +public class Sorting{ + merge(a, b){ + a.addAll(b); + return a; + } + +sort(in){ + var firstHalf = in; + var secondHalf = in; + return merge(sort(firstHalf), sort(secondHalf)); +} + + + /* + void sort(a){ + a = merge(a,a); + } + */ +} diff --git a/out/tests/resources/bytecode/javFiles/Static.jav b/out/tests/resources/bytecode/javFiles/Static.jav new file mode 100644 index 0000000..aa0c337 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Static.jav @@ -0,0 +1,18 @@ +import java.lang.Integer; + +class Other { + static field = 20; +} + +public class Static { + static i = 20; + + static { + var x = 30; + i = x; + } + + static m() { + return i + Other.field; + } +} diff --git a/out/tests/resources/bytecode/javFiles/StaticM.jav b/out/tests/resources/bytecode/javFiles/StaticM.jav new file mode 100644 index 0000000..6689003 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/StaticM.jav @@ -0,0 +1,10 @@ +public class StaticM { + + public static void m() { + System.out.println("Test"); + } + + public static void m2() { + m(); + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/SubMatrix.jav b/out/tests/resources/bytecode/javFiles/SubMatrix.jav new file mode 100644 index 0000000..f761321 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/SubMatrix.jav @@ -0,0 +1,13 @@ +import java.util.Vector; +import java.lang.Integer; + +public class Matrix2 extends Vector { + +} + +public class SubMatrix extends Matrix2 { + m(){ + Vector v = new Vector(); + v.add(1); + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/Subclass.jav b/out/tests/resources/bytecode/javFiles/Subclass.jav new file mode 100644 index 0000000..fe6e920 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Subclass.jav @@ -0,0 +1,6 @@ +public class Subclass extends Superclass { + + public void printMethod() { + super.printMethod(); + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/Superclass.jav b/out/tests/resources/bytecode/javFiles/Superclass.jav new file mode 100644 index 0000000..d58089d --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Superclass.jav @@ -0,0 +1,6 @@ +public class Superclass { + + public void printMethod() { + System.out.println("Printed in Superclass."); + } +} diff --git a/out/tests/resources/bytecode/javFiles/Switch.jav b/out/tests/resources/bytecode/javFiles/Switch.jav new file mode 100644 index 0000000..9c0e741 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Switch.jav @@ -0,0 +1,17 @@ +import java.lang.Integer; +import java.lang.Object; +import java.lang.Float; + +record Rec(Integer a, Object b) {} + +public class Switch { + main(o) { + return switch (o) { + case Rec(Integer a, Integer b) -> a + b; + case Rec(Integer a, Float b) -> a + 10; + case Rec(Integer a, Rec(Integer b, Integer c)) -> a + b + c; + case Integer i -> i; + default -> 0; + }; + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/Switch2.jav b/out/tests/resources/bytecode/javFiles/Switch2.jav new file mode 100644 index 0000000..c75aaa5 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Switch2.jav @@ -0,0 +1,13 @@ +import java.lang.Integer; + +record Point(x, y) {} + +class Switch2 { + m() { + var pt = new Point(10, 20); + return switch (pt) { + case Point(x, y) -> 10; + default -> 20; + }; + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/SwitchString.jav b/out/tests/resources/bytecode/javFiles/SwitchString.jav new file mode 100644 index 0000000..e8758c2 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/SwitchString.jav @@ -0,0 +1,14 @@ +import java.lang.Integer; +import java.lang.String; +import java.lang.Object; + +public class SwitchString { + main(o) { + return switch (o) { + case "AaAaAa" -> 1; // These two have the same hash code! + case "AaAaBB" -> 2; + case "test", "TEST" -> 3; + default -> 4; + }; + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/TXGenerics.jav b/out/tests/resources/bytecode/javFiles/TXGenerics.jav new file mode 100644 index 0000000..8dd7ab7 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/TXGenerics.jav @@ -0,0 +1,11 @@ +import java.lang.String; + +class TXGenerics { + a; + b; + + test() { + var c = new Cycle(); + c.m(a, b); + } +} diff --git a/out/tests/resources/bytecode/javFiles/Tph.jav b/out/tests/resources/bytecode/javFiles/Tph.jav new file mode 100644 index 0000000..3f9d0aa --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Tph.jav @@ -0,0 +1,11 @@ +public class Tph { + + m(a,b){ + var c = m2(b); + return a; + } + + m2(b){ + return b; + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/Tph2.jav b/out/tests/resources/bytecode/javFiles/Tph2.jav new file mode 100644 index 0000000..04ea5ba --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Tph2.jav @@ -0,0 +1,6 @@ +public class Tph2 { + id = x->x; + id3 (x) { + return id.apply(x); + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/Tph3.jav b/out/tests/resources/bytecode/javFiles/Tph3.jav new file mode 100644 index 0000000..553e274 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Tph3.jav @@ -0,0 +1,14 @@ +public class Tph3 { +// m(a,b){ +// var c = m2(a,b); +// return c; +// } +// +// m2(a,b){ +// return m(a,b); +// } + m1(x, y) { m2(x); x = y; + } + + m2(y) { m1(y, y); } +} diff --git a/out/tests/resources/bytecode/javFiles/Tph4.jav b/out/tests/resources/bytecode/javFiles/Tph4.jav new file mode 100644 index 0000000..58fe1d1 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Tph4.jav @@ -0,0 +1,12 @@ +public class Tph4{ + m(a,b){ + var c = m2(b); + var d = m2(c); + return d; + } + + m2(b){ + return b; + } + +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/Tph5.jav b/out/tests/resources/bytecode/javFiles/Tph5.jav new file mode 100644 index 0000000..e73cfa2 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Tph5.jav @@ -0,0 +1,13 @@ +public class Tph5 { +// m(a,b,c){ +// a = c; +// b = c; +// return a; +// } + + m(x,y){ + x = m2(y); + } + + m2(y) { return y; } +} diff --git a/out/tests/resources/bytecode/javFiles/Tph6.jav b/out/tests/resources/bytecode/javFiles/Tph6.jav new file mode 100644 index 0000000..2f9e429 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Tph6.jav @@ -0,0 +1,14 @@ +public class Tph6 { +// m(a,b,c){ +// a = c; +// b = c; +// return a; +// } + + m(x,y){ + var c = m2(y); + c = m2(x); + } + + m2(y) { return y; } +} diff --git a/out/tests/resources/bytecode/javFiles/Tph7.jav b/out/tests/resources/bytecode/javFiles/Tph7.jav new file mode 100644 index 0000000..cc55afb --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Tph7.jav @@ -0,0 +1,11 @@ +public class Tph7 { + + m(a,b){ + var c = m2(b); + return m2(b); + } + + m2(b){ + return b; + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/TypedID.jav b/out/tests/resources/bytecode/javFiles/TypedID.jav new file mode 100644 index 0000000..aa88583 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/TypedID.jav @@ -0,0 +1,12 @@ +public class TypedID/* */ { + + lam = x-> x; + + id(b){ + return b; + } + + m(){ + return lam; + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/Vector.jav b/out/tests/resources/bytecode/javFiles/Vector.jav new file mode 100644 index 0000000..5c21cff --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Vector.jav @@ -0,0 +1,23 @@ +import java.util.ArrayList; +import java.util.Vector; +import java.lang.Object; + +class MyVector{ + +id(x){ + Object i; + x.add(i); + x.add(i); + x.add(i); + x.add(i); + x.add(i); + x.add(i); + x.add(i); + x.add(i); + x.add(i); + x.add(i); + x.add(i); + x.add(i); + return x; +} +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/VectorAdd.jav b/out/tests/resources/bytecode/javFiles/VectorAdd.jav new file mode 100644 index 0000000..2ad73aa --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/VectorAdd.jav @@ -0,0 +1,26 @@ +import java.util.Vector; +import java.lang.Integer; +import java.lang.String; + +public class VectorAdd { + vectorAdd(v1, v2) { + var i = 0; + v1 = new Vector(); + var erg = new Vector<>(); + while (i < v1.size()) { + erg.addElement(v1.elementAt(i) + v2.elementAt(i)); + i++; + } + return erg; + } + + m(x, y, z) { + x = new Vector(); + y = new Vector(); + x.add(1); + y.add("2"); + //Integer i = x.elementAt(0); + //String s = y.elementAt(0); + return z.addAll(x); + } +} diff --git a/out/tests/resources/bytecode/javFiles/VectorSuper.jav b/out/tests/resources/bytecode/javFiles/VectorSuper.jav new file mode 100644 index 0000000..fbadafb --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/VectorSuper.jav @@ -0,0 +1,11 @@ +import java.util.Vector; +import java.lang.Integer; + +public class VectorSuper { + + m(x){ + Integer y = 1; + x.addElement(y); + //return x; + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/VoidMeth.jav b/out/tests/resources/bytecode/javFiles/VoidMeth.jav new file mode 100644 index 0000000..6b3ab21 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/VoidMeth.jav @@ -0,0 +1,4 @@ +public class VoidMeth{ + public void test(){ + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/WC.jav b/out/tests/resources/bytecode/javFiles/WC.jav new file mode 100644 index 0000000..389a4fc --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/WC.jav @@ -0,0 +1,8 @@ +import java.lang.Integer; +import java.util.List; +public class WC { + + void m (List a, List b) { + + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/While.jav b/out/tests/resources/bytecode/javFiles/While.jav new file mode 100644 index 0000000..cd2139a --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/While.jav @@ -0,0 +1,12 @@ +import java.lang.Integer; +import java.lang.Long; +import java.lang.Double; + +public class While { + m(x) { + while(x < 2) { + x = x+1; + } + return x; + } +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/Y.jav b/out/tests/resources/bytecode/javFiles/Y.jav new file mode 100644 index 0000000..a97360d --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/Y.jav @@ -0,0 +1,42 @@ +import java.lang.Integer; + +class Y { + y; + //factorial; + + Y() { + y = f -> t -> f.apply(y.apply(f)).apply(t); + //factorial = y.apply(f -> n -> { if (n == 0) return 1; else return n * f.apply(n - 1); }); + } + /* + getY() { + return y; + } + */ +} +/* +class fac1 { + factorial; + + fac1() { + var y; + y = new Y().getY(); + factorial = y.apply(f -> n -> { if (n == 0) return 1; else return n * f.apply(n - 1); }); + } +} + +ergibt Parse-Error +class fac1 { + factorial; + + fac1() { + var y; + y = new Y<>().y; + factorial = y.apply(f -> n -> { if (n == 0) return 1; else return n * f.apply(n - 1); }); + } + public static void main(String args[]) { + System.out.println(new fac1().factorial.apply(3)); + } + +} +*/ \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/applyLambda.jav b/out/tests/resources/bytecode/javFiles/applyLambda.jav new file mode 100644 index 0000000..331bfbf --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/applyLambda.jav @@ -0,0 +1,16 @@ +import java.util.Vector; +class Apply { } + +public class applyLambda { + + m () { + var lam1 = (x) -> { + return x; + }; + + return lam1.apply(new Apply()); + //return lam1; + //return new Vector(); + } +} + diff --git a/out/tests/resources/bytecode/javFiles/fc.jav b/out/tests/resources/bytecode/javFiles/fc.jav new file mode 100644 index 0000000..b387cb9 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/fc.jav @@ -0,0 +1,18 @@ +import java.util.List; + +class Test{ + methode(param1, param2, param3) { + param2.add(param3); + return param1.meth(param2); + } +} + +interface Klasse1{ + Klasse1 meth(p); + Klasse1 meth(Klasse2 p); +} + +interface Klasse2{ + Klasse1 meth(Klasse1 p); + Klasse2 meth(Klasse2 p); +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/mathStruc.jav b/out/tests/resources/bytecode/javFiles/mathStruc.jav new file mode 100644 index 0000000..171881b --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/mathStruc.jav @@ -0,0 +1,15 @@ +import java.util.Vector; +import java.lang.Integer; + +public class mathStruc { + model; + + //Fun1*, Fun1*,MathStruc >> + innerOp = (o) -> (ms) -> new mathStruc<>(o.apply(model,ms.model)); + + public mathStruc(m) { + model =m; + //innerOp = (o) -> (ms) -> new mathStruc<>(o.apply(this.model,ms.model)); + } +} + diff --git a/out/tests/resources/bytecode/javFiles/mathStrucInteger.jav b/out/tests/resources/bytecode/javFiles/mathStrucInteger.jav new file mode 100644 index 0000000..f1f6755 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/mathStrucInteger.jav @@ -0,0 +1,23 @@ +import java.util.Vector; +import java.lang.Integer; + +public class mathStrucInteger { + model; + + innerOp = (o) -> (ms) -> new mathStrucInteger<>(o.apply(model,ms.model)); + + public mathStrucInteger(m) { + model =m; + } +} + +class mathStrucIntegerUse { + + main() { + var ms; + ms = new mathStrucInteger<>(2); + var ms2; + ms2 = ms.innerOp.apply((x,y) -> x+y).apply(ms); + return ms2; + } +} diff --git a/out/tests/resources/bytecode/javFiles/mathStrucMatrixOP.jav b/out/tests/resources/bytecode/javFiles/mathStrucMatrixOP.jav new file mode 100644 index 0000000..2b24f03 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/mathStrucMatrixOP.jav @@ -0,0 +1,91 @@ +//PL 2019-10-24: laeuft nicht durch, zu gross +import java.util.Vector; +import java.lang.Integer; +import java.lang.Boolean; + +public class mathStrucMatrixOP { + model; + + innerOp = (o) -> (ms) -> new mathStrucMatrixOP<>(o.apply(model,ms.model)); + + public mathStrucMatrixOP(m) { + model =m; + } +} + +public class MatrixOP extends Vector> { + + MatrixOP () { + } + + MatrixOP(vv) { + Integer i; + i = 0; + while(i < vv.size()) { +// Boolean a = this.add(vv.elementAt(i)); + this.add(vv.elementAt(i)); + i=i+1; + } + } + + public mul = (m1, m2) -> { + var ret = new MatrixOP(); + var i = 0; + while(i < m1.size()) { + var v1 = m1.elementAt(i); + var v2 = new Vector(); + var j = 0; + while(j < v1.size()) { + var erg = 0; + var k = 0; + while(k < v1.size()) { + erg = erg + v1.elementAt(k) + * m2.elementAt(k).elementAt(j); + k++; } +// v2.addElement(new Integer(erg)); + v2.addElement(erg); + j++; } + ret.addElement(v2); + i++; + } + return ret; + }; +} + + +class mathStrucUseMatrixOP { + + main() { + Vector> vv = new Vector>(); + Vector v1 = new Vector(); + v1.addElement(2); + v1.addElement(2); + Vector v2 = new Vector(); + v2.addElement(3); + v2.addElement(3); + vv.addElement(v1); + vv.addElement(v2); + + MatrixOP m1 = new MatrixOP(vv); + + Vector> vv1 = new Vector>(); + Vector v3 = new Vector(); + v3.addElement(2); + v3.addElement(2); + Vector v4 = new Vector(); + v4.addElement(3); + v4.addElement(3); + vv1.addElement(v3); + vv1.addElement(v4); + + MatrixOP m2 = new MatrixOP(vv1); + + var mms; + mms = new mathStrucMatrixOP<>(m1); + var mms2; + mms2 = new mathStrucMatrixOP<>(m2); + var mms3; + mms3 = mms.innerOp.apply(m1.mul).apply(mms2); + return mms3; + } +} diff --git a/out/tests/resources/bytecode/javFiles/test.jav b/out/tests/resources/bytecode/javFiles/test.jav new file mode 100644 index 0000000..303d167 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/test.jav @@ -0,0 +1,15 @@ +class Test{ + methode(param1, param2, param3) { + return param1.meth(param2.meth(param3)); + } +} + +interface Klasse1{ + Klasse1 meth(Klasse1 p); + Klasse1 meth(Klasse2 p); +} + +interface Klasse2{ + Klasse1 meth(Klasse1 p); + Klasse2 meth(Klasse2 p); +} \ No newline at end of file diff --git a/out/tests/resources/bytecode/javFiles/test1.jav b/out/tests/resources/bytecode/javFiles/test1.jav new file mode 100644 index 0000000..4b34948 --- /dev/null +++ b/out/tests/resources/bytecode/javFiles/test1.jav @@ -0,0 +1,7 @@ +class Faculty { + + int a; + m (int x) { + return a+x; + } +} diff --git a/out/tests/resources/insertGenerics/javFiles/TestAny.jav b/out/tests/resources/insertGenerics/javFiles/TestAny.jav new file mode 100644 index 0000000..86c0ceb --- /dev/null +++ b/out/tests/resources/insertGenerics/javFiles/TestAny.jav @@ -0,0 +1,13 @@ +class TestAny { + a; + b = a; + anyMethod() { + var f; + return f; + } + otherMethod(e) { + b = e; + e = a; + return e; + } +} \ No newline at end of file diff --git a/out/tests/resources/insertGenerics/javFiles/TestAssign.jav b/out/tests/resources/insertGenerics/javFiles/TestAssign.jav new file mode 100644 index 0000000..d401641 --- /dev/null +++ b/out/tests/resources/insertGenerics/javFiles/TestAssign.jav @@ -0,0 +1,9 @@ +class TestAssign { + assign(x, y) { + x = y; + } + + assign2(x, y) { + assign(x, y); + } +} \ No newline at end of file diff --git a/out/tests/resources/insertGenerics/javFiles/TestClassField.jav b/out/tests/resources/insertGenerics/javFiles/TestClassField.jav new file mode 100644 index 0000000..f3d24e5 --- /dev/null +++ b/out/tests/resources/insertGenerics/javFiles/TestClassField.jav @@ -0,0 +1,6 @@ +class Example{ + f; + fReturn(){ + return f; + } +} \ No newline at end of file diff --git a/out/tests/resources/insertGenerics/javFiles/TestContraVariant.jav b/out/tests/resources/insertGenerics/javFiles/TestContraVariant.jav new file mode 100644 index 0000000..9c060f0 --- /dev/null +++ b/out/tests/resources/insertGenerics/javFiles/TestContraVariant.jav @@ -0,0 +1,38 @@ +public class TestContraVariant { + main(x, y) { + var y2 = m(x, y); + var y3 = y2.snd(); + var z; + y3 = z; + return new Pair<>(x, z); + } + + m(x, y) { + var x2 = main(x, y); + var x3 = x2.fst(); + var z; + x3 = z; + return new Pair<>(z, y); + } +} + +class Pair { + public T x; + public U y; + + public Pair() { + } + + public Pair(T var1, U var2) { + x = var1; + y = var2; + } + + public T fst() { + return x; + } + + public U snd() { + return y; + } +} \ No newline at end of file diff --git a/out/tests/resources/insertGenerics/javFiles/TestGGFinder.jav b/out/tests/resources/insertGenerics/javFiles/TestGGFinder.jav new file mode 100644 index 0000000..cc94cad --- /dev/null +++ b/out/tests/resources/insertGenerics/javFiles/TestGGFinder.jav @@ -0,0 +1,17 @@ +public class TestGGFinder { + a; + + id(b) { + var c = b; + return c; + } + + setA(x) { + a = x; + return a; + } + + m(x,y) { + x = id(y); + } +} \ No newline at end of file diff --git a/out/tests/resources/insertGenerics/javFiles/TestLocalVarLambda.jav b/out/tests/resources/insertGenerics/javFiles/TestLocalVarLambda.jav new file mode 100644 index 0000000..ab4455c --- /dev/null +++ b/out/tests/resources/insertGenerics/javFiles/TestLocalVarLambda.jav @@ -0,0 +1,7 @@ +public class TestLocalVarLambda { + +m(x) { + var id = z -> z; + return id.apply(x); + } +} \ No newline at end of file diff --git a/out/tests/resources/insertGenerics/javFiles/TestMutualRecursion.jav b/out/tests/resources/insertGenerics/javFiles/TestMutualRecursion.jav new file mode 100644 index 0000000..60ce72c --- /dev/null +++ b/out/tests/resources/insertGenerics/javFiles/TestMutualRecursion.jav @@ -0,0 +1,17 @@ +public class TestMutualRecursion { + a; + + id(b) { + var c = b; + return main(b,c); + } + + m(x,y) { + x = id(y); + return x; + } + + main(x,y) { + return m(id(x),y); + } +} \ No newline at end of file diff --git a/out/tests/resources/insertGenerics/javFiles/TestMutualRecursionWithField.jav b/out/tests/resources/insertGenerics/javFiles/TestMutualRecursionWithField.jav new file mode 100644 index 0000000..82dc42d --- /dev/null +++ b/out/tests/resources/insertGenerics/javFiles/TestMutualRecursionWithField.jav @@ -0,0 +1,22 @@ +public class TestMutualRecursionWithField { + a; + + id(b) { + var c = b; + return main(b,c); + } + + setA(x) { + a = x; + return a; + } + + m(x,y) { + x = id(y); + return x; + } + + main(x,y) { + return m(id(x),setA(y)); + } +} \ No newline at end of file diff --git a/out/tests/resources/insertGenerics/javFiles/TestMutualRecursionWithField2.jav b/out/tests/resources/insertGenerics/javFiles/TestMutualRecursionWithField2.jav new file mode 100644 index 0000000..727e603 --- /dev/null +++ b/out/tests/resources/insertGenerics/javFiles/TestMutualRecursionWithField2.jav @@ -0,0 +1,22 @@ +public class TestMutualRecursionWithField2 { + a; + + id(b) { + var c = b; + return main(b,c); + } + + setA(x) { + a = x; + return a; + } + + m(x,y) { + x = id(y); + return x; + } + + main(x,y) { + return m(setA(x),id(y)); + } +} \ No newline at end of file diff --git a/out/tests/resources/insertGenerics/javFiles/TestMutualRecursionWithField3.jav b/out/tests/resources/insertGenerics/javFiles/TestMutualRecursionWithField3.jav new file mode 100644 index 0000000..24e0989 --- /dev/null +++ b/out/tests/resources/insertGenerics/javFiles/TestMutualRecursionWithField3.jav @@ -0,0 +1,23 @@ +public class TestMutualRecursionWithField3 { + a; + + id(b) { + var c = b; + return main(b,c); + } + + setA(x) { + a = x; + return a; + } + + m(x,y) { + x = id(y); + return x; + } + + main(x,y) { + var z = m(setA(x),id(y)); + return z; + } +} \ No newline at end of file diff --git a/out/tests/resources/insertGenerics/javFiles/TestReturnVar.jav b/out/tests/resources/insertGenerics/javFiles/TestReturnVar.jav new file mode 100644 index 0000000..0688e5b --- /dev/null +++ b/out/tests/resources/insertGenerics/javFiles/TestReturnVar.jav @@ -0,0 +1,6 @@ +class VarReturn { + anyMethod() { + var f; + return f; + } +} \ No newline at end of file diff --git a/out/tests/resources/insertGenerics/javFiles/TestSecondLineOfClassConstraints.jav b/out/tests/resources/insertGenerics/javFiles/TestSecondLineOfClassConstraints.jav new file mode 100644 index 0000000..16275a5 --- /dev/null +++ b/out/tests/resources/insertGenerics/javFiles/TestSecondLineOfClassConstraints.jav @@ -0,0 +1,12 @@ +class Example { + a; + b = a; + anyMethod() { + var f; + return f; + } + otherMethod(e) { + e = a; + return e; + } +} \ No newline at end of file diff --git a/out/tests/resources/insertGenerics/javFiles/TestTPHsAndGenerics.jav b/out/tests/resources/insertGenerics/javFiles/TestTPHsAndGenerics.jav new file mode 100644 index 0000000..33a79e5 --- /dev/null +++ b/out/tests/resources/insertGenerics/javFiles/TestTPHsAndGenerics.jav @@ -0,0 +1,13 @@ +class TPHsAndGenerics { + id = x -> x; + id2 (x) { + return id.apply(x); + } + m(a, b){ + var c = m2(a,b); + return a; + } + m2(a, b){ + return b; + } +} \ No newline at end of file diff --git a/out/tests/resources/insertGenerics/javFiles/TestTPHsAndGenerics2.jav b/out/tests/resources/insertGenerics/javFiles/TestTPHsAndGenerics2.jav new file mode 100644 index 0000000..2a75e82 --- /dev/null +++ b/out/tests/resources/insertGenerics/javFiles/TestTPHsAndGenerics2.jav @@ -0,0 +1,14 @@ +class TPHsAndGenerics2 { + id = x -> x; + id2 (x) { + return id.apply(x); + } + m(a, b){ + var c = m2(a,b); + return a; + } + m2(a, b){ + return b; + } + +} \ No newline at end of file diff --git a/out/tests/resources/insertGenerics/javFiles/TestThreeArgs.jav b/out/tests/resources/insertGenerics/javFiles/TestThreeArgs.jav new file mode 100644 index 0000000..fe22dd3 --- /dev/null +++ b/out/tests/resources/insertGenerics/javFiles/TestThreeArgs.jav @@ -0,0 +1,15 @@ +public class TestThreeArgs { + a; + + id(b) { + var a /* = null */; + var c = b; + m(a,a,b); + return c; + } + + m(x,y, z) { + x = id(y); + return x; + } +} \ No newline at end of file diff --git a/out/tests/resources/insertGenerics/javFiles/TestTwoArgs.jav b/out/tests/resources/insertGenerics/javFiles/TestTwoArgs.jav new file mode 100644 index 0000000..b4754fe --- /dev/null +++ b/out/tests/resources/insertGenerics/javFiles/TestTwoArgs.jav @@ -0,0 +1,29 @@ +public class TestTwoArgs // +{ + //AS + a; + + //AN -> AN + id(b) { + var c = b; + return c; + } + + //T -> AS + setA(x) { + a = x; + return a; + } + + //(AG,Z) -> AG + m(x,y) { + x = id(y); + return x; + } + + // (AI, AH) -> AG + main(x,y) { + return m(id(x),setA(y)); + } +} + diff --git a/out/tests/resources/insertGenerics/javFiles/TestTwoArgs2.jav b/out/tests/resources/insertGenerics/javFiles/TestTwoArgs2.jav new file mode 100644 index 0000000..f8c270a --- /dev/null +++ b/out/tests/resources/insertGenerics/javFiles/TestTwoArgs2.jav @@ -0,0 +1,17 @@ +public class TestTwoArgs2 { + a; + + id(b) { + var c = b; + return c; + } + + m(x,y) { + x = id(y); + return x; + } + + main(x,y) { + return m(id(x),m(x,y)); + } +} \ No newline at end of file diff --git a/out/tests/resources/insertGenerics/javFiles/TestTwoCalls.jav b/out/tests/resources/insertGenerics/javFiles/TestTwoCalls.jav new file mode 100644 index 0000000..e3f0cfc --- /dev/null +++ b/out/tests/resources/insertGenerics/javFiles/TestTwoCalls.jav @@ -0,0 +1,14 @@ +public class TestTwoCalls { + + // O -> O + id(b) { + var c = b; + return c; + } + + // (S, T) -> T + main(x,y) { + id(x); + return id(y); + } +} \ No newline at end of file diff --git a/out/tests/resources/insertGenerics/javFiles/TestVector.jav b/out/tests/resources/insertGenerics/javFiles/TestVector.jav new file mode 100644 index 0000000..5f29c83 --- /dev/null +++ b/out/tests/resources/insertGenerics/javFiles/TestVector.jav @@ -0,0 +1,12 @@ +import java.util.Vector; + +public class TestVector { + + m(v, w) { + w.addElement(id(v.elementAt(0))); + } + + id(x) { + return x; + } +} diff --git a/out/tests/resources/insertGenerics/javFiles/TestVectorArg.jav b/out/tests/resources/insertGenerics/javFiles/TestVectorArg.jav new file mode 100644 index 0000000..ca29f82 --- /dev/null +++ b/out/tests/resources/insertGenerics/javFiles/TestVectorArg.jav @@ -0,0 +1,12 @@ +import java.util.Vector; + +public class TestVectorArg { + + add(v, e) { + v.addElement(e); + } + + main(v, e) { + add(v, e); + } +} \ No newline at end of file diff --git a/out/tests/resources/insertGenerics/javFiles/TestVoidMeth.jav b/out/tests/resources/insertGenerics/javFiles/TestVoidMeth.jav new file mode 100644 index 0000000..50ee720 --- /dev/null +++ b/out/tests/resources/insertGenerics/javFiles/TestVoidMeth.jav @@ -0,0 +1,4 @@ +class VoidMeth { + anyMethod() { + } +} \ No newline at end of file diff --git a/out/tests/resources/packageTest/pkg/sub/Cycle1.jav b/out/tests/resources/packageTest/pkg/sub/Cycle1.jav new file mode 100644 index 0000000..79267a0 --- /dev/null +++ b/out/tests/resources/packageTest/pkg/sub/Cycle1.jav @@ -0,0 +1,11 @@ +package pkg.sub; + +import java.lang.Integer; +import pkg.sub2.Cycle2; + +public class Cycle1 { + test() { + var cycle2 = new Cycle2(); + cycle2.test(); + } +} \ No newline at end of file diff --git a/out/tests/resources/packageTest/pkg/sub/Test1.jav b/out/tests/resources/packageTest/pkg/sub/Test1.jav new file mode 100644 index 0000000..7acebfb --- /dev/null +++ b/out/tests/resources/packageTest/pkg/sub/Test1.jav @@ -0,0 +1,11 @@ +package pkg.sub; + +import pkg.sub2.Test2; + +public class Test1 { + + main() { + var t2 = new Test2(); + t2.test(); + } +} \ No newline at end of file diff --git a/out/tests/resources/packageTest/pkg/sub2/Cycle2.jav b/out/tests/resources/packageTest/pkg/sub2/Cycle2.jav new file mode 100644 index 0000000..8a13e10 --- /dev/null +++ b/out/tests/resources/packageTest/pkg/sub2/Cycle2.jav @@ -0,0 +1,11 @@ +package pkg.sub2; + +import java.lang.Integer; +import pkg.sub.Cycle1; + +public class Cycle2 { + test() { + var cycle1 = new Cycle1(); + cycle1.test(); + } +} \ No newline at end of file diff --git a/out/tests/resources/packageTest/pkg/sub2/Test2.jav b/out/tests/resources/packageTest/pkg/sub2/Test2.jav new file mode 100644 index 0000000..a7f8927 --- /dev/null +++ b/out/tests/resources/packageTest/pkg/sub2/Test2.jav @@ -0,0 +1,6 @@ +package pkg.sub2; + +public class Test2 { + + test() {} +} \ No newline at end of file diff --git a/out/tests/resources/resources/AllgemeinTest/Assign.jav b/out/tests/resources/resources/AllgemeinTest/Assign.jav new file mode 100644 index 0000000..001fca7 --- /dev/null +++ b/out/tests/resources/resources/AllgemeinTest/Assign.jav @@ -0,0 +1,10 @@ +class Assign { + + assign(x, y) { + x = y; + } + + assign2(x, y) { + assign(x,y); + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/AllgemeinTest/CaptureConversion.jav b/out/tests/resources/resources/AllgemeinTest/CaptureConversion.jav new file mode 100644 index 0000000..b1033de --- /dev/null +++ b/out/tests/resources/resources/AllgemeinTest/CaptureConversion.jav @@ -0,0 +1,18 @@ +import java.lang.Object; +import java.util.Vector; + +class CaptureConversion { + + void assign(Vector v1, Vector v2) { + v1 = v2; + } + + void main() { + Vector v1; + v1 = new Vector(); + Vector v2; + v2 = new Vector(); + v1 = v2; + assign(v1, v2); + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/AllgemeinTest/Complex.jav b/out/tests/resources/resources/AllgemeinTest/Complex.jav new file mode 100644 index 0000000..15d5c5d --- /dev/null +++ b/out/tests/resources/resources/AllgemeinTest/Complex.jav @@ -0,0 +1,22 @@ +class Pair { + U a; + T b; + Pair(U x, T y) { + a = x; b = y; + } +} + +class Complex { + m(b) { + var c = b; + var d = c; + var e; + d = e; + var r1 = e; + var f = e; + var g; + f = g; + var r2 = g; + return new Pair<>(r1, r2); + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/AllgemeinTest/InfReturn.jav b/out/tests/resources/resources/AllgemeinTest/InfReturn.jav new file mode 100644 index 0000000..d1f6211 --- /dev/null +++ b/out/tests/resources/resources/AllgemeinTest/InfReturn.jav @@ -0,0 +1,7 @@ +public class InfReturn { + m(a) { + var ret; + a = ret; + return ret; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/AllgemeinTest/InfReturnII.jav b/out/tests/resources/resources/AllgemeinTest/InfReturnII.jav new file mode 100644 index 0000000..e1e9597 --- /dev/null +++ b/out/tests/resources/resources/AllgemeinTest/InfReturnII.jav @@ -0,0 +1,8 @@ +public class InfReturnII { + m(a, b) { + var ret; + a = ret; + b = ret; + return ret; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/AllgemeinTest/InnerInf.jav b/out/tests/resources/resources/AllgemeinTest/InnerInf.jav new file mode 100644 index 0000000..4eaa183 --- /dev/null +++ b/out/tests/resources/resources/AllgemeinTest/InnerInf.jav @@ -0,0 +1,7 @@ +class InnerInf { + m(a, b) { + var i; + a = i; + b = i; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/AllgemeinTest/Iteration.jav b/out/tests/resources/resources/AllgemeinTest/Iteration.jav new file mode 100644 index 0000000..2af750a --- /dev/null +++ b/out/tests/resources/resources/AllgemeinTest/Iteration.jav @@ -0,0 +1,43 @@ +/* +class Pair { + T x; + U y; + + public Pair() { } + public Pair(T x, U y) { + this.x = x; + this.y = y; + } + + public T fst () { + return x; + } + + public U snd () { + return y; + } +} +*/ + +public class Iteration { + id(x) { + return x; + } + + m1(x, y) { + var help; + help = m2(x, y); + var y2 = help.snd(); + var x2 = id(x); + return new Pair<>(x2,y2); + + } + + m2(x,y) { + var help = m1(x, y); + var x2 = help.fst(); + var y2 = id(y); + return new Pair<>(x2, y2); + } +} + \ No newline at end of file diff --git a/out/tests/resources/resources/AllgemeinTest/List.jav b/out/tests/resources/resources/AllgemeinTest/List.jav new file mode 100644 index 0000000..9c612f2 --- /dev/null +++ b/out/tests/resources/resources/AllgemeinTest/List.jav @@ -0,0 +1,46 @@ +import java.lang.Boolean; +import java.lang.Object; + +class List { + elem; + next; + + List() { + super(); + } + + List(elem, next) { + this.elem = elem; + this.next = next; + } + + addElement(newElem) { + return new List(newElem, this); + } + + append(l) { + if (next == null) { + return l; + } + else { + return new List(elem, next.append(l)); + } + } +/* + addAll(l) { + var nextLoc = next; + while (//nextLoc != null + true) { + nextLoc = nextLoc.next; + } + nextLoc = l; + } + + void m() { + List l; // = new List(1, null); + List l2; // = new List("SSS", null); + l.addAll(l2); + } +*/ +} + diff --git a/out/tests/resources/resources/AllgemeinTest/Overloading.jav b/out/tests/resources/resources/AllgemeinTest/Overloading.jav new file mode 100644 index 0000000..2809813 --- /dev/null +++ b/out/tests/resources/resources/AllgemeinTest/Overloading.jav @@ -0,0 +1,7 @@ +import java.lang.Integer; +import java.lang.Double; + +class Overloading { + m(x) { return x + x; } + m(x) { return x || x; } +} \ No newline at end of file diff --git a/out/tests/resources/resources/AllgemeinTest/Pair.jav b/out/tests/resources/resources/AllgemeinTest/Pair.jav new file mode 100644 index 0000000..89660b1 --- /dev/null +++ b/out/tests/resources/resources/AllgemeinTest/Pair.jav @@ -0,0 +1,36 @@ +import java.util.Vector; +import java.lang.Boolean; +import java.lang.Object; + +class Pair { + U a; + T b; + + make(x) { + var ret = new Pair<>(); + ret.a = x.elementAt(0); + ret.b = x.elementAt(1); + return ret; + } + + + eq(a, b) { + b = a; + return a == b; + } + + + compare( p) { + return eq(p.a, p.b); + //return p.a == p.b; + } + + +/* + void m(Pair p, Vector b) + { + //this.compare(p); //1, type incorrect + this.compare(this.make(b)); //2, OK + } +*/ +} \ No newline at end of file diff --git a/out/tests/resources/resources/AllgemeinTest/RecursionCond.jav b/out/tests/resources/resources/AllgemeinTest/RecursionCond.jav new file mode 100644 index 0000000..1640471 --- /dev/null +++ b/out/tests/resources/resources/AllgemeinTest/RecursionCond.jav @@ -0,0 +1,8 @@ +class RecursionCond { + m(a, b, c) { + if (1 == 2) { + b = m(a, b); + c = m(a, b); + } else return a; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/AllgemeinTest/StreamTest.jav b/out/tests/resources/resources/AllgemeinTest/StreamTest.jav new file mode 100644 index 0000000..cfaf23d --- /dev/null +++ b/out/tests/resources/resources/AllgemeinTest/StreamTest.jav @@ -0,0 +1,14 @@ +import java.util.stream.Stream; +import java.util.Vector; +import java.lang.Integer; + +class StreamTest { + + m() { + var vecInt = new Vector(); + var strInt = vecInt.stream(); + var dup = x -> x*2; + strInt.map(dup); + return dup; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/AllgemeinTest/Test.jav b/out/tests/resources/resources/AllgemeinTest/Test.jav new file mode 100644 index 0000000..48491b8 --- /dev/null +++ b/out/tests/resources/resources/AllgemeinTest/Test.jav @@ -0,0 +1,9 @@ +import java.lang.Boolean; +import java.lang.Integer; + +public class Test { + fac = (x) -> { + if (x == 1) { return 1; } + return x * fac.apply(x - 1); + }; +} \ No newline at end of file diff --git a/out/tests/resources/resources/AllgemeinTest/TripleTest.jav b/out/tests/resources/resources/AllgemeinTest/TripleTest.jav new file mode 100644 index 0000000..a0560b6 --- /dev/null +++ b/out/tests/resources/resources/AllgemeinTest/TripleTest.jav @@ -0,0 +1,19 @@ +class Triple { + U a; + T b; + S c; + + Triple(U x, T y, S z) { + a = x; b = y; c = z; + } + + U fst() { return a; } + T snd() { return b; } + S thrd() { return c; } +} + +public class TripleTest { + m() { + return new Triple<>(m().thrd(), m().thrd(), m().thrd()); + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/AllgemeinTest/Twice2.jav b/out/tests/resources/resources/AllgemeinTest/Twice2.jav new file mode 100644 index 0000000..87a3f23 --- /dev/null +++ b/out/tests/resources/resources/AllgemeinTest/Twice2.jav @@ -0,0 +1,12 @@ +class Twice2 { + id1inst = new Id<>(); + id1 = id1inst.id; + id2inst = new Id<>(); + id2 = id2inst.id; + twice = id1.apply(id2); + +} + +class Id { + id = (T x) -> x; +} \ No newline at end of file diff --git a/out/tests/resources/resources/AllgemeinTest/UseWildcardPair.jav b/out/tests/resources/resources/AllgemeinTest/UseWildcardPair.jav new file mode 100644 index 0000000..dc91e4e --- /dev/null +++ b/out/tests/resources/resources/AllgemeinTest/UseWildcardPair.jav @@ -0,0 +1,12 @@ +import java.util.Vector; +import java.lang.Boolean; + +class UseWildcardPair{ + + void m(Pair p, Vector b) + { + p.compare(p); //1, type incorrect + p.compare(p.make(b)); //2, OK + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/AA.jav b/out/tests/resources/resources/bytecode/javFiles/AA.jav new file mode 100644 index 0000000..6b79df3 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/AA.jav @@ -0,0 +1,8 @@ +import java.lang.Integer; +import java.lang.String; + +public class AA { + public m(Integer i) { return "AA"; } + + public m2(AA x) { return "AA"; } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Access.jav b/out/tests/resources/resources/bytecode/javFiles/Access.jav new file mode 100644 index 0000000..46cd8c8 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Access.jav @@ -0,0 +1,14 @@ +public class Access { + public int fPublic; + int fDefault; + private int fPrivate; + protected int fProtected; + + public void mPublic() {} + void mDefault() {} + private void mPrivate() {} + protected void mProtected() {} +} + +class AccessDefault { +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/AddLong.jav b/out/tests/resources/resources/bytecode/javFiles/AddLong.jav new file mode 100644 index 0000000..d6d47e9 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/AddLong.jav @@ -0,0 +1,9 @@ +import java.lang.Integer; +import java.lang.Long; + +public class AddLong{ + Long add(Integer a, Long b) { + Long c = a+b; + return c; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Annotation.jav b/out/tests/resources/resources/bytecode/javFiles/Annotation.jav new file mode 100644 index 0000000..520eb31 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Annotation.jav @@ -0,0 +1,8 @@ +class Base { + public void foo() {} +} + +public class Annotation extends Base { + @Override + public void foo() {} +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/AssignToLit.jav b/out/tests/resources/resources/bytecode/javFiles/AssignToLit.jav new file mode 100644 index 0000000..873828e --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/AssignToLit.jav @@ -0,0 +1,30 @@ +import java.lang.Integer; +import java.lang.Boolean; +import java.lang.String; +import java.lang.Byte; +import java.lang.Short; +import java.lang.Long; +import java.lang.Float; +import java.lang.Double; +import java.lang.Character; + +class AssignToLit { + void m(){ +// String s = "Test"; +// Boolean b = false; +// Byte byte1 = 5; +// Byte byte2 = 55; +// Short short1 = 5; +// Short short2 = 55; +// Integer int1 = 5; +// Integer int2 = 8888888; +// Long long1 = 1; +// Long long2 = 5; +// Long long3 = 89989898; +// Float float1 = 1; +// Float float2 = 55; +// Double d1 = 1; +// Double d2 = 55; + Character c = 'A'; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/BB.jav b/out/tests/resources/resources/bytecode/javFiles/BB.jav new file mode 100644 index 0000000..db741c6 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/BB.jav @@ -0,0 +1,4 @@ +import java.lang.Integer; +import AA; + +public class BB extends AA { } \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/BinaryInMeth.jav b/out/tests/resources/resources/bytecode/javFiles/BinaryInMeth.jav new file mode 100644 index 0000000..0e1ddc5 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/BinaryInMeth.jav @@ -0,0 +1,17 @@ +import java.lang.Integer; +import java.lang.Double; + +public class BinaryInMeth { + + public m(a){ + return ++a; + } + + public m2(a,b){ + return m(a+b); + } + + public m3(a) { + return m(++a); + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Box.jav b/out/tests/resources/resources/bytecode/javFiles/Box.jav new file mode 100644 index 0000000..4859d61 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Box.jav @@ -0,0 +1,7 @@ +class B { } +class Box_Main extends B { + m(b) { + b.m(new Box_Main()); + b.m(new B()); + } +} diff --git a/out/tests/resources/resources/bytecode/javFiles/Box.java b/out/tests/resources/resources/bytecode/javFiles/Box.java new file mode 100644 index 0000000..581e725 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Box.java @@ -0,0 +1,3 @@ +class Box { + void m(A a) { } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Bug112.jav b/out/tests/resources/resources/bytecode/javFiles/Bug112.jav new file mode 100644 index 0000000..a3f1bad --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Bug112.jav @@ -0,0 +1,7 @@ +public class Bug112 { + public m(x) { + var y; + x = y; + return y; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Bug122.jav b/out/tests/resources/resources/bytecode/javFiles/Bug122.jav new file mode 100644 index 0000000..746f311 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Bug122.jav @@ -0,0 +1,12 @@ +import java.lang.Integer; +import java.lang.Boolean; + +public class Bug122 { + public void main() { + if (true) { + for (Integer i = 0; i < 10; i++) { + + } + } + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Bug123.jav b/out/tests/resources/resources/bytecode/javFiles/Bug123.jav new file mode 100644 index 0000000..daecc91 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Bug123.jav @@ -0,0 +1,13 @@ +import java.lang.Boolean; +import java.lang.Integer; + +public class Bug123 { + public Boolean works(){ + if(true) return true; + else return false; + } + public void fails(){ + Boolean a = true; + if(true) a = false; + } +} diff --git a/out/tests/resources/resources/bytecode/javFiles/Bug125.jav b/out/tests/resources/resources/bytecode/javFiles/Bug125.jav new file mode 100644 index 0000000..692106c --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Bug125.jav @@ -0,0 +1,16 @@ +import java.lang.Boolean; +import java.lang.Integer; +import java.lang.String; +import java.util.List; +import java.util.LinkedList; +import java.util.ArrayList; + +public class Bug125 { + static ArrayList works = new ArrayList<>(); + static List fails = new ArrayList<>(); + + public void main() { + works.toString(); + fails.toString(); + } +} diff --git a/out/tests/resources/resources/bytecode/javFiles/Bug285.jav b/out/tests/resources/resources/bytecode/javFiles/Bug285.jav new file mode 100644 index 0000000..5f17b66 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Bug285.jav @@ -0,0 +1,15 @@ +import java.util.Optional; +import java.lang.Integer; + +public class StaticClass { + public static StaticClass barbar() { + return new StaticClass(); + } +} + +public class Bug285 { + public void foo() { + Optional opt = Optional.empty(); + StaticClass b = StaticClass.barbar(); + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Bug290A.jav b/out/tests/resources/resources/bytecode/javFiles/Bug290A.jav new file mode 100644 index 0000000..7667cac --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Bug290A.jav @@ -0,0 +1,7 @@ +import Bug290B; + +public class Bug290A { + public void m() { + new Bug290B(); + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Bug290B.jav b/out/tests/resources/resources/bytecode/javFiles/Bug290B.jav new file mode 100644 index 0000000..1a9201b --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Bug290B.jav @@ -0,0 +1,11 @@ +import java.lang.String; +import java.lang.Integer; + +public class Bug290B { + String name; + + public Bug290B() { + Integer i = 0; + name = i.toString() + "$$"; + } +} diff --git a/out/tests/resources/resources/bytecode/javFiles/Bug293.jav b/out/tests/resources/resources/bytecode/javFiles/Bug293.jav new file mode 100644 index 0000000..0e7dc26 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Bug293.jav @@ -0,0 +1,13 @@ +import java.lang.Integer; +import java.lang.Float; + +public class Bug293 { + bar(a) { + return 2 * a; + } +} + +interface IFoo { + void ga(); +} + diff --git a/out/tests/resources/resources/bytecode/javFiles/Bug295.jav b/out/tests/resources/resources/bytecode/javFiles/Bug295.jav new file mode 100644 index 0000000..be4488a --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Bug295.jav @@ -0,0 +1,18 @@ +import java.lang.Integer; + +public class Bug295 { + public Integer a; + public Integer b; + public Integer c; + + public Bug295(a, b, c) { + this(a); + this.b = b; + this.c = c; + } + + public Bug295(a) { + this.a = a; + } +} + diff --git a/out/tests/resources/resources/bytecode/javFiles/Bug296.jav b/out/tests/resources/resources/bytecode/javFiles/Bug296.jav new file mode 100644 index 0000000..35ac882 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Bug296.jav @@ -0,0 +1,11 @@ +import java.lang.Integer; + +public class Bug296 { + public static m1() { + return m2(); + } + + static m2() { + return 10; + } +} diff --git a/out/tests/resources/resources/bytecode/javFiles/Bug297.jav b/out/tests/resources/resources/bytecode/javFiles/Bug297.jav new file mode 100644 index 0000000..c4ff1e5 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Bug297.jav @@ -0,0 +1,11 @@ +import java.lang.Integer; + +public class Bug297 { + public static operation(func, a, b) { + return func.apply(a, b); + } + + public exec() { + return Foo.operation((x, y) -> x + y, 10, 10); + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Bug298.jav b/out/tests/resources/resources/bytecode/javFiles/Bug298.jav new file mode 100644 index 0000000..42ff96a --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Bug298.jav @@ -0,0 +1,17 @@ +import java.util.List; +import java.util.ArrayList; +import java.lang.Integer; +import java.lang.System; +import java.lang.Boolean; +import java.io.PrintStream; +import java.util.stream.Stream; +import java.util.function.Function; + +public class Bug298 { + public void m() { + List list = new ArrayList<>(); + list.stream().map(x -> 2 * x); + + Function filter = x -> true; + } +} diff --git a/out/tests/resources/resources/bytecode/javFiles/Bug300.jav b/out/tests/resources/resources/bytecode/javFiles/Bug300.jav new file mode 100644 index 0000000..728aa3f --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Bug300.jav @@ -0,0 +1,17 @@ +import java.lang.String; + +class Base { + toString() { + return "Base"; + } +} + +public class Bug300 extends Base { + public m() { + return super.toString(); + } + + toString() { + return "Derived"; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Bug301.jav b/out/tests/resources/resources/bytecode/javFiles/Bug301.jav new file mode 100644 index 0000000..30a6f2b --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Bug301.jav @@ -0,0 +1,4 @@ +import java.util.HashSet; + +public class Bug301 extends HashSet { +} diff --git a/out/tests/resources/resources/bytecode/javFiles/Bug302.jav b/out/tests/resources/resources/bytecode/javFiles/Bug302.jav new file mode 100644 index 0000000..baeb8a8 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Bug302.jav @@ -0,0 +1,11 @@ +import java.util.ArrayList; +import java.util.List; +import java.lang.Integer; + +public class Bug302 { + public Bug302(List a){} + + public static m() { + new Bug302(new ArrayList()); + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Bug306.jav b/out/tests/resources/resources/bytecode/javFiles/Bug306.jav new file mode 100644 index 0000000..d06ca67 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Bug306.jav @@ -0,0 +1,13 @@ +import java.lang.Integer; +import java.util.List; + +class Base { + m(List a) {} +} + +public class Bug306 extends Base { + @Override + m(List b) { + b.add(1); + } +} diff --git a/out/tests/resources/resources/bytecode/javFiles/Bug307.jav b/out/tests/resources/resources/bytecode/javFiles/Bug307.jav new file mode 100644 index 0000000..482e356 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Bug307.jav @@ -0,0 +1,46 @@ +public class Bug307 { + public void main() { + IVisitor v = new Visitor(); + Impl2 f = new Impl2(); + Impl1 g = new Impl1(); + + f.accept(v); + g.accept(v); + } +} + +interface IVisitor { + void visit(Impl1 f); + void visit(Impl2 fb); +} + +interface IAcceptor { + void accept(IVisitor v); +} + +class Visitor implements IVisitor { + + @Override + public void visit(Impl1 f) { + } + + @Override + public void visit(Impl2 fb) { + } +} + +class Impl1 implements IAcceptor { + + @Override + public void accept(IVisitor v) { + v.visit(this); + } +} + +class Impl2 implements IAcceptor { + + @Override + public void accept(IVisitor v) { + v.visit(this); + } +} diff --git a/out/tests/resources/resources/bytecode/javFiles/Bug309.jav b/out/tests/resources/resources/bytecode/javFiles/Bug309.jav new file mode 100644 index 0000000..23ae44e --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Bug309.jav @@ -0,0 +1,16 @@ +import java.util.List; +import java.util.ArrayList; +import java.lang.Integer; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import java.util.function.Function; +import java.util.function.Predicate; +import java.util.Optional; + +public class Bug309 { + public main() { + List list = new ArrayList<>(List.of(1,2,3,4,5,6,7,8,9)); + var res = list.stream().filter(x -> x == 5).map(x -> x * 2).findFirst(); + return res; + } +} diff --git a/out/tests/resources/resources/bytecode/javFiles/Bug310.jav b/out/tests/resources/resources/bytecode/javFiles/Bug310.jav new file mode 100644 index 0000000..0539338 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Bug310.jav @@ -0,0 +1,9 @@ +import java.lang.Integer; +import java.lang.String; + +public class Bug310 { + Integer i = 3; + public toString() { + return i.toString(); + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Bug311.jav b/out/tests/resources/resources/bytecode/javFiles/Bug311.jav new file mode 100644 index 0000000..e8ccb7f --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Bug311.jav @@ -0,0 +1,10 @@ +import java.lang.String; + +public class Bug311 { + Bug311A i = new Bug311A(); + public toString() { + return i.toString(); + } +} + +class Bug311A {} diff --git a/out/tests/resources/resources/bytecode/javFiles/Bug312.jav b/out/tests/resources/resources/bytecode/javFiles/Bug312.jav new file mode 100644 index 0000000..82f1aa2 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Bug312.jav @@ -0,0 +1,8 @@ +public class Bug312 { + Bug312A i = new Bug312A(); + public main() { + if (i == null) {} + } +} + +class Bug312A {} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Bug314.jav b/out/tests/resources/resources/bytecode/javFiles/Bug314.jav new file mode 100644 index 0000000..7f20d6d --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Bug314.jav @@ -0,0 +1,13 @@ +import java.lang.Integer; +import java.util.List; +import java.util.ArrayList; +import java.util.stream.Stream; +import java.util.function.Predicate; +import java.util.function.Function; +import java.util.stream.Collectors; + +public class Bug314 { + public List convert(List in) { + return in.stream().filter(x -> x > 5).collect(Collectors.toList()); + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Bug98.jav b/out/tests/resources/resources/bytecode/javFiles/Bug98.jav new file mode 100644 index 0000000..6a7a9e4 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Bug98.jav @@ -0,0 +1,16 @@ +import java.util.Vector; +import java.lang.Integer; +import java.lang.String; + +public class Bug98 { + + public m(x, y ,z) { + x = new Vector(); + y = new Vector(); + x.add(1); + y.add("2"); + //Integer i = x.elementAt(0); + //String s = y.elementAt(0); + return z.vectorAddAll(x, y); + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/BugXXX.jav b/out/tests/resources/resources/bytecode/javFiles/BugXXX.jav new file mode 100644 index 0000000..c25acdf --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/BugXXX.jav @@ -0,0 +1,16 @@ +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; +import java.lang.String; +import java.util.stream.Stream; +import java.util.function.Function; +import java.util.function.Predicate; +import java.lang.Integer; + +class BugXXX { + public main() { + List i = new ArrayList<>(List.of(1,2,3,4,5,6,7,8,9,10)); + Optional tmp = i.stream().filter(x -> x == 5).map(x -> x*2).findFirst(); + return tmp; + } +} diff --git a/out/tests/resources/resources/bytecode/javFiles/CC.jav b/out/tests/resources/resources/bytecode/javFiles/CC.jav new file mode 100644 index 0000000..a19fd1f --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/CC.jav @@ -0,0 +1,11 @@ +import java.lang.Integer; +import java.lang.String; +import BB; + +public class CC extends BB { + public m(Integer i) { + return "CC"; + } + + public m2(CC x) { return "CC"; } +} diff --git a/out/tests/resources/resources/bytecode/javFiles/Chain.jav b/out/tests/resources/resources/bytecode/javFiles/Chain.jav new file mode 100644 index 0000000..bd43a01 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Chain.jav @@ -0,0 +1,13 @@ +import java.lang.Integer; + +public class Chain { + x = 5; + + chain() { + return this; + } + + public m() { + return this.chain().chain().chain().x; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/ClassGenLam.jav b/out/tests/resources/resources/bytecode/javFiles/ClassGenLam.jav new file mode 100644 index 0000000..0e9cf05 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/ClassGenLam.jav @@ -0,0 +1,8 @@ +import java.lang.Integer; + +public class ClassGenLam { + lam = x-> x; +// public ClassGenLam() { +// lam = x->x; +// } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Cycle.jav b/out/tests/resources/resources/bytecode/javFiles/Cycle.jav new file mode 100644 index 0000000..b49e906 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Cycle.jav @@ -0,0 +1,6 @@ +public class Cycle { + public m(x, y) { + y = x; + x = y; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/DD.jav b/out/tests/resources/resources/bytecode/javFiles/DD.jav new file mode 100644 index 0000000..07eaf7c --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/DD.jav @@ -0,0 +1,5 @@ +import java.lang.Integer; +import CC; + +public class DD extends CC { } + diff --git a/out/tests/resources/resources/bytecode/javFiles/DuMethod.jav b/out/tests/resources/resources/bytecode/javFiles/DuMethod.jav new file mode 100644 index 0000000..3898a7b --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/DuMethod.jav @@ -0,0 +1,11 @@ +public class DuMethod{ + + method(a){ + return a+a; + } + + method(a){ + return a; + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/EmptyClass.jav b/out/tests/resources/resources/bytecode/javFiles/EmptyClass.jav new file mode 100644 index 0000000..8160d7d --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/EmptyClass.jav @@ -0,0 +1,3 @@ +public class EmptyClass{ + +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/EmptyMethod.jav b/out/tests/resources/resources/bytecode/javFiles/EmptyMethod.jav new file mode 100644 index 0000000..961989d --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/EmptyMethod.jav @@ -0,0 +1,8 @@ +public class EmptyMethod{ + + public void m1(){ + System.out.println("test"); + } + + public void m2(){} +} diff --git a/out/tests/resources/resources/bytecode/javFiles/Example.jav b/out/tests/resources/resources/bytecode/javFiles/Example.jav new file mode 100644 index 0000000..b7455a3 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Example.jav @@ -0,0 +1,9 @@ +import java.lang.String; + +public class Example { + + public m() { + String x = "X"; + return x; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Exceptions.jav b/out/tests/resources/resources/bytecode/javFiles/Exceptions.jav new file mode 100644 index 0000000..5b901ba --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Exceptions.jav @@ -0,0 +1,8 @@ +import java.lang.String; +import java.lang.RuntimeException; + +public class Exceptions { + public m() { + throw new RuntimeException("Some Exception"); + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Expressions.jav b/out/tests/resources/resources/bytecode/javFiles/Expressions.jav new file mode 100644 index 0000000..e2e992a --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Expressions.jav @@ -0,0 +1,8 @@ +class Expressions{ + +void test(){ + var x = 2; + x = x + 2; +} + +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/FC_Matrix.jav b/out/tests/resources/resources/bytecode/javFiles/FC_Matrix.jav new file mode 100644 index 0000000..75ead47 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/FC_Matrix.jav @@ -0,0 +1,10 @@ +import java.util.Vector; + +class Matrix extends Vector> { + + methode(m) { + m.add(1); + Matrix i; + methode(i); + } + } diff --git a/out/tests/resources/resources/bytecode/javFiles/Fac.jav b/out/tests/resources/resources/bytecode/javFiles/Fac.jav new file mode 100644 index 0000000..1e09235 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Fac.jav @@ -0,0 +1,15 @@ +import java.lang.Integer; +import java.lang.Double; +import java.lang.String; + +public class Fac { + getFac(n) { + var res = 1; + var i = 1; + while (i <= n) { + res = res * i; + i++; + } + return res; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Faculty.jav b/out/tests/resources/resources/bytecode/javFiles/Faculty.jav new file mode 100644 index 0000000..276d8df --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Faculty.jav @@ -0,0 +1,52 @@ +import java.lang.Integer; +//import java.lang.Long; +//import java.lang.Short; + +public class Faculty { + public fact; + Faculty() { + fact = (x) -> { + if (x == 1) { + return 1; + } + else { + return x * (fact.apply(x-1)); + } + }; + } + + + + public getFact(java.lang.Integer x) { + return fact.apply(x); + } +} +// m (x) { +// +//// var fact = (x) -> { +//// if (x == 1) { +//// return x; +//// } +//// else { +//// return x * (fact.apply(x-1)); +//// } +//// }; +//// return fact; +//// var x = 13; +//// if(x>22) { +//// return 0; +//// }else if(x <1){ +//// return x; +//// }else { +//// return 1; +//// } +// +// if (x < 0) { +// return 0; +// }else if(x<2) { +// return x; +// } else { +// return x * m(x-1); +// } +// } +//} diff --git a/out/tests/resources/resources/bytecode/javFiles/Faculty2.jav b/out/tests/resources/resources/bytecode/javFiles/Faculty2.jav new file mode 100644 index 0000000..828f06f --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Faculty2.jav @@ -0,0 +1,10 @@ +class Faculty2 { + + m () { + + var fact = (Integer x) -> { + return x; + }; + return fact; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/FacultyIf.jav b/out/tests/resources/resources/bytecode/javFiles/FacultyIf.jav new file mode 100644 index 0000000..3c36892 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/FacultyIf.jav @@ -0,0 +1,17 @@ +import java.lang.Integer; + +class Faculty { + + m () { + + var fact = (Integer x) -> { + if (x == 1) { + return x; + } + else { + return x * (fact.apply(x-1)); + } + }; + return fact; + } +} diff --git a/out/tests/resources/resources/bytecode/javFiles/FacultyTyped.jav b/out/tests/resources/resources/bytecode/javFiles/FacultyTyped.jav new file mode 100644 index 0000000..089d2f3 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/FacultyTyped.jav @@ -0,0 +1,19 @@ +import java.lang.Integer; + +class Faculty { + + Integer mul(Integer x, Integer y) { + return x; + } + + Fun1 m () { + var fact = (Integer x) -> { + return mul(x, fact.apply(x)); + }; + return fact; + } +} + +interface Fun1{ + B apply(A a); +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Field.jav b/out/tests/resources/resources/bytecode/javFiles/Field.jav new file mode 100644 index 0000000..0fd1133 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Field.jav @@ -0,0 +1,9 @@ +import java.lang.Integer; + +public class Field { + public x = 5; + + m(){ + return x; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/FieldAccess.jav b/out/tests/resources/resources/bytecode/javFiles/FieldAccess.jav new file mode 100644 index 0000000..894bb6e --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/FieldAccess.jav @@ -0,0 +1,13 @@ +class Box { +A f; +} +class B { + } + +class Box_Main extends B { + + m(b) { + b.f = new Box_Main(); + b.f = new B(); + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/FieldTph.jav b/out/tests/resources/resources/bytecode/javFiles/FieldTph.jav new file mode 100644 index 0000000..fc74e53 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/FieldTph.jav @@ -0,0 +1,4 @@ +public class FieldTph { + a; + +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/FieldTph2.jav b/out/tests/resources/resources/bytecode/javFiles/FieldTph2.jav new file mode 100644 index 0000000..21d9445 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/FieldTph2.jav @@ -0,0 +1,14 @@ +import java.lang.String; + +public class FieldTph2 { + public a; + + public m(b){ + b = a; + return b; + } + + public m2(c){ + a = c; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/FieldTphConsMeth.jav b/out/tests/resources/resources/bytecode/javFiles/FieldTphConsMeth.jav new file mode 100644 index 0000000..e8d01c1 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/FieldTphConsMeth.jav @@ -0,0 +1,26 @@ +public class FieldTphConsMeth { + + public a; + public FieldTphConsMeth(c) { + a = id(c); + } + + public id(b) { + return b; + } + + public setA(x) { + a = x; + return a; + } + + public m(x,y) { + x = id(y); + } + + /*m2(x,y) { + x = setA(y); + return x; + }*/ + +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/FieldTphMMeth.jav b/out/tests/resources/resources/bytecode/javFiles/FieldTphMMeth.jav new file mode 100644 index 0000000..e1277bf --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/FieldTphMMeth.jav @@ -0,0 +1,27 @@ +import java.lang.Boolean; + +public class FieldTphMMeth { + public a; + + public FieldTphMMeth(c,d,e) { + a = m(c,d,e); + } + + public m(b,d,e) { + if(e) { + return m3(b); + } else{ + return m3(d); + } + + } + + public m2(b) { + a = m3(b); + } + + public m3(b){ + return b; + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Fields.jav b/out/tests/resources/resources/bytecode/javFiles/Fields.jav new file mode 100644 index 0000000..cd2add7 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Fields.jav @@ -0,0 +1,11 @@ +import java.lang.String; + +class Fields{ +test2 = "test"; +test; +m(){ + var test3; + return test; +} + +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/For.jav b/out/tests/resources/resources/bytecode/javFiles/For.jav new file mode 100644 index 0000000..e96184e --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/For.jav @@ -0,0 +1,30 @@ +import java.lang.Integer; +import java.lang.Boolean; + +public class For{ + public Integer m(Integer x){ + var c = x + 2; + Boolean b = true; + c = 5; + c++; + ++c; + c--; + --c; + while(x<2){ + x = x +1; + b = false; + } + for(int i = 0; i<10; i++) { + x = x + 5; + } + return x; + } + +// m2(Integer x){ +// if(x<2) { +// return 1; +// }else { +// return 2; +// } +// } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/ForEach.jav b/out/tests/resources/resources/bytecode/javFiles/ForEach.jav new file mode 100644 index 0000000..301066a --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/ForEach.jav @@ -0,0 +1,23 @@ +import java.util.ArrayList; +import java.lang.Integer; +import java.lang.Number; + +public class ForEach { + public m() { + var list = new ArrayList<>(); + list.add(1); list.add(2); list.add(3); + + var sum = 0; + for (var i : list) { + sum = sum + i; + } + return sum; + } + + public m2() { + var list = new ArrayList(); + + for (Number n : list) { + } + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/FunOL.jav b/out/tests/resources/resources/bytecode/javFiles/FunOL.jav new file mode 100644 index 0000000..60736e1 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/FunOL.jav @@ -0,0 +1,12 @@ +import java.util.Vector; +import java.lang.Integer; +import java.lang.String; +//import java.lang.Byte; +//import java.lang.Boolean; + +public class FunOL { + + add(f, y) { + return f.apply() + y; + } +} diff --git a/out/tests/resources/resources/bytecode/javFiles/FunctionalInterface.jav b/out/tests/resources/resources/bytecode/javFiles/FunctionalInterface.jav new file mode 100644 index 0000000..39b3b34 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/FunctionalInterface.jav @@ -0,0 +1,15 @@ +import java.lang.Integer; +import java.util.function.Function; + +public class FunctionalInterface { + Integer accept(Function f) { + return f.apply(20); + } + + public Integer m() { + var v = accept(i -> { + return i * 10; + }); + return v; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Gen.jav b/out/tests/resources/resources/bytecode/javFiles/Gen.jav new file mode 100644 index 0000000..3b58b18 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Gen.jav @@ -0,0 +1,8 @@ +import java.lang.Integer; +import java.util.Vector; + +public class Gen{ + Vector m(Vector v){ + return v; + } +} diff --git a/out/tests/resources/resources/bytecode/javFiles/Generics.jav b/out/tests/resources/resources/bytecode/javFiles/Generics.jav new file mode 100644 index 0000000..bb7b2af --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Generics.jav @@ -0,0 +1,17 @@ + +class Generics { + Generics(B b){ + } + B mt1(B b){ + return mt1(b); + } +} + + +/* +Problem: +auto test = new List(); +auto test2 = new List(); +... //code, welcher möglicherweise test und test2 vertauscht +test.add("hallo"); +*/ \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Generics2.jav b/out/tests/resources/resources/bytecode/javFiles/Generics2.jav new file mode 100644 index 0000000..f3aa144 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Generics2.jav @@ -0,0 +1,9 @@ +import java.lang.String; +import java.lang.Integer; + +public class Generics2{ + public X m1(X b){ + return b; + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Generics3.jav b/out/tests/resources/resources/bytecode/javFiles/Generics3.jav new file mode 100644 index 0000000..fb354d4 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Generics3.jav @@ -0,0 +1,7 @@ +import java.lang.String; +import java.lang.Integer; +import java.util.List; + +class Generics3> { + +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Generics4.jav b/out/tests/resources/resources/bytecode/javFiles/Generics4.jav new file mode 100644 index 0000000..50b0b3e --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Generics4.jav @@ -0,0 +1,12 @@ +import java.lang.String; +import java.lang.Integer; + +class Generics4 { + C m1(C b){ + return b; + } + + m2(x) { + return m1(x); + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/GreaterEqual.jav b/out/tests/resources/resources/bytecode/javFiles/GreaterEqual.jav new file mode 100644 index 0000000..3ec69e8 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/GreaterEqual.jav @@ -0,0 +1,57 @@ +import java.lang.Integer; +import java.lang.Long; +import java.lang.Float; +import java.lang.Double; + +public class GreaterEqual { + + gE(Integer a, Integer b){ + var c = a>=b; + return c; + } + + gE(Long a, Long b){ + var c = a>=b; + return c; + } + + gE(Float a, Float b){ + var c = a>=b; + return c; + } + + gE(Double a, Double b){ + var c = a>=b; + return c; + } + + gE(Long a, Integer b){ + var c = a>=b; + return c; + } + + gE(Float a, Integer b){ + var c = a>=b; + return c; + } + + gE(Double a, Integer b){ + var c = a>=b; + return c; + } + + gE(Float a, Long b){ + var c = a>=b; + return c; + } + + gE(Double a, Long b){ + var c = a>=b; + return c; + } + + gE(Double a, Float b){ + var c = a>=b; + return c; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/GreaterThan.jav b/out/tests/resources/resources/bytecode/javFiles/GreaterThan.jav new file mode 100644 index 0000000..9077f5b --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/GreaterThan.jav @@ -0,0 +1,56 @@ +import java.lang.Integer; +import java.lang.Long; +import java.lang.Float; +import java.lang.Double; + +public class GreaterThan { + gT(Integer a, Integer b){ + var c = a>b; + return c; + } + + gT(Long a, Long b){ + var c = a>b; + return c; + } + + gT(Float a, Float b){ + var c = a>b; + return c; + } + + gT(Double a, Double b){ + var c = a>b; + return c; + } + + gT(Long a, Integer b){ + var c = a>b; + return c; + } + + gT(Float a, Integer b){ + var c = a>b; + return c; + } + + gT(Double a, Integer b){ + var c = a>b; + return c; + } + + gT(Float a, Long b){ + var c = a>b; + return c; + } + + gT(Double a, Long b){ + var c = a>b; + return c; + } + + gT(Double a, Float b){ + var c = a>b; + return c; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/HelloWorld.jav b/out/tests/resources/resources/bytecode/javFiles/HelloWorld.jav new file mode 100644 index 0000000..7f5f75d --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/HelloWorld.jav @@ -0,0 +1,9 @@ +import java.lang.System; +import java.lang.String; +import java.io.PrintStream; + +public class HelloWorld { + public static hello() { + System.out.println("Hello World!"); + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Id.jav b/out/tests/resources/resources/bytecode/javFiles/Id.jav new file mode 100644 index 0000000..f31991d --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Id.jav @@ -0,0 +1,20 @@ +public class Id { +// a; +// id(b){ +// return b; +// } + id2 = x -> x; +// id2 = () -> { +// var x = m(a); +// var y = x; +// var z = y; +// }; +// +// m(a){ +// return a; +// } + id3 (x) { + return id2.apply(x); + } +} + diff --git a/out/tests/resources/resources/bytecode/javFiles/IfTest.jav b/out/tests/resources/resources/bytecode/javFiles/IfTest.jav new file mode 100644 index 0000000..bbcda96 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/IfTest.jav @@ -0,0 +1,15 @@ +import java.lang.Integer; +import java.lang.Boolean; +import java.lang.String; + +public class IfTest{ + Integer m1(Boolean b) { + Integer i; + String b; + if(b) { + return i; + }else{ + return b; + } + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Import.jav b/out/tests/resources/resources/bytecode/javFiles/Import.jav new file mode 100644 index 0000000..c658568 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Import.jav @@ -0,0 +1,8 @@ +import java.util.Vector; + +class Import { + void methode(){ + Vector v = new Vector<>(); + v.add("X"); + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Inf.jav b/out/tests/resources/resources/bytecode/javFiles/Inf.jav new file mode 100644 index 0000000..6002994 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Inf.jav @@ -0,0 +1,65 @@ +public class Inf { + m(x,y,a){ + var z; + var v; + var w; + var b; + y=x; + z=x; + v=y; + w=y; + y=a; + b=a; + var c; + var d; + c = v; + d = v; + } +} + +/* +TPH M m(TPH N x, TPH O y, TPH P a)({ + TPH Q z; + TPH R v; + TPH S w; + TPH T b; + (y)::TPH O = (x)::TPH N; + (z)::TPH Q = (x)::TPH N; + (v)::TPH R = (y)::TPH O; + (w)::TPH S = (y)::TPH O; + (y)::TPH O = (a)::TPH P; + (b)::TPH T = (a)::TPH P; + TPH U c; + TPH V d; + (c)::TPH U = (v)::TPH R; + (d)::TPH V = (v)::TPH R; + return; +})::TPH W + + Inf()({ + super(()); + })::TPH Z + +} +// c::U d::V +// \ / +// v::R w::S +// \ / +// z::Q y::O b::T +// \ / \ / +// x::N a::P + +RESULT Final: [[(TPH N < TPH O), (TPH R < TPH V), (TPH N < TPH Q), (TPH P < TPH O), (TPH R < TPH U), (TPH M = void), (TPH O < TPH S), (TPH O < TPH R), (TPH P < TPH T)]] +Simplified constraints: [(TPH O < TPH S), (TPH P < TPH O), (TPH O < TPH R), (TPH P < TPH T), (TPH N < TPH O), (TPH N < TPH Q)] +m: [(TPH DDV = java.lang.Object), (TPH DDX = java.lang.Object), (TPH DDX < TPH DDV), (TPH N < TPH DDX), (TPH P < TPH DDX)] +Class Inf: [] +Inf: [] + +Unify nach Oder-Constraints-Anpassung: +UND:[(void =. M, , -1 WC: false, IT: false), (N <. O, 1 WC: false, IT: false, 1 WC: false, IT: false), (P <. O, 1 WC: false, IT: false, 1 WC: false, IT: false), (N <. Q, 1 WC: false, IT: false, 0 WC: true, IT: false), (O <. S, 1 WC: false, IT: false, 0 WC: true, IT: false), (O <. R, 1 WC: false, IT: false, 0 WC: true, IT: false), (P <. T, 1 WC: false, IT: false, 0 WC: true, IT: false)] +isInherited = false +isStatement = false + +ODER: +*/ + diff --git a/out/tests/resources/resources/bytecode/javFiles/Infimum.jav b/out/tests/resources/resources/bytecode/javFiles/Infimum.jav new file mode 100644 index 0000000..7c47539 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Infimum.jav @@ -0,0 +1,6 @@ +class Infimum { + m(x, y, z) { + y = x; + z = x; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Inherit.jav b/out/tests/resources/resources/bytecode/javFiles/Inherit.jav new file mode 100644 index 0000000..8808d8c --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Inherit.jav @@ -0,0 +1,21 @@ +import java.util.Vector; + +import java.lang.Integer; +import java.lang.String; +import AA; +import BB; +import CC; +import DD; + +public class Inherit { + + public main(d, i) { + return d.m(i); + } + + public main(v, i) { + var aa = v.elementAt(0); + return aa.m(i); + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Inherit2.jav b/out/tests/resources/resources/bytecode/javFiles/Inherit2.jav new file mode 100644 index 0000000..58a6ebb --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Inherit2.jav @@ -0,0 +1,20 @@ +import java.util.Vector; + +import java.lang.Integer; +import java.lang.String; +import AA; +import BB; +import CC; +import DD; + +public class Inherit2 { + + public main(d) { + return d.m2(d); + } + + public main(v) { + var aa = v.elementAt(0); + return aa.m2(aa); + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/InstanceOf.jav b/out/tests/resources/resources/bytecode/javFiles/InstanceOf.jav new file mode 100644 index 0000000..52a7473 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/InstanceOf.jav @@ -0,0 +1,18 @@ +import java.lang.Object; +import java.lang.Integer; +import java.lang.Boolean; + +interface Interface {} + +class Test implements Interface { +} +class Test2 { +} + +public class InstanceOf { + a = new Test(); + + public test1() { return this.a instanceof Test; } + public test2() { return this.a instanceof Interface; } + public test3() { return this.a instanceof Integer; } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Interface1.jav b/out/tests/resources/resources/bytecode/javFiles/Interface1.jav new file mode 100644 index 0000000..b741819 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Interface1.jav @@ -0,0 +1,3 @@ +public interface Interface1{ + public void test(); +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Interfaces.jav b/out/tests/resources/resources/bytecode/javFiles/Interfaces.jav new file mode 100644 index 0000000..0c4cd21 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Interfaces.jav @@ -0,0 +1,33 @@ +import java.lang.Integer; + +interface A { + void method1(); + default method2() { + } +} + +interface B { + void method3(); +} + +interface C { + Integer myInt(); +} + +class ClassX implements A { +} + +record ClassY(Integer myInt) implements C {} + +public class Interfaces implements A, B { + public void method1() { + } + public void method3() { + var intf = new Interfaces(); + intf = new ClassX(); + intf.method1(); + + C c = new ClassY(10); + c.myInt(); + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/KompTph.jav b/out/tests/resources/resources/bytecode/javFiles/KompTph.jav new file mode 100644 index 0000000..ec34e15 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/KompTph.jav @@ -0,0 +1,13 @@ +public class KompTph { + public m(a, b, c) { + var d = a; + var e = a; + a = b; + c = b; + m2(a,c); + } + + public m2(a,b){ + m(a,a,b); + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/LamRunnable.jav b/out/tests/resources/resources/bytecode/javFiles/LamRunnable.jav new file mode 100644 index 0000000..d0da84c --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/LamRunnable.jav @@ -0,0 +1,16 @@ +import java.lang.Runnable; +import java.lang.System; +import java.lang.String; +import java.io.PrintStream; + +public class LamRunnable { + + public LamRunnable() { + Runnable lam = () -> { + System.out.println("lambda"); + }; + + lam.run(); + } +} + \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Lambda.jav b/out/tests/resources/resources/bytecode/javFiles/Lambda.jav new file mode 100644 index 0000000..2e725bf --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Lambda.jav @@ -0,0 +1,11 @@ +import java.lang.Integer; + +public class Lambda { + + public m() { + var lam1 = (x) -> { + return x; + }; + return lam1; + } +} diff --git a/out/tests/resources/resources/bytecode/javFiles/Lambda2.jav b/out/tests/resources/resources/bytecode/javFiles/Lambda2.jav new file mode 100644 index 0000000..92f32b7 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Lambda2.jav @@ -0,0 +1,35 @@ +import java.lang.String; + +public class Lambda2 +{ + public static void main(List args){ + var listOfStrings = new List(); + var listOfObjects; + listOfObjects = map(listOfStrings, (a) -> a); +} + +public map(a , b){ + b.apply(a); + return a; +} + +/* +public static List map(List input, Function func) { + List output; + output = new List(); + output.add(func.apply(input.get())); + return output; +} +*/ +} + +class List{ + /* A get(); + void add(A); + */ +} +/* +class Function{ + B apply(A a); +} +*/ \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Lambda3.jav b/out/tests/resources/resources/bytecode/javFiles/Lambda3.jav new file mode 100644 index 0000000..9c4e960 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Lambda3.jav @@ -0,0 +1,23 @@ + +public class Lambda2 +{ + /* + public static List map(List input, + Function func){ + input.add(func.apply(input.get())); + } + */ + public map(input,func){ + input.add(func.apply(input.get())); + return map(new List(), func); + } +} + +class List{ + A get(); + void add(A); +} + +class Function{ + B apply(A a); +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Lambda4.jav b/out/tests/resources/resources/bytecode/javFiles/Lambda4.jav new file mode 100644 index 0000000..378eb4d --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Lambda4.jav @@ -0,0 +1,18 @@ +class Lambda{ + +methode(){ + return ((f) -> f); +} +} +/* +interface Fun0{ + A apply(); +} + +interface Fun1{ + A apply(B b); +} +*/ +interface Fun2{ + A apply(B b, C c); +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/LambdaCapture.jav b/out/tests/resources/resources/bytecode/javFiles/LambdaCapture.jav new file mode 100644 index 0000000..ab1751f --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/LambdaCapture.jav @@ -0,0 +1,12 @@ +import java.lang.Integer; +public class LambdaCapture { + Integer i = 8; + f; + public LambdaCapture(){ + Integer w = 7; + f = j ->{ + return w+i;}; + + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/LambdaField.jav b/out/tests/resources/resources/bytecode/javFiles/LambdaField.jav new file mode 100644 index 0000000..4eb5373 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/LambdaField.jav @@ -0,0 +1,6 @@ +public class LambdaField { + + f = x -> x; + +} + diff --git a/out/tests/resources/resources/bytecode/javFiles/LambdaRunnable.jav b/out/tests/resources/resources/bytecode/javFiles/LambdaRunnable.jav new file mode 100644 index 0000000..9dff3a8 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/LambdaRunnable.jav @@ -0,0 +1,17 @@ +import java.lang.Runnable; +import java.lang.String; +import java.lang.System; +import java.io.PrintStream; + +public class LambdaRunnable { + + public LambdaRunnable(){ + + + Runnable lam = () -> { + System.out.println("Runnable is running"); + }; + lam.run(); + } +} + diff --git a/out/tests/resources/resources/bytecode/javFiles/LambdaVoid.jav b/out/tests/resources/resources/bytecode/javFiles/LambdaVoid.jav new file mode 100644 index 0000000..dc16fcb --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/LambdaVoid.jav @@ -0,0 +1,9 @@ +import java.lang.Integer; + +public class Lambda { + + m () { + var lam1 = (x) -> { }; + return lam1; + } +} diff --git a/out/tests/resources/resources/bytecode/javFiles/LessEqual.jav b/out/tests/resources/resources/bytecode/javFiles/LessEqual.jav new file mode 100644 index 0000000..02714fc --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/LessEqual.jav @@ -0,0 +1,56 @@ +import java.lang.Integer; +import java.lang.Long; +import java.lang.Float; +import java.lang.Double; + +public class LessEqual { + public lessEqual(Integer a, Integer b){ + var c = a<=b; + return c; + } + + public lessEqual(Long a, Long b){ + var c = a<=b; + return c; + } + + public lessEqual(Float a, Float b){ + var c = a<=b; + return c; + } + + public lessEqual(Double a, Double b){ + var c = a<=b; + return c; + } + + public lessEqual(Long a, Integer b){ + var c = a<=b; + return c; + } + + public lessEqual(Float a, Integer b){ + var c = a<=b; + return c; + } + + public lessEqual(Double a, Integer b){ + var c = a<=b; + return c; + } + + public lessEqual(Float a, Long b){ + var c = a<=b; + return c; + } + + public lessEqual(Double a, Long b){ + var c = a<=b; + return c; + } + + public lessEqual(Double a, Float b){ + var c = a<=b; + return c; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/LessThan.jav b/out/tests/resources/resources/bytecode/javFiles/LessThan.jav new file mode 100644 index 0000000..a4c5be9 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/LessThan.jav @@ -0,0 +1,57 @@ +import java.lang.Integer; +import java.lang.Long; +import java.lang.Float; +import java.lang.Double; + +public class LessThan { + + public lessThan(Integer a, Integer b){ + var c = a> { + + Matrix () { + } + + public Matrix(vv) { + Integer i; + i = 0; + while(i < vv.size()) { +// Boolean a = this.add(vv.elementAt(i)); + this.add(vv.elementAt(i)); + i=i+1; + } + } + + public mul(m) { + var ret = new Matrix(); + var i = 0; + while(i < size()) { + var v1 = this.elementAt(i); + var v2 = new Vector(); + var j = 0; + while(j < v1.size()) { + var erg = 0; + var k = 0; + while(k < v1.size()) { + erg = erg + v1.elementAt(k) + * m.elementAt(k).elementAt(j); + k++; } +// v2.addElement(new Integer(erg)); + v2.addElement(erg); + j++; } + ret.addElement(v2); + i++; + } + return ret; + } +} diff --git a/out/tests/resources/resources/bytecode/javFiles/MatrixOP.jav b/out/tests/resources/resources/bytecode/javFiles/MatrixOP.jav new file mode 100644 index 0000000..749f208 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/MatrixOP.jav @@ -0,0 +1,43 @@ +import java.util.Vector; +import java.lang.Integer; +//import java.lang.Byte; +import java.lang.Boolean; + +public class MatrixOP extends Vector> { + + MatrixOP () { + } + + public MatrixOP(vv) { + Integer i; + i = 0; + while(i < vv.size()) { +// Boolean a = this.add(vv.elementAt(i)); + this.add(vv.elementAt(i)); + i=i+1; + } + } + + public mul = (m1, m2) -> { + var ret = new MatrixOP(); + var i = 0; + while(i < m1.size()) { + var v1 = m1.elementAt(i); + var v2 = new Vector(); + var j = 0; + while(j < v1.size()) { + var erg = 0; + var k = 0; + while(k < v1.size()) { + erg = erg + v1.elementAt(k) + * m2.elementAt(k).elementAt(j); + k++; } +// v2.addElement(new Integer(erg)); + v2.addElement(erg); + j++; } + ret.addElement(v2); + i++; + } + return ret; + }; +} diff --git a/out/tests/resources/resources/bytecode/javFiles/Merge.jav b/out/tests/resources/resources/bytecode/javFiles/Merge.jav new file mode 100644 index 0000000..c25c00a --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Merge.jav @@ -0,0 +1,20 @@ +import java.util.List; +import java.lang.Integer; +//import java.util.Collection; + +public class Merge { + + public merge(a, b) { + a.addAll(b); + return a; + } + + + + public sort(in){ + var firstHalf = in.subList(1,2); + var secondHalf = in.subList(1,2); + return merge(sort(firstHalf), sort(secondHalf)); + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Meth_Gen.jav b/out/tests/resources/resources/bytecode/javFiles/Meth_Gen.jav new file mode 100644 index 0000000..056dd82 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Meth_Gen.jav @@ -0,0 +1,11 @@ +class Meth_Gen { + + m1(x, y) { + m2(x); + x = y; + } + + m2(y) { + m1(y, y); + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/MethodCallGenerics.jav b/out/tests/resources/resources/bytecode/javFiles/MethodCallGenerics.jav new file mode 100644 index 0000000..0d02509 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/MethodCallGenerics.jav @@ -0,0 +1,14 @@ +import java.lang.String; + +class Generics { + // A mt1(A a, B b){ + B mt1(B a, B b){ + return mt1(a, a); + } +} + +class Test { + methode(String s){ + return new Generics().mt1(s,s); + } +} diff --git a/out/tests/resources/resources/bytecode/javFiles/MethodWildcardGen.jav b/out/tests/resources/resources/bytecode/javFiles/MethodWildcardGen.jav new file mode 100644 index 0000000..c982c44 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/MethodWildcardGen.jav @@ -0,0 +1,21 @@ +/* +class C{ + A f; + m(b, c){ + c.f = b; + c.m(b, c); + } +} +*/ +class C{ + X f; + m(b, c, d){ + this.f = b; + this.f = c.f; + c.m2(d); + } + + m2(a){ + a.f = this.f; + } +} diff --git a/out/tests/resources/resources/bytecode/javFiles/Methods.jav b/out/tests/resources/resources/bytecode/javFiles/Methods.jav new file mode 100644 index 0000000..3c46739 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Methods.jav @@ -0,0 +1,14 @@ +import java.lang.Integer; + +class Methods { + + m(a,b){ + var c=a+b; + return c; + } + + method2(x){ + Integer i = this.m(x,2); + return i; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/MethodsEasy.jav b/out/tests/resources/resources/bytecode/javFiles/MethodsEasy.jav new file mode 100644 index 0000000..ee6f9da --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/MethodsEasy.jav @@ -0,0 +1,7 @@ + +class Methods { + mt4(a,b,c) { return a.mt3(b).mt3(c) ; } + + mt3(a) {return a.mt3(a); } +} + diff --git a/out/tests/resources/resources/bytecode/javFiles/OL.jav b/out/tests/resources/resources/bytecode/javFiles/OL.jav new file mode 100644 index 0000000..a30edca --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/OL.jav @@ -0,0 +1,16 @@ +import java.lang.Double; +import java.lang.String; +import java.lang.Long; +import java.lang.Integer; + +public class OL { + public m (x) { return x + x; } +} + +public class OLMain { + public main(x) { + var ol; + ol = new OL(); + return ol.m(x); + } +} diff --git a/out/tests/resources/resources/bytecode/javFiles/OLConstructor.jav b/out/tests/resources/resources/bytecode/javFiles/OLConstructor.jav new file mode 100644 index 0000000..1e31509 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/OLConstructor.jav @@ -0,0 +1,17 @@ +import java.lang.Integer; + +public class Parent { + public Integer x; + + public Parent(Integer a) { + this.x = a; + } + + public Parent() {} +} + +public class Child extends Parent { + public Child() { + super(3); + } +} diff --git a/out/tests/resources/resources/bytecode/javFiles/OLFun.jav b/out/tests/resources/resources/bytecode/javFiles/OLFun.jav new file mode 100644 index 0000000..50d30b7 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/OLFun.jav @@ -0,0 +1,19 @@ +import java.lang.String; +import java.lang.Integer; +import java.lang.Double; +import java.util.Vector; +import java.lang.Boolean; + +public class OLFun { + + //f = x -> {return x + x;}; + m(f, x) { + x = f.apply(x+x); + return x; + } + + m2(y) { + m(x -> x * 2, y); + return; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/OLFun2.jav b/out/tests/resources/resources/bytecode/javFiles/OLFun2.jav new file mode 100644 index 0000000..6b6f38a --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/OLFun2.jav @@ -0,0 +1,13 @@ +import java.lang.String; +import java.lang.Integer; +import java.lang.Double; +import java.util.Vector; +import java.lang.Boolean; + +public class OLFun2 { + + x; + m(f){ + x = f.apply(x + x); + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Op.jav b/out/tests/resources/resources/bytecode/javFiles/Op.jav new file mode 100644 index 0000000..082f48d --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Op.jav @@ -0,0 +1,16 @@ +import java.lang.Integer; +import java.lang.String; +import java.lang.Long; +import java.lang.Float; +import java.lang.Double; +import java.lang.Boolean; +import java.lang.Short; +import java.lang.Byte; + +public class Op { + + m(a, b) { + //var c = a+b; + return a+b; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Op1.jav b/out/tests/resources/resources/bytecode/javFiles/Op1.jav new file mode 100644 index 0000000..48af9df --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Op1.jav @@ -0,0 +1,34 @@ +import java.lang.Boolean; +import java.lang.Integer; + +public class Op1 { + public not() { + var b = false; + var c = !b; + return c; + } + + public or() { + var a = 10; + var b = 20; + return a | b; + } + + public and() { + var a = 10; + var b = 20; + return a & b; + } + + public xor() { + var a = 10; + var b = 20; + return a ^ b; + } + + public mod() { + var a = 10; + var b = 2; + return a % b; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Op2.jav b/out/tests/resources/resources/bytecode/javFiles/Op2.jav new file mode 100644 index 0000000..cda23ae --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Op2.jav @@ -0,0 +1,17 @@ +import java.lang.Integer; +import java.lang.Double; +import java.lang.String; + +public class Op2 { + public m(){ + var x = ""; + var a = 5+x; + + Integer x = 10; + Double y = 10.5; + + var a = x - y; + + return a; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/OverlaodGen.jav b/out/tests/resources/resources/bytecode/javFiles/OverlaodGen.jav new file mode 100644 index 0000000..d594649 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/OverlaodGen.jav @@ -0,0 +1,11 @@ +import java.util.Vector; + +class OverlaodGen { + void method(Vector v) { +// Integer i = v.get(0); + } + + void method(Vector v) { +// String s = v.get(0); + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/OverloadPattern.jav b/out/tests/resources/resources/bytecode/javFiles/OverloadPattern.jav new file mode 100644 index 0000000..e7f777d --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/OverloadPattern.jav @@ -0,0 +1,50 @@ +import java.lang.Integer; +import java.lang.Number; +import java.lang.Float; + +record Point(Number x, Number y) {} + +public class OverloadPattern { + public m(Point(Integer x, Integer y)) { + return x + y; + } + + public m(Point(Float x, Float y)) { + return x * y; + } + + public m(Integer x) { + return x; + } +} + +/* +public class OverloadPattern { + Integer m$Point$_$java$lang$Integer$_$java$lang$Integer$_$(Point point) { + var x = point.x(); + var y = point.y(); + return x + y; + } + + Float m$Point$_$java$lang$Float$_$java$lang$Float$_$(Point point) { + var x = point.x(); + var y = point.y(); + return x * y; + } + + Number m(Point point) { + return switch(point) { + case Point(Integer x, Integer y) -> + m$Point$_$java$lang$Integer$_$java$lang$Integer$_$(point); + case Point(Float x, Float y) -> + m$Point$_$java$lang$Float$_$java$lang$Float$_$(point); + default -> throw new IllegalArgumentException(); + } + } + + Integer m(Integer x) { + return x; + } +} + +*/ \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Overloading.jav b/out/tests/resources/resources/bytecode/javFiles/Overloading.jav new file mode 100644 index 0000000..c44a7a9 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Overloading.jav @@ -0,0 +1,18 @@ +import java.lang.String; + +public class Overloading{ + + public test(x){ + return x.methode(); + } + + public methode(){ + return "Overloading"; + } +} + +public class Overloading2{ + public methode(){ + return "Overloading2"; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/OverrideEquals.jav b/out/tests/resources/resources/bytecode/javFiles/OverrideEquals.jav new file mode 100644 index 0000000..cabb6d4 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/OverrideEquals.jav @@ -0,0 +1,12 @@ +import java.lang.Object; +import java.lang.Boolean; + +public class OverrideEquals extends OverrideRoot { + public boolean equals(Object o) { + return true; + } + + public int method(int var1, float var2) { + return 0; + } +} diff --git a/out/tests/resources/resources/bytecode/javFiles/OverrideRoot.java b/out/tests/resources/resources/bytecode/javFiles/OverrideRoot.java new file mode 100644 index 0000000..5d09759 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/OverrideRoot.java @@ -0,0 +1,3 @@ +public abstract class OverrideRoot { + public abstract int method(int a, float b); +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Package.jav b/out/tests/resources/resources/bytecode/javFiles/Package.jav new file mode 100644 index 0000000..bbc1e51 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Package.jav @@ -0,0 +1,5 @@ +package strucType.input; + +class Neu +{ +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Pair.jav b/out/tests/resources/resources/bytecode/javFiles/Pair.jav new file mode 100644 index 0000000..4547ad1 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Pair.jav @@ -0,0 +1,17 @@ +import java.util.Vector; +import java.lang.Boolean; +import java.lang.Object; + + +public class Pair { + T x; + U y; + + public fst() { + return x; + } + + public snd() { + return y; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/PairNoGenerics.jav b/out/tests/resources/resources/bytecode/javFiles/PairNoGenerics.jav new file mode 100644 index 0000000..e69de29 diff --git a/out/tests/resources/resources/bytecode/javFiles/Plus.jav b/out/tests/resources/resources/bytecode/javFiles/Plus.jav new file mode 100644 index 0000000..74bdc61 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Plus.jav @@ -0,0 +1,9 @@ +import java.lang.Integer; +import java.lang.String; + +public class Plus { + + public m(a,b) { + return a+b; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/PostIncDec.jav b/out/tests/resources/resources/bytecode/javFiles/PostIncDec.jav new file mode 100644 index 0000000..d3672aa --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/PostIncDec.jav @@ -0,0 +1,27 @@ +import java.lang.Integer; + +public class PostIncDec { + public m() { + var i = 0; + i++; + return i; + } + + public m2() { + var i = 0; + var j = i++; + return j; + } + + public d() { + var i = 0; + i--; + return i; + } + + public d2() { + var i = 0; + var j = i--; + return j; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/PreInc.jav b/out/tests/resources/resources/bytecode/javFiles/PreInc.jav new file mode 100644 index 0000000..df66797 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/PreInc.jav @@ -0,0 +1,28 @@ +import java.lang.Integer; + +public class PreInc { + public m() { + var i = 0; + ++i; + return i; + } + + public m2() { + var i = 0; + var j = ++i; + return j; + } + + public d() { + var i = 0; + --i; + return i; + } + + public d2() { + var i = 0; + var j = --i; + return j; + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Put.jav b/out/tests/resources/resources/bytecode/javFiles/Put.jav new file mode 100644 index 0000000..113f284 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Put.jav @@ -0,0 +1,19 @@ +import java.util.Vector; +import java.util.Stack; + +public class Put { + + public putElement(ele, v) { + v.addElement(ele); + } + + public putElement(ele, s) { + s.push(ele); + } + + + public main(ele, x) { + putElement(ele, x); + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/RecordTest.jav b/out/tests/resources/resources/bytecode/javFiles/RecordTest.jav new file mode 100644 index 0000000..a19d1f0 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/RecordTest.jav @@ -0,0 +1,22 @@ +import java.lang.Integer; + +record Rec(Integer a, Integer b) {} + +/*public class Rec { + x; y; + Rec(Integer a, Integer b) { + x = a; + y = b; + } +}*/ + +public class RecordTest { + Rec a = new Rec(10, 20); + Rec b = new Rec(10, 20); + Rec c = new Rec(20, 40); + + public doesEqual() { return a.equals(b); } + public doesNotEqual() { return b.equals(c); } + public hashCode() { return a.hashCode(); } + public toString() { return a.toString(); } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/RecursiveMeth.jav b/out/tests/resources/resources/bytecode/javFiles/RecursiveMeth.jav new file mode 100644 index 0000000..be35a43 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/RecursiveMeth.jav @@ -0,0 +1,5 @@ +public class RecursiveMeth{ + public Integer test(){ + return this.test(); + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/RelOps.jav b/out/tests/resources/resources/bytecode/javFiles/RelOps.jav new file mode 100644 index 0000000..63491d9 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/RelOps.jav @@ -0,0 +1,8 @@ +import java.lang.Integer; +import java.lang.Boolean; + +public class RelOps { + public m(a,b){ + return a { + + public Scalar(v) { + Integer i; + i = 0; + while(i < v.size()) { + this.add(v.elementAt(i)); + i=i+1; + } + } + + public mul(v) { + var ret = 0; + var i = 0; + while(i < size()) { + ret = ret + this.elementAt(i) * v.elementAt(i); + i = i+1; + } + return ret; + } +} diff --git a/out/tests/resources/resources/bytecode/javFiles/SimpleCycle.jav b/out/tests/resources/resources/bytecode/javFiles/SimpleCycle.jav new file mode 100644 index 0000000..92f505b --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/SimpleCycle.jav @@ -0,0 +1,25 @@ +public class SimpleCycle { + + m(){ + var g; + var h; + g = h; + h = g; + /* + var y; + var z; + y=z; + z=y; + + var j = z; + var x; + b = a; + var c = b; + var f = d; + b = x; + var l = c; + a = l; + */ + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Sorting.jav b/out/tests/resources/resources/bytecode/javFiles/Sorting.jav new file mode 100644 index 0000000..345819d --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Sorting.jav @@ -0,0 +1,23 @@ +import java.util.List; +import java.util.ArrayList; +import java.lang.String; + +public class Sorting{ + merge(a, b){ + a.addAll(b); + return a; + } + +sort(in){ + var firstHalf = in; + var secondHalf = in; + return merge(sort(firstHalf), sort(secondHalf)); +} + + + /* + void sort(a){ + a = merge(a,a); + } + */ +} diff --git a/out/tests/resources/resources/bytecode/javFiles/Static.jav b/out/tests/resources/resources/bytecode/javFiles/Static.jav new file mode 100644 index 0000000..a02ef3c --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Static.jav @@ -0,0 +1,18 @@ +import java.lang.Integer; + +class Other { + static field = 20; +} + +public class Static { + static i = 20; + + static { + var x = 30; + i = x; + } + + public static m() { + return i + Other.field; + } +} diff --git a/out/tests/resources/resources/bytecode/javFiles/StaticM.jav b/out/tests/resources/resources/bytecode/javFiles/StaticM.jav new file mode 100644 index 0000000..6689003 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/StaticM.jav @@ -0,0 +1,10 @@ +public class StaticM { + + public static void m() { + System.out.println("Test"); + } + + public static void m2() { + m(); + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/SubMatrix.jav b/out/tests/resources/resources/bytecode/javFiles/SubMatrix.jav new file mode 100644 index 0000000..f761321 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/SubMatrix.jav @@ -0,0 +1,13 @@ +import java.util.Vector; +import java.lang.Integer; + +public class Matrix2 extends Vector { + +} + +public class SubMatrix extends Matrix2 { + m(){ + Vector v = new Vector(); + v.add(1); + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Subclass.jav b/out/tests/resources/resources/bytecode/javFiles/Subclass.jav new file mode 100644 index 0000000..fe6e920 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Subclass.jav @@ -0,0 +1,6 @@ +public class Subclass extends Superclass { + + public void printMethod() { + super.printMethod(); + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/SuperCall.jav b/out/tests/resources/resources/bytecode/javFiles/SuperCall.jav new file mode 100644 index 0000000..08b8a04 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/SuperCall.jav @@ -0,0 +1,11 @@ +import java.lang.Integer; + +class Parent { + public Parent(Integer x) {} +} + +public class SuperCall extends Parent { + public SuperCall() { + super(20); + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Superclass.jav b/out/tests/resources/resources/bytecode/javFiles/Superclass.jav new file mode 100644 index 0000000..d58089d --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Superclass.jav @@ -0,0 +1,6 @@ +public class Superclass { + + public void printMethod() { + System.out.println("Printed in Superclass."); + } +} diff --git a/out/tests/resources/resources/bytecode/javFiles/Switch.jav b/out/tests/resources/resources/bytecode/javFiles/Switch.jav new file mode 100644 index 0000000..f120f81 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Switch.jav @@ -0,0 +1,17 @@ +import java.lang.Integer; +import java.lang.Object; +import java.lang.Float; + +public record Rec(Integer a, Object b) {} + +public class Switch { + public main(o) { + return switch (o) { + case Rec(Integer a, Integer b) -> a + b; + case Rec(Integer a, Float b) -> a + 10; + case Rec(Integer a, Rec(Integer b, Integer c)) -> a + b + c; + case Integer i -> i; + default -> 0; + }; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Switch2.jav b/out/tests/resources/resources/bytecode/javFiles/Switch2.jav new file mode 100644 index 0000000..c75aaa5 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Switch2.jav @@ -0,0 +1,13 @@ +import java.lang.Integer; + +record Point(x, y) {} + +class Switch2 { + m() { + var pt = new Point(10, 20); + return switch (pt) { + case Point(x, y) -> 10; + default -> 20; + }; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/SwitchString.jav b/out/tests/resources/resources/bytecode/javFiles/SwitchString.jav new file mode 100644 index 0000000..53dcc93 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/SwitchString.jav @@ -0,0 +1,14 @@ +import java.lang.Integer; +import java.lang.String; +import java.lang.Object; + +public class SwitchString { + public main(o) { + return switch (o) { + case "AaAaAa" -> 1; // These two have the same hash code! + case "AaAaBB" -> 2; + case "test", "TEST" -> 3; + default -> 4; + }; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/TXGenerics.jav b/out/tests/resources/resources/bytecode/javFiles/TXGenerics.jav new file mode 100644 index 0000000..7f0f708 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/TXGenerics.jav @@ -0,0 +1,11 @@ +import java.lang.String; + +public class TXGenerics { + a; + b; + + public test() { + var c = new Cycle(); + c.m(a, b); + } +} diff --git a/out/tests/resources/resources/bytecode/javFiles/Ternary.jav b/out/tests/resources/resources/bytecode/javFiles/Ternary.jav new file mode 100644 index 0000000..321490b --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Ternary.jav @@ -0,0 +1,9 @@ +import java.lang.Boolean; +import java.lang.String; +import java.lang.Integer; + +public class Ternary { + public main(x) { + return x > 10 ? "big" : "small"; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Tph.jav b/out/tests/resources/resources/bytecode/javFiles/Tph.jav new file mode 100644 index 0000000..22f2f94 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Tph.jav @@ -0,0 +1,11 @@ +public class Tph { + + public m(a,b){ + var c = m2(b); + return a; + } + + public m2(b){ + return b; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Tph2.jav b/out/tests/resources/resources/bytecode/javFiles/Tph2.jav new file mode 100644 index 0000000..04ea5ba --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Tph2.jav @@ -0,0 +1,6 @@ +public class Tph2 { + id = x->x; + id3 (x) { + return id.apply(x); + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Tph3.jav b/out/tests/resources/resources/bytecode/javFiles/Tph3.jav new file mode 100644 index 0000000..553e274 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Tph3.jav @@ -0,0 +1,14 @@ +public class Tph3 { +// m(a,b){ +// var c = m2(a,b); +// return c; +// } +// +// m2(a,b){ +// return m(a,b); +// } + m1(x, y) { m2(x); x = y; + } + + m2(y) { m1(y, y); } +} diff --git a/out/tests/resources/resources/bytecode/javFiles/Tph4.jav b/out/tests/resources/resources/bytecode/javFiles/Tph4.jav new file mode 100644 index 0000000..58fe1d1 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Tph4.jav @@ -0,0 +1,12 @@ +public class Tph4{ + m(a,b){ + var c = m2(b); + var d = m2(c); + return d; + } + + m2(b){ + return b; + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Tph5.jav b/out/tests/resources/resources/bytecode/javFiles/Tph5.jav new file mode 100644 index 0000000..e73cfa2 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Tph5.jav @@ -0,0 +1,13 @@ +public class Tph5 { +// m(a,b,c){ +// a = c; +// b = c; +// return a; +// } + + m(x,y){ + x = m2(y); + } + + m2(y) { return y; } +} diff --git a/out/tests/resources/resources/bytecode/javFiles/Tph6.jav b/out/tests/resources/resources/bytecode/javFiles/Tph6.jav new file mode 100644 index 0000000..2f9e429 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Tph6.jav @@ -0,0 +1,14 @@ +public class Tph6 { +// m(a,b,c){ +// a = c; +// b = c; +// return a; +// } + + m(x,y){ + var c = m2(y); + c = m2(x); + } + + m2(y) { return y; } +} diff --git a/out/tests/resources/resources/bytecode/javFiles/Tph7.jav b/out/tests/resources/resources/bytecode/javFiles/Tph7.jav new file mode 100644 index 0000000..cc55afb --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Tph7.jav @@ -0,0 +1,11 @@ +public class Tph7 { + + m(a,b){ + var c = m2(b); + return m2(b); + } + + m2(b){ + return b; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/TypeCast.jav b/out/tests/resources/resources/bytecode/javFiles/TypeCast.jav new file mode 100644 index 0000000..dffab1a --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/TypeCast.jav @@ -0,0 +1,11 @@ +import java.lang.Object; +import java.lang.Integer; +import java.util.List; +import java.util.ArrayList; + +public class TypeCast { + public void main() { + Object a = new ArrayList(); + ArrayList b = (ArrayList) a; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/TypedID.jav b/out/tests/resources/resources/bytecode/javFiles/TypedID.jav new file mode 100644 index 0000000..aa88583 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/TypedID.jav @@ -0,0 +1,12 @@ +public class TypedID/* */ { + + lam = x-> x; + + id(b){ + return b; + } + + m(){ + return lam; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Vector.jav b/out/tests/resources/resources/bytecode/javFiles/Vector.jav new file mode 100644 index 0000000..5c21cff --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Vector.jav @@ -0,0 +1,23 @@ +import java.util.ArrayList; +import java.util.Vector; +import java.lang.Object; + +class MyVector{ + +id(x){ + Object i; + x.add(i); + x.add(i); + x.add(i); + x.add(i); + x.add(i); + x.add(i); + x.add(i); + x.add(i); + x.add(i); + x.add(i); + x.add(i); + x.add(i); + return x; +} +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/VectorAdd.jav b/out/tests/resources/resources/bytecode/javFiles/VectorAdd.jav new file mode 100644 index 0000000..2ad73aa --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/VectorAdd.jav @@ -0,0 +1,26 @@ +import java.util.Vector; +import java.lang.Integer; +import java.lang.String; + +public class VectorAdd { + vectorAdd(v1, v2) { + var i = 0; + v1 = new Vector(); + var erg = new Vector<>(); + while (i < v1.size()) { + erg.addElement(v1.elementAt(i) + v2.elementAt(i)); + i++; + } + return erg; + } + + m(x, y, z) { + x = new Vector(); + y = new Vector(); + x.add(1); + y.add("2"); + //Integer i = x.elementAt(0); + //String s = y.elementAt(0); + return z.addAll(x); + } +} diff --git a/out/tests/resources/resources/bytecode/javFiles/VectorSuper.jav b/out/tests/resources/resources/bytecode/javFiles/VectorSuper.jav new file mode 100644 index 0000000..fbadafb --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/VectorSuper.jav @@ -0,0 +1,11 @@ +import java.util.Vector; +import java.lang.Integer; + +public class VectorSuper { + + m(x){ + Integer y = 1; + x.addElement(y); + //return x; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/VoidMeth.jav b/out/tests/resources/resources/bytecode/javFiles/VoidMeth.jav new file mode 100644 index 0000000..6b3ab21 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/VoidMeth.jav @@ -0,0 +1,4 @@ +public class VoidMeth{ + public void test(){ + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/WC.jav b/out/tests/resources/resources/bytecode/javFiles/WC.jav new file mode 100644 index 0000000..389a4fc --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/WC.jav @@ -0,0 +1,8 @@ +import java.lang.Integer; +import java.util.List; +public class WC { + + void m (List a, List b) { + + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/While.jav b/out/tests/resources/resources/bytecode/javFiles/While.jav new file mode 100644 index 0000000..df259cf --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/While.jav @@ -0,0 +1,12 @@ +import java.lang.Integer; +import java.lang.Long; +import java.lang.Double; + +public class While { + public m(x) { + while(x < 2) { + x = x+1; + } + return x; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/Wildcards.jav b/out/tests/resources/resources/bytecode/javFiles/Wildcards.jav new file mode 100644 index 0000000..7dca051 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Wildcards.jav @@ -0,0 +1,8 @@ +import java.util.List; +import java.lang.Number; + +public class Wildcards { + public void m1(List a) {} + public void m2(List a) {} + public void m3(List a) {} +} diff --git a/out/tests/resources/resources/bytecode/javFiles/Y.jav b/out/tests/resources/resources/bytecode/javFiles/Y.jav new file mode 100644 index 0000000..0c14b49 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/Y.jav @@ -0,0 +1,42 @@ +import java.lang.Integer; + +public class Y { + y; + //factorial; + + public Y() { + y = f -> t -> f.apply(y.apply(f)).apply(t); + //factorial = y.apply(f -> n -> { if (n == 0) return 1; else return n * f.apply(n - 1); }); + } + /* + getY() { + return y; + } + */ +} +/* +class fac1 { + factorial; + + fac1() { + var y; + y = new Y().getY(); + factorial = y.apply(f -> n -> { if (n == 0) return 1; else return n * f.apply(n - 1); }); + } +} + +ergibt Parse-Error +class fac1 { + factorial; + + fac1() { + var y; + y = new Y<>().y; + factorial = y.apply(f -> n -> { if (n == 0) return 1; else return n * f.apply(n - 1); }); + } + public static void main(String args[]) { + System.out.println(new fac1().factorial.apply(3)); + } + +} +*/ \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/applyLambda.jav b/out/tests/resources/resources/bytecode/javFiles/applyLambda.jav new file mode 100644 index 0000000..37a3fba --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/applyLambda.jav @@ -0,0 +1,16 @@ +import java.util.Vector; +class Apply { } + +public class applyLambda { + + public m () { + var lam1 = (x) -> { + return x; + }; + + return lam1.apply(new Apply()); + //return lam1; + //return new Vector(); + } +} + diff --git a/out/tests/resources/resources/bytecode/javFiles/fc.jav b/out/tests/resources/resources/bytecode/javFiles/fc.jav new file mode 100644 index 0000000..b387cb9 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/fc.jav @@ -0,0 +1,18 @@ +import java.util.List; + +class Test{ + methode(param1, param2, param3) { + param2.add(param3); + return param1.meth(param2); + } +} + +interface Klasse1{ + Klasse1 meth(p); + Klasse1 meth(Klasse2 p); +} + +interface Klasse2{ + Klasse1 meth(Klasse1 p); + Klasse2 meth(Klasse2 p); +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/mathStruc.jav b/out/tests/resources/resources/bytecode/javFiles/mathStruc.jav new file mode 100644 index 0000000..171881b --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/mathStruc.jav @@ -0,0 +1,15 @@ +import java.util.Vector; +import java.lang.Integer; + +public class mathStruc { + model; + + //Fun1*, Fun1*,MathStruc >> + innerOp = (o) -> (ms) -> new mathStruc<>(o.apply(model,ms.model)); + + public mathStruc(m) { + model =m; + //innerOp = (o) -> (ms) -> new mathStruc<>(o.apply(this.model,ms.model)); + } +} + diff --git a/out/tests/resources/resources/bytecode/javFiles/mathStrucInteger.jav b/out/tests/resources/resources/bytecode/javFiles/mathStrucInteger.jav new file mode 100644 index 0000000..f1f6755 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/mathStrucInteger.jav @@ -0,0 +1,23 @@ +import java.util.Vector; +import java.lang.Integer; + +public class mathStrucInteger { + model; + + innerOp = (o) -> (ms) -> new mathStrucInteger<>(o.apply(model,ms.model)); + + public mathStrucInteger(m) { + model =m; + } +} + +class mathStrucIntegerUse { + + main() { + var ms; + ms = new mathStrucInteger<>(2); + var ms2; + ms2 = ms.innerOp.apply((x,y) -> x+y).apply(ms); + return ms2; + } +} diff --git a/out/tests/resources/resources/bytecode/javFiles/mathStrucMatrixOP.jav b/out/tests/resources/resources/bytecode/javFiles/mathStrucMatrixOP.jav new file mode 100644 index 0000000..2b24f03 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/mathStrucMatrixOP.jav @@ -0,0 +1,91 @@ +//PL 2019-10-24: laeuft nicht durch, zu gross +import java.util.Vector; +import java.lang.Integer; +import java.lang.Boolean; + +public class mathStrucMatrixOP { + model; + + innerOp = (o) -> (ms) -> new mathStrucMatrixOP<>(o.apply(model,ms.model)); + + public mathStrucMatrixOP(m) { + model =m; + } +} + +public class MatrixOP extends Vector> { + + MatrixOP () { + } + + MatrixOP(vv) { + Integer i; + i = 0; + while(i < vv.size()) { +// Boolean a = this.add(vv.elementAt(i)); + this.add(vv.elementAt(i)); + i=i+1; + } + } + + public mul = (m1, m2) -> { + var ret = new MatrixOP(); + var i = 0; + while(i < m1.size()) { + var v1 = m1.elementAt(i); + var v2 = new Vector(); + var j = 0; + while(j < v1.size()) { + var erg = 0; + var k = 0; + while(k < v1.size()) { + erg = erg + v1.elementAt(k) + * m2.elementAt(k).elementAt(j); + k++; } +// v2.addElement(new Integer(erg)); + v2.addElement(erg); + j++; } + ret.addElement(v2); + i++; + } + return ret; + }; +} + + +class mathStrucUseMatrixOP { + + main() { + Vector> vv = new Vector>(); + Vector v1 = new Vector(); + v1.addElement(2); + v1.addElement(2); + Vector v2 = new Vector(); + v2.addElement(3); + v2.addElement(3); + vv.addElement(v1); + vv.addElement(v2); + + MatrixOP m1 = new MatrixOP(vv); + + Vector> vv1 = new Vector>(); + Vector v3 = new Vector(); + v3.addElement(2); + v3.addElement(2); + Vector v4 = new Vector(); + v4.addElement(3); + v4.addElement(3); + vv1.addElement(v3); + vv1.addElement(v4); + + MatrixOP m2 = new MatrixOP(vv1); + + var mms; + mms = new mathStrucMatrixOP<>(m1); + var mms2; + mms2 = new mathStrucMatrixOP<>(m2); + var mms3; + mms3 = mms.innerOp.apply(m1.mul).apply(mms2); + return mms3; + } +} diff --git a/out/tests/resources/resources/bytecode/javFiles/test.jav b/out/tests/resources/resources/bytecode/javFiles/test.jav new file mode 100644 index 0000000..303d167 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/test.jav @@ -0,0 +1,15 @@ +class Test{ + methode(param1, param2, param3) { + return param1.meth(param2.meth(param3)); + } +} + +interface Klasse1{ + Klasse1 meth(Klasse1 p); + Klasse1 meth(Klasse2 p); +} + +interface Klasse2{ + Klasse1 meth(Klasse1 p); + Klasse2 meth(Klasse2 p); +} \ No newline at end of file diff --git a/out/tests/resources/resources/bytecode/javFiles/test1.jav b/out/tests/resources/resources/bytecode/javFiles/test1.jav new file mode 100644 index 0000000..4b34948 --- /dev/null +++ b/out/tests/resources/resources/bytecode/javFiles/test1.jav @@ -0,0 +1,7 @@ +class Faculty { + + int a; + m (int x) { + return a+x; + } +} diff --git a/out/tests/resources/resources/insertGenerics/javFiles/TestAny.jav b/out/tests/resources/resources/insertGenerics/javFiles/TestAny.jav new file mode 100644 index 0000000..86c0ceb --- /dev/null +++ b/out/tests/resources/resources/insertGenerics/javFiles/TestAny.jav @@ -0,0 +1,13 @@ +class TestAny { + a; + b = a; + anyMethod() { + var f; + return f; + } + otherMethod(e) { + b = e; + e = a; + return e; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/insertGenerics/javFiles/TestAssign.jav b/out/tests/resources/resources/insertGenerics/javFiles/TestAssign.jav new file mode 100644 index 0000000..d401641 --- /dev/null +++ b/out/tests/resources/resources/insertGenerics/javFiles/TestAssign.jav @@ -0,0 +1,9 @@ +class TestAssign { + assign(x, y) { + x = y; + } + + assign2(x, y) { + assign(x, y); + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/insertGenerics/javFiles/TestClassField.jav b/out/tests/resources/resources/insertGenerics/javFiles/TestClassField.jav new file mode 100644 index 0000000..f3d24e5 --- /dev/null +++ b/out/tests/resources/resources/insertGenerics/javFiles/TestClassField.jav @@ -0,0 +1,6 @@ +class Example{ + f; + fReturn(){ + return f; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/insertGenerics/javFiles/TestContraVariant.jav b/out/tests/resources/resources/insertGenerics/javFiles/TestContraVariant.jav new file mode 100644 index 0000000..9c060f0 --- /dev/null +++ b/out/tests/resources/resources/insertGenerics/javFiles/TestContraVariant.jav @@ -0,0 +1,38 @@ +public class TestContraVariant { + main(x, y) { + var y2 = m(x, y); + var y3 = y2.snd(); + var z; + y3 = z; + return new Pair<>(x, z); + } + + m(x, y) { + var x2 = main(x, y); + var x3 = x2.fst(); + var z; + x3 = z; + return new Pair<>(z, y); + } +} + +class Pair { + public T x; + public U y; + + public Pair() { + } + + public Pair(T var1, U var2) { + x = var1; + y = var2; + } + + public T fst() { + return x; + } + + public U snd() { + return y; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/insertGenerics/javFiles/TestGGFinder.jav b/out/tests/resources/resources/insertGenerics/javFiles/TestGGFinder.jav new file mode 100644 index 0000000..cc94cad --- /dev/null +++ b/out/tests/resources/resources/insertGenerics/javFiles/TestGGFinder.jav @@ -0,0 +1,17 @@ +public class TestGGFinder { + a; + + id(b) { + var c = b; + return c; + } + + setA(x) { + a = x; + return a; + } + + m(x,y) { + x = id(y); + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/insertGenerics/javFiles/TestLocalVarLambda.jav b/out/tests/resources/resources/insertGenerics/javFiles/TestLocalVarLambda.jav new file mode 100644 index 0000000..ab4455c --- /dev/null +++ b/out/tests/resources/resources/insertGenerics/javFiles/TestLocalVarLambda.jav @@ -0,0 +1,7 @@ +public class TestLocalVarLambda { + +m(x) { + var id = z -> z; + return id.apply(x); + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/insertGenerics/javFiles/TestMutualRecursion.jav b/out/tests/resources/resources/insertGenerics/javFiles/TestMutualRecursion.jav new file mode 100644 index 0000000..60ce72c --- /dev/null +++ b/out/tests/resources/resources/insertGenerics/javFiles/TestMutualRecursion.jav @@ -0,0 +1,17 @@ +public class TestMutualRecursion { + a; + + id(b) { + var c = b; + return main(b,c); + } + + m(x,y) { + x = id(y); + return x; + } + + main(x,y) { + return m(id(x),y); + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/insertGenerics/javFiles/TestMutualRecursionWithField.jav b/out/tests/resources/resources/insertGenerics/javFiles/TestMutualRecursionWithField.jav new file mode 100644 index 0000000..82dc42d --- /dev/null +++ b/out/tests/resources/resources/insertGenerics/javFiles/TestMutualRecursionWithField.jav @@ -0,0 +1,22 @@ +public class TestMutualRecursionWithField { + a; + + id(b) { + var c = b; + return main(b,c); + } + + setA(x) { + a = x; + return a; + } + + m(x,y) { + x = id(y); + return x; + } + + main(x,y) { + return m(id(x),setA(y)); + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/insertGenerics/javFiles/TestMutualRecursionWithField2.jav b/out/tests/resources/resources/insertGenerics/javFiles/TestMutualRecursionWithField2.jav new file mode 100644 index 0000000..727e603 --- /dev/null +++ b/out/tests/resources/resources/insertGenerics/javFiles/TestMutualRecursionWithField2.jav @@ -0,0 +1,22 @@ +public class TestMutualRecursionWithField2 { + a; + + id(b) { + var c = b; + return main(b,c); + } + + setA(x) { + a = x; + return a; + } + + m(x,y) { + x = id(y); + return x; + } + + main(x,y) { + return m(setA(x),id(y)); + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/insertGenerics/javFiles/TestMutualRecursionWithField3.jav b/out/tests/resources/resources/insertGenerics/javFiles/TestMutualRecursionWithField3.jav new file mode 100644 index 0000000..24e0989 --- /dev/null +++ b/out/tests/resources/resources/insertGenerics/javFiles/TestMutualRecursionWithField3.jav @@ -0,0 +1,23 @@ +public class TestMutualRecursionWithField3 { + a; + + id(b) { + var c = b; + return main(b,c); + } + + setA(x) { + a = x; + return a; + } + + m(x,y) { + x = id(y); + return x; + } + + main(x,y) { + var z = m(setA(x),id(y)); + return z; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/insertGenerics/javFiles/TestReturnVar.jav b/out/tests/resources/resources/insertGenerics/javFiles/TestReturnVar.jav new file mode 100644 index 0000000..0688e5b --- /dev/null +++ b/out/tests/resources/resources/insertGenerics/javFiles/TestReturnVar.jav @@ -0,0 +1,6 @@ +class VarReturn { + anyMethod() { + var f; + return f; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/insertGenerics/javFiles/TestSecondLineOfClassConstraints.jav b/out/tests/resources/resources/insertGenerics/javFiles/TestSecondLineOfClassConstraints.jav new file mode 100644 index 0000000..16275a5 --- /dev/null +++ b/out/tests/resources/resources/insertGenerics/javFiles/TestSecondLineOfClassConstraints.jav @@ -0,0 +1,12 @@ +class Example { + a; + b = a; + anyMethod() { + var f; + return f; + } + otherMethod(e) { + e = a; + return e; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/insertGenerics/javFiles/TestTPHsAndGenerics.jav b/out/tests/resources/resources/insertGenerics/javFiles/TestTPHsAndGenerics.jav new file mode 100644 index 0000000..33a79e5 --- /dev/null +++ b/out/tests/resources/resources/insertGenerics/javFiles/TestTPHsAndGenerics.jav @@ -0,0 +1,13 @@ +class TPHsAndGenerics { + id = x -> x; + id2 (x) { + return id.apply(x); + } + m(a, b){ + var c = m2(a,b); + return a; + } + m2(a, b){ + return b; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/insertGenerics/javFiles/TestTPHsAndGenerics2.jav b/out/tests/resources/resources/insertGenerics/javFiles/TestTPHsAndGenerics2.jav new file mode 100644 index 0000000..2a75e82 --- /dev/null +++ b/out/tests/resources/resources/insertGenerics/javFiles/TestTPHsAndGenerics2.jav @@ -0,0 +1,14 @@ +class TPHsAndGenerics2 { + id = x -> x; + id2 (x) { + return id.apply(x); + } + m(a, b){ + var c = m2(a,b); + return a; + } + m2(a, b){ + return b; + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/insertGenerics/javFiles/TestThreeArgs.jav b/out/tests/resources/resources/insertGenerics/javFiles/TestThreeArgs.jav new file mode 100644 index 0000000..fe22dd3 --- /dev/null +++ b/out/tests/resources/resources/insertGenerics/javFiles/TestThreeArgs.jav @@ -0,0 +1,15 @@ +public class TestThreeArgs { + a; + + id(b) { + var a /* = null */; + var c = b; + m(a,a,b); + return c; + } + + m(x,y, z) { + x = id(y); + return x; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/insertGenerics/javFiles/TestTwoArgs.jav b/out/tests/resources/resources/insertGenerics/javFiles/TestTwoArgs.jav new file mode 100644 index 0000000..b4754fe --- /dev/null +++ b/out/tests/resources/resources/insertGenerics/javFiles/TestTwoArgs.jav @@ -0,0 +1,29 @@ +public class TestTwoArgs // +{ + //AS + a; + + //AN -> AN + id(b) { + var c = b; + return c; + } + + //T -> AS + setA(x) { + a = x; + return a; + } + + //(AG,Z) -> AG + m(x,y) { + x = id(y); + return x; + } + + // (AI, AH) -> AG + main(x,y) { + return m(id(x),setA(y)); + } +} + diff --git a/out/tests/resources/resources/insertGenerics/javFiles/TestTwoArgs2.jav b/out/tests/resources/resources/insertGenerics/javFiles/TestTwoArgs2.jav new file mode 100644 index 0000000..f8c270a --- /dev/null +++ b/out/tests/resources/resources/insertGenerics/javFiles/TestTwoArgs2.jav @@ -0,0 +1,17 @@ +public class TestTwoArgs2 { + a; + + id(b) { + var c = b; + return c; + } + + m(x,y) { + x = id(y); + return x; + } + + main(x,y) { + return m(id(x),m(x,y)); + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/insertGenerics/javFiles/TestTwoCalls.jav b/out/tests/resources/resources/insertGenerics/javFiles/TestTwoCalls.jav new file mode 100644 index 0000000..e3f0cfc --- /dev/null +++ b/out/tests/resources/resources/insertGenerics/javFiles/TestTwoCalls.jav @@ -0,0 +1,14 @@ +public class TestTwoCalls { + + // O -> O + id(b) { + var c = b; + return c; + } + + // (S, T) -> T + main(x,y) { + id(x); + return id(y); + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/insertGenerics/javFiles/TestVector.jav b/out/tests/resources/resources/insertGenerics/javFiles/TestVector.jav new file mode 100644 index 0000000..5f29c83 --- /dev/null +++ b/out/tests/resources/resources/insertGenerics/javFiles/TestVector.jav @@ -0,0 +1,12 @@ +import java.util.Vector; + +public class TestVector { + + m(v, w) { + w.addElement(id(v.elementAt(0))); + } + + id(x) { + return x; + } +} diff --git a/out/tests/resources/resources/insertGenerics/javFiles/TestVectorArg.jav b/out/tests/resources/resources/insertGenerics/javFiles/TestVectorArg.jav new file mode 100644 index 0000000..ca29f82 --- /dev/null +++ b/out/tests/resources/resources/insertGenerics/javFiles/TestVectorArg.jav @@ -0,0 +1,12 @@ +import java.util.Vector; + +public class TestVectorArg { + + add(v, e) { + v.addElement(e); + } + + main(v, e) { + add(v, e); + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/insertGenerics/javFiles/TestVoidMeth.jav b/out/tests/resources/resources/insertGenerics/javFiles/TestVoidMeth.jav new file mode 100644 index 0000000..50ee720 --- /dev/null +++ b/out/tests/resources/resources/insertGenerics/javFiles/TestVoidMeth.jav @@ -0,0 +1,4 @@ +class VoidMeth { + anyMethod() { + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/packageTest/pkg/sub/Cycle1.jav b/out/tests/resources/resources/packageTest/pkg/sub/Cycle1.jav new file mode 100644 index 0000000..79267a0 --- /dev/null +++ b/out/tests/resources/resources/packageTest/pkg/sub/Cycle1.jav @@ -0,0 +1,11 @@ +package pkg.sub; + +import java.lang.Integer; +import pkg.sub2.Cycle2; + +public class Cycle1 { + test() { + var cycle2 = new Cycle2(); + cycle2.test(); + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/packageTest/pkg/sub/Interface.jav b/out/tests/resources/resources/packageTest/pkg/sub/Interface.jav new file mode 100644 index 0000000..388b424 --- /dev/null +++ b/out/tests/resources/resources/packageTest/pkg/sub/Interface.jav @@ -0,0 +1,3 @@ +package pkg.sub; + +public interface Interface {} diff --git a/out/tests/resources/resources/packageTest/pkg/sub/Test1.jav b/out/tests/resources/resources/packageTest/pkg/sub/Test1.jav new file mode 100644 index 0000000..7acebfb --- /dev/null +++ b/out/tests/resources/resources/packageTest/pkg/sub/Test1.jav @@ -0,0 +1,11 @@ +package pkg.sub; + +import pkg.sub2.Test2; + +public class Test1 { + + main() { + var t2 = new Test2(); + t2.test(); + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/packageTest/pkg/sub2/Cycle2.jav b/out/tests/resources/resources/packageTest/pkg/sub2/Cycle2.jav new file mode 100644 index 0000000..8a13e10 --- /dev/null +++ b/out/tests/resources/resources/packageTest/pkg/sub2/Cycle2.jav @@ -0,0 +1,11 @@ +package pkg.sub2; + +import java.lang.Integer; +import pkg.sub.Cycle1; + +public class Cycle2 { + test() { + var cycle1 = new Cycle1(); + cycle1.test(); + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/packageTest/pkg/sub2/Test2.jav b/out/tests/resources/resources/packageTest/pkg/sub2/Test2.jav new file mode 100644 index 0000000..a7f8927 --- /dev/null +++ b/out/tests/resources/resources/packageTest/pkg/sub2/Test2.jav @@ -0,0 +1,6 @@ +package pkg.sub2; + +public class Test2 { + + test() {} +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/BinaryInMeth.ast b/out/tests/resources/resources/syntaxtreegenerator/BinaryInMeth.ast new file mode 100644 index 0000000..5bb1379 --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/BinaryInMeth.ast @@ -0,0 +1,22 @@ +class BinaryInMeth { + +BinaryInMeth(){ + super(()); + } + TPH CMNB m(TPH CMNC a){ + return ++a; + } + + TPH CMNF m2(TPH CMNG a, TPH CMNH b){ + return this.m Signature: [TPH CMNK, TPH CMNL](a op b); + } + + TPH CMNP m3(TPH CMNQ a){ + return this.m Signature: [TPH CMNT, TPH CMNU](++a); + } + + BinaryInMeth(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/Box.ast b/out/tests/resources/resources/syntaxtreegenerator/Box.ast new file mode 100644 index 0000000..1bc437b --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/Box.ast @@ -0,0 +1,25 @@ +class B { + +B(){ + super(()); + } + B(){ + super(()); + } + +}class Box_Main { + +Box_Main(){ + super(()); + } + TPH T m(TPH U b){ + b.m Signature: [TPH W, TPH X](new Box_Main()); + b.m Signature: [TPH AB, TPH AC](new B()); + return; + } + + Box_Main(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/ClassGenLam.ast b/out/tests/resources/resources/syntaxtreegenerator/ClassGenLam.ast new file mode 100644 index 0000000..30b4345 --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/ClassGenLam.ast @@ -0,0 +1,14 @@ +class ClassGenLam { + + TPH HWDB lam; +ClassGenLam(){ + super(()); + this.lam = (TPH HWDC x) -> { + return x; + }; + } + ClassGenLam(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/Cycle.ast b/out/tests/resources/resources/syntaxtreegenerator/Cycle.ast new file mode 100644 index 0000000..18b435a --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/Cycle.ast @@ -0,0 +1,16 @@ +class Cycle { + +Cycle(){ + super(()); + } + TPH GGXG m(TPH GGXH x, TPH GGXI y){ + y = x; + x = y; + return; + } + + Cycle(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/Fac.ast b/out/tests/resources/resources/syntaxtreegenerator/Fac.ast new file mode 100644 index 0000000..b15ecdd --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/Fac.ast @@ -0,0 +1,22 @@ +class Fac { + +Fac(){ + super(()); + } + TPH BSTE getFac(TPH BSTF n){ + TPH BSTG res; + res = 1; + TPH BSTI i; + i = 1; + while(i op n){ + res = res op i; + i++; + }; + return res; + } + + Fac(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/Faculty.ast b/out/tests/resources/resources/syntaxtreegenerator/Faculty.ast new file mode 100644 index 0000000..66c777a --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/Faculty.ast @@ -0,0 +1,25 @@ +class Faculty { + + TPH DDAL fact; +Faculty(){ + super(()); + } + TPH DDBK getFact(java.lang.Integer x){ + return this.fact.apply Signature: [TPH DDBM, TPH DDBN](x); + } + + Faculty(){ + super(()); + this.fact = (TPH DDAO x) -> { + if(x op 1) + { + return 1; + } + else + { + return x op this.fact.apply Signature: [TPH DDAW, TPH DDAX](x op 1); + }; + }; + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/Field.ast b/out/tests/resources/resources/syntaxtreegenerator/Field.ast new file mode 100644 index 0000000..43ffa1a --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/Field.ast @@ -0,0 +1,16 @@ +class Field { + + TPH JBCG x; +Field(){ + super(()); + this.x = 5; + } + TPH JBCJ m(){ + return this.x; + } + + Field(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/FieldTph2.ast b/out/tests/resources/resources/syntaxtreegenerator/FieldTph2.ast new file mode 100644 index 0000000..23c7c16 --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/FieldTph2.ast @@ -0,0 +1,21 @@ +class FieldTph2 { + + TPH DJBG a; +FieldTph2(){ + super(()); + } + TPH DJBH m(TPH DJBI b){ + b = this.a; + return b; + } + + TPH DJBL m2(TPH DJBM c){ + this.a = c; + return; + } + + FieldTph2(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/FieldTphConsMeth.ast b/out/tests/resources/resources/syntaxtreegenerator/FieldTphConsMeth.ast new file mode 100644 index 0000000..9ada601 --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/FieldTphConsMeth.ast @@ -0,0 +1,27 @@ +class FieldTphConsMeth { + + TPH AINS a; +FieldTphConsMeth(){ + super(()); + } + TPH AIOE id(TPH AIOF b){ + return b; + } + + TPH AIOH setA(TPH AIOI x){ + this.a = x; + return this.a; + } + + TPH AIOM m(TPH AION x, TPH AIOO y){ + x = this.id Signature: [TPH AIOQ, TPH AIOR](y); + return; + } + + FieldTphConsMeth(TPH AINU c){ + super(()); + this.a = this.id Signature: [TPH AINX, TPH AINY](c); + return; + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/FieldTphMMeth.ast b/out/tests/resources/resources/syntaxtreegenerator/FieldTphMMeth.ast new file mode 100644 index 0000000..3a0cacd --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/FieldTphMMeth.ast @@ -0,0 +1,33 @@ +class FieldTphMMeth { + + TPH HBWQ a; +FieldTphMMeth(){ + super(()); + } + TPH HBXG m(TPH HBXH b, TPH HBXI d, TPH HBXJ e){ + if(e) + { + return this.m3 Signature: [TPH HBXL, TPH HBXM](b); + } + else + { + return this.m3 Signature: [TPH HBXR, TPH HBXS](d); + }; + } + + TPH HBXY m2(TPH HBXZ b){ + this.a = this.m3 Signature: [TPH HBYC, TPH HBYD](b); + return; + } + + TPH HBYH m3(TPH HBYI b){ + return b; + } + + FieldTphMMeth(TPH HBWS c, TPH HBWT d, TPH HBWU e){ + super(()); + this.a = this.m Signature: [TPH HBWX, TPH HBWY, TPH HBWZ, TPH HBXA](c, d, e); + return; + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/Gen.ast b/out/tests/resources/resources/syntaxtreegenerator/Gen.ast new file mode 100644 index 0000000..20f5484 --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/Gen.ast @@ -0,0 +1,14 @@ +class Gen { + +Gen(){ + super(()); + } + java.util.Vector m(java.util.Vector v){ + return v; + } + + Gen(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/Id.ast b/out/tests/resources/resources/syntaxtreegenerator/Id.ast new file mode 100644 index 0000000..4b375d2 --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/Id.ast @@ -0,0 +1,18 @@ +class Id { + + TPH BDGF id2; +Id(){ + super(()); + this.id2 = (TPH BDGG x) -> { + return x; + }; + } + TPH BDGM id3(TPH BDGN x){ + return this.id2.apply Signature: [TPH BDGP, TPH BDGQ](x); + } + + Id(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/Inf.ast b/out/tests/resources/resources/syntaxtreegenerator/Inf.ast new file mode 100644 index 0000000..5425c25 --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/Inf.ast @@ -0,0 +1,28 @@ +class Inf { + +Inf(){ + super(()); + } + TPH KYAM m(TPH KYAN x, TPH KYAO y, TPH KYAP a){ + TPH KYAQ z; + TPH KYAR v; + TPH KYAS w; + TPH KYAT b; + y = x; + z = x; + v = y; + w = y; + y = a; + b = a; + TPH KYAU c; + TPH KYAV d; + c = v; + d = v; + return; + } + + Inf(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/Instanceof.ast b/out/tests/resources/resources/syntaxtreegenerator/Instanceof.ast new file mode 100644 index 0000000..29d0754 --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/Instanceof.ast @@ -0,0 +1,44 @@ +class Instanceof { + +Instanceof(){ + super(()); + } + void checkInstanceof(){ + TPH a; + a = 4; + return a instanceof java.lang.Integer; + } + + void checkInstanceOfWithPattern(){ + TPH b; + b = 4.0; + if(b instanceof d) + { + return d; + } + else + { + return Kein Double; + }; + } + + void checkInstanceOfWithGuardedPattern(){ + TPH obj; + obj = test; + TPH flag; + if(obj instanceof s op s.length Signature: [TPH]() op 5) + { + flag = s.contains Signature: [TPH, TPH](jdk); + }; + return; + } + + java.lang.Boolean equals(java.lang.Object o){ + return o instanceof other op x op other.x op y op other.y; + } + + Instanceof(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/KompTph.ast b/out/tests/resources/resources/syntaxtreegenerator/KompTph.ast new file mode 100644 index 0000000..0cde632 --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/KompTph.ast @@ -0,0 +1,26 @@ +class KompTph { + +KompTph(){ + super(()); + } + TPH EOGX m(TPH EOGY a, TPH EOGZ b, TPH EOHA c){ + TPH EOHB d; + d = a; + TPH EOHC e; + e = a; + a = b; + c = b; + this.m2 Signature: [TPH EOHE, TPH EOHF, TPH EOHG](a, c); + return; + } + + TPH EOHK m2(TPH EOHL a, TPH EOHM b){ + this.m Signature: [TPH EOHO, TPH EOHP, TPH EOHQ, TPH EOHR](a, a, b); + return; + } + + KompTph(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/Lambda.ast b/out/tests/resources/resources/syntaxtreegenerator/Lambda.ast new file mode 100644 index 0000000..1cdc8f1 --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/Lambda.ast @@ -0,0 +1,18 @@ +class Lambda { + +Lambda(){ + super(()); + } + TPH KIZQ m(){ + TPH KIZR lam1; + lam1 = (TPH KIZS x) -> { + return x; + }; + return lam1; + } + + Lambda(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/LambdaCapture.ast b/out/tests/resources/resources/syntaxtreegenerator/LambdaCapture.ast new file mode 100644 index 0000000..de4944b --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/LambdaCapture.ast @@ -0,0 +1,18 @@ +class LambdaCapture { + + java.lang.Integer i; + TPH BIMD f; +LambdaCapture(){ + super(()); + this.i = 8; + } + LambdaCapture(){ + super(()); + java.lang.Integer w; + w = 7; + this.f = (TPH BIMH j) -> { + return w op this.i; + }; + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/Matrix.ast b/out/tests/resources/resources/syntaxtreegenerator/Matrix.ast new file mode 100644 index 0000000..f4779af --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/Matrix.ast @@ -0,0 +1,52 @@ +class Matrix { + +Matrix(){ + super(()); + } + TPH SBB mul(TPH SBC m){ + TPH SBD ret; + ret = new Matrix(); + TPH SBF i; + i = 0; + while(i op this.size Signature: [TPH SBJ]()){ + TPH SBM v1; + v1 = this.elementAt Signature: [TPH SBO, TPH SBP](i); + TPH SBS v2; + v2 = new java.util.Vector(); + TPH SBU j; + j = 0; + while(j op v1.size Signature: [TPH SBX]()){ + TPH SCA erg; + erg = 0; + TPH SCC k; + k = 0; + while(k op v1.size Signature: [TPH SCF]()){ + erg = erg op v1.elementAt Signature: [TPH SCI, TPH SCJ](k) op m.elementAt Signature: [TPH SCM, TPH SCN](k).elementAt Signature: [TPH SCQ, TPH SCR](j); + k++; + }; + v2.addElement Signature: [TPH SCZ, TPH SDA](erg); + j++; + }; + ret.addElement Signature: [TPH SDG, TPH SDH](v2); + i++; + }; + return ret; + } + + Matrix(){ + super(()); + return; + } + + Matrix(TPH SAF vv){ + super(()); + java.lang.Integer i; + i = 0; + while(i op vv.size Signature: [TPH SAI]()){ + this.add Signature: [TPH SAQ, TPH SAR](vv.elementAt Signature: [TPH SAM, TPH SAN](i)); + i = i op 1; + }; + return; + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/MatrixOP.ast b/out/tests/resources/resources/syntaxtreegenerator/MatrixOP.ast new file mode 100644 index 0000000..4ea4d5e --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/MatrixOP.ast @@ -0,0 +1,52 @@ +class MatrixOP { + + TPH JGDT mul; +MatrixOP(){ + super(()); + this.mul = (TPH JGDU m1, TPH JGDV m2) -> { + TPH JGDW ret; + ret = new MatrixOP(); + TPH JGDY i; + i = 0; + while(i op m1.size Signature: [TPH JGEB]()){ + TPH JGEE v1; + v1 = m1.elementAt Signature: [TPH JGEF, TPH JGEG](i); + TPH JGEJ v2; + v2 = new java.util.Vector(); + TPH JGEL j; + j = 0; + while(j op v1.size Signature: [TPH JGEO]()){ + TPH JGER erg; + erg = 0; + TPH JGET k; + k = 0; + while(k op v1.size Signature: [TPH JGEW]()){ + erg = erg op v1.elementAt Signature: [TPH JGEZ, TPH JGFA](k) op m2.elementAt Signature: [TPH JGFD, TPH JGFE](k).elementAt Signature: [TPH JGFH, TPH JGFI](j); + k++; + }; + v2.addElement Signature: [TPH JGFQ, TPH JGFR](erg); + j++; + }; + ret.addElement Signature: [TPH JGFX, TPH JGFY](v2); + i++; + }; + return ret; + }; + } + MatrixOP(){ + super(()); + return; + } + + MatrixOP(TPH JGGP vv){ + super(()); + java.lang.Integer i; + i = 0; + while(i op vv.size Signature: [TPH JGGS]()){ + this.add Signature: [TPH JGHA, TPH JGHB](vv.elementAt Signature: [TPH JGGW, TPH JGGX](i)); + i = i op 1; + }; + return; + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/Merge.ast b/out/tests/resources/resources/syntaxtreegenerator/Merge.ast new file mode 100644 index 0000000..c3632d1 --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/Merge.ast @@ -0,0 +1,23 @@ +class Merge { + +Merge(){ + super(()); + } + TPH JQYM merge(TPH JQYN a, TPH JQYO b){ + a.addAll Signature: [TPH JQYP, TPH JQYQ](b); + return a; + } + + TPH JQYU sort(TPH JQYV in){ + TPH JQYW firstHalf; + firstHalf = in.subList Signature: [TPH JQYZ, TPH JQZA, TPH JQZB](1, 2); + TPH JQZE secondHalf; + secondHalf = in.subList Signature: [TPH JQZH, TPH JQZI, TPH JQZJ](1, 2); + return this.merge Signature: [TPH JQZX, TPH JQZY, TPH JQZZ](this.sort Signature: [TPH JQZO, TPH JQZP](firstHalf), this.sort Signature: [TPH JQZT, TPH JQZU](secondHalf)); + } + + Merge(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/OL.ast b/out/tests/resources/resources/syntaxtreegenerator/OL.ast new file mode 100644 index 0000000..96ea150 --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/OL.ast @@ -0,0 +1,41 @@ +class OL { + +OL(){ + super(()); + } + java.lang.Double m(java.lang.Double x){ + return x op x; + } + + java.lang.Integer m(java.lang.Integer x){ + return x op x; + } + + java.lang.String m(java.lang.String x){ + return x op x; + } + + java.lang.Boolean m(java.lang.Boolean x){ + return x; + } + + OL(){ + super(()); + } + +}class OLMain { + +OLMain(){ + super(()); + } + TPH BYOF main(TPH BYOG x){ + TPH BYOH ol; + ol = new OL(); + return ol.m Signature: [TPH BYOJ, TPH BYOK](x); + } + + OLMain(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/OLFun.ast b/out/tests/resources/resources/syntaxtreegenerator/OLFun.ast new file mode 100644 index 0000000..4f5e08f --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/OLFun.ast @@ -0,0 +1,22 @@ +class OLFun { + +OLFun(){ + super(()); + } + TPH JXJR m(TPH JXJS f, TPH JXJT x){ + x = f.apply Signature: [TPH JXJV, TPH JXJW](x op x); + return x; + } + + TPH JXKA m2(TPH JXKB y){ + this.m Signature: [TPH JXKK, TPH JXKL, TPH JXKM]((TPH JXKD x) -> { + return x op 2; + }, y); + return; + } + + OLFun(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/OLFun2.ast b/out/tests/resources/resources/syntaxtreegenerator/OLFun2.ast new file mode 100644 index 0000000..57415e3 --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/OLFun2.ast @@ -0,0 +1,16 @@ +class OLFun2 { + + TPH CTXA x; +OLFun2(){ + super(()); + } + TPH CTXB m(TPH CTXC f){ + this.x = f.apply Signature: [TPH CTXH, TPH CTXI](this.x op this.x); + return; + } + + OLFun2(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/Overloading.ast b/out/tests/resources/resources/syntaxtreegenerator/Overloading.ast new file mode 100644 index 0000000..29fd0bb --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/Overloading.ast @@ -0,0 +1,31 @@ +class Overloading { + +Overloading(){ + super(()); + } + TPH N test(TPH O x){ + return x.methode Signature: [TPH P](); + } + + TPH T methode(){ + return Overloading; + } + + Overloading(){ + super(()); + } + +}class Overloading2 { + +Overloading2(){ + super(()); + } + TPH AO methode(){ + return Overloading2; + } + + Overloading2(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/Pair.ast b/out/tests/resources/resources/syntaxtreegenerator/Pair.ast new file mode 100644 index 0000000..67a0183 --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/Pair.ast @@ -0,0 +1,20 @@ +class Pair { + + U a; + T b; +Pair(){ + super(()); + } + TPH IURS make(TPH IURT x){ + TPH IURU ret; + ret = new Pair(); + ret.a = x.elementAt Signature: [TPH IUSA, TPH IUSB](0); + ret.b = x.elementAt Signature: [TPH IUSG, TPH IUSH](1); + return ret; + } + + Pair(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/PatternMatching.ast b/out/tests/resources/resources/syntaxtreegenerator/PatternMatching.ast new file mode 100644 index 0000000..41a2453 --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/PatternMatching.ast @@ -0,0 +1,120 @@ +class Point { + + java.lang.Integer x; + java.lang.Integer y; +Point(java.lang.Integer x, java.lang.Integer y){ + super(()); + this.x = x; + this.y = y; + } + java.lang.Integer x(){ + return this.x; + } + + java.lang.Integer y(){ + return this.y; + } + + Point(java.lang.Integer x, java.lang.Integer y){ + super(()); + this.x = x; + this.y = y; + } + +}class Shape { + +}class ColoredPoint { + + Point pt; + java.lang.String color; +ColoredPoint(Point pt, java.lang.String color){ + super(()); + this.pt = pt; + this.color = color; + } + Point pt(){ + return this.pt; + } + + java.lang.String color(){ + return this.color; + } + + ColoredPoint(Point pt, java.lang.String color){ + super(()); + this.pt = pt; + this.color = color; + } + +}class Rectangle { + + ColoredPoint upperLeft; + ColoredPoint lowerRight; +Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight){ + super(()); + this.upperLeft = upperLeft; + this.lowerRight = lowerRight; + } + ColoredPoint upperLeft(){ + return this.upperLeft; + } + + ColoredPoint lowerRight(){ + return this.lowerRight; + } + + Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight){ + super(()); + this.upperLeft = upperLeft; + this.lowerRight = lowerRight; + } + +}class Color { + +Color(){ + super(()); + } + Color(){ + super(()); + } + +}class Blue { + +Blue(){ + super(()); + } + Blue(){ + super(()); + } + +}class Red { + +Red(){ + super(()); + } + Red(){ + super(()); + } + +}class PatternMatching { + +PatternMatching(){ + super(()); + } + void printColorOfUpperLeftPoint(Shape shape){ + switch(shape){ + case Rectangle(ColoredPoint(Point pt, java.lang.String color), ColoredPoint lowerRight): + System.out.println Signature: [TPH, TPH](x: op pt.x Signature: [TPH]() op / color: op color op / lowerRight: op lowerRight); + + default: + System.out.println Signature: [TPH, TPH](not a rectangle); + + }; + return; + } + + PatternMatching(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/Plus.ast b/out/tests/resources/resources/syntaxtreegenerator/Plus.ast new file mode 100644 index 0000000..c395f00 --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/Plus.ast @@ -0,0 +1,14 @@ +class Plus { + +Plus(){ + super(()); + } + TPH ACHZ m(TPH ACIA a, TPH ACIB b){ + return a op b; + } + + Plus(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/Record.ast b/out/tests/resources/resources/syntaxtreegenerator/Record.ast new file mode 100644 index 0000000..26d9587 --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/Record.ast @@ -0,0 +1,47 @@ +class Point { + + TPH x; + TPH y; +Point(TPH x, TPH y){ + super(()); + this.x = x; + this.y = y; + } + TPH x(){ + return this.x; + } + + TPH y(){ + return this.y; + } + + Point(TPH x, TPH y){ + super(()); + this.x = x; + this.y = y; + } + +}class Line { + + TPH pt1; + TPH pt2; +Line(TPH pt1, TPH pt2){ + super(()); + this.pt1 = pt1; + this.pt2 = pt2; + } + TPH pt1(){ + return this.pt1; + } + + TPH pt2(){ + return this.pt2; + } + + Line(TPH pt1, TPH pt2){ + super(()); + this.pt1 = pt1; + this.pt2 = pt2; + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/RelOps.ast b/out/tests/resources/resources/syntaxtreegenerator/RelOps.ast new file mode 100644 index 0000000..4b8fa1d --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/RelOps.ast @@ -0,0 +1,14 @@ +class RelOps { + +RelOps(){ + super(()); + } + TPH IPBY m(TPH IPBZ a, TPH IPCA b){ + return a op b; + } + + RelOps(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/Scalar.ast b/out/tests/resources/resources/syntaxtreegenerator/Scalar.ast new file mode 100644 index 0000000..fddde3a --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/Scalar.ast @@ -0,0 +1,29 @@ +class Scalar { + +Scalar(){ + super(()); + } + TPH KOXT mul(TPH KOXU v){ + TPH KOXV ret; + ret = 0; + TPH KOXX i; + i = 0; + while(i op this.size Signature: [TPH KOYB]()){ + ret = ret op this.elementAt Signature: [TPH KOYF, TPH KOYG](i) op v.elementAt Signature: [TPH KOYJ, TPH KOYK](i); + i = i op 1; + }; + return ret; + } + + Scalar(TPH KOWX v){ + super(()); + java.lang.Integer i; + i = 0; + while(i op v.size Signature: [TPH KOXA]()){ + this.add Signature: [TPH KOXI, TPH KOXJ](v.elementAt Signature: [TPH KOXE, TPH KOXF](i)); + i = i op 1; + }; + return; + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/Sealed.ast b/out/tests/resources/resources/syntaxtreegenerator/Sealed.ast new file mode 100644 index 0000000..24423ca --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/Sealed.ast @@ -0,0 +1,144 @@ +class Shape { + +Shape(){ + super(()); + } + Shape(){ + super(()); + } + +}class Circle { + +Circle(){ + super(()); + } + Circle(){ + super(()); + } + +}class Rectangle { + +Rectangle(){ + super(()); + } + Rectangle(){ + super(()); + } + +}class TransparentRectangle { + +TransparentRectangle(){ + super(()); + } + TransparentRectangle(){ + super(()); + } + +}class FilledRectangle { + +FilledRectangle(){ + super(()); + } + FilledRectangle(){ + super(()); + } + +}class Square { + +Square(){ + super(()); + } + Square(){ + super(()); + } + +}class WeirdShape { + +WeirdShape(){ + super(()); + } + WeirdShape(){ + super(()); + } + +}class Expr { + +}class ConstantExpr { + + java.lang.Integer i; +ConstantExpr(java.lang.Integer i){ + super(()); + this.i = i; + } + java.lang.Integer i(){ + return this.i; + } + + ConstantExpr(java.lang.Integer i){ + super(()); + this.i = i; + } + +}class PlusExpr { + + Expr a; + Expr b; +PlusExpr(Expr a, Expr b){ + super(()); + this.a = a; + this.b = b; + } + Expr a(){ + return this.a; + } + + Expr b(){ + return this.b; + } + + PlusExpr(Expr a, Expr b){ + super(()); + this.a = a; + this.b = b; + } + +}class TimesExpr { + + Expr a; + Expr b; +TimesExpr(Expr a, Expr b){ + super(()); + this.a = a; + this.b = b; + } + Expr a(){ + return this.a; + } + + Expr b(){ + return this.b; + } + + TimesExpr(Expr a, Expr b){ + super(()); + this.a = a; + this.b = b; + } + +}class NegExpr { + + Expr e; +NegExpr(Expr e){ + super(()); + this.e = e; + } + Expr e(){ + return this.e; + } + + NegExpr(Expr e){ + super(()); + this.e = e; + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/SimpleCycle.ast b/out/tests/resources/resources/syntaxtreegenerator/SimpleCycle.ast new file mode 100644 index 0000000..771757a --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/SimpleCycle.ast @@ -0,0 +1,18 @@ +class SimpleCycle { + +SimpleCycle(){ + super(()); + } + TPH ETMJ m(){ + TPH ETMK g; + TPH ETML h; + g = h; + h = g; + return; + } + + SimpleCycle(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/Sorting.ast b/out/tests/resources/resources/syntaxtreegenerator/Sorting.ast new file mode 100644 index 0000000..979d268 --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/Sorting.ast @@ -0,0 +1,23 @@ +class Sorting { + +Sorting(){ + super(()); + } + TPH JNN merge(TPH JNO a, TPH JNP b){ + a.addAll Signature: [TPH JNQ, TPH JNR](b); + return a; + } + + TPH JNV sort(TPH JNW in){ + TPH JNX firstHalf; + firstHalf = in; + TPH JNY secondHalf; + secondHalf = in; + return this.merge Signature: [TPH JOK, TPH JOL, TPH JOM](this.sort Signature: [TPH JOB, TPH JOC](firstHalf), this.sort Signature: [TPH JOG, TPH JOH](secondHalf)); + } + + Sorting(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/SubMatrix.ast b/out/tests/resources/resources/syntaxtreegenerator/SubMatrix.ast new file mode 100644 index 0000000..61ab2f2 --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/SubMatrix.ast @@ -0,0 +1,26 @@ +class Matrix2 { + +Matrix2(){ + super(()); + } + Matrix2(){ + super(()); + } + +}class SubMatrix { + +SubMatrix(){ + super(()); + } + TPH DOFK m(){ + java.util.Vector v; + v = new java.util.Vector(); + v.add Signature: [TPH DOFN, TPH DOFO](1); + return; + } + + SubMatrix(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/Switch.ast b/out/tests/resources/resources/syntaxtreegenerator/Switch.ast new file mode 100644 index 0000000..f6dfd8f --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/Switch.ast @@ -0,0 +1,96 @@ +class SwitchStatement { + +SwitchStatement(){ + super(()); + } + TPH switchStandard(){ + str = SwitchMe; + switch(str){ + case java.lang.String s: + return true; + + default: + return false; + + }; + } + + TPH switchInteger(){ + i = 5; + switch(i){ + case java.lang.Integer j: + case java.lang.String s: + i = 6; + break; + + default: + i = 0; + break; + + }; + return i op 0; + } + + TPH guardedPattern(){ + TPH i; + i = 1; + switch(i){ + case java.lang.Integer j: + return true; + + default: + return false; + + }; + } + + TPH recordPattern(java.lang.Object obj){ + switch(obj){ + case Coordinates(java.lang.Double lat, java.lang.Double lon): + return true; + + default: + return false; + + }; + } + + SwitchStatement(){ + super(()); + } + +}class SwitchExpression { + + java.lang.Integer x; + java.lang.Integer y; +SwitchExpression(java.lang.Integer x, java.lang.Integer y){ + super(()); + this.x = x; + this.y = y; + } + java.lang.Integer x(){ + return this.x; + } + + java.lang.Integer y(){ + return this.y; + } + + java.lang.Boolean switchStandard(TPH str){ + return switch(str){ + case java.lang.String s: + yield true; + + default: + yield false; + + }; + } + + SwitchExpression(java.lang.Integer x, java.lang.Integer y){ + super(()); + this.x = x; + this.y = y; + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/TXGenerics.ast b/out/tests/resources/resources/syntaxtreegenerator/TXGenerics.ast new file mode 100644 index 0000000..1c4a0ea --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/TXGenerics.ast @@ -0,0 +1,19 @@ +class TXGenerics { + + TPH GLEG a; + TPH GLEH b; +TXGenerics(){ + super(()); + } + TPH GLEI test(){ + TPH GLEJ c; + c = new Cycle(); + c.m Signature: [TPH GLEN, TPH GLEO, TPH GLEP](this.a, this.b); + return; + } + + TXGenerics(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/Tph.ast b/out/tests/resources/resources/syntaxtreegenerator/Tph.ast new file mode 100644 index 0000000..939f9a5 --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/Tph.ast @@ -0,0 +1,20 @@ +class Tph { + +Tph(){ + super(()); + } + TPH BNOP m(TPH BNOQ a, TPH BNOR b){ + TPH BNOS c; + c = this.m2 Signature: [TPH BNOU, TPH BNOV](b); + return a; + } + + TPH BNOZ m2(TPH BNPA b){ + return b; + } + + Tph(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/Tph2.ast b/out/tests/resources/resources/syntaxtreegenerator/Tph2.ast new file mode 100644 index 0000000..f138866 --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/Tph2.ast @@ -0,0 +1,18 @@ +class Tph2 { + + TPH FGYW id; +Tph2(){ + super(()); + this.id = (TPH FGYX x) -> { + return x; + }; + } + TPH FGZD id3(TPH FGZE x){ + return this.id.apply Signature: [TPH FGZG, TPH FGZH](x); + } + + Tph2(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/Tph3.ast b/out/tests/resources/resources/syntaxtreegenerator/Tph3.ast new file mode 100644 index 0000000..cfbf0bc --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/Tph3.ast @@ -0,0 +1,21 @@ +class Tph3 { + +Tph3(){ + super(()); + } + TPH FMEJ m1(TPH FMEK x, TPH FMEL y){ + this.m2 Signature: [TPH FMEN, TPH FMEO](x); + x = y; + return; + } + + TPH FMES m2(TPH FMET y){ + this.m1 Signature: [TPH FMEV, TPH FMEW, TPH FMEX](y, y); + return; + } + + Tph3(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/Tph4.ast b/out/tests/resources/resources/syntaxtreegenerator/Tph4.ast new file mode 100644 index 0000000..2ed453b --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/Tph4.ast @@ -0,0 +1,22 @@ +class Tph4 { + +Tph4(){ + super(()); + } + TPH FRJD m(TPH FRJE a, TPH FRJF b){ + TPH FRJG c; + c = this.m2 Signature: [TPH FRJI, TPH FRJJ](b); + TPH FRJM d; + d = this.m2 Signature: [TPH FRJO, TPH FRJP](c); + return d; + } + + TPH FRJT m2(TPH FRJU b){ + return b; + } + + Tph4(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/Tph5.ast b/out/tests/resources/resources/syntaxtreegenerator/Tph5.ast new file mode 100644 index 0000000..dfdda9d --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/Tph5.ast @@ -0,0 +1,19 @@ +class Tph5 { + +Tph5(){ + super(()); + } + TPH FWNY m(TPH FWNZ x, TPH FWOA y){ + x = this.m2 Signature: [TPH FWOC, TPH FWOD](y); + return; + } + + TPH FWOH m2(TPH FWOI y){ + return y; + } + + Tph5(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/Tph6.ast b/out/tests/resources/resources/syntaxtreegenerator/Tph6.ast new file mode 100644 index 0000000..eba65bc --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/Tph6.ast @@ -0,0 +1,21 @@ +class Tph6 { + +Tph6(){ + super(()); + } + TPH GBSM m(TPH GBSN x, TPH GBSO y){ + TPH GBSP c; + c = this.m2 Signature: [TPH GBSR, TPH GBSS](y); + c = this.m2 Signature: [TPH GBSW, TPH GBSX](x); + return; + } + + TPH GBTB m2(TPH GBTC y){ + return y; + } + + Tph6(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/Tph7.ast b/out/tests/resources/resources/syntaxtreegenerator/Tph7.ast new file mode 100644 index 0000000..8d2ebe4 --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/Tph7.ast @@ -0,0 +1,20 @@ +class Tph7 { + +Tph7(){ + super(()); + } + TPH GQRI m(TPH GQRJ a, TPH GQRK b){ + TPH GQRL c; + c = this.m2 Signature: [TPH GQRN, TPH GQRO](b); + return this.m2 Signature: [TPH GQRS, TPH GQRT](b); + } + + TPH GQRX m2(TPH GQRY b){ + return b; + } + + Tph7(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/TypedID.ast b/out/tests/resources/resources/syntaxtreegenerator/TypedID.ast new file mode 100644 index 0000000..0a56861 --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/TypedID.ast @@ -0,0 +1,22 @@ +class TypedID { + + TPH GVWK lam; +TypedID(){ + super(()); + this.lam = (TPH GVWL x) -> { + return x; + }; + } + TPH GVWR id(TPH GVWS b){ + return b; + } + + TPH GVWU m(){ + return this.lam; + } + + TypedID(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/VectorAdd.ast b/out/tests/resources/resources/syntaxtreegenerator/VectorAdd.ast new file mode 100644 index 0000000..992c9c1 --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/VectorAdd.ast @@ -0,0 +1,31 @@ +class VectorAdd { + +VectorAdd(){ + super(()); + } + TPH EXVJ vectorAdd(TPH EXVK v1, TPH EXVL v2){ + TPH EXVM i; + i = 0; + v1 = new java.util.Vector(); + TPH EXVP erg; + erg = new java.util.Vector(); + while(i op v1.size Signature: [TPH EXVT]()){ + erg.addElement Signature: [TPH EXWF, TPH EXWG](v1.elementAt Signature: [TPH EXVW, TPH EXVX](i) op v2.elementAt Signature: [TPH EXWA, TPH EXWB](i)); + i++; + }; + return erg; + } + + TPH EXWN m(TPH EXWO x, TPH EXWP y, TPH EXWQ z){ + x = new java.util.Vector(); + y = new java.util.Vector(); + x.add Signature: [TPH EXWU, TPH EXWV](1); + y.add Signature: [TPH EXWY, TPH EXWZ](2); + return z.addAll Signature: [TPH EXXC, TPH EXXD](x); + } + + VectorAdd(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/VectorSuper.ast b/out/tests/resources/resources/syntaxtreegenerator/VectorSuper.ast new file mode 100644 index 0000000..ec2faf3 --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/VectorSuper.ast @@ -0,0 +1,17 @@ +class VectorSuper { + +VectorSuper(){ + super(()); + } + TPH HPGR m(TPH HPGS x){ + java.lang.Integer y; + y = 1; + x.addElement Signature: [TPH HPGU, TPH HPGV](y); + return; + } + + VectorSuper(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/Y.ast b/out/tests/resources/resources/syntaxtreegenerator/Y.ast new file mode 100644 index 0000000..6a73619 --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/Y.ast @@ -0,0 +1,16 @@ +class Y { + + TPH IBFH y; +Y(){ + super(()); + } + Y(){ + super(()); + this.y = (TPH IBFK f) -> { + return (TPH IBFL t) -> { + return f.apply Signature: [TPH IBFR, TPH IBFS](this.y.apply Signature: [TPH IBFN, TPH IBFO](f)).apply Signature: [TPH IBFV, TPH IBFW](t); + }; + }; + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/applyLambda.ast b/out/tests/resources/resources/syntaxtreegenerator/applyLambda.ast new file mode 100644 index 0000000..504ddde --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/applyLambda.ast @@ -0,0 +1,27 @@ +class Apply { + +Apply(){ + super(()); + } + Apply(){ + super(()); + } + +}class applyLambda { + +applyLambda(){ + super(()); + } + TPH ASWH m(){ + TPH ASWI lam1; + lam1 = (TPH ASWJ x) -> { + return x; + }; + return lam1.apply Signature: [TPH ASWP, TPH ASWQ](new Apply()); + } + + applyLambda(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/javFiles/Instanceof.jav b/out/tests/resources/resources/syntaxtreegenerator/javFiles/Instanceof.jav new file mode 100644 index 0000000..c9a2d0b --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/javFiles/Instanceof.jav @@ -0,0 +1,36 @@ +import java.lang.Integer; +import java.lang.Double; +import java.lang.String; +import java.lang.Object; + +public class Instanceof{ + void checkInstanceof() { + var a = 4; + return (a instanceof java.lang.Integer); + } + + void checkInstanceOfWithPattern(){ + var b = 4.0; + if(b instanceof java.lang.Double d){ + return d; + }else{ + return "Kein Double"; + } + } + + void checkInstanceOfWithGuardedPattern(){ + var obj = "test"; + var flag; + if (obj instanceof String s && s.length() > 5) { + flag = s.contains("jdk"); + } + } + + record Point(int x, int y){ } + + boolean equals(Object o) { + return (o instanceof Point other) + && x == other.x + && y == other.y; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/javFiles/PatternMatching.jav b/out/tests/resources/resources/syntaxtreegenerator/javFiles/PatternMatching.jav new file mode 100644 index 0000000..d256ac0 --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/javFiles/PatternMatching.jav @@ -0,0 +1,19 @@ +import java.lang.String; + +record Point(int x, int y) {} +interface Shape {} +record ColoredPoint(Point pt, String color) {} +record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) implements Shape {} +sealed class Color permits Blue, Red {} +class Blue extends Color {} +class Red extends Color {} + +class PatternMatching { +void printColorOfUpperLeftPoint(Shape shape) +{ + switch (shape) { + case Rectangle(ColoredPoint(Point pt, String color), ColoredPoint lowerRight) -> System.out.println("x: " + pt.x() + " / color: " + color + " / lowerRight: " + lowerRight); + default -> System.out.println("not a rectangle"); + }; +} +} diff --git a/out/tests/resources/resources/syntaxtreegenerator/javFiles/Record.jav b/out/tests/resources/resources/syntaxtreegenerator/javFiles/Record.jav new file mode 100644 index 0000000..31edc83 --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/javFiles/Record.jav @@ -0,0 +1,5 @@ +// Simple records +record Point(x, y){ } + +//Combination of records +record Line(pt1, pt2){} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/javFiles/Sealed.jav b/out/tests/resources/resources/syntaxtreegenerator/javFiles/Sealed.jav new file mode 100644 index 0000000..b7a68e5 --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/javFiles/Sealed.jav @@ -0,0 +1,21 @@ +public abstract sealed class Shape + permits Circle, Rectangle, Square, WeirdShape { } + +public final class Circle extends Shape { } + +public sealed class Rectangle extends Shape + permits TransparentRectangle, FilledRectangle { } +public final class TransparentRectangle extends Rectangle { } +public final class FilledRectangle extends Rectangle { } + +public final class Square extends Shape { } + +public non-sealed class WeirdShape extends Shape { } + +public sealed interface Expr + permits ConstantExpr, PlusExpr, TimesExpr, NegExpr { } + +public record ConstantExpr(int i) implements Expr { } +public record PlusExpr(Expr a, Expr b) implements Expr { } +public record TimesExpr(Expr a, Expr b) implements Expr { } +public record NegExpr(Expr e) implements Expr { } \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/javFiles/Switch.jav b/out/tests/resources/resources/syntaxtreegenerator/javFiles/Switch.jav new file mode 100644 index 0000000..6c0f68a --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/javFiles/Switch.jav @@ -0,0 +1,52 @@ +import java.lang.Integer; +import java.lang.Boolean; +import java.lang.String; +import java.lang.Object; + +class SwitchStatement { + + switchStandard(){ + str = "SwitchMe"; + switch(str){ + case String s: return true; + default: return false; + } + } + + switchInteger(){ + i = 5; + switch(i){ + case Integer j: + case String s: i = 6; break; + default: i = 0; break; + } + return (i==0); + } + + guardedPattern(){ + var i = 1; + switch(i){ + case Integer j && j == 1: return true; + default: return false; + } + } + + record Coordinates(double x, double y) {} + + recordPattern(Object obj){ + switch(obj){ + case Coordinates(double lat, double lon): return true; + default: return false; + } + } +} + +record SwitchExpression(int x, int y){ + + boolean switchStandard(str){ + return switch(str){ + case String s -> yield true; + default -> yield false; + }; + } +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/mathStruc.ast b/out/tests/resources/resources/syntaxtreegenerator/mathStruc.ast new file mode 100644 index 0000000..8531850 --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/mathStruc.ast @@ -0,0 +1,19 @@ +class mathStruc { + + TPH IHHZ model; + TPH IHIA innerOp; +mathStruc(){ + super(()); + this.innerOp = (TPH IHIB o) -> { + return (TPH IHIC ms) -> { + return new mathStruc(o.apply Signature: [TPH IHIF, TPH IHIG, TPH IHIH](this.model, ms.model)); + }; + }; + } + mathStruc(TPH IHIW m){ + super(()); + this.model = m; + return; + } + +} \ No newline at end of file diff --git a/out/tests/resources/resources/syntaxtreegenerator/mathStrucInteger.ast b/out/tests/resources/resources/syntaxtreegenerator/mathStrucInteger.ast new file mode 100644 index 0000000..c36d537 --- /dev/null +++ b/out/tests/resources/resources/syntaxtreegenerator/mathStrucInteger.ast @@ -0,0 +1,38 @@ +class mathStrucInteger { + + TPH EBJW model; + TPH EBJX innerOp; +mathStrucInteger(){ + super(()); + this.innerOp = (TPH EBJY o) -> { + return (TPH EBJZ ms) -> { + return new mathStrucInteger(o.apply Signature: [TPH EBKC, TPH EBKD, TPH EBKE](this.model, ms.model)); + }; + }; + } + mathStrucInteger(TPH EBKT m){ + super(()); + this.model = m; + return; + } + +}class mathStrucIntegerUse { + +mathStrucIntegerUse(){ + super(()); + } + TPH EBLO main(){ + TPH EBLP ms; + ms = new mathStrucInteger(2); + TPH EBLT ms2; + ms2 = ms.innerOp.apply Signature: [TPH EBMD, TPH EBME]((TPH EBLV x, TPH EBLW y) -> { + return x op y; + }).apply Signature: [TPH EBMH, TPH EBMI](ms); + return ms2; + } + + mathStrucIntegerUse(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/BinaryInMeth.ast b/out/tests/resources/syntaxtreegenerator/BinaryInMeth.ast new file mode 100644 index 0000000..5bb1379 --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/BinaryInMeth.ast @@ -0,0 +1,22 @@ +class BinaryInMeth { + +BinaryInMeth(){ + super(()); + } + TPH CMNB m(TPH CMNC a){ + return ++a; + } + + TPH CMNF m2(TPH CMNG a, TPH CMNH b){ + return this.m Signature: [TPH CMNK, TPH CMNL](a op b); + } + + TPH CMNP m3(TPH CMNQ a){ + return this.m Signature: [TPH CMNT, TPH CMNU](++a); + } + + BinaryInMeth(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/Box.ast b/out/tests/resources/syntaxtreegenerator/Box.ast new file mode 100644 index 0000000..1bc437b --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/Box.ast @@ -0,0 +1,25 @@ +class B { + +B(){ + super(()); + } + B(){ + super(()); + } + +}class Box_Main { + +Box_Main(){ + super(()); + } + TPH T m(TPH U b){ + b.m Signature: [TPH W, TPH X](new Box_Main()); + b.m Signature: [TPH AB, TPH AC](new B()); + return; + } + + Box_Main(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/ClassGenLam.ast b/out/tests/resources/syntaxtreegenerator/ClassGenLam.ast new file mode 100644 index 0000000..30b4345 --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/ClassGenLam.ast @@ -0,0 +1,14 @@ +class ClassGenLam { + + TPH HWDB lam; +ClassGenLam(){ + super(()); + this.lam = (TPH HWDC x) -> { + return x; + }; + } + ClassGenLam(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/Cycle.ast b/out/tests/resources/syntaxtreegenerator/Cycle.ast new file mode 100644 index 0000000..18b435a --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/Cycle.ast @@ -0,0 +1,16 @@ +class Cycle { + +Cycle(){ + super(()); + } + TPH GGXG m(TPH GGXH x, TPH GGXI y){ + y = x; + x = y; + return; + } + + Cycle(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/Fac.ast b/out/tests/resources/syntaxtreegenerator/Fac.ast new file mode 100644 index 0000000..b15ecdd --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/Fac.ast @@ -0,0 +1,22 @@ +class Fac { + +Fac(){ + super(()); + } + TPH BSTE getFac(TPH BSTF n){ + TPH BSTG res; + res = 1; + TPH BSTI i; + i = 1; + while(i op n){ + res = res op i; + i++; + }; + return res; + } + + Fac(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/Faculty.ast b/out/tests/resources/syntaxtreegenerator/Faculty.ast new file mode 100644 index 0000000..66c777a --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/Faculty.ast @@ -0,0 +1,25 @@ +class Faculty { + + TPH DDAL fact; +Faculty(){ + super(()); + } + TPH DDBK getFact(java.lang.Integer x){ + return this.fact.apply Signature: [TPH DDBM, TPH DDBN](x); + } + + Faculty(){ + super(()); + this.fact = (TPH DDAO x) -> { + if(x op 1) + { + return 1; + } + else + { + return x op this.fact.apply Signature: [TPH DDAW, TPH DDAX](x op 1); + }; + }; + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/Field.ast b/out/tests/resources/syntaxtreegenerator/Field.ast new file mode 100644 index 0000000..43ffa1a --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/Field.ast @@ -0,0 +1,16 @@ +class Field { + + TPH JBCG x; +Field(){ + super(()); + this.x = 5; + } + TPH JBCJ m(){ + return this.x; + } + + Field(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/FieldTph2.ast b/out/tests/resources/syntaxtreegenerator/FieldTph2.ast new file mode 100644 index 0000000..23c7c16 --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/FieldTph2.ast @@ -0,0 +1,21 @@ +class FieldTph2 { + + TPH DJBG a; +FieldTph2(){ + super(()); + } + TPH DJBH m(TPH DJBI b){ + b = this.a; + return b; + } + + TPH DJBL m2(TPH DJBM c){ + this.a = c; + return; + } + + FieldTph2(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/FieldTphConsMeth.ast b/out/tests/resources/syntaxtreegenerator/FieldTphConsMeth.ast new file mode 100644 index 0000000..9ada601 --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/FieldTphConsMeth.ast @@ -0,0 +1,27 @@ +class FieldTphConsMeth { + + TPH AINS a; +FieldTphConsMeth(){ + super(()); + } + TPH AIOE id(TPH AIOF b){ + return b; + } + + TPH AIOH setA(TPH AIOI x){ + this.a = x; + return this.a; + } + + TPH AIOM m(TPH AION x, TPH AIOO y){ + x = this.id Signature: [TPH AIOQ, TPH AIOR](y); + return; + } + + FieldTphConsMeth(TPH AINU c){ + super(()); + this.a = this.id Signature: [TPH AINX, TPH AINY](c); + return; + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/FieldTphMMeth.ast b/out/tests/resources/syntaxtreegenerator/FieldTphMMeth.ast new file mode 100644 index 0000000..3a0cacd --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/FieldTphMMeth.ast @@ -0,0 +1,33 @@ +class FieldTphMMeth { + + TPH HBWQ a; +FieldTphMMeth(){ + super(()); + } + TPH HBXG m(TPH HBXH b, TPH HBXI d, TPH HBXJ e){ + if(e) + { + return this.m3 Signature: [TPH HBXL, TPH HBXM](b); + } + else + { + return this.m3 Signature: [TPH HBXR, TPH HBXS](d); + }; + } + + TPH HBXY m2(TPH HBXZ b){ + this.a = this.m3 Signature: [TPH HBYC, TPH HBYD](b); + return; + } + + TPH HBYH m3(TPH HBYI b){ + return b; + } + + FieldTphMMeth(TPH HBWS c, TPH HBWT d, TPH HBWU e){ + super(()); + this.a = this.m Signature: [TPH HBWX, TPH HBWY, TPH HBWZ, TPH HBXA](c, d, e); + return; + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/Gen.ast b/out/tests/resources/syntaxtreegenerator/Gen.ast new file mode 100644 index 0000000..20f5484 --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/Gen.ast @@ -0,0 +1,14 @@ +class Gen { + +Gen(){ + super(()); + } + java.util.Vector m(java.util.Vector v){ + return v; + } + + Gen(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/Id.ast b/out/tests/resources/syntaxtreegenerator/Id.ast new file mode 100644 index 0000000..4b375d2 --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/Id.ast @@ -0,0 +1,18 @@ +class Id { + + TPH BDGF id2; +Id(){ + super(()); + this.id2 = (TPH BDGG x) -> { + return x; + }; + } + TPH BDGM id3(TPH BDGN x){ + return this.id2.apply Signature: [TPH BDGP, TPH BDGQ](x); + } + + Id(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/Inf.ast b/out/tests/resources/syntaxtreegenerator/Inf.ast new file mode 100644 index 0000000..5425c25 --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/Inf.ast @@ -0,0 +1,28 @@ +class Inf { + +Inf(){ + super(()); + } + TPH KYAM m(TPH KYAN x, TPH KYAO y, TPH KYAP a){ + TPH KYAQ z; + TPH KYAR v; + TPH KYAS w; + TPH KYAT b; + y = x; + z = x; + v = y; + w = y; + y = a; + b = a; + TPH KYAU c; + TPH KYAV d; + c = v; + d = v; + return; + } + + Inf(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/Instanceof.ast b/out/tests/resources/syntaxtreegenerator/Instanceof.ast new file mode 100644 index 0000000..29d0754 --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/Instanceof.ast @@ -0,0 +1,44 @@ +class Instanceof { + +Instanceof(){ + super(()); + } + void checkInstanceof(){ + TPH a; + a = 4; + return a instanceof java.lang.Integer; + } + + void checkInstanceOfWithPattern(){ + TPH b; + b = 4.0; + if(b instanceof d) + { + return d; + } + else + { + return Kein Double; + }; + } + + void checkInstanceOfWithGuardedPattern(){ + TPH obj; + obj = test; + TPH flag; + if(obj instanceof s op s.length Signature: [TPH]() op 5) + { + flag = s.contains Signature: [TPH, TPH](jdk); + }; + return; + } + + java.lang.Boolean equals(java.lang.Object o){ + return o instanceof other op x op other.x op y op other.y; + } + + Instanceof(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/KompTph.ast b/out/tests/resources/syntaxtreegenerator/KompTph.ast new file mode 100644 index 0000000..0cde632 --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/KompTph.ast @@ -0,0 +1,26 @@ +class KompTph { + +KompTph(){ + super(()); + } + TPH EOGX m(TPH EOGY a, TPH EOGZ b, TPH EOHA c){ + TPH EOHB d; + d = a; + TPH EOHC e; + e = a; + a = b; + c = b; + this.m2 Signature: [TPH EOHE, TPH EOHF, TPH EOHG](a, c); + return; + } + + TPH EOHK m2(TPH EOHL a, TPH EOHM b){ + this.m Signature: [TPH EOHO, TPH EOHP, TPH EOHQ, TPH EOHR](a, a, b); + return; + } + + KompTph(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/Lambda.ast b/out/tests/resources/syntaxtreegenerator/Lambda.ast new file mode 100644 index 0000000..1cdc8f1 --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/Lambda.ast @@ -0,0 +1,18 @@ +class Lambda { + +Lambda(){ + super(()); + } + TPH KIZQ m(){ + TPH KIZR lam1; + lam1 = (TPH KIZS x) -> { + return x; + }; + return lam1; + } + + Lambda(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/LambdaCapture.ast b/out/tests/resources/syntaxtreegenerator/LambdaCapture.ast new file mode 100644 index 0000000..de4944b --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/LambdaCapture.ast @@ -0,0 +1,18 @@ +class LambdaCapture { + + java.lang.Integer i; + TPH BIMD f; +LambdaCapture(){ + super(()); + this.i = 8; + } + LambdaCapture(){ + super(()); + java.lang.Integer w; + w = 7; + this.f = (TPH BIMH j) -> { + return w op this.i; + }; + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/Matrix.ast b/out/tests/resources/syntaxtreegenerator/Matrix.ast new file mode 100644 index 0000000..f4779af --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/Matrix.ast @@ -0,0 +1,52 @@ +class Matrix { + +Matrix(){ + super(()); + } + TPH SBB mul(TPH SBC m){ + TPH SBD ret; + ret = new Matrix(); + TPH SBF i; + i = 0; + while(i op this.size Signature: [TPH SBJ]()){ + TPH SBM v1; + v1 = this.elementAt Signature: [TPH SBO, TPH SBP](i); + TPH SBS v2; + v2 = new java.util.Vector(); + TPH SBU j; + j = 0; + while(j op v1.size Signature: [TPH SBX]()){ + TPH SCA erg; + erg = 0; + TPH SCC k; + k = 0; + while(k op v1.size Signature: [TPH SCF]()){ + erg = erg op v1.elementAt Signature: [TPH SCI, TPH SCJ](k) op m.elementAt Signature: [TPH SCM, TPH SCN](k).elementAt Signature: [TPH SCQ, TPH SCR](j); + k++; + }; + v2.addElement Signature: [TPH SCZ, TPH SDA](erg); + j++; + }; + ret.addElement Signature: [TPH SDG, TPH SDH](v2); + i++; + }; + return ret; + } + + Matrix(){ + super(()); + return; + } + + Matrix(TPH SAF vv){ + super(()); + java.lang.Integer i; + i = 0; + while(i op vv.size Signature: [TPH SAI]()){ + this.add Signature: [TPH SAQ, TPH SAR](vv.elementAt Signature: [TPH SAM, TPH SAN](i)); + i = i op 1; + }; + return; + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/MatrixOP.ast b/out/tests/resources/syntaxtreegenerator/MatrixOP.ast new file mode 100644 index 0000000..4ea4d5e --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/MatrixOP.ast @@ -0,0 +1,52 @@ +class MatrixOP { + + TPH JGDT mul; +MatrixOP(){ + super(()); + this.mul = (TPH JGDU m1, TPH JGDV m2) -> { + TPH JGDW ret; + ret = new MatrixOP(); + TPH JGDY i; + i = 0; + while(i op m1.size Signature: [TPH JGEB]()){ + TPH JGEE v1; + v1 = m1.elementAt Signature: [TPH JGEF, TPH JGEG](i); + TPH JGEJ v2; + v2 = new java.util.Vector(); + TPH JGEL j; + j = 0; + while(j op v1.size Signature: [TPH JGEO]()){ + TPH JGER erg; + erg = 0; + TPH JGET k; + k = 0; + while(k op v1.size Signature: [TPH JGEW]()){ + erg = erg op v1.elementAt Signature: [TPH JGEZ, TPH JGFA](k) op m2.elementAt Signature: [TPH JGFD, TPH JGFE](k).elementAt Signature: [TPH JGFH, TPH JGFI](j); + k++; + }; + v2.addElement Signature: [TPH JGFQ, TPH JGFR](erg); + j++; + }; + ret.addElement Signature: [TPH JGFX, TPH JGFY](v2); + i++; + }; + return ret; + }; + } + MatrixOP(){ + super(()); + return; + } + + MatrixOP(TPH JGGP vv){ + super(()); + java.lang.Integer i; + i = 0; + while(i op vv.size Signature: [TPH JGGS]()){ + this.add Signature: [TPH JGHA, TPH JGHB](vv.elementAt Signature: [TPH JGGW, TPH JGGX](i)); + i = i op 1; + }; + return; + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/Merge.ast b/out/tests/resources/syntaxtreegenerator/Merge.ast new file mode 100644 index 0000000..c3632d1 --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/Merge.ast @@ -0,0 +1,23 @@ +class Merge { + +Merge(){ + super(()); + } + TPH JQYM merge(TPH JQYN a, TPH JQYO b){ + a.addAll Signature: [TPH JQYP, TPH JQYQ](b); + return a; + } + + TPH JQYU sort(TPH JQYV in){ + TPH JQYW firstHalf; + firstHalf = in.subList Signature: [TPH JQYZ, TPH JQZA, TPH JQZB](1, 2); + TPH JQZE secondHalf; + secondHalf = in.subList Signature: [TPH JQZH, TPH JQZI, TPH JQZJ](1, 2); + return this.merge Signature: [TPH JQZX, TPH JQZY, TPH JQZZ](this.sort Signature: [TPH JQZO, TPH JQZP](firstHalf), this.sort Signature: [TPH JQZT, TPH JQZU](secondHalf)); + } + + Merge(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/OL.ast b/out/tests/resources/syntaxtreegenerator/OL.ast new file mode 100644 index 0000000..96ea150 --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/OL.ast @@ -0,0 +1,41 @@ +class OL { + +OL(){ + super(()); + } + java.lang.Double m(java.lang.Double x){ + return x op x; + } + + java.lang.Integer m(java.lang.Integer x){ + return x op x; + } + + java.lang.String m(java.lang.String x){ + return x op x; + } + + java.lang.Boolean m(java.lang.Boolean x){ + return x; + } + + OL(){ + super(()); + } + +}class OLMain { + +OLMain(){ + super(()); + } + TPH BYOF main(TPH BYOG x){ + TPH BYOH ol; + ol = new OL(); + return ol.m Signature: [TPH BYOJ, TPH BYOK](x); + } + + OLMain(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/OLFun.ast b/out/tests/resources/syntaxtreegenerator/OLFun.ast new file mode 100644 index 0000000..4f5e08f --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/OLFun.ast @@ -0,0 +1,22 @@ +class OLFun { + +OLFun(){ + super(()); + } + TPH JXJR m(TPH JXJS f, TPH JXJT x){ + x = f.apply Signature: [TPH JXJV, TPH JXJW](x op x); + return x; + } + + TPH JXKA m2(TPH JXKB y){ + this.m Signature: [TPH JXKK, TPH JXKL, TPH JXKM]((TPH JXKD x) -> { + return x op 2; + }, y); + return; + } + + OLFun(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/OLFun2.ast b/out/tests/resources/syntaxtreegenerator/OLFun2.ast new file mode 100644 index 0000000..57415e3 --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/OLFun2.ast @@ -0,0 +1,16 @@ +class OLFun2 { + + TPH CTXA x; +OLFun2(){ + super(()); + } + TPH CTXB m(TPH CTXC f){ + this.x = f.apply Signature: [TPH CTXH, TPH CTXI](this.x op this.x); + return; + } + + OLFun2(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/Overloading.ast b/out/tests/resources/syntaxtreegenerator/Overloading.ast new file mode 100644 index 0000000..29fd0bb --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/Overloading.ast @@ -0,0 +1,31 @@ +class Overloading { + +Overloading(){ + super(()); + } + TPH N test(TPH O x){ + return x.methode Signature: [TPH P](); + } + + TPH T methode(){ + return Overloading; + } + + Overloading(){ + super(()); + } + +}class Overloading2 { + +Overloading2(){ + super(()); + } + TPH AO methode(){ + return Overloading2; + } + + Overloading2(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/Pair.ast b/out/tests/resources/syntaxtreegenerator/Pair.ast new file mode 100644 index 0000000..67a0183 --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/Pair.ast @@ -0,0 +1,20 @@ +class Pair { + + U a; + T b; +Pair(){ + super(()); + } + TPH IURS make(TPH IURT x){ + TPH IURU ret; + ret = new Pair(); + ret.a = x.elementAt Signature: [TPH IUSA, TPH IUSB](0); + ret.b = x.elementAt Signature: [TPH IUSG, TPH IUSH](1); + return ret; + } + + Pair(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/PatternMatching.ast b/out/tests/resources/syntaxtreegenerator/PatternMatching.ast new file mode 100644 index 0000000..41a2453 --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/PatternMatching.ast @@ -0,0 +1,120 @@ +class Point { + + java.lang.Integer x; + java.lang.Integer y; +Point(java.lang.Integer x, java.lang.Integer y){ + super(()); + this.x = x; + this.y = y; + } + java.lang.Integer x(){ + return this.x; + } + + java.lang.Integer y(){ + return this.y; + } + + Point(java.lang.Integer x, java.lang.Integer y){ + super(()); + this.x = x; + this.y = y; + } + +}class Shape { + +}class ColoredPoint { + + Point pt; + java.lang.String color; +ColoredPoint(Point pt, java.lang.String color){ + super(()); + this.pt = pt; + this.color = color; + } + Point pt(){ + return this.pt; + } + + java.lang.String color(){ + return this.color; + } + + ColoredPoint(Point pt, java.lang.String color){ + super(()); + this.pt = pt; + this.color = color; + } + +}class Rectangle { + + ColoredPoint upperLeft; + ColoredPoint lowerRight; +Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight){ + super(()); + this.upperLeft = upperLeft; + this.lowerRight = lowerRight; + } + ColoredPoint upperLeft(){ + return this.upperLeft; + } + + ColoredPoint lowerRight(){ + return this.lowerRight; + } + + Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight){ + super(()); + this.upperLeft = upperLeft; + this.lowerRight = lowerRight; + } + +}class Color { + +Color(){ + super(()); + } + Color(){ + super(()); + } + +}class Blue { + +Blue(){ + super(()); + } + Blue(){ + super(()); + } + +}class Red { + +Red(){ + super(()); + } + Red(){ + super(()); + } + +}class PatternMatching { + +PatternMatching(){ + super(()); + } + void printColorOfUpperLeftPoint(Shape shape){ + switch(shape){ + case Rectangle(ColoredPoint(Point pt, java.lang.String color), ColoredPoint lowerRight): + System.out.println Signature: [TPH, TPH](x: op pt.x Signature: [TPH]() op / color: op color op / lowerRight: op lowerRight); + + default: + System.out.println Signature: [TPH, TPH](not a rectangle); + + }; + return; + } + + PatternMatching(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/Plus.ast b/out/tests/resources/syntaxtreegenerator/Plus.ast new file mode 100644 index 0000000..c395f00 --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/Plus.ast @@ -0,0 +1,14 @@ +class Plus { + +Plus(){ + super(()); + } + TPH ACHZ m(TPH ACIA a, TPH ACIB b){ + return a op b; + } + + Plus(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/Record.ast b/out/tests/resources/syntaxtreegenerator/Record.ast new file mode 100644 index 0000000..26d9587 --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/Record.ast @@ -0,0 +1,47 @@ +class Point { + + TPH x; + TPH y; +Point(TPH x, TPH y){ + super(()); + this.x = x; + this.y = y; + } + TPH x(){ + return this.x; + } + + TPH y(){ + return this.y; + } + + Point(TPH x, TPH y){ + super(()); + this.x = x; + this.y = y; + } + +}class Line { + + TPH pt1; + TPH pt2; +Line(TPH pt1, TPH pt2){ + super(()); + this.pt1 = pt1; + this.pt2 = pt2; + } + TPH pt1(){ + return this.pt1; + } + + TPH pt2(){ + return this.pt2; + } + + Line(TPH pt1, TPH pt2){ + super(()); + this.pt1 = pt1; + this.pt2 = pt2; + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/RelOps.ast b/out/tests/resources/syntaxtreegenerator/RelOps.ast new file mode 100644 index 0000000..4b8fa1d --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/RelOps.ast @@ -0,0 +1,14 @@ +class RelOps { + +RelOps(){ + super(()); + } + TPH IPBY m(TPH IPBZ a, TPH IPCA b){ + return a op b; + } + + RelOps(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/Scalar.ast b/out/tests/resources/syntaxtreegenerator/Scalar.ast new file mode 100644 index 0000000..fddde3a --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/Scalar.ast @@ -0,0 +1,29 @@ +class Scalar { + +Scalar(){ + super(()); + } + TPH KOXT mul(TPH KOXU v){ + TPH KOXV ret; + ret = 0; + TPH KOXX i; + i = 0; + while(i op this.size Signature: [TPH KOYB]()){ + ret = ret op this.elementAt Signature: [TPH KOYF, TPH KOYG](i) op v.elementAt Signature: [TPH KOYJ, TPH KOYK](i); + i = i op 1; + }; + return ret; + } + + Scalar(TPH KOWX v){ + super(()); + java.lang.Integer i; + i = 0; + while(i op v.size Signature: [TPH KOXA]()){ + this.add Signature: [TPH KOXI, TPH KOXJ](v.elementAt Signature: [TPH KOXE, TPH KOXF](i)); + i = i op 1; + }; + return; + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/Sealed.ast b/out/tests/resources/syntaxtreegenerator/Sealed.ast new file mode 100644 index 0000000..24423ca --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/Sealed.ast @@ -0,0 +1,144 @@ +class Shape { + +Shape(){ + super(()); + } + Shape(){ + super(()); + } + +}class Circle { + +Circle(){ + super(()); + } + Circle(){ + super(()); + } + +}class Rectangle { + +Rectangle(){ + super(()); + } + Rectangle(){ + super(()); + } + +}class TransparentRectangle { + +TransparentRectangle(){ + super(()); + } + TransparentRectangle(){ + super(()); + } + +}class FilledRectangle { + +FilledRectangle(){ + super(()); + } + FilledRectangle(){ + super(()); + } + +}class Square { + +Square(){ + super(()); + } + Square(){ + super(()); + } + +}class WeirdShape { + +WeirdShape(){ + super(()); + } + WeirdShape(){ + super(()); + } + +}class Expr { + +}class ConstantExpr { + + java.lang.Integer i; +ConstantExpr(java.lang.Integer i){ + super(()); + this.i = i; + } + java.lang.Integer i(){ + return this.i; + } + + ConstantExpr(java.lang.Integer i){ + super(()); + this.i = i; + } + +}class PlusExpr { + + Expr a; + Expr b; +PlusExpr(Expr a, Expr b){ + super(()); + this.a = a; + this.b = b; + } + Expr a(){ + return this.a; + } + + Expr b(){ + return this.b; + } + + PlusExpr(Expr a, Expr b){ + super(()); + this.a = a; + this.b = b; + } + +}class TimesExpr { + + Expr a; + Expr b; +TimesExpr(Expr a, Expr b){ + super(()); + this.a = a; + this.b = b; + } + Expr a(){ + return this.a; + } + + Expr b(){ + return this.b; + } + + TimesExpr(Expr a, Expr b){ + super(()); + this.a = a; + this.b = b; + } + +}class NegExpr { + + Expr e; +NegExpr(Expr e){ + super(()); + this.e = e; + } + Expr e(){ + return this.e; + } + + NegExpr(Expr e){ + super(()); + this.e = e; + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/SimpleCycle.ast b/out/tests/resources/syntaxtreegenerator/SimpleCycle.ast new file mode 100644 index 0000000..771757a --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/SimpleCycle.ast @@ -0,0 +1,18 @@ +class SimpleCycle { + +SimpleCycle(){ + super(()); + } + TPH ETMJ m(){ + TPH ETMK g; + TPH ETML h; + g = h; + h = g; + return; + } + + SimpleCycle(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/Sorting.ast b/out/tests/resources/syntaxtreegenerator/Sorting.ast new file mode 100644 index 0000000..979d268 --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/Sorting.ast @@ -0,0 +1,23 @@ +class Sorting { + +Sorting(){ + super(()); + } + TPH JNN merge(TPH JNO a, TPH JNP b){ + a.addAll Signature: [TPH JNQ, TPH JNR](b); + return a; + } + + TPH JNV sort(TPH JNW in){ + TPH JNX firstHalf; + firstHalf = in; + TPH JNY secondHalf; + secondHalf = in; + return this.merge Signature: [TPH JOK, TPH JOL, TPH JOM](this.sort Signature: [TPH JOB, TPH JOC](firstHalf), this.sort Signature: [TPH JOG, TPH JOH](secondHalf)); + } + + Sorting(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/SubMatrix.ast b/out/tests/resources/syntaxtreegenerator/SubMatrix.ast new file mode 100644 index 0000000..61ab2f2 --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/SubMatrix.ast @@ -0,0 +1,26 @@ +class Matrix2 { + +Matrix2(){ + super(()); + } + Matrix2(){ + super(()); + } + +}class SubMatrix { + +SubMatrix(){ + super(()); + } + TPH DOFK m(){ + java.util.Vector v; + v = new java.util.Vector(); + v.add Signature: [TPH DOFN, TPH DOFO](1); + return; + } + + SubMatrix(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/Switch.ast b/out/tests/resources/syntaxtreegenerator/Switch.ast new file mode 100644 index 0000000..f6dfd8f --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/Switch.ast @@ -0,0 +1,96 @@ +class SwitchStatement { + +SwitchStatement(){ + super(()); + } + TPH switchStandard(){ + str = SwitchMe; + switch(str){ + case java.lang.String s: + return true; + + default: + return false; + + }; + } + + TPH switchInteger(){ + i = 5; + switch(i){ + case java.lang.Integer j: + case java.lang.String s: + i = 6; + break; + + default: + i = 0; + break; + + }; + return i op 0; + } + + TPH guardedPattern(){ + TPH i; + i = 1; + switch(i){ + case java.lang.Integer j: + return true; + + default: + return false; + + }; + } + + TPH recordPattern(java.lang.Object obj){ + switch(obj){ + case Coordinates(java.lang.Double lat, java.lang.Double lon): + return true; + + default: + return false; + + }; + } + + SwitchStatement(){ + super(()); + } + +}class SwitchExpression { + + java.lang.Integer x; + java.lang.Integer y; +SwitchExpression(java.lang.Integer x, java.lang.Integer y){ + super(()); + this.x = x; + this.y = y; + } + java.lang.Integer x(){ + return this.x; + } + + java.lang.Integer y(){ + return this.y; + } + + java.lang.Boolean switchStandard(TPH str){ + return switch(str){ + case java.lang.String s: + yield true; + + default: + yield false; + + }; + } + + SwitchExpression(java.lang.Integer x, java.lang.Integer y){ + super(()); + this.x = x; + this.y = y; + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/TXGenerics.ast b/out/tests/resources/syntaxtreegenerator/TXGenerics.ast new file mode 100644 index 0000000..1c4a0ea --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/TXGenerics.ast @@ -0,0 +1,19 @@ +class TXGenerics { + + TPH GLEG a; + TPH GLEH b; +TXGenerics(){ + super(()); + } + TPH GLEI test(){ + TPH GLEJ c; + c = new Cycle(); + c.m Signature: [TPH GLEN, TPH GLEO, TPH GLEP](this.a, this.b); + return; + } + + TXGenerics(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/Tph.ast b/out/tests/resources/syntaxtreegenerator/Tph.ast new file mode 100644 index 0000000..939f9a5 --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/Tph.ast @@ -0,0 +1,20 @@ +class Tph { + +Tph(){ + super(()); + } + TPH BNOP m(TPH BNOQ a, TPH BNOR b){ + TPH BNOS c; + c = this.m2 Signature: [TPH BNOU, TPH BNOV](b); + return a; + } + + TPH BNOZ m2(TPH BNPA b){ + return b; + } + + Tph(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/Tph2.ast b/out/tests/resources/syntaxtreegenerator/Tph2.ast new file mode 100644 index 0000000..f138866 --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/Tph2.ast @@ -0,0 +1,18 @@ +class Tph2 { + + TPH FGYW id; +Tph2(){ + super(()); + this.id = (TPH FGYX x) -> { + return x; + }; + } + TPH FGZD id3(TPH FGZE x){ + return this.id.apply Signature: [TPH FGZG, TPH FGZH](x); + } + + Tph2(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/Tph3.ast b/out/tests/resources/syntaxtreegenerator/Tph3.ast new file mode 100644 index 0000000..cfbf0bc --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/Tph3.ast @@ -0,0 +1,21 @@ +class Tph3 { + +Tph3(){ + super(()); + } + TPH FMEJ m1(TPH FMEK x, TPH FMEL y){ + this.m2 Signature: [TPH FMEN, TPH FMEO](x); + x = y; + return; + } + + TPH FMES m2(TPH FMET y){ + this.m1 Signature: [TPH FMEV, TPH FMEW, TPH FMEX](y, y); + return; + } + + Tph3(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/Tph4.ast b/out/tests/resources/syntaxtreegenerator/Tph4.ast new file mode 100644 index 0000000..2ed453b --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/Tph4.ast @@ -0,0 +1,22 @@ +class Tph4 { + +Tph4(){ + super(()); + } + TPH FRJD m(TPH FRJE a, TPH FRJF b){ + TPH FRJG c; + c = this.m2 Signature: [TPH FRJI, TPH FRJJ](b); + TPH FRJM d; + d = this.m2 Signature: [TPH FRJO, TPH FRJP](c); + return d; + } + + TPH FRJT m2(TPH FRJU b){ + return b; + } + + Tph4(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/Tph5.ast b/out/tests/resources/syntaxtreegenerator/Tph5.ast new file mode 100644 index 0000000..dfdda9d --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/Tph5.ast @@ -0,0 +1,19 @@ +class Tph5 { + +Tph5(){ + super(()); + } + TPH FWNY m(TPH FWNZ x, TPH FWOA y){ + x = this.m2 Signature: [TPH FWOC, TPH FWOD](y); + return; + } + + TPH FWOH m2(TPH FWOI y){ + return y; + } + + Tph5(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/Tph6.ast b/out/tests/resources/syntaxtreegenerator/Tph6.ast new file mode 100644 index 0000000..eba65bc --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/Tph6.ast @@ -0,0 +1,21 @@ +class Tph6 { + +Tph6(){ + super(()); + } + TPH GBSM m(TPH GBSN x, TPH GBSO y){ + TPH GBSP c; + c = this.m2 Signature: [TPH GBSR, TPH GBSS](y); + c = this.m2 Signature: [TPH GBSW, TPH GBSX](x); + return; + } + + TPH GBTB m2(TPH GBTC y){ + return y; + } + + Tph6(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/Tph7.ast b/out/tests/resources/syntaxtreegenerator/Tph7.ast new file mode 100644 index 0000000..8d2ebe4 --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/Tph7.ast @@ -0,0 +1,20 @@ +class Tph7 { + +Tph7(){ + super(()); + } + TPH GQRI m(TPH GQRJ a, TPH GQRK b){ + TPH GQRL c; + c = this.m2 Signature: [TPH GQRN, TPH GQRO](b); + return this.m2 Signature: [TPH GQRS, TPH GQRT](b); + } + + TPH GQRX m2(TPH GQRY b){ + return b; + } + + Tph7(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/TypedID.ast b/out/tests/resources/syntaxtreegenerator/TypedID.ast new file mode 100644 index 0000000..0a56861 --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/TypedID.ast @@ -0,0 +1,22 @@ +class TypedID { + + TPH GVWK lam; +TypedID(){ + super(()); + this.lam = (TPH GVWL x) -> { + return x; + }; + } + TPH GVWR id(TPH GVWS b){ + return b; + } + + TPH GVWU m(){ + return this.lam; + } + + TypedID(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/VectorAdd.ast b/out/tests/resources/syntaxtreegenerator/VectorAdd.ast new file mode 100644 index 0000000..992c9c1 --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/VectorAdd.ast @@ -0,0 +1,31 @@ +class VectorAdd { + +VectorAdd(){ + super(()); + } + TPH EXVJ vectorAdd(TPH EXVK v1, TPH EXVL v2){ + TPH EXVM i; + i = 0; + v1 = new java.util.Vector(); + TPH EXVP erg; + erg = new java.util.Vector(); + while(i op v1.size Signature: [TPH EXVT]()){ + erg.addElement Signature: [TPH EXWF, TPH EXWG](v1.elementAt Signature: [TPH EXVW, TPH EXVX](i) op v2.elementAt Signature: [TPH EXWA, TPH EXWB](i)); + i++; + }; + return erg; + } + + TPH EXWN m(TPH EXWO x, TPH EXWP y, TPH EXWQ z){ + x = new java.util.Vector(); + y = new java.util.Vector(); + x.add Signature: [TPH EXWU, TPH EXWV](1); + y.add Signature: [TPH EXWY, TPH EXWZ](2); + return z.addAll Signature: [TPH EXXC, TPH EXXD](x); + } + + VectorAdd(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/VectorSuper.ast b/out/tests/resources/syntaxtreegenerator/VectorSuper.ast new file mode 100644 index 0000000..ec2faf3 --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/VectorSuper.ast @@ -0,0 +1,17 @@ +class VectorSuper { + +VectorSuper(){ + super(()); + } + TPH HPGR m(TPH HPGS x){ + java.lang.Integer y; + y = 1; + x.addElement Signature: [TPH HPGU, TPH HPGV](y); + return; + } + + VectorSuper(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/Y.ast b/out/tests/resources/syntaxtreegenerator/Y.ast new file mode 100644 index 0000000..6a73619 --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/Y.ast @@ -0,0 +1,16 @@ +class Y { + + TPH IBFH y; +Y(){ + super(()); + } + Y(){ + super(()); + this.y = (TPH IBFK f) -> { + return (TPH IBFL t) -> { + return f.apply Signature: [TPH IBFR, TPH IBFS](this.y.apply Signature: [TPH IBFN, TPH IBFO](f)).apply Signature: [TPH IBFV, TPH IBFW](t); + }; + }; + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/applyLambda.ast b/out/tests/resources/syntaxtreegenerator/applyLambda.ast new file mode 100644 index 0000000..504ddde --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/applyLambda.ast @@ -0,0 +1,27 @@ +class Apply { + +Apply(){ + super(()); + } + Apply(){ + super(()); + } + +}class applyLambda { + +applyLambda(){ + super(()); + } + TPH ASWH m(){ + TPH ASWI lam1; + lam1 = (TPH ASWJ x) -> { + return x; + }; + return lam1.apply Signature: [TPH ASWP, TPH ASWQ](new Apply()); + } + + applyLambda(){ + super(()); + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/javFiles/Instanceof.jav b/out/tests/resources/syntaxtreegenerator/javFiles/Instanceof.jav new file mode 100644 index 0000000..c9a2d0b --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/javFiles/Instanceof.jav @@ -0,0 +1,36 @@ +import java.lang.Integer; +import java.lang.Double; +import java.lang.String; +import java.lang.Object; + +public class Instanceof{ + void checkInstanceof() { + var a = 4; + return (a instanceof java.lang.Integer); + } + + void checkInstanceOfWithPattern(){ + var b = 4.0; + if(b instanceof java.lang.Double d){ + return d; + }else{ + return "Kein Double"; + } + } + + void checkInstanceOfWithGuardedPattern(){ + var obj = "test"; + var flag; + if (obj instanceof String s && s.length() > 5) { + flag = s.contains("jdk"); + } + } + + record Point(int x, int y){ } + + boolean equals(Object o) { + return (o instanceof Point other) + && x == other.x + && y == other.y; + } +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/javFiles/PatternMatching.jav b/out/tests/resources/syntaxtreegenerator/javFiles/PatternMatching.jav new file mode 100644 index 0000000..d256ac0 --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/javFiles/PatternMatching.jav @@ -0,0 +1,19 @@ +import java.lang.String; + +record Point(int x, int y) {} +interface Shape {} +record ColoredPoint(Point pt, String color) {} +record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) implements Shape {} +sealed class Color permits Blue, Red {} +class Blue extends Color {} +class Red extends Color {} + +class PatternMatching { +void printColorOfUpperLeftPoint(Shape shape) +{ + switch (shape) { + case Rectangle(ColoredPoint(Point pt, String color), ColoredPoint lowerRight) -> System.out.println("x: " + pt.x() + " / color: " + color + " / lowerRight: " + lowerRight); + default -> System.out.println("not a rectangle"); + }; +} +} diff --git a/out/tests/resources/syntaxtreegenerator/javFiles/Record.jav b/out/tests/resources/syntaxtreegenerator/javFiles/Record.jav new file mode 100644 index 0000000..31edc83 --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/javFiles/Record.jav @@ -0,0 +1,5 @@ +// Simple records +record Point(x, y){ } + +//Combination of records +record Line(pt1, pt2){} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/javFiles/Sealed.jav b/out/tests/resources/syntaxtreegenerator/javFiles/Sealed.jav new file mode 100644 index 0000000..b7a68e5 --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/javFiles/Sealed.jav @@ -0,0 +1,21 @@ +public abstract sealed class Shape + permits Circle, Rectangle, Square, WeirdShape { } + +public final class Circle extends Shape { } + +public sealed class Rectangle extends Shape + permits TransparentRectangle, FilledRectangle { } +public final class TransparentRectangle extends Rectangle { } +public final class FilledRectangle extends Rectangle { } + +public final class Square extends Shape { } + +public non-sealed class WeirdShape extends Shape { } + +public sealed interface Expr + permits ConstantExpr, PlusExpr, TimesExpr, NegExpr { } + +public record ConstantExpr(int i) implements Expr { } +public record PlusExpr(Expr a, Expr b) implements Expr { } +public record TimesExpr(Expr a, Expr b) implements Expr { } +public record NegExpr(Expr e) implements Expr { } \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/javFiles/Switch.jav b/out/tests/resources/syntaxtreegenerator/javFiles/Switch.jav new file mode 100644 index 0000000..6c0f68a --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/javFiles/Switch.jav @@ -0,0 +1,52 @@ +import java.lang.Integer; +import java.lang.Boolean; +import java.lang.String; +import java.lang.Object; + +class SwitchStatement { + + switchStandard(){ + str = "SwitchMe"; + switch(str){ + case String s: return true; + default: return false; + } + } + + switchInteger(){ + i = 5; + switch(i){ + case Integer j: + case String s: i = 6; break; + default: i = 0; break; + } + return (i==0); + } + + guardedPattern(){ + var i = 1; + switch(i){ + case Integer j && j == 1: return true; + default: return false; + } + } + + record Coordinates(double x, double y) {} + + recordPattern(Object obj){ + switch(obj){ + case Coordinates(double lat, double lon): return true; + default: return false; + } + } +} + +record SwitchExpression(int x, int y){ + + boolean switchStandard(str){ + return switch(str){ + case String s -> yield true; + default -> yield false; + }; + } +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/mathStruc.ast b/out/tests/resources/syntaxtreegenerator/mathStruc.ast new file mode 100644 index 0000000..8531850 --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/mathStruc.ast @@ -0,0 +1,19 @@ +class mathStruc { + + TPH IHHZ model; + TPH IHIA innerOp; +mathStruc(){ + super(()); + this.innerOp = (TPH IHIB o) -> { + return (TPH IHIC ms) -> { + return new mathStruc(o.apply Signature: [TPH IHIF, TPH IHIG, TPH IHIH](this.model, ms.model)); + }; + }; + } + mathStruc(TPH IHIW m){ + super(()); + this.model = m; + return; + } + +} \ No newline at end of file diff --git a/out/tests/resources/syntaxtreegenerator/mathStrucInteger.ast b/out/tests/resources/syntaxtreegenerator/mathStrucInteger.ast new file mode 100644 index 0000000..c36d537 --- /dev/null +++ b/out/tests/resources/syntaxtreegenerator/mathStrucInteger.ast @@ -0,0 +1,38 @@ +class mathStrucInteger { + + TPH EBJW model; + TPH EBJX innerOp; +mathStrucInteger(){ + super(()); + this.innerOp = (TPH EBJY o) -> { + return (TPH EBJZ ms) -> { + return new mathStrucInteger(o.apply Signature: [TPH EBKC, TPH EBKD, TPH EBKE](this.model, ms.model)); + }; + }; + } + mathStrucInteger(TPH EBKT m){ + super(()); + this.model = m; + return; + } + +}class mathStrucIntegerUse { + +mathStrucIntegerUse(){ + super(()); + } + TPH EBLO main(){ + TPH EBLP ms; + ms = new mathStrucInteger(2); + TPH EBLT ms2; + ms2 = ms.innerOp.apply Signature: [TPH EBMD, TPH EBME]((TPH EBLV x, TPH EBLW y) -> { + return x op y; + }).apply Signature: [TPH EBMH, TPH EBMI](ms); + return ms2; + } + + mathStrucIntegerUse(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources-back/AllgemeinTest/Assign.jav b/resources-back/AllgemeinTest/Assign.jav new file mode 100644 index 0000000..001fca7 --- /dev/null +++ b/resources-back/AllgemeinTest/Assign.jav @@ -0,0 +1,10 @@ +class Assign { + + assign(x, y) { + x = y; + } + + assign2(x, y) { + assign(x,y); + } +} \ No newline at end of file diff --git a/resources-back/AllgemeinTest/CaptureConversion.jav b/resources-back/AllgemeinTest/CaptureConversion.jav new file mode 100644 index 0000000..b1033de --- /dev/null +++ b/resources-back/AllgemeinTest/CaptureConversion.jav @@ -0,0 +1,18 @@ +import java.lang.Object; +import java.util.Vector; + +class CaptureConversion { + + void assign(Vector v1, Vector v2) { + v1 = v2; + } + + void main() { + Vector v1; + v1 = new Vector(); + Vector v2; + v2 = new Vector(); + v1 = v2; + assign(v1, v2); + } +} \ No newline at end of file diff --git a/resources-back/AllgemeinTest/Complex.jav b/resources-back/AllgemeinTest/Complex.jav new file mode 100644 index 0000000..15d5c5d --- /dev/null +++ b/resources-back/AllgemeinTest/Complex.jav @@ -0,0 +1,22 @@ +class Pair { + U a; + T b; + Pair(U x, T y) { + a = x; b = y; + } +} + +class Complex { + m(b) { + var c = b; + var d = c; + var e; + d = e; + var r1 = e; + var f = e; + var g; + f = g; + var r2 = g; + return new Pair<>(r1, r2); + } +} \ No newline at end of file diff --git a/resources-back/AllgemeinTest/InfReturn.jav b/resources-back/AllgemeinTest/InfReturn.jav new file mode 100644 index 0000000..d1f6211 --- /dev/null +++ b/resources-back/AllgemeinTest/InfReturn.jav @@ -0,0 +1,7 @@ +public class InfReturn { + m(a) { + var ret; + a = ret; + return ret; + } +} \ No newline at end of file diff --git a/resources-back/AllgemeinTest/InfReturnII.jav b/resources-back/AllgemeinTest/InfReturnII.jav new file mode 100644 index 0000000..e1e9597 --- /dev/null +++ b/resources-back/AllgemeinTest/InfReturnII.jav @@ -0,0 +1,8 @@ +public class InfReturnII { + m(a, b) { + var ret; + a = ret; + b = ret; + return ret; + } +} \ No newline at end of file diff --git a/resources-back/AllgemeinTest/InnerInf.jav b/resources-back/AllgemeinTest/InnerInf.jav new file mode 100644 index 0000000..4eaa183 --- /dev/null +++ b/resources-back/AllgemeinTest/InnerInf.jav @@ -0,0 +1,7 @@ +class InnerInf { + m(a, b) { + var i; + a = i; + b = i; + } +} \ No newline at end of file diff --git a/resources-back/AllgemeinTest/Iteration.jav b/resources-back/AllgemeinTest/Iteration.jav new file mode 100644 index 0000000..2af750a --- /dev/null +++ b/resources-back/AllgemeinTest/Iteration.jav @@ -0,0 +1,43 @@ +/* +class Pair { + T x; + U y; + + public Pair() { } + public Pair(T x, U y) { + this.x = x; + this.y = y; + } + + public T fst () { + return x; + } + + public U snd () { + return y; + } +} +*/ + +public class Iteration { + id(x) { + return x; + } + + m1(x, y) { + var help; + help = m2(x, y); + var y2 = help.snd(); + var x2 = id(x); + return new Pair<>(x2,y2); + + } + + m2(x,y) { + var help = m1(x, y); + var x2 = help.fst(); + var y2 = id(y); + return new Pair<>(x2, y2); + } +} + \ No newline at end of file diff --git a/resources-back/AllgemeinTest/Overloading.jav b/resources-back/AllgemeinTest/Overloading.jav new file mode 100644 index 0000000..2809813 --- /dev/null +++ b/resources-back/AllgemeinTest/Overloading.jav @@ -0,0 +1,7 @@ +import java.lang.Integer; +import java.lang.Double; + +class Overloading { + m(x) { return x + x; } + m(x) { return x || x; } +} \ No newline at end of file diff --git a/resources-back/AllgemeinTest/Pair.jav b/resources-back/AllgemeinTest/Pair.jav new file mode 100644 index 0000000..89660b1 --- /dev/null +++ b/resources-back/AllgemeinTest/Pair.jav @@ -0,0 +1,36 @@ +import java.util.Vector; +import java.lang.Boolean; +import java.lang.Object; + +class Pair { + U a; + T b; + + make(x) { + var ret = new Pair<>(); + ret.a = x.elementAt(0); + ret.b = x.elementAt(1); + return ret; + } + + + eq(a, b) { + b = a; + return a == b; + } + + + compare( p) { + return eq(p.a, p.b); + //return p.a == p.b; + } + + +/* + void m(Pair p, Vector b) + { + //this.compare(p); //1, type incorrect + this.compare(this.make(b)); //2, OK + } +*/ +} \ No newline at end of file diff --git a/resources-back/AllgemeinTest/RecursionCond.jav b/resources-back/AllgemeinTest/RecursionCond.jav new file mode 100644 index 0000000..1640471 --- /dev/null +++ b/resources-back/AllgemeinTest/RecursionCond.jav @@ -0,0 +1,8 @@ +class RecursionCond { + m(a, b, c) { + if (1 == 2) { + b = m(a, b); + c = m(a, b); + } else return a; + } +} \ No newline at end of file diff --git a/resources-back/AllgemeinTest/StreamTest.jav b/resources-back/AllgemeinTest/StreamTest.jav new file mode 100644 index 0000000..cfaf23d --- /dev/null +++ b/resources-back/AllgemeinTest/StreamTest.jav @@ -0,0 +1,14 @@ +import java.util.stream.Stream; +import java.util.Vector; +import java.lang.Integer; + +class StreamTest { + + m() { + var vecInt = new Vector(); + var strInt = vecInt.stream(); + var dup = x -> x*2; + strInt.map(dup); + return dup; + } +} \ No newline at end of file diff --git a/resources-back/AllgemeinTest/Test.jav b/resources-back/AllgemeinTest/Test.jav new file mode 100644 index 0000000..48491b8 --- /dev/null +++ b/resources-back/AllgemeinTest/Test.jav @@ -0,0 +1,9 @@ +import java.lang.Boolean; +import java.lang.Integer; + +public class Test { + fac = (x) -> { + if (x == 1) { return 1; } + return x * fac.apply(x - 1); + }; +} \ No newline at end of file diff --git a/resources-back/AllgemeinTest/TripleTest.jav b/resources-back/AllgemeinTest/TripleTest.jav new file mode 100644 index 0000000..a0560b6 --- /dev/null +++ b/resources-back/AllgemeinTest/TripleTest.jav @@ -0,0 +1,19 @@ +class Triple { + U a; + T b; + S c; + + Triple(U x, T y, S z) { + a = x; b = y; c = z; + } + + U fst() { return a; } + T snd() { return b; } + S thrd() { return c; } +} + +public class TripleTest { + m() { + return new Triple<>(m().thrd(), m().thrd(), m().thrd()); + } +} \ No newline at end of file diff --git a/resources-back/AllgemeinTest/Twice2.jav b/resources-back/AllgemeinTest/Twice2.jav new file mode 100644 index 0000000..87a3f23 --- /dev/null +++ b/resources-back/AllgemeinTest/Twice2.jav @@ -0,0 +1,12 @@ +class Twice2 { + id1inst = new Id<>(); + id1 = id1inst.id; + id2inst = new Id<>(); + id2 = id2inst.id; + twice = id1.apply(id2); + +} + +class Id { + id = (T x) -> x; +} \ No newline at end of file diff --git a/resources-back/AllgemeinTest/UseWildcardPair.jav b/resources-back/AllgemeinTest/UseWildcardPair.jav new file mode 100644 index 0000000..dc91e4e --- /dev/null +++ b/resources-back/AllgemeinTest/UseWildcardPair.jav @@ -0,0 +1,12 @@ +import java.util.Vector; +import java.lang.Boolean; + +class UseWildcardPair{ + + void m(Pair p, Vector b) + { + p.compare(p); //1, type incorrect + p.compare(p.make(b)); //2, OK + } + +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/AA.jav b/resources-back/bytecode/javFiles/AA.jav new file mode 100644 index 0000000..3f8f172 --- /dev/null +++ b/resources-back/bytecode/javFiles/AA.jav @@ -0,0 +1,8 @@ +import java.lang.Integer; +import java.lang.String; + +public class AA { + m(Integer i) { return "AA"; } + + m2(AA x) { return "AA"; } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/AddLong.jav b/resources-back/bytecode/javFiles/AddLong.jav new file mode 100644 index 0000000..d6d47e9 --- /dev/null +++ b/resources-back/bytecode/javFiles/AddLong.jav @@ -0,0 +1,9 @@ +import java.lang.Integer; +import java.lang.Long; + +public class AddLong{ + Long add(Integer a, Long b) { + Long c = a+b; + return c; + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/AssignToLit.jav b/resources-back/bytecode/javFiles/AssignToLit.jav new file mode 100644 index 0000000..873828e --- /dev/null +++ b/resources-back/bytecode/javFiles/AssignToLit.jav @@ -0,0 +1,30 @@ +import java.lang.Integer; +import java.lang.Boolean; +import java.lang.String; +import java.lang.Byte; +import java.lang.Short; +import java.lang.Long; +import java.lang.Float; +import java.lang.Double; +import java.lang.Character; + +class AssignToLit { + void m(){ +// String s = "Test"; +// Boolean b = false; +// Byte byte1 = 5; +// Byte byte2 = 55; +// Short short1 = 5; +// Short short2 = 55; +// Integer int1 = 5; +// Integer int2 = 8888888; +// Long long1 = 1; +// Long long2 = 5; +// Long long3 = 89989898; +// Float float1 = 1; +// Float float2 = 55; +// Double d1 = 1; +// Double d2 = 55; + Character c = 'A'; + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/BB.jav b/resources-back/bytecode/javFiles/BB.jav new file mode 100644 index 0000000..27856c4 --- /dev/null +++ b/resources-back/bytecode/javFiles/BB.jav @@ -0,0 +1,3 @@ +import java.lang.Integer; + +public class BB extends AA { } \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/BinaryInMeth.jav b/resources-back/bytecode/javFiles/BinaryInMeth.jav new file mode 100644 index 0000000..3b5fa77 --- /dev/null +++ b/resources-back/bytecode/javFiles/BinaryInMeth.jav @@ -0,0 +1,17 @@ +import java.lang.Integer; +import java.lang.Double; + +public class BinaryInMeth { + + m(a){ + return ++a; + } + + m2(a,b){ + return m(a+b); + } + + m3(a) { + return m(++a); + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/Box.jav b/resources-back/bytecode/javFiles/Box.jav new file mode 100644 index 0000000..4859d61 --- /dev/null +++ b/resources-back/bytecode/javFiles/Box.jav @@ -0,0 +1,7 @@ +class B { } +class Box_Main extends B { + m(b) { + b.m(new Box_Main()); + b.m(new B()); + } +} diff --git a/resources-back/bytecode/javFiles/Box.java b/resources-back/bytecode/javFiles/Box.java new file mode 100644 index 0000000..581e725 --- /dev/null +++ b/resources-back/bytecode/javFiles/Box.java @@ -0,0 +1,3 @@ +class Box { + void m(A a) { } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/CC.jav b/resources-back/bytecode/javFiles/CC.jav new file mode 100644 index 0000000..d7d5c96 --- /dev/null +++ b/resources-back/bytecode/javFiles/CC.jav @@ -0,0 +1,11 @@ +import java.lang.Integer; +import java.lang.String; + + +public class CC extends BB { + m(Integer i) { + return "CC"; + } + + m2(CC x) { return "CC"; } +} diff --git a/resources-back/bytecode/javFiles/Chain.jav b/resources-back/bytecode/javFiles/Chain.jav new file mode 100644 index 0000000..c6b034a --- /dev/null +++ b/resources-back/bytecode/javFiles/Chain.jav @@ -0,0 +1,13 @@ +import java.lang.Integer; + +public class Chain { + x = 5; + + chain() { + return this; + } + + m() { + return this.chain().chain().chain().x; + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/ClassGenLam.jav b/resources-back/bytecode/javFiles/ClassGenLam.jav new file mode 100644 index 0000000..0e9cf05 --- /dev/null +++ b/resources-back/bytecode/javFiles/ClassGenLam.jav @@ -0,0 +1,8 @@ +import java.lang.Integer; + +public class ClassGenLam { + lam = x-> x; +// public ClassGenLam() { +// lam = x->x; +// } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/Cycle.jav b/resources-back/bytecode/javFiles/Cycle.jav new file mode 100644 index 0000000..85f2ba9 --- /dev/null +++ b/resources-back/bytecode/javFiles/Cycle.jav @@ -0,0 +1,6 @@ +class Cycle { + m(x, y) { + y = x; + x = y; + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/DD.jav b/resources-back/bytecode/javFiles/DD.jav new file mode 100644 index 0000000..6d49f4c --- /dev/null +++ b/resources-back/bytecode/javFiles/DD.jav @@ -0,0 +1,4 @@ +import java.lang.Integer; + +public class DD extends CC { } + diff --git a/resources-back/bytecode/javFiles/DuMethod.jav b/resources-back/bytecode/javFiles/DuMethod.jav new file mode 100644 index 0000000..3898a7b --- /dev/null +++ b/resources-back/bytecode/javFiles/DuMethod.jav @@ -0,0 +1,11 @@ +public class DuMethod{ + + method(a){ + return a+a; + } + + method(a){ + return a; + } + +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/EmptyClass.jav b/resources-back/bytecode/javFiles/EmptyClass.jav new file mode 100644 index 0000000..8160d7d --- /dev/null +++ b/resources-back/bytecode/javFiles/EmptyClass.jav @@ -0,0 +1,3 @@ +public class EmptyClass{ + +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/EmptyMethod.jav b/resources-back/bytecode/javFiles/EmptyMethod.jav new file mode 100644 index 0000000..961989d --- /dev/null +++ b/resources-back/bytecode/javFiles/EmptyMethod.jav @@ -0,0 +1,8 @@ +public class EmptyMethod{ + + public void m1(){ + System.out.println("test"); + } + + public void m2(){} +} diff --git a/resources-back/bytecode/javFiles/Example.jav b/resources-back/bytecode/javFiles/Example.jav new file mode 100644 index 0000000..b7455a3 --- /dev/null +++ b/resources-back/bytecode/javFiles/Example.jav @@ -0,0 +1,9 @@ +import java.lang.String; + +public class Example { + + public m() { + String x = "X"; + return x; + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/Exceptions.jav b/resources-back/bytecode/javFiles/Exceptions.jav new file mode 100644 index 0000000..9903511 --- /dev/null +++ b/resources-back/bytecode/javFiles/Exceptions.jav @@ -0,0 +1,3 @@ +public class Exceptions { +// m(Integer i) throws +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/Expressions.jav b/resources-back/bytecode/javFiles/Expressions.jav new file mode 100644 index 0000000..e2e992a --- /dev/null +++ b/resources-back/bytecode/javFiles/Expressions.jav @@ -0,0 +1,8 @@ +class Expressions{ + +void test(){ + var x = 2; + x = x + 2; +} + +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/FC_Matrix.jav b/resources-back/bytecode/javFiles/FC_Matrix.jav new file mode 100644 index 0000000..75ead47 --- /dev/null +++ b/resources-back/bytecode/javFiles/FC_Matrix.jav @@ -0,0 +1,10 @@ +import java.util.Vector; + +class Matrix extends Vector> { + + methode(m) { + m.add(1); + Matrix i; + methode(i); + } + } diff --git a/resources-back/bytecode/javFiles/Fac.jav b/resources-back/bytecode/javFiles/Fac.jav new file mode 100644 index 0000000..1e09235 --- /dev/null +++ b/resources-back/bytecode/javFiles/Fac.jav @@ -0,0 +1,15 @@ +import java.lang.Integer; +import java.lang.Double; +import java.lang.String; + +public class Fac { + getFac(n) { + var res = 1; + var i = 1; + while (i <= n) { + res = res * i; + i++; + } + return res; + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/Faculty.jav b/resources-back/bytecode/javFiles/Faculty.jav new file mode 100644 index 0000000..276d8df --- /dev/null +++ b/resources-back/bytecode/javFiles/Faculty.jav @@ -0,0 +1,52 @@ +import java.lang.Integer; +//import java.lang.Long; +//import java.lang.Short; + +public class Faculty { + public fact; + Faculty() { + fact = (x) -> { + if (x == 1) { + return 1; + } + else { + return x * (fact.apply(x-1)); + } + }; + } + + + + public getFact(java.lang.Integer x) { + return fact.apply(x); + } +} +// m (x) { +// +//// var fact = (x) -> { +//// if (x == 1) { +//// return x; +//// } +//// else { +//// return x * (fact.apply(x-1)); +//// } +//// }; +//// return fact; +//// var x = 13; +//// if(x>22) { +//// return 0; +//// }else if(x <1){ +//// return x; +//// }else { +//// return 1; +//// } +// +// if (x < 0) { +// return 0; +// }else if(x<2) { +// return x; +// } else { +// return x * m(x-1); +// } +// } +//} diff --git a/resources-back/bytecode/javFiles/Faculty2.jav b/resources-back/bytecode/javFiles/Faculty2.jav new file mode 100644 index 0000000..828f06f --- /dev/null +++ b/resources-back/bytecode/javFiles/Faculty2.jav @@ -0,0 +1,10 @@ +class Faculty2 { + + m () { + + var fact = (Integer x) -> { + return x; + }; + return fact; + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/FacultyIf.jav b/resources-back/bytecode/javFiles/FacultyIf.jav new file mode 100644 index 0000000..3c36892 --- /dev/null +++ b/resources-back/bytecode/javFiles/FacultyIf.jav @@ -0,0 +1,17 @@ +import java.lang.Integer; + +class Faculty { + + m () { + + var fact = (Integer x) -> { + if (x == 1) { + return x; + } + else { + return x * (fact.apply(x-1)); + } + }; + return fact; + } +} diff --git a/resources-back/bytecode/javFiles/FacultyTyped.jav b/resources-back/bytecode/javFiles/FacultyTyped.jav new file mode 100644 index 0000000..089d2f3 --- /dev/null +++ b/resources-back/bytecode/javFiles/FacultyTyped.jav @@ -0,0 +1,19 @@ +import java.lang.Integer; + +class Faculty { + + Integer mul(Integer x, Integer y) { + return x; + } + + Fun1 m () { + var fact = (Integer x) -> { + return mul(x, fact.apply(x)); + }; + return fact; + } +} + +interface Fun1{ + B apply(A a); +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/Field.jav b/resources-back/bytecode/javFiles/Field.jav new file mode 100644 index 0000000..0fd1133 --- /dev/null +++ b/resources-back/bytecode/javFiles/Field.jav @@ -0,0 +1,9 @@ +import java.lang.Integer; + +public class Field { + public x = 5; + + m(){ + return x; + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/FieldAccess.jav b/resources-back/bytecode/javFiles/FieldAccess.jav new file mode 100644 index 0000000..894bb6e --- /dev/null +++ b/resources-back/bytecode/javFiles/FieldAccess.jav @@ -0,0 +1,13 @@ +class Box { +A f; +} +class B { + } + +class Box_Main extends B { + + m(b) { + b.f = new Box_Main(); + b.f = new B(); + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/FieldTph.jav b/resources-back/bytecode/javFiles/FieldTph.jav new file mode 100644 index 0000000..fc74e53 --- /dev/null +++ b/resources-back/bytecode/javFiles/FieldTph.jav @@ -0,0 +1,4 @@ +public class FieldTph { + a; + +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/FieldTph2.jav b/resources-back/bytecode/javFiles/FieldTph2.jav new file mode 100644 index 0000000..ed0d452 --- /dev/null +++ b/resources-back/bytecode/javFiles/FieldTph2.jav @@ -0,0 +1,14 @@ +import java.lang.String; + +public class FieldTph2 { + a; + + m(b){ + b = a; + return b; + } + + m2(c){ + a = c; + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/FieldTphConsMeth.jav b/resources-back/bytecode/javFiles/FieldTphConsMeth.jav new file mode 100644 index 0000000..cf195bd --- /dev/null +++ b/resources-back/bytecode/javFiles/FieldTphConsMeth.jav @@ -0,0 +1,26 @@ +public class FieldTphConsMeth { + + a; + public FieldTphConsMeth(c) { + a = id(c); + } + + id(b) { + return b; + } + + setA(x) { + a = x; + return a; + } + + m(x,y) { + x = id(y); + } + + /*m2(x,y) { + x = setA(y); + return x; + }*/ + +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/FieldTphMMeth.jav b/resources-back/bytecode/javFiles/FieldTphMMeth.jav new file mode 100644 index 0000000..ad97edc --- /dev/null +++ b/resources-back/bytecode/javFiles/FieldTphMMeth.jav @@ -0,0 +1,27 @@ +import java.lang.Boolean; + +public class FieldTphMMeth { + a; + + public FieldTphMMeth(c,d,e) { + a = m(c,d,e); + } + + m(b,d,e) { + if(e) { + return m3(b); + } else{ + return m3(d); + } + + } + + m2(b) { + a = m3(b); + } + + m3(b){ + return b; + } + +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/Fields.jav b/resources-back/bytecode/javFiles/Fields.jav new file mode 100644 index 0000000..cd2add7 --- /dev/null +++ b/resources-back/bytecode/javFiles/Fields.jav @@ -0,0 +1,11 @@ +import java.lang.String; + +class Fields{ +test2 = "test"; +test; +m(){ + var test3; + return test; +} + +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/For.jav b/resources-back/bytecode/javFiles/For.jav new file mode 100644 index 0000000..2d967f9 --- /dev/null +++ b/resources-back/bytecode/javFiles/For.jav @@ -0,0 +1,30 @@ +import java.lang.Integer; +import java.lang.Boolean; + +class For{ + Integer m(Integer x){ + var c = x + 2; + Boolean b = true; + c = 5; + c++; + ++c; + c--; + --c; + while(x<2){ + x = x +1; + b = false; + } + for(int i = 0; i<10; i++) { + x = x + 5; + } + return x; + } + +// m2(Integer x){ +// if(x<2) { +// return 1; +// }else { +// return 2; +// } +// } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/FunOL.jav b/resources-back/bytecode/javFiles/FunOL.jav new file mode 100644 index 0000000..60736e1 --- /dev/null +++ b/resources-back/bytecode/javFiles/FunOL.jav @@ -0,0 +1,12 @@ +import java.util.Vector; +import java.lang.Integer; +import java.lang.String; +//import java.lang.Byte; +//import java.lang.Boolean; + +public class FunOL { + + add(f, y) { + return f.apply() + y; + } +} diff --git a/resources-back/bytecode/javFiles/FunctionalInterface.jav b/resources-back/bytecode/javFiles/FunctionalInterface.jav new file mode 100644 index 0000000..62120fa --- /dev/null +++ b/resources-back/bytecode/javFiles/FunctionalInterface.jav @@ -0,0 +1,15 @@ +import java.lang.Integer; +import java.util.function.Function; + +public class FunctionalInterface { + Integer accept(Function f) { + return f.apply(20); + } + + Integer m() { + var v = accept(i -> { + return i * 10; + }); + return v; + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/Gen.jav b/resources-back/bytecode/javFiles/Gen.jav new file mode 100644 index 0000000..3b58b18 --- /dev/null +++ b/resources-back/bytecode/javFiles/Gen.jav @@ -0,0 +1,8 @@ +import java.lang.Integer; +import java.util.Vector; + +public class Gen{ + Vector m(Vector v){ + return v; + } +} diff --git a/resources-back/bytecode/javFiles/Generics.jav b/resources-back/bytecode/javFiles/Generics.jav new file mode 100644 index 0000000..bb7b2af --- /dev/null +++ b/resources-back/bytecode/javFiles/Generics.jav @@ -0,0 +1,17 @@ + +class Generics { + Generics(B b){ + } + B mt1(B b){ + return mt1(b); + } +} + + +/* +Problem: +auto test = new List(); +auto test2 = new List(); +... //code, welcher möglicherweise test und test2 vertauscht +test.add("hallo"); +*/ \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/Generics2.jav b/resources-back/bytecode/javFiles/Generics2.jav new file mode 100644 index 0000000..762890b --- /dev/null +++ b/resources-back/bytecode/javFiles/Generics2.jav @@ -0,0 +1,9 @@ +import java.lang.String; +import java.lang.Integer; + +class Generics2{ + B m1(B b){ + return b; + } + +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/Generics3.jav b/resources-back/bytecode/javFiles/Generics3.jav new file mode 100644 index 0000000..fb354d4 --- /dev/null +++ b/resources-back/bytecode/javFiles/Generics3.jav @@ -0,0 +1,7 @@ +import java.lang.String; +import java.lang.Integer; +import java.util.List; + +class Generics3> { + +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/Generics4.jav b/resources-back/bytecode/javFiles/Generics4.jav new file mode 100644 index 0000000..50b0b3e --- /dev/null +++ b/resources-back/bytecode/javFiles/Generics4.jav @@ -0,0 +1,12 @@ +import java.lang.String; +import java.lang.Integer; + +class Generics4 { + C m1(C b){ + return b; + } + + m2(x) { + return m1(x); + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/GreaterEqual.jav b/resources-back/bytecode/javFiles/GreaterEqual.jav new file mode 100644 index 0000000..3ec69e8 --- /dev/null +++ b/resources-back/bytecode/javFiles/GreaterEqual.jav @@ -0,0 +1,57 @@ +import java.lang.Integer; +import java.lang.Long; +import java.lang.Float; +import java.lang.Double; + +public class GreaterEqual { + + gE(Integer a, Integer b){ + var c = a>=b; + return c; + } + + gE(Long a, Long b){ + var c = a>=b; + return c; + } + + gE(Float a, Float b){ + var c = a>=b; + return c; + } + + gE(Double a, Double b){ + var c = a>=b; + return c; + } + + gE(Long a, Integer b){ + var c = a>=b; + return c; + } + + gE(Float a, Integer b){ + var c = a>=b; + return c; + } + + gE(Double a, Integer b){ + var c = a>=b; + return c; + } + + gE(Float a, Long b){ + var c = a>=b; + return c; + } + + gE(Double a, Long b){ + var c = a>=b; + return c; + } + + gE(Double a, Float b){ + var c = a>=b; + return c; + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/GreaterThan.jav b/resources-back/bytecode/javFiles/GreaterThan.jav new file mode 100644 index 0000000..9077f5b --- /dev/null +++ b/resources-back/bytecode/javFiles/GreaterThan.jav @@ -0,0 +1,56 @@ +import java.lang.Integer; +import java.lang.Long; +import java.lang.Float; +import java.lang.Double; + +public class GreaterThan { + gT(Integer a, Integer b){ + var c = a>b; + return c; + } + + gT(Long a, Long b){ + var c = a>b; + return c; + } + + gT(Float a, Float b){ + var c = a>b; + return c; + } + + gT(Double a, Double b){ + var c = a>b; + return c; + } + + gT(Long a, Integer b){ + var c = a>b; + return c; + } + + gT(Float a, Integer b){ + var c = a>b; + return c; + } + + gT(Double a, Integer b){ + var c = a>b; + return c; + } + + gT(Float a, Long b){ + var c = a>b; + return c; + } + + gT(Double a, Long b){ + var c = a>b; + return c; + } + + gT(Double a, Float b){ + var c = a>b; + return c; + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/HelloWorld.jav b/resources-back/bytecode/javFiles/HelloWorld.jav new file mode 100644 index 0000000..ff3df08 --- /dev/null +++ b/resources-back/bytecode/javFiles/HelloWorld.jav @@ -0,0 +1,9 @@ +import java.lang.System; +import java.lang.String; +import java.io.PrintStream; + +public class HelloWorld { + static hello() { + System.out.println("Hello World!"); + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/Id.jav b/resources-back/bytecode/javFiles/Id.jav new file mode 100644 index 0000000..f31991d --- /dev/null +++ b/resources-back/bytecode/javFiles/Id.jav @@ -0,0 +1,20 @@ +public class Id { +// a; +// id(b){ +// return b; +// } + id2 = x -> x; +// id2 = () -> { +// var x = m(a); +// var y = x; +// var z = y; +// }; +// +// m(a){ +// return a; +// } + id3 (x) { + return id2.apply(x); + } +} + diff --git a/resources-back/bytecode/javFiles/IfTest.jav b/resources-back/bytecode/javFiles/IfTest.jav new file mode 100644 index 0000000..bbcda96 --- /dev/null +++ b/resources-back/bytecode/javFiles/IfTest.jav @@ -0,0 +1,15 @@ +import java.lang.Integer; +import java.lang.Boolean; +import java.lang.String; + +public class IfTest{ + Integer m1(Boolean b) { + Integer i; + String b; + if(b) { + return i; + }else{ + return b; + } + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/Import.jav b/resources-back/bytecode/javFiles/Import.jav new file mode 100644 index 0000000..c658568 --- /dev/null +++ b/resources-back/bytecode/javFiles/Import.jav @@ -0,0 +1,8 @@ +import java.util.Vector; + +class Import { + void methode(){ + Vector v = new Vector<>(); + v.add("X"); + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/Inf.jav b/resources-back/bytecode/javFiles/Inf.jav new file mode 100644 index 0000000..6002994 --- /dev/null +++ b/resources-back/bytecode/javFiles/Inf.jav @@ -0,0 +1,65 @@ +public class Inf { + m(x,y,a){ + var z; + var v; + var w; + var b; + y=x; + z=x; + v=y; + w=y; + y=a; + b=a; + var c; + var d; + c = v; + d = v; + } +} + +/* +TPH M m(TPH N x, TPH O y, TPH P a)({ + TPH Q z; + TPH R v; + TPH S w; + TPH T b; + (y)::TPH O = (x)::TPH N; + (z)::TPH Q = (x)::TPH N; + (v)::TPH R = (y)::TPH O; + (w)::TPH S = (y)::TPH O; + (y)::TPH O = (a)::TPH P; + (b)::TPH T = (a)::TPH P; + TPH U c; + TPH V d; + (c)::TPH U = (v)::TPH R; + (d)::TPH V = (v)::TPH R; + return; +})::TPH W + + Inf()({ + super(()); + })::TPH Z + +} +// c::U d::V +// \ / +// v::R w::S +// \ / +// z::Q y::O b::T +// \ / \ / +// x::N a::P + +RESULT Final: [[(TPH N < TPH O), (TPH R < TPH V), (TPH N < TPH Q), (TPH P < TPH O), (TPH R < TPH U), (TPH M = void), (TPH O < TPH S), (TPH O < TPH R), (TPH P < TPH T)]] +Simplified constraints: [(TPH O < TPH S), (TPH P < TPH O), (TPH O < TPH R), (TPH P < TPH T), (TPH N < TPH O), (TPH N < TPH Q)] +m: [(TPH DDV = java.lang.Object), (TPH DDX = java.lang.Object), (TPH DDX < TPH DDV), (TPH N < TPH DDX), (TPH P < TPH DDX)] +Class Inf: [] +Inf: [] + +Unify nach Oder-Constraints-Anpassung: +UND:[(void =. M, , -1 WC: false, IT: false), (N <. O, 1 WC: false, IT: false, 1 WC: false, IT: false), (P <. O, 1 WC: false, IT: false, 1 WC: false, IT: false), (N <. Q, 1 WC: false, IT: false, 0 WC: true, IT: false), (O <. S, 1 WC: false, IT: false, 0 WC: true, IT: false), (O <. R, 1 WC: false, IT: false, 0 WC: true, IT: false), (P <. T, 1 WC: false, IT: false, 0 WC: true, IT: false)] +isInherited = false +isStatement = false + +ODER: +*/ + diff --git a/resources-back/bytecode/javFiles/Infimum.jav b/resources-back/bytecode/javFiles/Infimum.jav new file mode 100644 index 0000000..7c47539 --- /dev/null +++ b/resources-back/bytecode/javFiles/Infimum.jav @@ -0,0 +1,6 @@ +class Infimum { + m(x, y, z) { + y = x; + z = x; + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/Inherit.jav b/resources-back/bytecode/javFiles/Inherit.jav new file mode 100644 index 0000000..7b5927d --- /dev/null +++ b/resources-back/bytecode/javFiles/Inherit.jav @@ -0,0 +1,18 @@ +import java.util.Vector; + +import java.lang.Integer; +import java.lang.String; + + +public class Inherit { + + main(d, i) { + return d.m(i); + } + + main(v, i) { + var aa = v.elementAt(0); + return aa.m(i); + } + +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/Inherit2.jav b/resources-back/bytecode/javFiles/Inherit2.jav new file mode 100644 index 0000000..fe4c506 --- /dev/null +++ b/resources-back/bytecode/javFiles/Inherit2.jav @@ -0,0 +1,17 @@ +import java.util.Vector; + +import java.lang.Integer; +import java.lang.String; + + +public class Inherit2 { + + main(d) { + return d.m2(d); + } + + main(v) { + var aa = v.elementAt(0); + return aa.m2(aa); + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/InstanceOf.jav b/resources-back/bytecode/javFiles/InstanceOf.jav new file mode 100644 index 0000000..4cee01f --- /dev/null +++ b/resources-back/bytecode/javFiles/InstanceOf.jav @@ -0,0 +1,18 @@ +import java.lang.Number; +import java.lang.Integer; +import java.lang.Double; +import java.lang.String; + +public class InstanceOf { + main(n) { + if (n instanceof Integer i) { + takes(i); + return "Integer"; + } else if (n instanceof Double d) { + takes(d); + return "Double"; + } + } + + takes(i) {} // Should be overloaded +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/Interface1.jav b/resources-back/bytecode/javFiles/Interface1.jav new file mode 100644 index 0000000..b741819 --- /dev/null +++ b/resources-back/bytecode/javFiles/Interface1.jav @@ -0,0 +1,3 @@ +public interface Interface1{ + public void test(); +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/Interfaces.jav b/resources-back/bytecode/javFiles/Interfaces.jav new file mode 100644 index 0000000..0c4cd21 --- /dev/null +++ b/resources-back/bytecode/javFiles/Interfaces.jav @@ -0,0 +1,33 @@ +import java.lang.Integer; + +interface A { + void method1(); + default method2() { + } +} + +interface B { + void method3(); +} + +interface C { + Integer myInt(); +} + +class ClassX implements A { +} + +record ClassY(Integer myInt) implements C {} + +public class Interfaces implements A, B { + public void method1() { + } + public void method3() { + var intf = new Interfaces(); + intf = new ClassX(); + intf.method1(); + + C c = new ClassY(10); + c.myInt(); + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/KompTph.jav b/resources-back/bytecode/javFiles/KompTph.jav new file mode 100644 index 0000000..ec34e15 --- /dev/null +++ b/resources-back/bytecode/javFiles/KompTph.jav @@ -0,0 +1,13 @@ +public class KompTph { + public m(a, b, c) { + var d = a; + var e = a; + a = b; + c = b; + m2(a,c); + } + + public m2(a,b){ + m(a,a,b); + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/LamRunnable.jav b/resources-back/bytecode/javFiles/LamRunnable.jav new file mode 100644 index 0000000..451858f --- /dev/null +++ b/resources-back/bytecode/javFiles/LamRunnable.jav @@ -0,0 +1,9 @@ +public class LamRunnable{ + + public LamRunnable(){ + + Runnable lam = () -> {System.out.println("lambda");}; + lam.run(); + } +} + \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/Lambda.jav b/resources-back/bytecode/javFiles/Lambda.jav new file mode 100644 index 0000000..ba466b1 --- /dev/null +++ b/resources-back/bytecode/javFiles/Lambda.jav @@ -0,0 +1,11 @@ +import java.lang.Integer; + +public class Lambda { + + m () { + var lam1 = (x) -> { + return x; + }; + return lam1; + } +} diff --git a/resources-back/bytecode/javFiles/Lambda2.jav b/resources-back/bytecode/javFiles/Lambda2.jav new file mode 100644 index 0000000..92f32b7 --- /dev/null +++ b/resources-back/bytecode/javFiles/Lambda2.jav @@ -0,0 +1,35 @@ +import java.lang.String; + +public class Lambda2 +{ + public static void main(List args){ + var listOfStrings = new List(); + var listOfObjects; + listOfObjects = map(listOfStrings, (a) -> a); +} + +public map(a , b){ + b.apply(a); + return a; +} + +/* +public static List map(List input, Function func) { + List output; + output = new List(); + output.add(func.apply(input.get())); + return output; +} +*/ +} + +class List{ + /* A get(); + void add(A); + */ +} +/* +class Function{ + B apply(A a); +} +*/ \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/Lambda3.jav b/resources-back/bytecode/javFiles/Lambda3.jav new file mode 100644 index 0000000..9c4e960 --- /dev/null +++ b/resources-back/bytecode/javFiles/Lambda3.jav @@ -0,0 +1,23 @@ + +public class Lambda2 +{ + /* + public static List map(List input, + Function func){ + input.add(func.apply(input.get())); + } + */ + public map(input,func){ + input.add(func.apply(input.get())); + return map(new List(), func); + } +} + +class List{ + A get(); + void add(A); +} + +class Function{ + B apply(A a); +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/Lambda4.jav b/resources-back/bytecode/javFiles/Lambda4.jav new file mode 100644 index 0000000..378eb4d --- /dev/null +++ b/resources-back/bytecode/javFiles/Lambda4.jav @@ -0,0 +1,18 @@ +class Lambda{ + +methode(){ + return ((f) -> f); +} +} +/* +interface Fun0{ + A apply(); +} + +interface Fun1{ + A apply(B b); +} +*/ +interface Fun2{ + A apply(B b, C c); +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/LambdaCapture.jav b/resources-back/bytecode/javFiles/LambdaCapture.jav new file mode 100644 index 0000000..ab1751f --- /dev/null +++ b/resources-back/bytecode/javFiles/LambdaCapture.jav @@ -0,0 +1,12 @@ +import java.lang.Integer; +public class LambdaCapture { + Integer i = 8; + f; + public LambdaCapture(){ + Integer w = 7; + f = j ->{ + return w+i;}; + + } + +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/LambdaField.jav b/resources-back/bytecode/javFiles/LambdaField.jav new file mode 100644 index 0000000..4eb5373 --- /dev/null +++ b/resources-back/bytecode/javFiles/LambdaField.jav @@ -0,0 +1,6 @@ +public class LambdaField { + + f = x -> x; + +} + diff --git a/resources-back/bytecode/javFiles/LambdaRunnable.jav b/resources-back/bytecode/javFiles/LambdaRunnable.jav new file mode 100644 index 0000000..9dff3a8 --- /dev/null +++ b/resources-back/bytecode/javFiles/LambdaRunnable.jav @@ -0,0 +1,17 @@ +import java.lang.Runnable; +import java.lang.String; +import java.lang.System; +import java.io.PrintStream; + +public class LambdaRunnable { + + public LambdaRunnable(){ + + + Runnable lam = () -> { + System.out.println("Runnable is running"); + }; + lam.run(); + } +} + diff --git a/resources-back/bytecode/javFiles/LambdaVoid.jav b/resources-back/bytecode/javFiles/LambdaVoid.jav new file mode 100644 index 0000000..dc16fcb --- /dev/null +++ b/resources-back/bytecode/javFiles/LambdaVoid.jav @@ -0,0 +1,9 @@ +import java.lang.Integer; + +public class Lambda { + + m () { + var lam1 = (x) -> { }; + return lam1; + } +} diff --git a/resources-back/bytecode/javFiles/LessEqual.jav b/resources-back/bytecode/javFiles/LessEqual.jav new file mode 100644 index 0000000..2e3b702 --- /dev/null +++ b/resources-back/bytecode/javFiles/LessEqual.jav @@ -0,0 +1,56 @@ +import java.lang.Integer; +import java.lang.Long; +import java.lang.Float; +import java.lang.Double; + +public class LessEqual { + lessEqual(Integer a, Integer b){ + var c = a<=b; + return c; + } + + lessEqual(Long a, Long b){ + var c = a<=b; + return c; + } + + lessEqual(Float a, Float b){ + var c = a<=b; + return c; + } + + lessEqual(Double a, Double b){ + var c = a<=b; + return c; + } + + lessEqual(Long a, Integer b){ + var c = a<=b; + return c; + } + + lessEqual(Float a, Integer b){ + var c = a<=b; + return c; + } + + lessEqual(Double a, Integer b){ + var c = a<=b; + return c; + } + + lessEqual(Float a, Long b){ + var c = a<=b; + return c; + } + + lessEqual(Double a, Long b){ + var c = a<=b; + return c; + } + + lessEqual(Double a, Float b){ + var c = a<=b; + return c; + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/LessThan.jav b/resources-back/bytecode/javFiles/LessThan.jav new file mode 100644 index 0000000..04e1e83 --- /dev/null +++ b/resources-back/bytecode/javFiles/LessThan.jav @@ -0,0 +1,57 @@ +import java.lang.Integer; +import java.lang.Long; +import java.lang.Float; +import java.lang.Double; + +public class LessThan { + + lessThan(Integer a, Integer b){ + var c = a> { + + Matrix () { + } + + Matrix(vv) { + Integer i; + i = 0; + while(i < vv.size()) { +// Boolean a = this.add(vv.elementAt(i)); + this.add(vv.elementAt(i)); + i=i+1; + } + } + + mul(m) { + var ret = new Matrix(); + var i = 0; + while(i < size()) { + var v1 = this.elementAt(i); + var v2 = new Vector(); + var j = 0; + while(j < v1.size()) { + var erg = 0; + var k = 0; + while(k < v1.size()) { + erg = erg + v1.elementAt(k) + * m.elementAt(k).elementAt(j); + k++; } +// v2.addElement(new Integer(erg)); + v2.addElement(erg); + j++; } + ret.addElement(v2); + i++; + } + return ret; + } +} diff --git a/resources-back/bytecode/javFiles/MatrixOP.jav b/resources-back/bytecode/javFiles/MatrixOP.jav new file mode 100644 index 0000000..21d3734 --- /dev/null +++ b/resources-back/bytecode/javFiles/MatrixOP.jav @@ -0,0 +1,43 @@ +import java.util.Vector; +import java.lang.Integer; +//import java.lang.Byte; +import java.lang.Boolean; + +public class MatrixOP extends Vector> { + + MatrixOP () { + } + + MatrixOP(vv) { + Integer i; + i = 0; + while(i < vv.size()) { +// Boolean a = this.add(vv.elementAt(i)); + this.add(vv.elementAt(i)); + i=i+1; + } + } + + public mul = (m1, m2) -> { + var ret = new MatrixOP(); + var i = 0; + while(i < m1.size()) { + var v1 = m1.elementAt(i); + var v2 = new Vector(); + var j = 0; + while(j < v1.size()) { + var erg = 0; + var k = 0; + while(k < v1.size()) { + erg = erg + v1.elementAt(k) + * m2.elementAt(k).elementAt(j); + k++; } +// v2.addElement(new Integer(erg)); + v2.addElement(erg); + j++; } + ret.addElement(v2); + i++; + } + return ret; + }; +} diff --git a/resources-back/bytecode/javFiles/Merge.jav b/resources-back/bytecode/javFiles/Merge.jav new file mode 100644 index 0000000..ad5e103 --- /dev/null +++ b/resources-back/bytecode/javFiles/Merge.jav @@ -0,0 +1,20 @@ +import java.util.List; +import java.lang.Integer; +//import java.util.Collection; + +class Merge { + + merge(a, b) { + a.addAll(b); + return a; + } + + + + sort(in){ + var firstHalf = in.subList(1,2); + var secondHalf = in.subList(1,2); + return merge(sort(firstHalf), sort(secondHalf)); + } + +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/Meth_Gen.jav b/resources-back/bytecode/javFiles/Meth_Gen.jav new file mode 100644 index 0000000..056dd82 --- /dev/null +++ b/resources-back/bytecode/javFiles/Meth_Gen.jav @@ -0,0 +1,11 @@ +class Meth_Gen { + + m1(x, y) { + m2(x); + x = y; + } + + m2(y) { + m1(y, y); + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/MethodCallGenerics.jav b/resources-back/bytecode/javFiles/MethodCallGenerics.jav new file mode 100644 index 0000000..0d02509 --- /dev/null +++ b/resources-back/bytecode/javFiles/MethodCallGenerics.jav @@ -0,0 +1,14 @@ +import java.lang.String; + +class Generics { + // A mt1(A a, B b){ + B mt1(B a, B b){ + return mt1(a, a); + } +} + +class Test { + methode(String s){ + return new Generics().mt1(s,s); + } +} diff --git a/resources-back/bytecode/javFiles/MethodWildcardGen.jav b/resources-back/bytecode/javFiles/MethodWildcardGen.jav new file mode 100644 index 0000000..c982c44 --- /dev/null +++ b/resources-back/bytecode/javFiles/MethodWildcardGen.jav @@ -0,0 +1,21 @@ +/* +class C{ + A f; + m(b, c){ + c.f = b; + c.m(b, c); + } +} +*/ +class C{ + X f; + m(b, c, d){ + this.f = b; + this.f = c.f; + c.m2(d); + } + + m2(a){ + a.f = this.f; + } +} diff --git a/resources-back/bytecode/javFiles/Methods.jav b/resources-back/bytecode/javFiles/Methods.jav new file mode 100644 index 0000000..3c46739 --- /dev/null +++ b/resources-back/bytecode/javFiles/Methods.jav @@ -0,0 +1,14 @@ +import java.lang.Integer; + +class Methods { + + m(a,b){ + var c=a+b; + return c; + } + + method2(x){ + Integer i = this.m(x,2); + return i; + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/MethodsEasy.jav b/resources-back/bytecode/javFiles/MethodsEasy.jav new file mode 100644 index 0000000..ee6f9da --- /dev/null +++ b/resources-back/bytecode/javFiles/MethodsEasy.jav @@ -0,0 +1,7 @@ + +class Methods { + mt4(a,b,c) { return a.mt3(b).mt3(c) ; } + + mt3(a) {return a.mt3(a); } +} + diff --git a/resources-back/bytecode/javFiles/OL.jav b/resources-back/bytecode/javFiles/OL.jav new file mode 100644 index 0000000..afeaa2f --- /dev/null +++ b/resources-back/bytecode/javFiles/OL.jav @@ -0,0 +1,15 @@ +import java.lang.Double; +import java.lang.String; +import java.lang.Long; + +class OL { + m (x) { return x + x; } +} + +class OLMain { + main(x) { + var ol; + ol = new OL(); + return ol.m(x); + } +} diff --git a/resources-back/bytecode/javFiles/OLFun.jav b/resources-back/bytecode/javFiles/OLFun.jav new file mode 100644 index 0000000..50d30b7 --- /dev/null +++ b/resources-back/bytecode/javFiles/OLFun.jav @@ -0,0 +1,19 @@ +import java.lang.String; +import java.lang.Integer; +import java.lang.Double; +import java.util.Vector; +import java.lang.Boolean; + +public class OLFun { + + //f = x -> {return x + x;}; + m(f, x) { + x = f.apply(x+x); + return x; + } + + m2(y) { + m(x -> x * 2, y); + return; + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/OLFun2.jav b/resources-back/bytecode/javFiles/OLFun2.jav new file mode 100644 index 0000000..6b6f38a --- /dev/null +++ b/resources-back/bytecode/javFiles/OLFun2.jav @@ -0,0 +1,13 @@ +import java.lang.String; +import java.lang.Integer; +import java.lang.Double; +import java.util.Vector; +import java.lang.Boolean; + +public class OLFun2 { + + x; + m(f){ + x = f.apply(x + x); + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/Op.jav b/resources-back/bytecode/javFiles/Op.jav new file mode 100644 index 0000000..082f48d --- /dev/null +++ b/resources-back/bytecode/javFiles/Op.jav @@ -0,0 +1,16 @@ +import java.lang.Integer; +import java.lang.String; +import java.lang.Long; +import java.lang.Float; +import java.lang.Double; +import java.lang.Boolean; +import java.lang.Short; +import java.lang.Byte; + +public class Op { + + m(a, b) { + //var c = a+b; + return a+b; + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/Op1.jav b/resources-back/bytecode/javFiles/Op1.jav new file mode 100644 index 0000000..800f58b --- /dev/null +++ b/resources-back/bytecode/javFiles/Op1.jav @@ -0,0 +1,11 @@ +public class Op1{ + public Op1() { + + Runnable lam = () -> { + String test = ""; + String b = "b"; + test = b; + System.out.println(test);}; + //lam.run(); + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/Op2.jav b/resources-back/bytecode/javFiles/Op2.jav new file mode 100644 index 0000000..9d446eb --- /dev/null +++ b/resources-back/bytecode/javFiles/Op2.jav @@ -0,0 +1,11 @@ +import java.lang.Integer; +import java.lang.String; + +public class Op2 { + m(){ + var x = ""; + var a = 5+x; + + return a; + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/OverlaodGen.jav b/resources-back/bytecode/javFiles/OverlaodGen.jav new file mode 100644 index 0000000..d594649 --- /dev/null +++ b/resources-back/bytecode/javFiles/OverlaodGen.jav @@ -0,0 +1,11 @@ +import java.util.Vector; + +class OverlaodGen { + void method(Vector v) { +// Integer i = v.get(0); + } + + void method(Vector v) { +// String s = v.get(0); + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/OverloadPattern.jav b/resources-back/bytecode/javFiles/OverloadPattern.jav new file mode 100644 index 0000000..5e86416 --- /dev/null +++ b/resources-back/bytecode/javFiles/OverloadPattern.jav @@ -0,0 +1,50 @@ +import java.lang.Integer; +import java.lang.Number; +import java.lang.Float; + +record Point(Number x, Number y) {} + +public class OverloadPattern { + m(Point(Integer x, Integer y)) { + return x + y; + } + + m(Point(Float x, Float y)) { + return x * y; + } + + m(Integer x) { + return x; + } +} + +/* +public class OverloadPattern { + Integer m$Point$_$java$lang$Integer$_$java$lang$Integer$_$(Point point) { + var x = point.x(); + var y = point.y(); + return x + y; + } + + Float m$Point$_$java$lang$Float$_$java$lang$Float$_$(Point point) { + var x = point.x(); + var y = point.y(); + return x * y; + } + + Number m(Point point) { + return switch(point) { + case Point(Integer x, Integer y) -> + m$Point$_$java$lang$Integer$_$java$lang$Integer$_$(point); + case Point(Float x, Float y) -> + m$Point$_$java$lang$Float$_$java$lang$Float$_$(point); + default -> throw new IllegalArgumentException(); + } + } + + Integer m(Integer x) { + return x; + } +} + +*/ \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/Overloading.jav b/resources-back/bytecode/javFiles/Overloading.jav new file mode 100644 index 0000000..fb48fe0 --- /dev/null +++ b/resources-back/bytecode/javFiles/Overloading.jav @@ -0,0 +1,18 @@ +import java.lang.String; + +public class Overloading{ + + test(x){ + return x.methode(); + } + + methode(){ + return "Overloading"; + } +} + +public class Overloading2{ + methode(){ + return "Overloading2"; + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/Package.jav b/resources-back/bytecode/javFiles/Package.jav new file mode 100644 index 0000000..bbc1e51 --- /dev/null +++ b/resources-back/bytecode/javFiles/Package.jav @@ -0,0 +1,5 @@ +package strucType.input; + +class Neu +{ +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/Pair.jav b/resources-back/bytecode/javFiles/Pair.jav new file mode 100644 index 0000000..aacb8d4 --- /dev/null +++ b/resources-back/bytecode/javFiles/Pair.jav @@ -0,0 +1,32 @@ +import java.util.Vector; +import java.lang.Boolean; +import java.lang.Object; + +class Pair { + U a; + T b; + + make(x) { + var ret = new Pair<>(); + ret.a = x.elementAt(0); + ret.b = x.elementAt(1); + return ret; + } + /* + eq(a, b) { + b = a; + return a == b; + } + + compare( p) { + return eq(p.a, p.b); + //return p.a == p.b; + } + + void m(Pair p, List b) + { + //this.compare(p); //1, type incorrect + this.compare(this.make(b)); //2, OK + } +*/ +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/PairNoGenerics.jav b/resources-back/bytecode/javFiles/PairNoGenerics.jav new file mode 100644 index 0000000..e69de29 diff --git a/resources-back/bytecode/javFiles/Plus.jav b/resources-back/bytecode/javFiles/Plus.jav new file mode 100644 index 0000000..1cdecc8 --- /dev/null +++ b/resources-back/bytecode/javFiles/Plus.jav @@ -0,0 +1,9 @@ +import java.lang.Integer; +import java.lang.String; + +public class Plus { + + m(a,b) { + return a+b; + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/PostIncDec.jav b/resources-back/bytecode/javFiles/PostIncDec.jav new file mode 100644 index 0000000..29c2ef1 --- /dev/null +++ b/resources-back/bytecode/javFiles/PostIncDec.jav @@ -0,0 +1,27 @@ +import java.lang.Integer; + +public class PostIncDec { + m() { + var i = 0; + i++; + return i; + } + + m2() { + var i = 0; + var j = i++; + return j; + } + + d() { + var i = 0; + i--; + return i; + } + + d2() { + var i = 0; + var j = i--; + return j; + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/PreInc.jav b/resources-back/bytecode/javFiles/PreInc.jav new file mode 100644 index 0000000..011501f --- /dev/null +++ b/resources-back/bytecode/javFiles/PreInc.jav @@ -0,0 +1,28 @@ +import java.lang.Integer; + +public class PreInc { + m() { + var i = 0; + ++i; + return i; + } + + m2() { + var i = 0; + var j = ++i; + return j; + } + + d() { + var i = 0; + --i; + return i; + } + + d2() { + var i = 0; + var j = --i; + return j; + } + +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/Put.jav b/resources-back/bytecode/javFiles/Put.jav new file mode 100644 index 0000000..79a1cfa --- /dev/null +++ b/resources-back/bytecode/javFiles/Put.jav @@ -0,0 +1,19 @@ +import java.util.Vector; +import java.util.Stack; + +public class Put { + + putElement(ele, v) { + v.addElement(ele); + } + + putElement(ele, s) { + s.push(ele); + } + + + main(ele, x) { + putElement(ele, x); + } + +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/RecordTest.jav b/resources-back/bytecode/javFiles/RecordTest.jav new file mode 100644 index 0000000..c64c3d9 --- /dev/null +++ b/resources-back/bytecode/javFiles/RecordTest.jav @@ -0,0 +1,22 @@ +import java.lang.Integer; + +record Rec(Integer a, Integer b) {} + +/*public class Rec { + x; y; + Rec(Integer a, Integer b) { + x = a; + y = b; + } +}*/ + +public class RecordTest { + a = new Rec(10, 20); + b = new Rec(10, 20); + c = new Rec(20, 40); + + doesEqual() { return a.equals(b); } + doesNotEqual() { return b.equals(c); } + hashCode() { return a.hashCode(); } + toString() { return a.toString(); } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/RecursiveMeth.jav b/resources-back/bytecode/javFiles/RecursiveMeth.jav new file mode 100644 index 0000000..be35a43 --- /dev/null +++ b/resources-back/bytecode/javFiles/RecursiveMeth.jav @@ -0,0 +1,5 @@ +public class RecursiveMeth{ + public Integer test(){ + return this.test(); + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/RelOps.jav b/resources-back/bytecode/javFiles/RelOps.jav new file mode 100644 index 0000000..0fdd2cf --- /dev/null +++ b/resources-back/bytecode/javFiles/RelOps.jav @@ -0,0 +1,8 @@ +import java.lang.Integer; +import java.lang.Boolean; + +public class RelOps { + m(a,b){ + return a { + + Scalar(v) { + Integer i; + i = 0; + while(i < v.size()) { + this.add(v.elementAt(i)); + i=i+1; + } + } + + mul(v) { + var ret = 0; + var i = 0; + while(i < size()) { + ret = ret + this.elementAt(i) * v.elementAt(i); + i = i+1; + } + return ret; + } +} diff --git a/resources-back/bytecode/javFiles/SimpleCycle.jav b/resources-back/bytecode/javFiles/SimpleCycle.jav new file mode 100644 index 0000000..92f505b --- /dev/null +++ b/resources-back/bytecode/javFiles/SimpleCycle.jav @@ -0,0 +1,25 @@ +public class SimpleCycle { + + m(){ + var g; + var h; + g = h; + h = g; + /* + var y; + var z; + y=z; + z=y; + + var j = z; + var x; + b = a; + var c = b; + var f = d; + b = x; + var l = c; + a = l; + */ + } + +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/Sorting.jav b/resources-back/bytecode/javFiles/Sorting.jav new file mode 100644 index 0000000..345819d --- /dev/null +++ b/resources-back/bytecode/javFiles/Sorting.jav @@ -0,0 +1,23 @@ +import java.util.List; +import java.util.ArrayList; +import java.lang.String; + +public class Sorting{ + merge(a, b){ + a.addAll(b); + return a; + } + +sort(in){ + var firstHalf = in; + var secondHalf = in; + return merge(sort(firstHalf), sort(secondHalf)); +} + + + /* + void sort(a){ + a = merge(a,a); + } + */ +} diff --git a/resources-back/bytecode/javFiles/Static.jav b/resources-back/bytecode/javFiles/Static.jav new file mode 100644 index 0000000..aa0c337 --- /dev/null +++ b/resources-back/bytecode/javFiles/Static.jav @@ -0,0 +1,18 @@ +import java.lang.Integer; + +class Other { + static field = 20; +} + +public class Static { + static i = 20; + + static { + var x = 30; + i = x; + } + + static m() { + return i + Other.field; + } +} diff --git a/resources-back/bytecode/javFiles/StaticM.jav b/resources-back/bytecode/javFiles/StaticM.jav new file mode 100644 index 0000000..6689003 --- /dev/null +++ b/resources-back/bytecode/javFiles/StaticM.jav @@ -0,0 +1,10 @@ +public class StaticM { + + public static void m() { + System.out.println("Test"); + } + + public static void m2() { + m(); + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/SubMatrix.jav b/resources-back/bytecode/javFiles/SubMatrix.jav new file mode 100644 index 0000000..f761321 --- /dev/null +++ b/resources-back/bytecode/javFiles/SubMatrix.jav @@ -0,0 +1,13 @@ +import java.util.Vector; +import java.lang.Integer; + +public class Matrix2 extends Vector { + +} + +public class SubMatrix extends Matrix2 { + m(){ + Vector v = new Vector(); + v.add(1); + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/Subclass.jav b/resources-back/bytecode/javFiles/Subclass.jav new file mode 100644 index 0000000..fe6e920 --- /dev/null +++ b/resources-back/bytecode/javFiles/Subclass.jav @@ -0,0 +1,6 @@ +public class Subclass extends Superclass { + + public void printMethod() { + super.printMethod(); + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/Superclass.jav b/resources-back/bytecode/javFiles/Superclass.jav new file mode 100644 index 0000000..d58089d --- /dev/null +++ b/resources-back/bytecode/javFiles/Superclass.jav @@ -0,0 +1,6 @@ +public class Superclass { + + public void printMethod() { + System.out.println("Printed in Superclass."); + } +} diff --git a/resources-back/bytecode/javFiles/Switch.jav b/resources-back/bytecode/javFiles/Switch.jav new file mode 100644 index 0000000..9c0e741 --- /dev/null +++ b/resources-back/bytecode/javFiles/Switch.jav @@ -0,0 +1,17 @@ +import java.lang.Integer; +import java.lang.Object; +import java.lang.Float; + +record Rec(Integer a, Object b) {} + +public class Switch { + main(o) { + return switch (o) { + case Rec(Integer a, Integer b) -> a + b; + case Rec(Integer a, Float b) -> a + 10; + case Rec(Integer a, Rec(Integer b, Integer c)) -> a + b + c; + case Integer i -> i; + default -> 0; + }; + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/Switch2.jav b/resources-back/bytecode/javFiles/Switch2.jav new file mode 100644 index 0000000..c75aaa5 --- /dev/null +++ b/resources-back/bytecode/javFiles/Switch2.jav @@ -0,0 +1,13 @@ +import java.lang.Integer; + +record Point(x, y) {} + +class Switch2 { + m() { + var pt = new Point(10, 20); + return switch (pt) { + case Point(x, y) -> 10; + default -> 20; + }; + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/SwitchString.jav b/resources-back/bytecode/javFiles/SwitchString.jav new file mode 100644 index 0000000..e8758c2 --- /dev/null +++ b/resources-back/bytecode/javFiles/SwitchString.jav @@ -0,0 +1,14 @@ +import java.lang.Integer; +import java.lang.String; +import java.lang.Object; + +public class SwitchString { + main(o) { + return switch (o) { + case "AaAaAa" -> 1; // These two have the same hash code! + case "AaAaBB" -> 2; + case "test", "TEST" -> 3; + default -> 4; + }; + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/TXGenerics.jav b/resources-back/bytecode/javFiles/TXGenerics.jav new file mode 100644 index 0000000..8dd7ab7 --- /dev/null +++ b/resources-back/bytecode/javFiles/TXGenerics.jav @@ -0,0 +1,11 @@ +import java.lang.String; + +class TXGenerics { + a; + b; + + test() { + var c = new Cycle(); + c.m(a, b); + } +} diff --git a/resources-back/bytecode/javFiles/Tph.jav b/resources-back/bytecode/javFiles/Tph.jav new file mode 100644 index 0000000..3f9d0aa --- /dev/null +++ b/resources-back/bytecode/javFiles/Tph.jav @@ -0,0 +1,11 @@ +public class Tph { + + m(a,b){ + var c = m2(b); + return a; + } + + m2(b){ + return b; + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/Tph2.jav b/resources-back/bytecode/javFiles/Tph2.jav new file mode 100644 index 0000000..04ea5ba --- /dev/null +++ b/resources-back/bytecode/javFiles/Tph2.jav @@ -0,0 +1,6 @@ +public class Tph2 { + id = x->x; + id3 (x) { + return id.apply(x); + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/Tph3.jav b/resources-back/bytecode/javFiles/Tph3.jav new file mode 100644 index 0000000..553e274 --- /dev/null +++ b/resources-back/bytecode/javFiles/Tph3.jav @@ -0,0 +1,14 @@ +public class Tph3 { +// m(a,b){ +// var c = m2(a,b); +// return c; +// } +// +// m2(a,b){ +// return m(a,b); +// } + m1(x, y) { m2(x); x = y; + } + + m2(y) { m1(y, y); } +} diff --git a/resources-back/bytecode/javFiles/Tph4.jav b/resources-back/bytecode/javFiles/Tph4.jav new file mode 100644 index 0000000..58fe1d1 --- /dev/null +++ b/resources-back/bytecode/javFiles/Tph4.jav @@ -0,0 +1,12 @@ +public class Tph4{ + m(a,b){ + var c = m2(b); + var d = m2(c); + return d; + } + + m2(b){ + return b; + } + +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/Tph5.jav b/resources-back/bytecode/javFiles/Tph5.jav new file mode 100644 index 0000000..e73cfa2 --- /dev/null +++ b/resources-back/bytecode/javFiles/Tph5.jav @@ -0,0 +1,13 @@ +public class Tph5 { +// m(a,b,c){ +// a = c; +// b = c; +// return a; +// } + + m(x,y){ + x = m2(y); + } + + m2(y) { return y; } +} diff --git a/resources-back/bytecode/javFiles/Tph6.jav b/resources-back/bytecode/javFiles/Tph6.jav new file mode 100644 index 0000000..2f9e429 --- /dev/null +++ b/resources-back/bytecode/javFiles/Tph6.jav @@ -0,0 +1,14 @@ +public class Tph6 { +// m(a,b,c){ +// a = c; +// b = c; +// return a; +// } + + m(x,y){ + var c = m2(y); + c = m2(x); + } + + m2(y) { return y; } +} diff --git a/resources-back/bytecode/javFiles/Tph7.jav b/resources-back/bytecode/javFiles/Tph7.jav new file mode 100644 index 0000000..cc55afb --- /dev/null +++ b/resources-back/bytecode/javFiles/Tph7.jav @@ -0,0 +1,11 @@ +public class Tph7 { + + m(a,b){ + var c = m2(b); + return m2(b); + } + + m2(b){ + return b; + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/TypedID.jav b/resources-back/bytecode/javFiles/TypedID.jav new file mode 100644 index 0000000..aa88583 --- /dev/null +++ b/resources-back/bytecode/javFiles/TypedID.jav @@ -0,0 +1,12 @@ +public class TypedID/* */ { + + lam = x-> x; + + id(b){ + return b; + } + + m(){ + return lam; + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/Vector.jav b/resources-back/bytecode/javFiles/Vector.jav new file mode 100644 index 0000000..5c21cff --- /dev/null +++ b/resources-back/bytecode/javFiles/Vector.jav @@ -0,0 +1,23 @@ +import java.util.ArrayList; +import java.util.Vector; +import java.lang.Object; + +class MyVector{ + +id(x){ + Object i; + x.add(i); + x.add(i); + x.add(i); + x.add(i); + x.add(i); + x.add(i); + x.add(i); + x.add(i); + x.add(i); + x.add(i); + x.add(i); + x.add(i); + return x; +} +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/VectorAdd.jav b/resources-back/bytecode/javFiles/VectorAdd.jav new file mode 100644 index 0000000..2ad73aa --- /dev/null +++ b/resources-back/bytecode/javFiles/VectorAdd.jav @@ -0,0 +1,26 @@ +import java.util.Vector; +import java.lang.Integer; +import java.lang.String; + +public class VectorAdd { + vectorAdd(v1, v2) { + var i = 0; + v1 = new Vector(); + var erg = new Vector<>(); + while (i < v1.size()) { + erg.addElement(v1.elementAt(i) + v2.elementAt(i)); + i++; + } + return erg; + } + + m(x, y, z) { + x = new Vector(); + y = new Vector(); + x.add(1); + y.add("2"); + //Integer i = x.elementAt(0); + //String s = y.elementAt(0); + return z.addAll(x); + } +} diff --git a/resources-back/bytecode/javFiles/VectorSuper.jav b/resources-back/bytecode/javFiles/VectorSuper.jav new file mode 100644 index 0000000..fbadafb --- /dev/null +++ b/resources-back/bytecode/javFiles/VectorSuper.jav @@ -0,0 +1,11 @@ +import java.util.Vector; +import java.lang.Integer; + +public class VectorSuper { + + m(x){ + Integer y = 1; + x.addElement(y); + //return x; + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/VoidMeth.jav b/resources-back/bytecode/javFiles/VoidMeth.jav new file mode 100644 index 0000000..6b3ab21 --- /dev/null +++ b/resources-back/bytecode/javFiles/VoidMeth.jav @@ -0,0 +1,4 @@ +public class VoidMeth{ + public void test(){ + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/WC.jav b/resources-back/bytecode/javFiles/WC.jav new file mode 100644 index 0000000..389a4fc --- /dev/null +++ b/resources-back/bytecode/javFiles/WC.jav @@ -0,0 +1,8 @@ +import java.lang.Integer; +import java.util.List; +public class WC { + + void m (List a, List b) { + + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/While.jav b/resources-back/bytecode/javFiles/While.jav new file mode 100644 index 0000000..cd2139a --- /dev/null +++ b/resources-back/bytecode/javFiles/While.jav @@ -0,0 +1,12 @@ +import java.lang.Integer; +import java.lang.Long; +import java.lang.Double; + +public class While { + m(x) { + while(x < 2) { + x = x+1; + } + return x; + } +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/Y.jav b/resources-back/bytecode/javFiles/Y.jav new file mode 100644 index 0000000..a97360d --- /dev/null +++ b/resources-back/bytecode/javFiles/Y.jav @@ -0,0 +1,42 @@ +import java.lang.Integer; + +class Y { + y; + //factorial; + + Y() { + y = f -> t -> f.apply(y.apply(f)).apply(t); + //factorial = y.apply(f -> n -> { if (n == 0) return 1; else return n * f.apply(n - 1); }); + } + /* + getY() { + return y; + } + */ +} +/* +class fac1 { + factorial; + + fac1() { + var y; + y = new Y().getY(); + factorial = y.apply(f -> n -> { if (n == 0) return 1; else return n * f.apply(n - 1); }); + } +} + +ergibt Parse-Error +class fac1 { + factorial; + + fac1() { + var y; + y = new Y<>().y; + factorial = y.apply(f -> n -> { if (n == 0) return 1; else return n * f.apply(n - 1); }); + } + public static void main(String args[]) { + System.out.println(new fac1().factorial.apply(3)); + } + +} +*/ \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/applyLambda.jav b/resources-back/bytecode/javFiles/applyLambda.jav new file mode 100644 index 0000000..331bfbf --- /dev/null +++ b/resources-back/bytecode/javFiles/applyLambda.jav @@ -0,0 +1,16 @@ +import java.util.Vector; +class Apply { } + +public class applyLambda { + + m () { + var lam1 = (x) -> { + return x; + }; + + return lam1.apply(new Apply()); + //return lam1; + //return new Vector(); + } +} + diff --git a/resources-back/bytecode/javFiles/fc.jav b/resources-back/bytecode/javFiles/fc.jav new file mode 100644 index 0000000..b387cb9 --- /dev/null +++ b/resources-back/bytecode/javFiles/fc.jav @@ -0,0 +1,18 @@ +import java.util.List; + +class Test{ + methode(param1, param2, param3) { + param2.add(param3); + return param1.meth(param2); + } +} + +interface Klasse1{ + Klasse1 meth(p); + Klasse1 meth(Klasse2 p); +} + +interface Klasse2{ + Klasse1 meth(Klasse1 p); + Klasse2 meth(Klasse2 p); +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/mathStruc.jav b/resources-back/bytecode/javFiles/mathStruc.jav new file mode 100644 index 0000000..171881b --- /dev/null +++ b/resources-back/bytecode/javFiles/mathStruc.jav @@ -0,0 +1,15 @@ +import java.util.Vector; +import java.lang.Integer; + +public class mathStruc { + model; + + //Fun1*, Fun1*,MathStruc >> + innerOp = (o) -> (ms) -> new mathStruc<>(o.apply(model,ms.model)); + + public mathStruc(m) { + model =m; + //innerOp = (o) -> (ms) -> new mathStruc<>(o.apply(this.model,ms.model)); + } +} + diff --git a/resources-back/bytecode/javFiles/mathStrucInteger.jav b/resources-back/bytecode/javFiles/mathStrucInteger.jav new file mode 100644 index 0000000..f1f6755 --- /dev/null +++ b/resources-back/bytecode/javFiles/mathStrucInteger.jav @@ -0,0 +1,23 @@ +import java.util.Vector; +import java.lang.Integer; + +public class mathStrucInteger { + model; + + innerOp = (o) -> (ms) -> new mathStrucInteger<>(o.apply(model,ms.model)); + + public mathStrucInteger(m) { + model =m; + } +} + +class mathStrucIntegerUse { + + main() { + var ms; + ms = new mathStrucInteger<>(2); + var ms2; + ms2 = ms.innerOp.apply((x,y) -> x+y).apply(ms); + return ms2; + } +} diff --git a/resources-back/bytecode/javFiles/mathStrucMatrixOP.jav b/resources-back/bytecode/javFiles/mathStrucMatrixOP.jav new file mode 100644 index 0000000..2b24f03 --- /dev/null +++ b/resources-back/bytecode/javFiles/mathStrucMatrixOP.jav @@ -0,0 +1,91 @@ +//PL 2019-10-24: laeuft nicht durch, zu gross +import java.util.Vector; +import java.lang.Integer; +import java.lang.Boolean; + +public class mathStrucMatrixOP { + model; + + innerOp = (o) -> (ms) -> new mathStrucMatrixOP<>(o.apply(model,ms.model)); + + public mathStrucMatrixOP(m) { + model =m; + } +} + +public class MatrixOP extends Vector> { + + MatrixOP () { + } + + MatrixOP(vv) { + Integer i; + i = 0; + while(i < vv.size()) { +// Boolean a = this.add(vv.elementAt(i)); + this.add(vv.elementAt(i)); + i=i+1; + } + } + + public mul = (m1, m2) -> { + var ret = new MatrixOP(); + var i = 0; + while(i < m1.size()) { + var v1 = m1.elementAt(i); + var v2 = new Vector(); + var j = 0; + while(j < v1.size()) { + var erg = 0; + var k = 0; + while(k < v1.size()) { + erg = erg + v1.elementAt(k) + * m2.elementAt(k).elementAt(j); + k++; } +// v2.addElement(new Integer(erg)); + v2.addElement(erg); + j++; } + ret.addElement(v2); + i++; + } + return ret; + }; +} + + +class mathStrucUseMatrixOP { + + main() { + Vector> vv = new Vector>(); + Vector v1 = new Vector(); + v1.addElement(2); + v1.addElement(2); + Vector v2 = new Vector(); + v2.addElement(3); + v2.addElement(3); + vv.addElement(v1); + vv.addElement(v2); + + MatrixOP m1 = new MatrixOP(vv); + + Vector> vv1 = new Vector>(); + Vector v3 = new Vector(); + v3.addElement(2); + v3.addElement(2); + Vector v4 = new Vector(); + v4.addElement(3); + v4.addElement(3); + vv1.addElement(v3); + vv1.addElement(v4); + + MatrixOP m2 = new MatrixOP(vv1); + + var mms; + mms = new mathStrucMatrixOP<>(m1); + var mms2; + mms2 = new mathStrucMatrixOP<>(m2); + var mms3; + mms3 = mms.innerOp.apply(m1.mul).apply(mms2); + return mms3; + } +} diff --git a/resources-back/bytecode/javFiles/test.jav b/resources-back/bytecode/javFiles/test.jav new file mode 100644 index 0000000..303d167 --- /dev/null +++ b/resources-back/bytecode/javFiles/test.jav @@ -0,0 +1,15 @@ +class Test{ + methode(param1, param2, param3) { + return param1.meth(param2.meth(param3)); + } +} + +interface Klasse1{ + Klasse1 meth(Klasse1 p); + Klasse1 meth(Klasse2 p); +} + +interface Klasse2{ + Klasse1 meth(Klasse1 p); + Klasse2 meth(Klasse2 p); +} \ No newline at end of file diff --git a/resources-back/bytecode/javFiles/test1.jav b/resources-back/bytecode/javFiles/test1.jav new file mode 100644 index 0000000..4b34948 --- /dev/null +++ b/resources-back/bytecode/javFiles/test1.jav @@ -0,0 +1,7 @@ +class Faculty { + + int a; + m (int x) { + return a+x; + } +} diff --git a/resources-back/insertGenerics/javFiles/TestAny.jav b/resources-back/insertGenerics/javFiles/TestAny.jav new file mode 100644 index 0000000..86c0ceb --- /dev/null +++ b/resources-back/insertGenerics/javFiles/TestAny.jav @@ -0,0 +1,13 @@ +class TestAny { + a; + b = a; + anyMethod() { + var f; + return f; + } + otherMethod(e) { + b = e; + e = a; + return e; + } +} \ No newline at end of file diff --git a/resources-back/insertGenerics/javFiles/TestAssign.jav b/resources-back/insertGenerics/javFiles/TestAssign.jav new file mode 100644 index 0000000..d401641 --- /dev/null +++ b/resources-back/insertGenerics/javFiles/TestAssign.jav @@ -0,0 +1,9 @@ +class TestAssign { + assign(x, y) { + x = y; + } + + assign2(x, y) { + assign(x, y); + } +} \ No newline at end of file diff --git a/resources-back/insertGenerics/javFiles/TestClassField.jav b/resources-back/insertGenerics/javFiles/TestClassField.jav new file mode 100644 index 0000000..f3d24e5 --- /dev/null +++ b/resources-back/insertGenerics/javFiles/TestClassField.jav @@ -0,0 +1,6 @@ +class Example{ + f; + fReturn(){ + return f; + } +} \ No newline at end of file diff --git a/resources-back/insertGenerics/javFiles/TestContraVariant.jav b/resources-back/insertGenerics/javFiles/TestContraVariant.jav new file mode 100644 index 0000000..9c060f0 --- /dev/null +++ b/resources-back/insertGenerics/javFiles/TestContraVariant.jav @@ -0,0 +1,38 @@ +public class TestContraVariant { + main(x, y) { + var y2 = m(x, y); + var y3 = y2.snd(); + var z; + y3 = z; + return new Pair<>(x, z); + } + + m(x, y) { + var x2 = main(x, y); + var x3 = x2.fst(); + var z; + x3 = z; + return new Pair<>(z, y); + } +} + +class Pair { + public T x; + public U y; + + public Pair() { + } + + public Pair(T var1, U var2) { + x = var1; + y = var2; + } + + public T fst() { + return x; + } + + public U snd() { + return y; + } +} \ No newline at end of file diff --git a/resources-back/insertGenerics/javFiles/TestGGFinder.jav b/resources-back/insertGenerics/javFiles/TestGGFinder.jav new file mode 100644 index 0000000..cc94cad --- /dev/null +++ b/resources-back/insertGenerics/javFiles/TestGGFinder.jav @@ -0,0 +1,17 @@ +public class TestGGFinder { + a; + + id(b) { + var c = b; + return c; + } + + setA(x) { + a = x; + return a; + } + + m(x,y) { + x = id(y); + } +} \ No newline at end of file diff --git a/resources-back/insertGenerics/javFiles/TestLocalVarLambda.jav b/resources-back/insertGenerics/javFiles/TestLocalVarLambda.jav new file mode 100644 index 0000000..ab4455c --- /dev/null +++ b/resources-back/insertGenerics/javFiles/TestLocalVarLambda.jav @@ -0,0 +1,7 @@ +public class TestLocalVarLambda { + +m(x) { + var id = z -> z; + return id.apply(x); + } +} \ No newline at end of file diff --git a/resources-back/insertGenerics/javFiles/TestMutualRecursion.jav b/resources-back/insertGenerics/javFiles/TestMutualRecursion.jav new file mode 100644 index 0000000..60ce72c --- /dev/null +++ b/resources-back/insertGenerics/javFiles/TestMutualRecursion.jav @@ -0,0 +1,17 @@ +public class TestMutualRecursion { + a; + + id(b) { + var c = b; + return main(b,c); + } + + m(x,y) { + x = id(y); + return x; + } + + main(x,y) { + return m(id(x),y); + } +} \ No newline at end of file diff --git a/resources-back/insertGenerics/javFiles/TestMutualRecursionWithField.jav b/resources-back/insertGenerics/javFiles/TestMutualRecursionWithField.jav new file mode 100644 index 0000000..82dc42d --- /dev/null +++ b/resources-back/insertGenerics/javFiles/TestMutualRecursionWithField.jav @@ -0,0 +1,22 @@ +public class TestMutualRecursionWithField { + a; + + id(b) { + var c = b; + return main(b,c); + } + + setA(x) { + a = x; + return a; + } + + m(x,y) { + x = id(y); + return x; + } + + main(x,y) { + return m(id(x),setA(y)); + } +} \ No newline at end of file diff --git a/resources-back/insertGenerics/javFiles/TestMutualRecursionWithField2.jav b/resources-back/insertGenerics/javFiles/TestMutualRecursionWithField2.jav new file mode 100644 index 0000000..727e603 --- /dev/null +++ b/resources-back/insertGenerics/javFiles/TestMutualRecursionWithField2.jav @@ -0,0 +1,22 @@ +public class TestMutualRecursionWithField2 { + a; + + id(b) { + var c = b; + return main(b,c); + } + + setA(x) { + a = x; + return a; + } + + m(x,y) { + x = id(y); + return x; + } + + main(x,y) { + return m(setA(x),id(y)); + } +} \ No newline at end of file diff --git a/resources-back/insertGenerics/javFiles/TestMutualRecursionWithField3.jav b/resources-back/insertGenerics/javFiles/TestMutualRecursionWithField3.jav new file mode 100644 index 0000000..24e0989 --- /dev/null +++ b/resources-back/insertGenerics/javFiles/TestMutualRecursionWithField3.jav @@ -0,0 +1,23 @@ +public class TestMutualRecursionWithField3 { + a; + + id(b) { + var c = b; + return main(b,c); + } + + setA(x) { + a = x; + return a; + } + + m(x,y) { + x = id(y); + return x; + } + + main(x,y) { + var z = m(setA(x),id(y)); + return z; + } +} \ No newline at end of file diff --git a/resources-back/insertGenerics/javFiles/TestReturnVar.jav b/resources-back/insertGenerics/javFiles/TestReturnVar.jav new file mode 100644 index 0000000..0688e5b --- /dev/null +++ b/resources-back/insertGenerics/javFiles/TestReturnVar.jav @@ -0,0 +1,6 @@ +class VarReturn { + anyMethod() { + var f; + return f; + } +} \ No newline at end of file diff --git a/resources-back/insertGenerics/javFiles/TestSecondLineOfClassConstraints.jav b/resources-back/insertGenerics/javFiles/TestSecondLineOfClassConstraints.jav new file mode 100644 index 0000000..16275a5 --- /dev/null +++ b/resources-back/insertGenerics/javFiles/TestSecondLineOfClassConstraints.jav @@ -0,0 +1,12 @@ +class Example { + a; + b = a; + anyMethod() { + var f; + return f; + } + otherMethod(e) { + e = a; + return e; + } +} \ No newline at end of file diff --git a/resources-back/insertGenerics/javFiles/TestTPHsAndGenerics.jav b/resources-back/insertGenerics/javFiles/TestTPHsAndGenerics.jav new file mode 100644 index 0000000..33a79e5 --- /dev/null +++ b/resources-back/insertGenerics/javFiles/TestTPHsAndGenerics.jav @@ -0,0 +1,13 @@ +class TPHsAndGenerics { + id = x -> x; + id2 (x) { + return id.apply(x); + } + m(a, b){ + var c = m2(a,b); + return a; + } + m2(a, b){ + return b; + } +} \ No newline at end of file diff --git a/resources-back/insertGenerics/javFiles/TestTPHsAndGenerics2.jav b/resources-back/insertGenerics/javFiles/TestTPHsAndGenerics2.jav new file mode 100644 index 0000000..2a75e82 --- /dev/null +++ b/resources-back/insertGenerics/javFiles/TestTPHsAndGenerics2.jav @@ -0,0 +1,14 @@ +class TPHsAndGenerics2 { + id = x -> x; + id2 (x) { + return id.apply(x); + } + m(a, b){ + var c = m2(a,b); + return a; + } + m2(a, b){ + return b; + } + +} \ No newline at end of file diff --git a/resources-back/insertGenerics/javFiles/TestThreeArgs.jav b/resources-back/insertGenerics/javFiles/TestThreeArgs.jav new file mode 100644 index 0000000..fe22dd3 --- /dev/null +++ b/resources-back/insertGenerics/javFiles/TestThreeArgs.jav @@ -0,0 +1,15 @@ +public class TestThreeArgs { + a; + + id(b) { + var a /* = null */; + var c = b; + m(a,a,b); + return c; + } + + m(x,y, z) { + x = id(y); + return x; + } +} \ No newline at end of file diff --git a/resources-back/insertGenerics/javFiles/TestTwoArgs.jav b/resources-back/insertGenerics/javFiles/TestTwoArgs.jav new file mode 100644 index 0000000..b4754fe --- /dev/null +++ b/resources-back/insertGenerics/javFiles/TestTwoArgs.jav @@ -0,0 +1,29 @@ +public class TestTwoArgs // +{ + //AS + a; + + //AN -> AN + id(b) { + var c = b; + return c; + } + + //T -> AS + setA(x) { + a = x; + return a; + } + + //(AG,Z) -> AG + m(x,y) { + x = id(y); + return x; + } + + // (AI, AH) -> AG + main(x,y) { + return m(id(x),setA(y)); + } +} + diff --git a/resources-back/insertGenerics/javFiles/TestTwoArgs2.jav b/resources-back/insertGenerics/javFiles/TestTwoArgs2.jav new file mode 100644 index 0000000..f8c270a --- /dev/null +++ b/resources-back/insertGenerics/javFiles/TestTwoArgs2.jav @@ -0,0 +1,17 @@ +public class TestTwoArgs2 { + a; + + id(b) { + var c = b; + return c; + } + + m(x,y) { + x = id(y); + return x; + } + + main(x,y) { + return m(id(x),m(x,y)); + } +} \ No newline at end of file diff --git a/resources-back/insertGenerics/javFiles/TestTwoCalls.jav b/resources-back/insertGenerics/javFiles/TestTwoCalls.jav new file mode 100644 index 0000000..e3f0cfc --- /dev/null +++ b/resources-back/insertGenerics/javFiles/TestTwoCalls.jav @@ -0,0 +1,14 @@ +public class TestTwoCalls { + + // O -> O + id(b) { + var c = b; + return c; + } + + // (S, T) -> T + main(x,y) { + id(x); + return id(y); + } +} \ No newline at end of file diff --git a/resources-back/insertGenerics/javFiles/TestVector.jav b/resources-back/insertGenerics/javFiles/TestVector.jav new file mode 100644 index 0000000..5f29c83 --- /dev/null +++ b/resources-back/insertGenerics/javFiles/TestVector.jav @@ -0,0 +1,12 @@ +import java.util.Vector; + +public class TestVector { + + m(v, w) { + w.addElement(id(v.elementAt(0))); + } + + id(x) { + return x; + } +} diff --git a/resources-back/insertGenerics/javFiles/TestVectorArg.jav b/resources-back/insertGenerics/javFiles/TestVectorArg.jav new file mode 100644 index 0000000..ca29f82 --- /dev/null +++ b/resources-back/insertGenerics/javFiles/TestVectorArg.jav @@ -0,0 +1,12 @@ +import java.util.Vector; + +public class TestVectorArg { + + add(v, e) { + v.addElement(e); + } + + main(v, e) { + add(v, e); + } +} \ No newline at end of file diff --git a/resources-back/insertGenerics/javFiles/TestVoidMeth.jav b/resources-back/insertGenerics/javFiles/TestVoidMeth.jav new file mode 100644 index 0000000..50ee720 --- /dev/null +++ b/resources-back/insertGenerics/javFiles/TestVoidMeth.jav @@ -0,0 +1,4 @@ +class VoidMeth { + anyMethod() { + } +} \ No newline at end of file diff --git a/resources-back/packageTest/pkg/sub/Cycle1.jav b/resources-back/packageTest/pkg/sub/Cycle1.jav new file mode 100644 index 0000000..79267a0 --- /dev/null +++ b/resources-back/packageTest/pkg/sub/Cycle1.jav @@ -0,0 +1,11 @@ +package pkg.sub; + +import java.lang.Integer; +import pkg.sub2.Cycle2; + +public class Cycle1 { + test() { + var cycle2 = new Cycle2(); + cycle2.test(); + } +} \ No newline at end of file diff --git a/resources-back/packageTest/pkg/sub/Test1.jav b/resources-back/packageTest/pkg/sub/Test1.jav new file mode 100644 index 0000000..7acebfb --- /dev/null +++ b/resources-back/packageTest/pkg/sub/Test1.jav @@ -0,0 +1,11 @@ +package pkg.sub; + +import pkg.sub2.Test2; + +public class Test1 { + + main() { + var t2 = new Test2(); + t2.test(); + } +} \ No newline at end of file diff --git a/resources-back/packageTest/pkg/sub2/Cycle2.jav b/resources-back/packageTest/pkg/sub2/Cycle2.jav new file mode 100644 index 0000000..8a13e10 --- /dev/null +++ b/resources-back/packageTest/pkg/sub2/Cycle2.jav @@ -0,0 +1,11 @@ +package pkg.sub2; + +import java.lang.Integer; +import pkg.sub.Cycle1; + +public class Cycle2 { + test() { + var cycle1 = new Cycle1(); + cycle1.test(); + } +} \ No newline at end of file diff --git a/resources-back/packageTest/pkg/sub2/Test2.jav b/resources-back/packageTest/pkg/sub2/Test2.jav new file mode 100644 index 0000000..a7f8927 --- /dev/null +++ b/resources-back/packageTest/pkg/sub2/Test2.jav @@ -0,0 +1,6 @@ +package pkg.sub2; + +public class Test2 { + + test() {} +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/BinaryInMeth.ast b/resources-back/syntaxtreegenerator/BinaryInMeth.ast new file mode 100644 index 0000000..5bb1379 --- /dev/null +++ b/resources-back/syntaxtreegenerator/BinaryInMeth.ast @@ -0,0 +1,22 @@ +class BinaryInMeth { + +BinaryInMeth(){ + super(()); + } + TPH CMNB m(TPH CMNC a){ + return ++a; + } + + TPH CMNF m2(TPH CMNG a, TPH CMNH b){ + return this.m Signature: [TPH CMNK, TPH CMNL](a op b); + } + + TPH CMNP m3(TPH CMNQ a){ + return this.m Signature: [TPH CMNT, TPH CMNU](++a); + } + + BinaryInMeth(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/Box.ast b/resources-back/syntaxtreegenerator/Box.ast new file mode 100644 index 0000000..1bc437b --- /dev/null +++ b/resources-back/syntaxtreegenerator/Box.ast @@ -0,0 +1,25 @@ +class B { + +B(){ + super(()); + } + B(){ + super(()); + } + +}class Box_Main { + +Box_Main(){ + super(()); + } + TPH T m(TPH U b){ + b.m Signature: [TPH W, TPH X](new Box_Main()); + b.m Signature: [TPH AB, TPH AC](new B()); + return; + } + + Box_Main(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/ClassGenLam.ast b/resources-back/syntaxtreegenerator/ClassGenLam.ast new file mode 100644 index 0000000..30b4345 --- /dev/null +++ b/resources-back/syntaxtreegenerator/ClassGenLam.ast @@ -0,0 +1,14 @@ +class ClassGenLam { + + TPH HWDB lam; +ClassGenLam(){ + super(()); + this.lam = (TPH HWDC x) -> { + return x; + }; + } + ClassGenLam(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/Cycle.ast b/resources-back/syntaxtreegenerator/Cycle.ast new file mode 100644 index 0000000..18b435a --- /dev/null +++ b/resources-back/syntaxtreegenerator/Cycle.ast @@ -0,0 +1,16 @@ +class Cycle { + +Cycle(){ + super(()); + } + TPH GGXG m(TPH GGXH x, TPH GGXI y){ + y = x; + x = y; + return; + } + + Cycle(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/Fac.ast b/resources-back/syntaxtreegenerator/Fac.ast new file mode 100644 index 0000000..b15ecdd --- /dev/null +++ b/resources-back/syntaxtreegenerator/Fac.ast @@ -0,0 +1,22 @@ +class Fac { + +Fac(){ + super(()); + } + TPH BSTE getFac(TPH BSTF n){ + TPH BSTG res; + res = 1; + TPH BSTI i; + i = 1; + while(i op n){ + res = res op i; + i++; + }; + return res; + } + + Fac(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/Faculty.ast b/resources-back/syntaxtreegenerator/Faculty.ast new file mode 100644 index 0000000..66c777a --- /dev/null +++ b/resources-back/syntaxtreegenerator/Faculty.ast @@ -0,0 +1,25 @@ +class Faculty { + + TPH DDAL fact; +Faculty(){ + super(()); + } + TPH DDBK getFact(java.lang.Integer x){ + return this.fact.apply Signature: [TPH DDBM, TPH DDBN](x); + } + + Faculty(){ + super(()); + this.fact = (TPH DDAO x) -> { + if(x op 1) + { + return 1; + } + else + { + return x op this.fact.apply Signature: [TPH DDAW, TPH DDAX](x op 1); + }; + }; + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/Field.ast b/resources-back/syntaxtreegenerator/Field.ast new file mode 100644 index 0000000..43ffa1a --- /dev/null +++ b/resources-back/syntaxtreegenerator/Field.ast @@ -0,0 +1,16 @@ +class Field { + + TPH JBCG x; +Field(){ + super(()); + this.x = 5; + } + TPH JBCJ m(){ + return this.x; + } + + Field(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/FieldTph2.ast b/resources-back/syntaxtreegenerator/FieldTph2.ast new file mode 100644 index 0000000..23c7c16 --- /dev/null +++ b/resources-back/syntaxtreegenerator/FieldTph2.ast @@ -0,0 +1,21 @@ +class FieldTph2 { + + TPH DJBG a; +FieldTph2(){ + super(()); + } + TPH DJBH m(TPH DJBI b){ + b = this.a; + return b; + } + + TPH DJBL m2(TPH DJBM c){ + this.a = c; + return; + } + + FieldTph2(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/FieldTphConsMeth.ast b/resources-back/syntaxtreegenerator/FieldTphConsMeth.ast new file mode 100644 index 0000000..9ada601 --- /dev/null +++ b/resources-back/syntaxtreegenerator/FieldTphConsMeth.ast @@ -0,0 +1,27 @@ +class FieldTphConsMeth { + + TPH AINS a; +FieldTphConsMeth(){ + super(()); + } + TPH AIOE id(TPH AIOF b){ + return b; + } + + TPH AIOH setA(TPH AIOI x){ + this.a = x; + return this.a; + } + + TPH AIOM m(TPH AION x, TPH AIOO y){ + x = this.id Signature: [TPH AIOQ, TPH AIOR](y); + return; + } + + FieldTphConsMeth(TPH AINU c){ + super(()); + this.a = this.id Signature: [TPH AINX, TPH AINY](c); + return; + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/FieldTphMMeth.ast b/resources-back/syntaxtreegenerator/FieldTphMMeth.ast new file mode 100644 index 0000000..3a0cacd --- /dev/null +++ b/resources-back/syntaxtreegenerator/FieldTphMMeth.ast @@ -0,0 +1,33 @@ +class FieldTphMMeth { + + TPH HBWQ a; +FieldTphMMeth(){ + super(()); + } + TPH HBXG m(TPH HBXH b, TPH HBXI d, TPH HBXJ e){ + if(e) + { + return this.m3 Signature: [TPH HBXL, TPH HBXM](b); + } + else + { + return this.m3 Signature: [TPH HBXR, TPH HBXS](d); + }; + } + + TPH HBXY m2(TPH HBXZ b){ + this.a = this.m3 Signature: [TPH HBYC, TPH HBYD](b); + return; + } + + TPH HBYH m3(TPH HBYI b){ + return b; + } + + FieldTphMMeth(TPH HBWS c, TPH HBWT d, TPH HBWU e){ + super(()); + this.a = this.m Signature: [TPH HBWX, TPH HBWY, TPH HBWZ, TPH HBXA](c, d, e); + return; + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/Gen.ast b/resources-back/syntaxtreegenerator/Gen.ast new file mode 100644 index 0000000..20f5484 --- /dev/null +++ b/resources-back/syntaxtreegenerator/Gen.ast @@ -0,0 +1,14 @@ +class Gen { + +Gen(){ + super(()); + } + java.util.Vector m(java.util.Vector v){ + return v; + } + + Gen(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/Id.ast b/resources-back/syntaxtreegenerator/Id.ast new file mode 100644 index 0000000..4b375d2 --- /dev/null +++ b/resources-back/syntaxtreegenerator/Id.ast @@ -0,0 +1,18 @@ +class Id { + + TPH BDGF id2; +Id(){ + super(()); + this.id2 = (TPH BDGG x) -> { + return x; + }; + } + TPH BDGM id3(TPH BDGN x){ + return this.id2.apply Signature: [TPH BDGP, TPH BDGQ](x); + } + + Id(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/Inf.ast b/resources-back/syntaxtreegenerator/Inf.ast new file mode 100644 index 0000000..5425c25 --- /dev/null +++ b/resources-back/syntaxtreegenerator/Inf.ast @@ -0,0 +1,28 @@ +class Inf { + +Inf(){ + super(()); + } + TPH KYAM m(TPH KYAN x, TPH KYAO y, TPH KYAP a){ + TPH KYAQ z; + TPH KYAR v; + TPH KYAS w; + TPH KYAT b; + y = x; + z = x; + v = y; + w = y; + y = a; + b = a; + TPH KYAU c; + TPH KYAV d; + c = v; + d = v; + return; + } + + Inf(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/Instanceof.ast b/resources-back/syntaxtreegenerator/Instanceof.ast new file mode 100644 index 0000000..29d0754 --- /dev/null +++ b/resources-back/syntaxtreegenerator/Instanceof.ast @@ -0,0 +1,44 @@ +class Instanceof { + +Instanceof(){ + super(()); + } + void checkInstanceof(){ + TPH a; + a = 4; + return a instanceof java.lang.Integer; + } + + void checkInstanceOfWithPattern(){ + TPH b; + b = 4.0; + if(b instanceof d) + { + return d; + } + else + { + return Kein Double; + }; + } + + void checkInstanceOfWithGuardedPattern(){ + TPH obj; + obj = test; + TPH flag; + if(obj instanceof s op s.length Signature: [TPH]() op 5) + { + flag = s.contains Signature: [TPH, TPH](jdk); + }; + return; + } + + java.lang.Boolean equals(java.lang.Object o){ + return o instanceof other op x op other.x op y op other.y; + } + + Instanceof(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/KompTph.ast b/resources-back/syntaxtreegenerator/KompTph.ast new file mode 100644 index 0000000..0cde632 --- /dev/null +++ b/resources-back/syntaxtreegenerator/KompTph.ast @@ -0,0 +1,26 @@ +class KompTph { + +KompTph(){ + super(()); + } + TPH EOGX m(TPH EOGY a, TPH EOGZ b, TPH EOHA c){ + TPH EOHB d; + d = a; + TPH EOHC e; + e = a; + a = b; + c = b; + this.m2 Signature: [TPH EOHE, TPH EOHF, TPH EOHG](a, c); + return; + } + + TPH EOHK m2(TPH EOHL a, TPH EOHM b){ + this.m Signature: [TPH EOHO, TPH EOHP, TPH EOHQ, TPH EOHR](a, a, b); + return; + } + + KompTph(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/Lambda.ast b/resources-back/syntaxtreegenerator/Lambda.ast new file mode 100644 index 0000000..1cdc8f1 --- /dev/null +++ b/resources-back/syntaxtreegenerator/Lambda.ast @@ -0,0 +1,18 @@ +class Lambda { + +Lambda(){ + super(()); + } + TPH KIZQ m(){ + TPH KIZR lam1; + lam1 = (TPH KIZS x) -> { + return x; + }; + return lam1; + } + + Lambda(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/LambdaCapture.ast b/resources-back/syntaxtreegenerator/LambdaCapture.ast new file mode 100644 index 0000000..de4944b --- /dev/null +++ b/resources-back/syntaxtreegenerator/LambdaCapture.ast @@ -0,0 +1,18 @@ +class LambdaCapture { + + java.lang.Integer i; + TPH BIMD f; +LambdaCapture(){ + super(()); + this.i = 8; + } + LambdaCapture(){ + super(()); + java.lang.Integer w; + w = 7; + this.f = (TPH BIMH j) -> { + return w op this.i; + }; + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/Matrix.ast b/resources-back/syntaxtreegenerator/Matrix.ast new file mode 100644 index 0000000..f4779af --- /dev/null +++ b/resources-back/syntaxtreegenerator/Matrix.ast @@ -0,0 +1,52 @@ +class Matrix { + +Matrix(){ + super(()); + } + TPH SBB mul(TPH SBC m){ + TPH SBD ret; + ret = new Matrix(); + TPH SBF i; + i = 0; + while(i op this.size Signature: [TPH SBJ]()){ + TPH SBM v1; + v1 = this.elementAt Signature: [TPH SBO, TPH SBP](i); + TPH SBS v2; + v2 = new java.util.Vector(); + TPH SBU j; + j = 0; + while(j op v1.size Signature: [TPH SBX]()){ + TPH SCA erg; + erg = 0; + TPH SCC k; + k = 0; + while(k op v1.size Signature: [TPH SCF]()){ + erg = erg op v1.elementAt Signature: [TPH SCI, TPH SCJ](k) op m.elementAt Signature: [TPH SCM, TPH SCN](k).elementAt Signature: [TPH SCQ, TPH SCR](j); + k++; + }; + v2.addElement Signature: [TPH SCZ, TPH SDA](erg); + j++; + }; + ret.addElement Signature: [TPH SDG, TPH SDH](v2); + i++; + }; + return ret; + } + + Matrix(){ + super(()); + return; + } + + Matrix(TPH SAF vv){ + super(()); + java.lang.Integer i; + i = 0; + while(i op vv.size Signature: [TPH SAI]()){ + this.add Signature: [TPH SAQ, TPH SAR](vv.elementAt Signature: [TPH SAM, TPH SAN](i)); + i = i op 1; + }; + return; + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/MatrixOP.ast b/resources-back/syntaxtreegenerator/MatrixOP.ast new file mode 100644 index 0000000..4ea4d5e --- /dev/null +++ b/resources-back/syntaxtreegenerator/MatrixOP.ast @@ -0,0 +1,52 @@ +class MatrixOP { + + TPH JGDT mul; +MatrixOP(){ + super(()); + this.mul = (TPH JGDU m1, TPH JGDV m2) -> { + TPH JGDW ret; + ret = new MatrixOP(); + TPH JGDY i; + i = 0; + while(i op m1.size Signature: [TPH JGEB]()){ + TPH JGEE v1; + v1 = m1.elementAt Signature: [TPH JGEF, TPH JGEG](i); + TPH JGEJ v2; + v2 = new java.util.Vector(); + TPH JGEL j; + j = 0; + while(j op v1.size Signature: [TPH JGEO]()){ + TPH JGER erg; + erg = 0; + TPH JGET k; + k = 0; + while(k op v1.size Signature: [TPH JGEW]()){ + erg = erg op v1.elementAt Signature: [TPH JGEZ, TPH JGFA](k) op m2.elementAt Signature: [TPH JGFD, TPH JGFE](k).elementAt Signature: [TPH JGFH, TPH JGFI](j); + k++; + }; + v2.addElement Signature: [TPH JGFQ, TPH JGFR](erg); + j++; + }; + ret.addElement Signature: [TPH JGFX, TPH JGFY](v2); + i++; + }; + return ret; + }; + } + MatrixOP(){ + super(()); + return; + } + + MatrixOP(TPH JGGP vv){ + super(()); + java.lang.Integer i; + i = 0; + while(i op vv.size Signature: [TPH JGGS]()){ + this.add Signature: [TPH JGHA, TPH JGHB](vv.elementAt Signature: [TPH JGGW, TPH JGGX](i)); + i = i op 1; + }; + return; + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/Merge.ast b/resources-back/syntaxtreegenerator/Merge.ast new file mode 100644 index 0000000..c3632d1 --- /dev/null +++ b/resources-back/syntaxtreegenerator/Merge.ast @@ -0,0 +1,23 @@ +class Merge { + +Merge(){ + super(()); + } + TPH JQYM merge(TPH JQYN a, TPH JQYO b){ + a.addAll Signature: [TPH JQYP, TPH JQYQ](b); + return a; + } + + TPH JQYU sort(TPH JQYV in){ + TPH JQYW firstHalf; + firstHalf = in.subList Signature: [TPH JQYZ, TPH JQZA, TPH JQZB](1, 2); + TPH JQZE secondHalf; + secondHalf = in.subList Signature: [TPH JQZH, TPH JQZI, TPH JQZJ](1, 2); + return this.merge Signature: [TPH JQZX, TPH JQZY, TPH JQZZ](this.sort Signature: [TPH JQZO, TPH JQZP](firstHalf), this.sort Signature: [TPH JQZT, TPH JQZU](secondHalf)); + } + + Merge(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/OL.ast b/resources-back/syntaxtreegenerator/OL.ast new file mode 100644 index 0000000..96ea150 --- /dev/null +++ b/resources-back/syntaxtreegenerator/OL.ast @@ -0,0 +1,41 @@ +class OL { + +OL(){ + super(()); + } + java.lang.Double m(java.lang.Double x){ + return x op x; + } + + java.lang.Integer m(java.lang.Integer x){ + return x op x; + } + + java.lang.String m(java.lang.String x){ + return x op x; + } + + java.lang.Boolean m(java.lang.Boolean x){ + return x; + } + + OL(){ + super(()); + } + +}class OLMain { + +OLMain(){ + super(()); + } + TPH BYOF main(TPH BYOG x){ + TPH BYOH ol; + ol = new OL(); + return ol.m Signature: [TPH BYOJ, TPH BYOK](x); + } + + OLMain(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/OLFun.ast b/resources-back/syntaxtreegenerator/OLFun.ast new file mode 100644 index 0000000..4f5e08f --- /dev/null +++ b/resources-back/syntaxtreegenerator/OLFun.ast @@ -0,0 +1,22 @@ +class OLFun { + +OLFun(){ + super(()); + } + TPH JXJR m(TPH JXJS f, TPH JXJT x){ + x = f.apply Signature: [TPH JXJV, TPH JXJW](x op x); + return x; + } + + TPH JXKA m2(TPH JXKB y){ + this.m Signature: [TPH JXKK, TPH JXKL, TPH JXKM]((TPH JXKD x) -> { + return x op 2; + }, y); + return; + } + + OLFun(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/OLFun2.ast b/resources-back/syntaxtreegenerator/OLFun2.ast new file mode 100644 index 0000000..57415e3 --- /dev/null +++ b/resources-back/syntaxtreegenerator/OLFun2.ast @@ -0,0 +1,16 @@ +class OLFun2 { + + TPH CTXA x; +OLFun2(){ + super(()); + } + TPH CTXB m(TPH CTXC f){ + this.x = f.apply Signature: [TPH CTXH, TPH CTXI](this.x op this.x); + return; + } + + OLFun2(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/Overloading.ast b/resources-back/syntaxtreegenerator/Overloading.ast new file mode 100644 index 0000000..29fd0bb --- /dev/null +++ b/resources-back/syntaxtreegenerator/Overloading.ast @@ -0,0 +1,31 @@ +class Overloading { + +Overloading(){ + super(()); + } + TPH N test(TPH O x){ + return x.methode Signature: [TPH P](); + } + + TPH T methode(){ + return Overloading; + } + + Overloading(){ + super(()); + } + +}class Overloading2 { + +Overloading2(){ + super(()); + } + TPH AO methode(){ + return Overloading2; + } + + Overloading2(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/Pair.ast b/resources-back/syntaxtreegenerator/Pair.ast new file mode 100644 index 0000000..67a0183 --- /dev/null +++ b/resources-back/syntaxtreegenerator/Pair.ast @@ -0,0 +1,20 @@ +class Pair { + + U a; + T b; +Pair(){ + super(()); + } + TPH IURS make(TPH IURT x){ + TPH IURU ret; + ret = new Pair(); + ret.a = x.elementAt Signature: [TPH IUSA, TPH IUSB](0); + ret.b = x.elementAt Signature: [TPH IUSG, TPH IUSH](1); + return ret; + } + + Pair(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/PatternMatching.ast b/resources-back/syntaxtreegenerator/PatternMatching.ast new file mode 100644 index 0000000..41a2453 --- /dev/null +++ b/resources-back/syntaxtreegenerator/PatternMatching.ast @@ -0,0 +1,120 @@ +class Point { + + java.lang.Integer x; + java.lang.Integer y; +Point(java.lang.Integer x, java.lang.Integer y){ + super(()); + this.x = x; + this.y = y; + } + java.lang.Integer x(){ + return this.x; + } + + java.lang.Integer y(){ + return this.y; + } + + Point(java.lang.Integer x, java.lang.Integer y){ + super(()); + this.x = x; + this.y = y; + } + +}class Shape { + +}class ColoredPoint { + + Point pt; + java.lang.String color; +ColoredPoint(Point pt, java.lang.String color){ + super(()); + this.pt = pt; + this.color = color; + } + Point pt(){ + return this.pt; + } + + java.lang.String color(){ + return this.color; + } + + ColoredPoint(Point pt, java.lang.String color){ + super(()); + this.pt = pt; + this.color = color; + } + +}class Rectangle { + + ColoredPoint upperLeft; + ColoredPoint lowerRight; +Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight){ + super(()); + this.upperLeft = upperLeft; + this.lowerRight = lowerRight; + } + ColoredPoint upperLeft(){ + return this.upperLeft; + } + + ColoredPoint lowerRight(){ + return this.lowerRight; + } + + Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight){ + super(()); + this.upperLeft = upperLeft; + this.lowerRight = lowerRight; + } + +}class Color { + +Color(){ + super(()); + } + Color(){ + super(()); + } + +}class Blue { + +Blue(){ + super(()); + } + Blue(){ + super(()); + } + +}class Red { + +Red(){ + super(()); + } + Red(){ + super(()); + } + +}class PatternMatching { + +PatternMatching(){ + super(()); + } + void printColorOfUpperLeftPoint(Shape shape){ + switch(shape){ + case Rectangle(ColoredPoint(Point pt, java.lang.String color), ColoredPoint lowerRight): + System.out.println Signature: [TPH, TPH](x: op pt.x Signature: [TPH]() op / color: op color op / lowerRight: op lowerRight); + + default: + System.out.println Signature: [TPH, TPH](not a rectangle); + + }; + return; + } + + PatternMatching(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/Plus.ast b/resources-back/syntaxtreegenerator/Plus.ast new file mode 100644 index 0000000..c395f00 --- /dev/null +++ b/resources-back/syntaxtreegenerator/Plus.ast @@ -0,0 +1,14 @@ +class Plus { + +Plus(){ + super(()); + } + TPH ACHZ m(TPH ACIA a, TPH ACIB b){ + return a op b; + } + + Plus(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/Record.ast b/resources-back/syntaxtreegenerator/Record.ast new file mode 100644 index 0000000..26d9587 --- /dev/null +++ b/resources-back/syntaxtreegenerator/Record.ast @@ -0,0 +1,47 @@ +class Point { + + TPH x; + TPH y; +Point(TPH x, TPH y){ + super(()); + this.x = x; + this.y = y; + } + TPH x(){ + return this.x; + } + + TPH y(){ + return this.y; + } + + Point(TPH x, TPH y){ + super(()); + this.x = x; + this.y = y; + } + +}class Line { + + TPH pt1; + TPH pt2; +Line(TPH pt1, TPH pt2){ + super(()); + this.pt1 = pt1; + this.pt2 = pt2; + } + TPH pt1(){ + return this.pt1; + } + + TPH pt2(){ + return this.pt2; + } + + Line(TPH pt1, TPH pt2){ + super(()); + this.pt1 = pt1; + this.pt2 = pt2; + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/RelOps.ast b/resources-back/syntaxtreegenerator/RelOps.ast new file mode 100644 index 0000000..4b8fa1d --- /dev/null +++ b/resources-back/syntaxtreegenerator/RelOps.ast @@ -0,0 +1,14 @@ +class RelOps { + +RelOps(){ + super(()); + } + TPH IPBY m(TPH IPBZ a, TPH IPCA b){ + return a op b; + } + + RelOps(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/Scalar.ast b/resources-back/syntaxtreegenerator/Scalar.ast new file mode 100644 index 0000000..fddde3a --- /dev/null +++ b/resources-back/syntaxtreegenerator/Scalar.ast @@ -0,0 +1,29 @@ +class Scalar { + +Scalar(){ + super(()); + } + TPH KOXT mul(TPH KOXU v){ + TPH KOXV ret; + ret = 0; + TPH KOXX i; + i = 0; + while(i op this.size Signature: [TPH KOYB]()){ + ret = ret op this.elementAt Signature: [TPH KOYF, TPH KOYG](i) op v.elementAt Signature: [TPH KOYJ, TPH KOYK](i); + i = i op 1; + }; + return ret; + } + + Scalar(TPH KOWX v){ + super(()); + java.lang.Integer i; + i = 0; + while(i op v.size Signature: [TPH KOXA]()){ + this.add Signature: [TPH KOXI, TPH KOXJ](v.elementAt Signature: [TPH KOXE, TPH KOXF](i)); + i = i op 1; + }; + return; + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/Sealed.ast b/resources-back/syntaxtreegenerator/Sealed.ast new file mode 100644 index 0000000..24423ca --- /dev/null +++ b/resources-back/syntaxtreegenerator/Sealed.ast @@ -0,0 +1,144 @@ +class Shape { + +Shape(){ + super(()); + } + Shape(){ + super(()); + } + +}class Circle { + +Circle(){ + super(()); + } + Circle(){ + super(()); + } + +}class Rectangle { + +Rectangle(){ + super(()); + } + Rectangle(){ + super(()); + } + +}class TransparentRectangle { + +TransparentRectangle(){ + super(()); + } + TransparentRectangle(){ + super(()); + } + +}class FilledRectangle { + +FilledRectangle(){ + super(()); + } + FilledRectangle(){ + super(()); + } + +}class Square { + +Square(){ + super(()); + } + Square(){ + super(()); + } + +}class WeirdShape { + +WeirdShape(){ + super(()); + } + WeirdShape(){ + super(()); + } + +}class Expr { + +}class ConstantExpr { + + java.lang.Integer i; +ConstantExpr(java.lang.Integer i){ + super(()); + this.i = i; + } + java.lang.Integer i(){ + return this.i; + } + + ConstantExpr(java.lang.Integer i){ + super(()); + this.i = i; + } + +}class PlusExpr { + + Expr a; + Expr b; +PlusExpr(Expr a, Expr b){ + super(()); + this.a = a; + this.b = b; + } + Expr a(){ + return this.a; + } + + Expr b(){ + return this.b; + } + + PlusExpr(Expr a, Expr b){ + super(()); + this.a = a; + this.b = b; + } + +}class TimesExpr { + + Expr a; + Expr b; +TimesExpr(Expr a, Expr b){ + super(()); + this.a = a; + this.b = b; + } + Expr a(){ + return this.a; + } + + Expr b(){ + return this.b; + } + + TimesExpr(Expr a, Expr b){ + super(()); + this.a = a; + this.b = b; + } + +}class NegExpr { + + Expr e; +NegExpr(Expr e){ + super(()); + this.e = e; + } + Expr e(){ + return this.e; + } + + NegExpr(Expr e){ + super(()); + this.e = e; + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/SimpleCycle.ast b/resources-back/syntaxtreegenerator/SimpleCycle.ast new file mode 100644 index 0000000..771757a --- /dev/null +++ b/resources-back/syntaxtreegenerator/SimpleCycle.ast @@ -0,0 +1,18 @@ +class SimpleCycle { + +SimpleCycle(){ + super(()); + } + TPH ETMJ m(){ + TPH ETMK g; + TPH ETML h; + g = h; + h = g; + return; + } + + SimpleCycle(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/Sorting.ast b/resources-back/syntaxtreegenerator/Sorting.ast new file mode 100644 index 0000000..979d268 --- /dev/null +++ b/resources-back/syntaxtreegenerator/Sorting.ast @@ -0,0 +1,23 @@ +class Sorting { + +Sorting(){ + super(()); + } + TPH JNN merge(TPH JNO a, TPH JNP b){ + a.addAll Signature: [TPH JNQ, TPH JNR](b); + return a; + } + + TPH JNV sort(TPH JNW in){ + TPH JNX firstHalf; + firstHalf = in; + TPH JNY secondHalf; + secondHalf = in; + return this.merge Signature: [TPH JOK, TPH JOL, TPH JOM](this.sort Signature: [TPH JOB, TPH JOC](firstHalf), this.sort Signature: [TPH JOG, TPH JOH](secondHalf)); + } + + Sorting(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/SubMatrix.ast b/resources-back/syntaxtreegenerator/SubMatrix.ast new file mode 100644 index 0000000..61ab2f2 --- /dev/null +++ b/resources-back/syntaxtreegenerator/SubMatrix.ast @@ -0,0 +1,26 @@ +class Matrix2 { + +Matrix2(){ + super(()); + } + Matrix2(){ + super(()); + } + +}class SubMatrix { + +SubMatrix(){ + super(()); + } + TPH DOFK m(){ + java.util.Vector v; + v = new java.util.Vector(); + v.add Signature: [TPH DOFN, TPH DOFO](1); + return; + } + + SubMatrix(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/Switch.ast b/resources-back/syntaxtreegenerator/Switch.ast new file mode 100644 index 0000000..f6dfd8f --- /dev/null +++ b/resources-back/syntaxtreegenerator/Switch.ast @@ -0,0 +1,96 @@ +class SwitchStatement { + +SwitchStatement(){ + super(()); + } + TPH switchStandard(){ + str = SwitchMe; + switch(str){ + case java.lang.String s: + return true; + + default: + return false; + + }; + } + + TPH switchInteger(){ + i = 5; + switch(i){ + case java.lang.Integer j: + case java.lang.String s: + i = 6; + break; + + default: + i = 0; + break; + + }; + return i op 0; + } + + TPH guardedPattern(){ + TPH i; + i = 1; + switch(i){ + case java.lang.Integer j: + return true; + + default: + return false; + + }; + } + + TPH recordPattern(java.lang.Object obj){ + switch(obj){ + case Coordinates(java.lang.Double lat, java.lang.Double lon): + return true; + + default: + return false; + + }; + } + + SwitchStatement(){ + super(()); + } + +}class SwitchExpression { + + java.lang.Integer x; + java.lang.Integer y; +SwitchExpression(java.lang.Integer x, java.lang.Integer y){ + super(()); + this.x = x; + this.y = y; + } + java.lang.Integer x(){ + return this.x; + } + + java.lang.Integer y(){ + return this.y; + } + + java.lang.Boolean switchStandard(TPH str){ + return switch(str){ + case java.lang.String s: + yield true; + + default: + yield false; + + }; + } + + SwitchExpression(java.lang.Integer x, java.lang.Integer y){ + super(()); + this.x = x; + this.y = y; + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/TXGenerics.ast b/resources-back/syntaxtreegenerator/TXGenerics.ast new file mode 100644 index 0000000..1c4a0ea --- /dev/null +++ b/resources-back/syntaxtreegenerator/TXGenerics.ast @@ -0,0 +1,19 @@ +class TXGenerics { + + TPH GLEG a; + TPH GLEH b; +TXGenerics(){ + super(()); + } + TPH GLEI test(){ + TPH GLEJ c; + c = new Cycle(); + c.m Signature: [TPH GLEN, TPH GLEO, TPH GLEP](this.a, this.b); + return; + } + + TXGenerics(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/Tph.ast b/resources-back/syntaxtreegenerator/Tph.ast new file mode 100644 index 0000000..939f9a5 --- /dev/null +++ b/resources-back/syntaxtreegenerator/Tph.ast @@ -0,0 +1,20 @@ +class Tph { + +Tph(){ + super(()); + } + TPH BNOP m(TPH BNOQ a, TPH BNOR b){ + TPH BNOS c; + c = this.m2 Signature: [TPH BNOU, TPH BNOV](b); + return a; + } + + TPH BNOZ m2(TPH BNPA b){ + return b; + } + + Tph(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/Tph2.ast b/resources-back/syntaxtreegenerator/Tph2.ast new file mode 100644 index 0000000..f138866 --- /dev/null +++ b/resources-back/syntaxtreegenerator/Tph2.ast @@ -0,0 +1,18 @@ +class Tph2 { + + TPH FGYW id; +Tph2(){ + super(()); + this.id = (TPH FGYX x) -> { + return x; + }; + } + TPH FGZD id3(TPH FGZE x){ + return this.id.apply Signature: [TPH FGZG, TPH FGZH](x); + } + + Tph2(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/Tph3.ast b/resources-back/syntaxtreegenerator/Tph3.ast new file mode 100644 index 0000000..cfbf0bc --- /dev/null +++ b/resources-back/syntaxtreegenerator/Tph3.ast @@ -0,0 +1,21 @@ +class Tph3 { + +Tph3(){ + super(()); + } + TPH FMEJ m1(TPH FMEK x, TPH FMEL y){ + this.m2 Signature: [TPH FMEN, TPH FMEO](x); + x = y; + return; + } + + TPH FMES m2(TPH FMET y){ + this.m1 Signature: [TPH FMEV, TPH FMEW, TPH FMEX](y, y); + return; + } + + Tph3(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/Tph4.ast b/resources-back/syntaxtreegenerator/Tph4.ast new file mode 100644 index 0000000..2ed453b --- /dev/null +++ b/resources-back/syntaxtreegenerator/Tph4.ast @@ -0,0 +1,22 @@ +class Tph4 { + +Tph4(){ + super(()); + } + TPH FRJD m(TPH FRJE a, TPH FRJF b){ + TPH FRJG c; + c = this.m2 Signature: [TPH FRJI, TPH FRJJ](b); + TPH FRJM d; + d = this.m2 Signature: [TPH FRJO, TPH FRJP](c); + return d; + } + + TPH FRJT m2(TPH FRJU b){ + return b; + } + + Tph4(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/Tph5.ast b/resources-back/syntaxtreegenerator/Tph5.ast new file mode 100644 index 0000000..dfdda9d --- /dev/null +++ b/resources-back/syntaxtreegenerator/Tph5.ast @@ -0,0 +1,19 @@ +class Tph5 { + +Tph5(){ + super(()); + } + TPH FWNY m(TPH FWNZ x, TPH FWOA y){ + x = this.m2 Signature: [TPH FWOC, TPH FWOD](y); + return; + } + + TPH FWOH m2(TPH FWOI y){ + return y; + } + + Tph5(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/Tph6.ast b/resources-back/syntaxtreegenerator/Tph6.ast new file mode 100644 index 0000000..eba65bc --- /dev/null +++ b/resources-back/syntaxtreegenerator/Tph6.ast @@ -0,0 +1,21 @@ +class Tph6 { + +Tph6(){ + super(()); + } + TPH GBSM m(TPH GBSN x, TPH GBSO y){ + TPH GBSP c; + c = this.m2 Signature: [TPH GBSR, TPH GBSS](y); + c = this.m2 Signature: [TPH GBSW, TPH GBSX](x); + return; + } + + TPH GBTB m2(TPH GBTC y){ + return y; + } + + Tph6(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/Tph7.ast b/resources-back/syntaxtreegenerator/Tph7.ast new file mode 100644 index 0000000..8d2ebe4 --- /dev/null +++ b/resources-back/syntaxtreegenerator/Tph7.ast @@ -0,0 +1,20 @@ +class Tph7 { + +Tph7(){ + super(()); + } + TPH GQRI m(TPH GQRJ a, TPH GQRK b){ + TPH GQRL c; + c = this.m2 Signature: [TPH GQRN, TPH GQRO](b); + return this.m2 Signature: [TPH GQRS, TPH GQRT](b); + } + + TPH GQRX m2(TPH GQRY b){ + return b; + } + + Tph7(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/TypedID.ast b/resources-back/syntaxtreegenerator/TypedID.ast new file mode 100644 index 0000000..0a56861 --- /dev/null +++ b/resources-back/syntaxtreegenerator/TypedID.ast @@ -0,0 +1,22 @@ +class TypedID { + + TPH GVWK lam; +TypedID(){ + super(()); + this.lam = (TPH GVWL x) -> { + return x; + }; + } + TPH GVWR id(TPH GVWS b){ + return b; + } + + TPH GVWU m(){ + return this.lam; + } + + TypedID(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/VectorAdd.ast b/resources-back/syntaxtreegenerator/VectorAdd.ast new file mode 100644 index 0000000..992c9c1 --- /dev/null +++ b/resources-back/syntaxtreegenerator/VectorAdd.ast @@ -0,0 +1,31 @@ +class VectorAdd { + +VectorAdd(){ + super(()); + } + TPH EXVJ vectorAdd(TPH EXVK v1, TPH EXVL v2){ + TPH EXVM i; + i = 0; + v1 = new java.util.Vector(); + TPH EXVP erg; + erg = new java.util.Vector(); + while(i op v1.size Signature: [TPH EXVT]()){ + erg.addElement Signature: [TPH EXWF, TPH EXWG](v1.elementAt Signature: [TPH EXVW, TPH EXVX](i) op v2.elementAt Signature: [TPH EXWA, TPH EXWB](i)); + i++; + }; + return erg; + } + + TPH EXWN m(TPH EXWO x, TPH EXWP y, TPH EXWQ z){ + x = new java.util.Vector(); + y = new java.util.Vector(); + x.add Signature: [TPH EXWU, TPH EXWV](1); + y.add Signature: [TPH EXWY, TPH EXWZ](2); + return z.addAll Signature: [TPH EXXC, TPH EXXD](x); + } + + VectorAdd(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/VectorSuper.ast b/resources-back/syntaxtreegenerator/VectorSuper.ast new file mode 100644 index 0000000..ec2faf3 --- /dev/null +++ b/resources-back/syntaxtreegenerator/VectorSuper.ast @@ -0,0 +1,17 @@ +class VectorSuper { + +VectorSuper(){ + super(()); + } + TPH HPGR m(TPH HPGS x){ + java.lang.Integer y; + y = 1; + x.addElement Signature: [TPH HPGU, TPH HPGV](y); + return; + } + + VectorSuper(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/Y.ast b/resources-back/syntaxtreegenerator/Y.ast new file mode 100644 index 0000000..6a73619 --- /dev/null +++ b/resources-back/syntaxtreegenerator/Y.ast @@ -0,0 +1,16 @@ +class Y { + + TPH IBFH y; +Y(){ + super(()); + } + Y(){ + super(()); + this.y = (TPH IBFK f) -> { + return (TPH IBFL t) -> { + return f.apply Signature: [TPH IBFR, TPH IBFS](this.y.apply Signature: [TPH IBFN, TPH IBFO](f)).apply Signature: [TPH IBFV, TPH IBFW](t); + }; + }; + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/applyLambda.ast b/resources-back/syntaxtreegenerator/applyLambda.ast new file mode 100644 index 0000000..504ddde --- /dev/null +++ b/resources-back/syntaxtreegenerator/applyLambda.ast @@ -0,0 +1,27 @@ +class Apply { + +Apply(){ + super(()); + } + Apply(){ + super(()); + } + +}class applyLambda { + +applyLambda(){ + super(()); + } + TPH ASWH m(){ + TPH ASWI lam1; + lam1 = (TPH ASWJ x) -> { + return x; + }; + return lam1.apply Signature: [TPH ASWP, TPH ASWQ](new Apply()); + } + + applyLambda(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/javFiles/Instanceof.jav b/resources-back/syntaxtreegenerator/javFiles/Instanceof.jav new file mode 100644 index 0000000..c9a2d0b --- /dev/null +++ b/resources-back/syntaxtreegenerator/javFiles/Instanceof.jav @@ -0,0 +1,36 @@ +import java.lang.Integer; +import java.lang.Double; +import java.lang.String; +import java.lang.Object; + +public class Instanceof{ + void checkInstanceof() { + var a = 4; + return (a instanceof java.lang.Integer); + } + + void checkInstanceOfWithPattern(){ + var b = 4.0; + if(b instanceof java.lang.Double d){ + return d; + }else{ + return "Kein Double"; + } + } + + void checkInstanceOfWithGuardedPattern(){ + var obj = "test"; + var flag; + if (obj instanceof String s && s.length() > 5) { + flag = s.contains("jdk"); + } + } + + record Point(int x, int y){ } + + boolean equals(Object o) { + return (o instanceof Point other) + && x == other.x + && y == other.y; + } +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/javFiles/PatternMatching.jav b/resources-back/syntaxtreegenerator/javFiles/PatternMatching.jav new file mode 100644 index 0000000..d256ac0 --- /dev/null +++ b/resources-back/syntaxtreegenerator/javFiles/PatternMatching.jav @@ -0,0 +1,19 @@ +import java.lang.String; + +record Point(int x, int y) {} +interface Shape {} +record ColoredPoint(Point pt, String color) {} +record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) implements Shape {} +sealed class Color permits Blue, Red {} +class Blue extends Color {} +class Red extends Color {} + +class PatternMatching { +void printColorOfUpperLeftPoint(Shape shape) +{ + switch (shape) { + case Rectangle(ColoredPoint(Point pt, String color), ColoredPoint lowerRight) -> System.out.println("x: " + pt.x() + " / color: " + color + " / lowerRight: " + lowerRight); + default -> System.out.println("not a rectangle"); + }; +} +} diff --git a/resources-back/syntaxtreegenerator/javFiles/Record.jav b/resources-back/syntaxtreegenerator/javFiles/Record.jav new file mode 100644 index 0000000..31edc83 --- /dev/null +++ b/resources-back/syntaxtreegenerator/javFiles/Record.jav @@ -0,0 +1,5 @@ +// Simple records +record Point(x, y){ } + +//Combination of records +record Line(pt1, pt2){} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/javFiles/Sealed.jav b/resources-back/syntaxtreegenerator/javFiles/Sealed.jav new file mode 100644 index 0000000..b7a68e5 --- /dev/null +++ b/resources-back/syntaxtreegenerator/javFiles/Sealed.jav @@ -0,0 +1,21 @@ +public abstract sealed class Shape + permits Circle, Rectangle, Square, WeirdShape { } + +public final class Circle extends Shape { } + +public sealed class Rectangle extends Shape + permits TransparentRectangle, FilledRectangle { } +public final class TransparentRectangle extends Rectangle { } +public final class FilledRectangle extends Rectangle { } + +public final class Square extends Shape { } + +public non-sealed class WeirdShape extends Shape { } + +public sealed interface Expr + permits ConstantExpr, PlusExpr, TimesExpr, NegExpr { } + +public record ConstantExpr(int i) implements Expr { } +public record PlusExpr(Expr a, Expr b) implements Expr { } +public record TimesExpr(Expr a, Expr b) implements Expr { } +public record NegExpr(Expr e) implements Expr { } \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/javFiles/Switch.jav b/resources-back/syntaxtreegenerator/javFiles/Switch.jav new file mode 100644 index 0000000..6c0f68a --- /dev/null +++ b/resources-back/syntaxtreegenerator/javFiles/Switch.jav @@ -0,0 +1,52 @@ +import java.lang.Integer; +import java.lang.Boolean; +import java.lang.String; +import java.lang.Object; + +class SwitchStatement { + + switchStandard(){ + str = "SwitchMe"; + switch(str){ + case String s: return true; + default: return false; + } + } + + switchInteger(){ + i = 5; + switch(i){ + case Integer j: + case String s: i = 6; break; + default: i = 0; break; + } + return (i==0); + } + + guardedPattern(){ + var i = 1; + switch(i){ + case Integer j && j == 1: return true; + default: return false; + } + } + + record Coordinates(double x, double y) {} + + recordPattern(Object obj){ + switch(obj){ + case Coordinates(double lat, double lon): return true; + default: return false; + } + } +} + +record SwitchExpression(int x, int y){ + + boolean switchStandard(str){ + return switch(str){ + case String s -> yield true; + default -> yield false; + }; + } +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/mathStruc.ast b/resources-back/syntaxtreegenerator/mathStruc.ast new file mode 100644 index 0000000..8531850 --- /dev/null +++ b/resources-back/syntaxtreegenerator/mathStruc.ast @@ -0,0 +1,19 @@ +class mathStruc { + + TPH IHHZ model; + TPH IHIA innerOp; +mathStruc(){ + super(()); + this.innerOp = (TPH IHIB o) -> { + return (TPH IHIC ms) -> { + return new mathStruc(o.apply Signature: [TPH IHIF, TPH IHIG, TPH IHIH](this.model, ms.model)); + }; + }; + } + mathStruc(TPH IHIW m){ + super(()); + this.model = m; + return; + } + +} \ No newline at end of file diff --git a/resources-back/syntaxtreegenerator/mathStrucInteger.ast b/resources-back/syntaxtreegenerator/mathStrucInteger.ast new file mode 100644 index 0000000..c36d537 --- /dev/null +++ b/resources-back/syntaxtreegenerator/mathStrucInteger.ast @@ -0,0 +1,38 @@ +class mathStrucInteger { + + TPH EBJW model; + TPH EBJX innerOp; +mathStrucInteger(){ + super(()); + this.innerOp = (TPH EBJY o) -> { + return (TPH EBJZ ms) -> { + return new mathStrucInteger(o.apply Signature: [TPH EBKC, TPH EBKD, TPH EBKE](this.model, ms.model)); + }; + }; + } + mathStrucInteger(TPH EBKT m){ + super(()); + this.model = m; + return; + } + +}class mathStrucIntegerUse { + +mathStrucIntegerUse(){ + super(()); + } + TPH EBLO main(){ + TPH EBLP ms; + ms = new mathStrucInteger(2); + TPH EBLT ms2; + ms2 = ms.innerOp.apply Signature: [TPH EBMD, TPH EBME]((TPH EBLV x, TPH EBLW y) -> { + return x op y; + }).apply Signature: [TPH EBMH, TPH EBMI](ms); + return ms2; + } + + mathStrucIntegerUse(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources/AllgemeinTest/Assign.jav b/resources/AllgemeinTest/Assign.jav new file mode 100644 index 0000000..001fca7 --- /dev/null +++ b/resources/AllgemeinTest/Assign.jav @@ -0,0 +1,10 @@ +class Assign { + + assign(x, y) { + x = y; + } + + assign2(x, y) { + assign(x,y); + } +} \ No newline at end of file diff --git a/resources/AllgemeinTest/CaptureConversion.jav b/resources/AllgemeinTest/CaptureConversion.jav new file mode 100644 index 0000000..b1033de --- /dev/null +++ b/resources/AllgemeinTest/CaptureConversion.jav @@ -0,0 +1,18 @@ +import java.lang.Object; +import java.util.Vector; + +class CaptureConversion { + + void assign(Vector v1, Vector v2) { + v1 = v2; + } + + void main() { + Vector v1; + v1 = new Vector(); + Vector v2; + v2 = new Vector(); + v1 = v2; + assign(v1, v2); + } +} \ No newline at end of file diff --git a/resources/AllgemeinTest/Complex.jav b/resources/AllgemeinTest/Complex.jav new file mode 100644 index 0000000..15d5c5d --- /dev/null +++ b/resources/AllgemeinTest/Complex.jav @@ -0,0 +1,22 @@ +class Pair { + U a; + T b; + Pair(U x, T y) { + a = x; b = y; + } +} + +class Complex { + m(b) { + var c = b; + var d = c; + var e; + d = e; + var r1 = e; + var f = e; + var g; + f = g; + var r2 = g; + return new Pair<>(r1, r2); + } +} \ No newline at end of file diff --git a/resources/AllgemeinTest/InfReturn.jav b/resources/AllgemeinTest/InfReturn.jav new file mode 100644 index 0000000..d1f6211 --- /dev/null +++ b/resources/AllgemeinTest/InfReturn.jav @@ -0,0 +1,7 @@ +public class InfReturn { + m(a) { + var ret; + a = ret; + return ret; + } +} \ No newline at end of file diff --git a/resources/AllgemeinTest/InfReturnII.jav b/resources/AllgemeinTest/InfReturnII.jav new file mode 100644 index 0000000..e1e9597 --- /dev/null +++ b/resources/AllgemeinTest/InfReturnII.jav @@ -0,0 +1,8 @@ +public class InfReturnII { + m(a, b) { + var ret; + a = ret; + b = ret; + return ret; + } +} \ No newline at end of file diff --git a/resources/AllgemeinTest/InnerInf.jav b/resources/AllgemeinTest/InnerInf.jav new file mode 100644 index 0000000..4eaa183 --- /dev/null +++ b/resources/AllgemeinTest/InnerInf.jav @@ -0,0 +1,7 @@ +class InnerInf { + m(a, b) { + var i; + a = i; + b = i; + } +} \ No newline at end of file diff --git a/resources/AllgemeinTest/Iteration.jav b/resources/AllgemeinTest/Iteration.jav new file mode 100644 index 0000000..2af750a --- /dev/null +++ b/resources/AllgemeinTest/Iteration.jav @@ -0,0 +1,43 @@ +/* +class Pair { + T x; + U y; + + public Pair() { } + public Pair(T x, U y) { + this.x = x; + this.y = y; + } + + public T fst () { + return x; + } + + public U snd () { + return y; + } +} +*/ + +public class Iteration { + id(x) { + return x; + } + + m1(x, y) { + var help; + help = m2(x, y); + var y2 = help.snd(); + var x2 = id(x); + return new Pair<>(x2,y2); + + } + + m2(x,y) { + var help = m1(x, y); + var x2 = help.fst(); + var y2 = id(y); + return new Pair<>(x2, y2); + } +} + \ No newline at end of file diff --git a/resources/AllgemeinTest/List.jav b/resources/AllgemeinTest/List.jav new file mode 100644 index 0000000..9c612f2 --- /dev/null +++ b/resources/AllgemeinTest/List.jav @@ -0,0 +1,46 @@ +import java.lang.Boolean; +import java.lang.Object; + +class List { + elem; + next; + + List() { + super(); + } + + List(elem, next) { + this.elem = elem; + this.next = next; + } + + addElement(newElem) { + return new List(newElem, this); + } + + append(l) { + if (next == null) { + return l; + } + else { + return new List(elem, next.append(l)); + } + } +/* + addAll(l) { + var nextLoc = next; + while (//nextLoc != null + true) { + nextLoc = nextLoc.next; + } + nextLoc = l; + } + + void m() { + List l; // = new List(1, null); + List l2; // = new List("SSS", null); + l.addAll(l2); + } +*/ +} + diff --git a/resources/AllgemeinTest/Overloading.jav b/resources/AllgemeinTest/Overloading.jav new file mode 100644 index 0000000..2809813 --- /dev/null +++ b/resources/AllgemeinTest/Overloading.jav @@ -0,0 +1,7 @@ +import java.lang.Integer; +import java.lang.Double; + +class Overloading { + m(x) { return x + x; } + m(x) { return x || x; } +} \ No newline at end of file diff --git a/resources/AllgemeinTest/Pair.jav b/resources/AllgemeinTest/Pair.jav new file mode 100644 index 0000000..89660b1 --- /dev/null +++ b/resources/AllgemeinTest/Pair.jav @@ -0,0 +1,36 @@ +import java.util.Vector; +import java.lang.Boolean; +import java.lang.Object; + +class Pair { + U a; + T b; + + make(x) { + var ret = new Pair<>(); + ret.a = x.elementAt(0); + ret.b = x.elementAt(1); + return ret; + } + + + eq(a, b) { + b = a; + return a == b; + } + + + compare( p) { + return eq(p.a, p.b); + //return p.a == p.b; + } + + +/* + void m(Pair p, Vector b) + { + //this.compare(p); //1, type incorrect + this.compare(this.make(b)); //2, OK + } +*/ +} \ No newline at end of file diff --git a/resources/AllgemeinTest/RecursionCond.jav b/resources/AllgemeinTest/RecursionCond.jav new file mode 100644 index 0000000..1640471 --- /dev/null +++ b/resources/AllgemeinTest/RecursionCond.jav @@ -0,0 +1,8 @@ +class RecursionCond { + m(a, b, c) { + if (1 == 2) { + b = m(a, b); + c = m(a, b); + } else return a; + } +} \ No newline at end of file diff --git a/resources/AllgemeinTest/StreamTest.jav b/resources/AllgemeinTest/StreamTest.jav new file mode 100644 index 0000000..cfaf23d --- /dev/null +++ b/resources/AllgemeinTest/StreamTest.jav @@ -0,0 +1,14 @@ +import java.util.stream.Stream; +import java.util.Vector; +import java.lang.Integer; + +class StreamTest { + + m() { + var vecInt = new Vector(); + var strInt = vecInt.stream(); + var dup = x -> x*2; + strInt.map(dup); + return dup; + } +} \ No newline at end of file diff --git a/resources/AllgemeinTest/Test.jav b/resources/AllgemeinTest/Test.jav new file mode 100644 index 0000000..48491b8 --- /dev/null +++ b/resources/AllgemeinTest/Test.jav @@ -0,0 +1,9 @@ +import java.lang.Boolean; +import java.lang.Integer; + +public class Test { + fac = (x) -> { + if (x == 1) { return 1; } + return x * fac.apply(x - 1); + }; +} \ No newline at end of file diff --git a/resources/AllgemeinTest/TripleTest.jav b/resources/AllgemeinTest/TripleTest.jav new file mode 100644 index 0000000..a0560b6 --- /dev/null +++ b/resources/AllgemeinTest/TripleTest.jav @@ -0,0 +1,19 @@ +class Triple { + U a; + T b; + S c; + + Triple(U x, T y, S z) { + a = x; b = y; c = z; + } + + U fst() { return a; } + T snd() { return b; } + S thrd() { return c; } +} + +public class TripleTest { + m() { + return new Triple<>(m().thrd(), m().thrd(), m().thrd()); + } +} \ No newline at end of file diff --git a/resources/AllgemeinTest/Twice2.jav b/resources/AllgemeinTest/Twice2.jav new file mode 100644 index 0000000..87a3f23 --- /dev/null +++ b/resources/AllgemeinTest/Twice2.jav @@ -0,0 +1,12 @@ +class Twice2 { + id1inst = new Id<>(); + id1 = id1inst.id; + id2inst = new Id<>(); + id2 = id2inst.id; + twice = id1.apply(id2); + +} + +class Id { + id = (T x) -> x; +} \ No newline at end of file diff --git a/resources/AllgemeinTest/UseWildcardPair.jav b/resources/AllgemeinTest/UseWildcardPair.jav new file mode 100644 index 0000000..dc91e4e --- /dev/null +++ b/resources/AllgemeinTest/UseWildcardPair.jav @@ -0,0 +1,12 @@ +import java.util.Vector; +import java.lang.Boolean; + +class UseWildcardPair{ + + void m(Pair p, Vector b) + { + p.compare(p); //1, type incorrect + p.compare(p.make(b)); //2, OK + } + +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/AA.jav b/resources/bytecode/javFiles/AA.jav new file mode 100644 index 0000000..6b79df3 --- /dev/null +++ b/resources/bytecode/javFiles/AA.jav @@ -0,0 +1,8 @@ +import java.lang.Integer; +import java.lang.String; + +public class AA { + public m(Integer i) { return "AA"; } + + public m2(AA x) { return "AA"; } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Access.jav b/resources/bytecode/javFiles/Access.jav new file mode 100644 index 0000000..46cd8c8 --- /dev/null +++ b/resources/bytecode/javFiles/Access.jav @@ -0,0 +1,14 @@ +public class Access { + public int fPublic; + int fDefault; + private int fPrivate; + protected int fProtected; + + public void mPublic() {} + void mDefault() {} + private void mPrivate() {} + protected void mProtected() {} +} + +class AccessDefault { +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/AddLong.jav b/resources/bytecode/javFiles/AddLong.jav new file mode 100644 index 0000000..d6d47e9 --- /dev/null +++ b/resources/bytecode/javFiles/AddLong.jav @@ -0,0 +1,9 @@ +import java.lang.Integer; +import java.lang.Long; + +public class AddLong{ + Long add(Integer a, Long b) { + Long c = a+b; + return c; + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Annotation.jav b/resources/bytecode/javFiles/Annotation.jav new file mode 100644 index 0000000..520eb31 --- /dev/null +++ b/resources/bytecode/javFiles/Annotation.jav @@ -0,0 +1,8 @@ +class Base { + public void foo() {} +} + +public class Annotation extends Base { + @Override + public void foo() {} +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/AssignToLit.jav b/resources/bytecode/javFiles/AssignToLit.jav new file mode 100644 index 0000000..873828e --- /dev/null +++ b/resources/bytecode/javFiles/AssignToLit.jav @@ -0,0 +1,30 @@ +import java.lang.Integer; +import java.lang.Boolean; +import java.lang.String; +import java.lang.Byte; +import java.lang.Short; +import java.lang.Long; +import java.lang.Float; +import java.lang.Double; +import java.lang.Character; + +class AssignToLit { + void m(){ +// String s = "Test"; +// Boolean b = false; +// Byte byte1 = 5; +// Byte byte2 = 55; +// Short short1 = 5; +// Short short2 = 55; +// Integer int1 = 5; +// Integer int2 = 8888888; +// Long long1 = 1; +// Long long2 = 5; +// Long long3 = 89989898; +// Float float1 = 1; +// Float float2 = 55; +// Double d1 = 1; +// Double d2 = 55; + Character c = 'A'; + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/BB.jav b/resources/bytecode/javFiles/BB.jav new file mode 100644 index 0000000..db741c6 --- /dev/null +++ b/resources/bytecode/javFiles/BB.jav @@ -0,0 +1,4 @@ +import java.lang.Integer; +import AA; + +public class BB extends AA { } \ No newline at end of file diff --git a/resources/bytecode/javFiles/BinaryInMeth.jav b/resources/bytecode/javFiles/BinaryInMeth.jav new file mode 100644 index 0000000..0e1ddc5 --- /dev/null +++ b/resources/bytecode/javFiles/BinaryInMeth.jav @@ -0,0 +1,17 @@ +import java.lang.Integer; +import java.lang.Double; + +public class BinaryInMeth { + + public m(a){ + return ++a; + } + + public m2(a,b){ + return m(a+b); + } + + public m3(a) { + return m(++a); + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Box.jav b/resources/bytecode/javFiles/Box.jav new file mode 100644 index 0000000..4859d61 --- /dev/null +++ b/resources/bytecode/javFiles/Box.jav @@ -0,0 +1,7 @@ +class B { } +class Box_Main extends B { + m(b) { + b.m(new Box_Main()); + b.m(new B()); + } +} diff --git a/resources/bytecode/javFiles/Box.java b/resources/bytecode/javFiles/Box.java new file mode 100644 index 0000000..581e725 --- /dev/null +++ b/resources/bytecode/javFiles/Box.java @@ -0,0 +1,3 @@ +class Box { + void m(A a) { } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Bug112.jav b/resources/bytecode/javFiles/Bug112.jav new file mode 100644 index 0000000..a3f1bad --- /dev/null +++ b/resources/bytecode/javFiles/Bug112.jav @@ -0,0 +1,7 @@ +public class Bug112 { + public m(x) { + var y; + x = y; + return y; + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Bug122.jav b/resources/bytecode/javFiles/Bug122.jav new file mode 100644 index 0000000..746f311 --- /dev/null +++ b/resources/bytecode/javFiles/Bug122.jav @@ -0,0 +1,12 @@ +import java.lang.Integer; +import java.lang.Boolean; + +public class Bug122 { + public void main() { + if (true) { + for (Integer i = 0; i < 10; i++) { + + } + } + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Bug123.jav b/resources/bytecode/javFiles/Bug123.jav new file mode 100644 index 0000000..daecc91 --- /dev/null +++ b/resources/bytecode/javFiles/Bug123.jav @@ -0,0 +1,13 @@ +import java.lang.Boolean; +import java.lang.Integer; + +public class Bug123 { + public Boolean works(){ + if(true) return true; + else return false; + } + public void fails(){ + Boolean a = true; + if(true) a = false; + } +} diff --git a/resources/bytecode/javFiles/Bug125.jav b/resources/bytecode/javFiles/Bug125.jav new file mode 100644 index 0000000..692106c --- /dev/null +++ b/resources/bytecode/javFiles/Bug125.jav @@ -0,0 +1,16 @@ +import java.lang.Boolean; +import java.lang.Integer; +import java.lang.String; +import java.util.List; +import java.util.LinkedList; +import java.util.ArrayList; + +public class Bug125 { + static ArrayList works = new ArrayList<>(); + static List fails = new ArrayList<>(); + + public void main() { + works.toString(); + fails.toString(); + } +} diff --git a/resources/bytecode/javFiles/Bug285.jav b/resources/bytecode/javFiles/Bug285.jav new file mode 100644 index 0000000..5f17b66 --- /dev/null +++ b/resources/bytecode/javFiles/Bug285.jav @@ -0,0 +1,15 @@ +import java.util.Optional; +import java.lang.Integer; + +public class StaticClass { + public static StaticClass barbar() { + return new StaticClass(); + } +} + +public class Bug285 { + public void foo() { + Optional opt = Optional.empty(); + StaticClass b = StaticClass.barbar(); + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Bug290A.jav b/resources/bytecode/javFiles/Bug290A.jav new file mode 100644 index 0000000..7667cac --- /dev/null +++ b/resources/bytecode/javFiles/Bug290A.jav @@ -0,0 +1,7 @@ +import Bug290B; + +public class Bug290A { + public void m() { + new Bug290B(); + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Bug290B.jav b/resources/bytecode/javFiles/Bug290B.jav new file mode 100644 index 0000000..1a9201b --- /dev/null +++ b/resources/bytecode/javFiles/Bug290B.jav @@ -0,0 +1,11 @@ +import java.lang.String; +import java.lang.Integer; + +public class Bug290B { + String name; + + public Bug290B() { + Integer i = 0; + name = i.toString() + "$$"; + } +} diff --git a/resources/bytecode/javFiles/Bug293.jav b/resources/bytecode/javFiles/Bug293.jav new file mode 100644 index 0000000..0e7dc26 --- /dev/null +++ b/resources/bytecode/javFiles/Bug293.jav @@ -0,0 +1,13 @@ +import java.lang.Integer; +import java.lang.Float; + +public class Bug293 { + bar(a) { + return 2 * a; + } +} + +interface IFoo { + void ga(); +} + diff --git a/resources/bytecode/javFiles/Bug295.jav b/resources/bytecode/javFiles/Bug295.jav new file mode 100644 index 0000000..be4488a --- /dev/null +++ b/resources/bytecode/javFiles/Bug295.jav @@ -0,0 +1,18 @@ +import java.lang.Integer; + +public class Bug295 { + public Integer a; + public Integer b; + public Integer c; + + public Bug295(a, b, c) { + this(a); + this.b = b; + this.c = c; + } + + public Bug295(a) { + this.a = a; + } +} + diff --git a/resources/bytecode/javFiles/Bug296.jav b/resources/bytecode/javFiles/Bug296.jav new file mode 100644 index 0000000..35ac882 --- /dev/null +++ b/resources/bytecode/javFiles/Bug296.jav @@ -0,0 +1,11 @@ +import java.lang.Integer; + +public class Bug296 { + public static m1() { + return m2(); + } + + static m2() { + return 10; + } +} diff --git a/resources/bytecode/javFiles/Bug297.jav b/resources/bytecode/javFiles/Bug297.jav new file mode 100644 index 0000000..c4ff1e5 --- /dev/null +++ b/resources/bytecode/javFiles/Bug297.jav @@ -0,0 +1,11 @@ +import java.lang.Integer; + +public class Bug297 { + public static operation(func, a, b) { + return func.apply(a, b); + } + + public exec() { + return Foo.operation((x, y) -> x + y, 10, 10); + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Bug298.jav b/resources/bytecode/javFiles/Bug298.jav new file mode 100644 index 0000000..42ff96a --- /dev/null +++ b/resources/bytecode/javFiles/Bug298.jav @@ -0,0 +1,17 @@ +import java.util.List; +import java.util.ArrayList; +import java.lang.Integer; +import java.lang.System; +import java.lang.Boolean; +import java.io.PrintStream; +import java.util.stream.Stream; +import java.util.function.Function; + +public class Bug298 { + public void m() { + List list = new ArrayList<>(); + list.stream().map(x -> 2 * x); + + Function filter = x -> true; + } +} diff --git a/resources/bytecode/javFiles/Bug300.jav b/resources/bytecode/javFiles/Bug300.jav new file mode 100644 index 0000000..728aa3f --- /dev/null +++ b/resources/bytecode/javFiles/Bug300.jav @@ -0,0 +1,17 @@ +import java.lang.String; + +class Base { + toString() { + return "Base"; + } +} + +public class Bug300 extends Base { + public m() { + return super.toString(); + } + + toString() { + return "Derived"; + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Bug301.jav b/resources/bytecode/javFiles/Bug301.jav new file mode 100644 index 0000000..30a6f2b --- /dev/null +++ b/resources/bytecode/javFiles/Bug301.jav @@ -0,0 +1,4 @@ +import java.util.HashSet; + +public class Bug301 extends HashSet { +} diff --git a/resources/bytecode/javFiles/Bug302.jav b/resources/bytecode/javFiles/Bug302.jav new file mode 100644 index 0000000..baeb8a8 --- /dev/null +++ b/resources/bytecode/javFiles/Bug302.jav @@ -0,0 +1,11 @@ +import java.util.ArrayList; +import java.util.List; +import java.lang.Integer; + +public class Bug302 { + public Bug302(List a){} + + public static m() { + new Bug302(new ArrayList()); + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Bug306.jav b/resources/bytecode/javFiles/Bug306.jav new file mode 100644 index 0000000..d06ca67 --- /dev/null +++ b/resources/bytecode/javFiles/Bug306.jav @@ -0,0 +1,13 @@ +import java.lang.Integer; +import java.util.List; + +class Base { + m(List a) {} +} + +public class Bug306 extends Base { + @Override + m(List b) { + b.add(1); + } +} diff --git a/resources/bytecode/javFiles/Bug307.jav b/resources/bytecode/javFiles/Bug307.jav new file mode 100644 index 0000000..482e356 --- /dev/null +++ b/resources/bytecode/javFiles/Bug307.jav @@ -0,0 +1,46 @@ +public class Bug307 { + public void main() { + IVisitor v = new Visitor(); + Impl2 f = new Impl2(); + Impl1 g = new Impl1(); + + f.accept(v); + g.accept(v); + } +} + +interface IVisitor { + void visit(Impl1 f); + void visit(Impl2 fb); +} + +interface IAcceptor { + void accept(IVisitor v); +} + +class Visitor implements IVisitor { + + @Override + public void visit(Impl1 f) { + } + + @Override + public void visit(Impl2 fb) { + } +} + +class Impl1 implements IAcceptor { + + @Override + public void accept(IVisitor v) { + v.visit(this); + } +} + +class Impl2 implements IAcceptor { + + @Override + public void accept(IVisitor v) { + v.visit(this); + } +} diff --git a/resources/bytecode/javFiles/Bug309.jav b/resources/bytecode/javFiles/Bug309.jav new file mode 100644 index 0000000..23ae44e --- /dev/null +++ b/resources/bytecode/javFiles/Bug309.jav @@ -0,0 +1,16 @@ +import java.util.List; +import java.util.ArrayList; +import java.lang.Integer; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import java.util.function.Function; +import java.util.function.Predicate; +import java.util.Optional; + +public class Bug309 { + public main() { + List list = new ArrayList<>(List.of(1,2,3,4,5,6,7,8,9)); + var res = list.stream().filter(x -> x == 5).map(x -> x * 2).findFirst(); + return res; + } +} diff --git a/resources/bytecode/javFiles/Bug310.jav b/resources/bytecode/javFiles/Bug310.jav new file mode 100644 index 0000000..0539338 --- /dev/null +++ b/resources/bytecode/javFiles/Bug310.jav @@ -0,0 +1,9 @@ +import java.lang.Integer; +import java.lang.String; + +public class Bug310 { + Integer i = 3; + public toString() { + return i.toString(); + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Bug311.jav b/resources/bytecode/javFiles/Bug311.jav new file mode 100644 index 0000000..e8ccb7f --- /dev/null +++ b/resources/bytecode/javFiles/Bug311.jav @@ -0,0 +1,10 @@ +import java.lang.String; + +public class Bug311 { + Bug311A i = new Bug311A(); + public toString() { + return i.toString(); + } +} + +class Bug311A {} diff --git a/resources/bytecode/javFiles/Bug312.jav b/resources/bytecode/javFiles/Bug312.jav new file mode 100644 index 0000000..82f1aa2 --- /dev/null +++ b/resources/bytecode/javFiles/Bug312.jav @@ -0,0 +1,8 @@ +public class Bug312 { + Bug312A i = new Bug312A(); + public main() { + if (i == null) {} + } +} + +class Bug312A {} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Bug314.jav b/resources/bytecode/javFiles/Bug314.jav new file mode 100644 index 0000000..7f20d6d --- /dev/null +++ b/resources/bytecode/javFiles/Bug314.jav @@ -0,0 +1,13 @@ +import java.lang.Integer; +import java.util.List; +import java.util.ArrayList; +import java.util.stream.Stream; +import java.util.function.Predicate; +import java.util.function.Function; +import java.util.stream.Collectors; + +public class Bug314 { + public List convert(List in) { + return in.stream().filter(x -> x > 5).collect(Collectors.toList()); + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Bug98.jav b/resources/bytecode/javFiles/Bug98.jav new file mode 100644 index 0000000..6a7a9e4 --- /dev/null +++ b/resources/bytecode/javFiles/Bug98.jav @@ -0,0 +1,16 @@ +import java.util.Vector; +import java.lang.Integer; +import java.lang.String; + +public class Bug98 { + + public m(x, y ,z) { + x = new Vector(); + y = new Vector(); + x.add(1); + y.add("2"); + //Integer i = x.elementAt(0); + //String s = y.elementAt(0); + return z.vectorAddAll(x, y); + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/BugXXX.jav b/resources/bytecode/javFiles/BugXXX.jav new file mode 100644 index 0000000..c25acdf --- /dev/null +++ b/resources/bytecode/javFiles/BugXXX.jav @@ -0,0 +1,16 @@ +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; +import java.lang.String; +import java.util.stream.Stream; +import java.util.function.Function; +import java.util.function.Predicate; +import java.lang.Integer; + +class BugXXX { + public main() { + List i = new ArrayList<>(List.of(1,2,3,4,5,6,7,8,9,10)); + Optional tmp = i.stream().filter(x -> x == 5).map(x -> x*2).findFirst(); + return tmp; + } +} diff --git a/resources/bytecode/javFiles/CC.jav b/resources/bytecode/javFiles/CC.jav new file mode 100644 index 0000000..a19fd1f --- /dev/null +++ b/resources/bytecode/javFiles/CC.jav @@ -0,0 +1,11 @@ +import java.lang.Integer; +import java.lang.String; +import BB; + +public class CC extends BB { + public m(Integer i) { + return "CC"; + } + + public m2(CC x) { return "CC"; } +} diff --git a/resources/bytecode/javFiles/Chain.jav b/resources/bytecode/javFiles/Chain.jav new file mode 100644 index 0000000..bd43a01 --- /dev/null +++ b/resources/bytecode/javFiles/Chain.jav @@ -0,0 +1,13 @@ +import java.lang.Integer; + +public class Chain { + x = 5; + + chain() { + return this; + } + + public m() { + return this.chain().chain().chain().x; + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/ClassGenLam.jav b/resources/bytecode/javFiles/ClassGenLam.jav new file mode 100644 index 0000000..0e9cf05 --- /dev/null +++ b/resources/bytecode/javFiles/ClassGenLam.jav @@ -0,0 +1,8 @@ +import java.lang.Integer; + +public class ClassGenLam { + lam = x-> x; +// public ClassGenLam() { +// lam = x->x; +// } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Cycle.jav b/resources/bytecode/javFiles/Cycle.jav new file mode 100644 index 0000000..b49e906 --- /dev/null +++ b/resources/bytecode/javFiles/Cycle.jav @@ -0,0 +1,6 @@ +public class Cycle { + public m(x, y) { + y = x; + x = y; + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/DD.jav b/resources/bytecode/javFiles/DD.jav new file mode 100644 index 0000000..07eaf7c --- /dev/null +++ b/resources/bytecode/javFiles/DD.jav @@ -0,0 +1,5 @@ +import java.lang.Integer; +import CC; + +public class DD extends CC { } + diff --git a/resources/bytecode/javFiles/DuMethod.jav b/resources/bytecode/javFiles/DuMethod.jav new file mode 100644 index 0000000..3898a7b --- /dev/null +++ b/resources/bytecode/javFiles/DuMethod.jav @@ -0,0 +1,11 @@ +public class DuMethod{ + + method(a){ + return a+a; + } + + method(a){ + return a; + } + +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/EmptyClass.jav b/resources/bytecode/javFiles/EmptyClass.jav new file mode 100644 index 0000000..8160d7d --- /dev/null +++ b/resources/bytecode/javFiles/EmptyClass.jav @@ -0,0 +1,3 @@ +public class EmptyClass{ + +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/EmptyMethod.jav b/resources/bytecode/javFiles/EmptyMethod.jav new file mode 100644 index 0000000..961989d --- /dev/null +++ b/resources/bytecode/javFiles/EmptyMethod.jav @@ -0,0 +1,8 @@ +public class EmptyMethod{ + + public void m1(){ + System.out.println("test"); + } + + public void m2(){} +} diff --git a/resources/bytecode/javFiles/Example.jav b/resources/bytecode/javFiles/Example.jav new file mode 100644 index 0000000..b7455a3 --- /dev/null +++ b/resources/bytecode/javFiles/Example.jav @@ -0,0 +1,9 @@ +import java.lang.String; + +public class Example { + + public m() { + String x = "X"; + return x; + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Exceptions.jav b/resources/bytecode/javFiles/Exceptions.jav new file mode 100644 index 0000000..5b901ba --- /dev/null +++ b/resources/bytecode/javFiles/Exceptions.jav @@ -0,0 +1,8 @@ +import java.lang.String; +import java.lang.RuntimeException; + +public class Exceptions { + public m() { + throw new RuntimeException("Some Exception"); + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Expressions.jav b/resources/bytecode/javFiles/Expressions.jav new file mode 100644 index 0000000..e2e992a --- /dev/null +++ b/resources/bytecode/javFiles/Expressions.jav @@ -0,0 +1,8 @@ +class Expressions{ + +void test(){ + var x = 2; + x = x + 2; +} + +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/FC_Matrix.jav b/resources/bytecode/javFiles/FC_Matrix.jav new file mode 100644 index 0000000..75ead47 --- /dev/null +++ b/resources/bytecode/javFiles/FC_Matrix.jav @@ -0,0 +1,10 @@ +import java.util.Vector; + +class Matrix extends Vector> { + + methode(m) { + m.add(1); + Matrix i; + methode(i); + } + } diff --git a/resources/bytecode/javFiles/Fac.jav b/resources/bytecode/javFiles/Fac.jav new file mode 100644 index 0000000..1e09235 --- /dev/null +++ b/resources/bytecode/javFiles/Fac.jav @@ -0,0 +1,15 @@ +import java.lang.Integer; +import java.lang.Double; +import java.lang.String; + +public class Fac { + getFac(n) { + var res = 1; + var i = 1; + while (i <= n) { + res = res * i; + i++; + } + return res; + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Faculty.jav b/resources/bytecode/javFiles/Faculty.jav new file mode 100644 index 0000000..276d8df --- /dev/null +++ b/resources/bytecode/javFiles/Faculty.jav @@ -0,0 +1,52 @@ +import java.lang.Integer; +//import java.lang.Long; +//import java.lang.Short; + +public class Faculty { + public fact; + Faculty() { + fact = (x) -> { + if (x == 1) { + return 1; + } + else { + return x * (fact.apply(x-1)); + } + }; + } + + + + public getFact(java.lang.Integer x) { + return fact.apply(x); + } +} +// m (x) { +// +//// var fact = (x) -> { +//// if (x == 1) { +//// return x; +//// } +//// else { +//// return x * (fact.apply(x-1)); +//// } +//// }; +//// return fact; +//// var x = 13; +//// if(x>22) { +//// return 0; +//// }else if(x <1){ +//// return x; +//// }else { +//// return 1; +//// } +// +// if (x < 0) { +// return 0; +// }else if(x<2) { +// return x; +// } else { +// return x * m(x-1); +// } +// } +//} diff --git a/resources/bytecode/javFiles/Faculty2.jav b/resources/bytecode/javFiles/Faculty2.jav new file mode 100644 index 0000000..828f06f --- /dev/null +++ b/resources/bytecode/javFiles/Faculty2.jav @@ -0,0 +1,10 @@ +class Faculty2 { + + m () { + + var fact = (Integer x) -> { + return x; + }; + return fact; + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/FacultyIf.jav b/resources/bytecode/javFiles/FacultyIf.jav new file mode 100644 index 0000000..3c36892 --- /dev/null +++ b/resources/bytecode/javFiles/FacultyIf.jav @@ -0,0 +1,17 @@ +import java.lang.Integer; + +class Faculty { + + m () { + + var fact = (Integer x) -> { + if (x == 1) { + return x; + } + else { + return x * (fact.apply(x-1)); + } + }; + return fact; + } +} diff --git a/resources/bytecode/javFiles/FacultyTyped.jav b/resources/bytecode/javFiles/FacultyTyped.jav new file mode 100644 index 0000000..089d2f3 --- /dev/null +++ b/resources/bytecode/javFiles/FacultyTyped.jav @@ -0,0 +1,19 @@ +import java.lang.Integer; + +class Faculty { + + Integer mul(Integer x, Integer y) { + return x; + } + + Fun1 m () { + var fact = (Integer x) -> { + return mul(x, fact.apply(x)); + }; + return fact; + } +} + +interface Fun1{ + B apply(A a); +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Field.jav b/resources/bytecode/javFiles/Field.jav new file mode 100644 index 0000000..0fd1133 --- /dev/null +++ b/resources/bytecode/javFiles/Field.jav @@ -0,0 +1,9 @@ +import java.lang.Integer; + +public class Field { + public x = 5; + + m(){ + return x; + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/FieldAccess.jav b/resources/bytecode/javFiles/FieldAccess.jav new file mode 100644 index 0000000..894bb6e --- /dev/null +++ b/resources/bytecode/javFiles/FieldAccess.jav @@ -0,0 +1,13 @@ +class Box { +A f; +} +class B { + } + +class Box_Main extends B { + + m(b) { + b.f = new Box_Main(); + b.f = new B(); + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/FieldTph.jav b/resources/bytecode/javFiles/FieldTph.jav new file mode 100644 index 0000000..fc74e53 --- /dev/null +++ b/resources/bytecode/javFiles/FieldTph.jav @@ -0,0 +1,4 @@ +public class FieldTph { + a; + +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/FieldTph2.jav b/resources/bytecode/javFiles/FieldTph2.jav new file mode 100644 index 0000000..21d9445 --- /dev/null +++ b/resources/bytecode/javFiles/FieldTph2.jav @@ -0,0 +1,14 @@ +import java.lang.String; + +public class FieldTph2 { + public a; + + public m(b){ + b = a; + return b; + } + + public m2(c){ + a = c; + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/FieldTphConsMeth.jav b/resources/bytecode/javFiles/FieldTphConsMeth.jav new file mode 100644 index 0000000..e8d01c1 --- /dev/null +++ b/resources/bytecode/javFiles/FieldTphConsMeth.jav @@ -0,0 +1,26 @@ +public class FieldTphConsMeth { + + public a; + public FieldTphConsMeth(c) { + a = id(c); + } + + public id(b) { + return b; + } + + public setA(x) { + a = x; + return a; + } + + public m(x,y) { + x = id(y); + } + + /*m2(x,y) { + x = setA(y); + return x; + }*/ + +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/FieldTphMMeth.jav b/resources/bytecode/javFiles/FieldTphMMeth.jav new file mode 100644 index 0000000..e1277bf --- /dev/null +++ b/resources/bytecode/javFiles/FieldTphMMeth.jav @@ -0,0 +1,27 @@ +import java.lang.Boolean; + +public class FieldTphMMeth { + public a; + + public FieldTphMMeth(c,d,e) { + a = m(c,d,e); + } + + public m(b,d,e) { + if(e) { + return m3(b); + } else{ + return m3(d); + } + + } + + public m2(b) { + a = m3(b); + } + + public m3(b){ + return b; + } + +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Fields.jav b/resources/bytecode/javFiles/Fields.jav new file mode 100644 index 0000000..cd2add7 --- /dev/null +++ b/resources/bytecode/javFiles/Fields.jav @@ -0,0 +1,11 @@ +import java.lang.String; + +class Fields{ +test2 = "test"; +test; +m(){ + var test3; + return test; +} + +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/For.jav b/resources/bytecode/javFiles/For.jav new file mode 100644 index 0000000..e96184e --- /dev/null +++ b/resources/bytecode/javFiles/For.jav @@ -0,0 +1,30 @@ +import java.lang.Integer; +import java.lang.Boolean; + +public class For{ + public Integer m(Integer x){ + var c = x + 2; + Boolean b = true; + c = 5; + c++; + ++c; + c--; + --c; + while(x<2){ + x = x +1; + b = false; + } + for(int i = 0; i<10; i++) { + x = x + 5; + } + return x; + } + +// m2(Integer x){ +// if(x<2) { +// return 1; +// }else { +// return 2; +// } +// } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/ForEach.jav b/resources/bytecode/javFiles/ForEach.jav new file mode 100644 index 0000000..301066a --- /dev/null +++ b/resources/bytecode/javFiles/ForEach.jav @@ -0,0 +1,23 @@ +import java.util.ArrayList; +import java.lang.Integer; +import java.lang.Number; + +public class ForEach { + public m() { + var list = new ArrayList<>(); + list.add(1); list.add(2); list.add(3); + + var sum = 0; + for (var i : list) { + sum = sum + i; + } + return sum; + } + + public m2() { + var list = new ArrayList(); + + for (Number n : list) { + } + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/FunOL.jav b/resources/bytecode/javFiles/FunOL.jav new file mode 100644 index 0000000..60736e1 --- /dev/null +++ b/resources/bytecode/javFiles/FunOL.jav @@ -0,0 +1,12 @@ +import java.util.Vector; +import java.lang.Integer; +import java.lang.String; +//import java.lang.Byte; +//import java.lang.Boolean; + +public class FunOL { + + add(f, y) { + return f.apply() + y; + } +} diff --git a/resources/bytecode/javFiles/FunctionalInterface.jav b/resources/bytecode/javFiles/FunctionalInterface.jav new file mode 100644 index 0000000..39b3b34 --- /dev/null +++ b/resources/bytecode/javFiles/FunctionalInterface.jav @@ -0,0 +1,15 @@ +import java.lang.Integer; +import java.util.function.Function; + +public class FunctionalInterface { + Integer accept(Function f) { + return f.apply(20); + } + + public Integer m() { + var v = accept(i -> { + return i * 10; + }); + return v; + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Gen.jav b/resources/bytecode/javFiles/Gen.jav new file mode 100644 index 0000000..3b58b18 --- /dev/null +++ b/resources/bytecode/javFiles/Gen.jav @@ -0,0 +1,8 @@ +import java.lang.Integer; +import java.util.Vector; + +public class Gen{ + Vector m(Vector v){ + return v; + } +} diff --git a/resources/bytecode/javFiles/Generics.jav b/resources/bytecode/javFiles/Generics.jav new file mode 100644 index 0000000..bb7b2af --- /dev/null +++ b/resources/bytecode/javFiles/Generics.jav @@ -0,0 +1,17 @@ + +class Generics { + Generics(B b){ + } + B mt1(B b){ + return mt1(b); + } +} + + +/* +Problem: +auto test = new List(); +auto test2 = new List(); +... //code, welcher möglicherweise test und test2 vertauscht +test.add("hallo"); +*/ \ No newline at end of file diff --git a/resources/bytecode/javFiles/Generics2.jav b/resources/bytecode/javFiles/Generics2.jav new file mode 100644 index 0000000..f3aa144 --- /dev/null +++ b/resources/bytecode/javFiles/Generics2.jav @@ -0,0 +1,9 @@ +import java.lang.String; +import java.lang.Integer; + +public class Generics2{ + public X m1(X b){ + return b; + } + +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Generics3.jav b/resources/bytecode/javFiles/Generics3.jav new file mode 100644 index 0000000..fb354d4 --- /dev/null +++ b/resources/bytecode/javFiles/Generics3.jav @@ -0,0 +1,7 @@ +import java.lang.String; +import java.lang.Integer; +import java.util.List; + +class Generics3> { + +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Generics4.jav b/resources/bytecode/javFiles/Generics4.jav new file mode 100644 index 0000000..50b0b3e --- /dev/null +++ b/resources/bytecode/javFiles/Generics4.jav @@ -0,0 +1,12 @@ +import java.lang.String; +import java.lang.Integer; + +class Generics4 { + C m1(C b){ + return b; + } + + m2(x) { + return m1(x); + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/GreaterEqual.jav b/resources/bytecode/javFiles/GreaterEqual.jav new file mode 100644 index 0000000..3ec69e8 --- /dev/null +++ b/resources/bytecode/javFiles/GreaterEqual.jav @@ -0,0 +1,57 @@ +import java.lang.Integer; +import java.lang.Long; +import java.lang.Float; +import java.lang.Double; + +public class GreaterEqual { + + gE(Integer a, Integer b){ + var c = a>=b; + return c; + } + + gE(Long a, Long b){ + var c = a>=b; + return c; + } + + gE(Float a, Float b){ + var c = a>=b; + return c; + } + + gE(Double a, Double b){ + var c = a>=b; + return c; + } + + gE(Long a, Integer b){ + var c = a>=b; + return c; + } + + gE(Float a, Integer b){ + var c = a>=b; + return c; + } + + gE(Double a, Integer b){ + var c = a>=b; + return c; + } + + gE(Float a, Long b){ + var c = a>=b; + return c; + } + + gE(Double a, Long b){ + var c = a>=b; + return c; + } + + gE(Double a, Float b){ + var c = a>=b; + return c; + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/GreaterThan.jav b/resources/bytecode/javFiles/GreaterThan.jav new file mode 100644 index 0000000..9077f5b --- /dev/null +++ b/resources/bytecode/javFiles/GreaterThan.jav @@ -0,0 +1,56 @@ +import java.lang.Integer; +import java.lang.Long; +import java.lang.Float; +import java.lang.Double; + +public class GreaterThan { + gT(Integer a, Integer b){ + var c = a>b; + return c; + } + + gT(Long a, Long b){ + var c = a>b; + return c; + } + + gT(Float a, Float b){ + var c = a>b; + return c; + } + + gT(Double a, Double b){ + var c = a>b; + return c; + } + + gT(Long a, Integer b){ + var c = a>b; + return c; + } + + gT(Float a, Integer b){ + var c = a>b; + return c; + } + + gT(Double a, Integer b){ + var c = a>b; + return c; + } + + gT(Float a, Long b){ + var c = a>b; + return c; + } + + gT(Double a, Long b){ + var c = a>b; + return c; + } + + gT(Double a, Float b){ + var c = a>b; + return c; + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/HelloWorld.jav b/resources/bytecode/javFiles/HelloWorld.jav new file mode 100644 index 0000000..7f5f75d --- /dev/null +++ b/resources/bytecode/javFiles/HelloWorld.jav @@ -0,0 +1,9 @@ +import java.lang.System; +import java.lang.String; +import java.io.PrintStream; + +public class HelloWorld { + public static hello() { + System.out.println("Hello World!"); + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Id.jav b/resources/bytecode/javFiles/Id.jav new file mode 100644 index 0000000..f31991d --- /dev/null +++ b/resources/bytecode/javFiles/Id.jav @@ -0,0 +1,20 @@ +public class Id { +// a; +// id(b){ +// return b; +// } + id2 = x -> x; +// id2 = () -> { +// var x = m(a); +// var y = x; +// var z = y; +// }; +// +// m(a){ +// return a; +// } + id3 (x) { + return id2.apply(x); + } +} + diff --git a/resources/bytecode/javFiles/IfTest.jav b/resources/bytecode/javFiles/IfTest.jav new file mode 100644 index 0000000..bbcda96 --- /dev/null +++ b/resources/bytecode/javFiles/IfTest.jav @@ -0,0 +1,15 @@ +import java.lang.Integer; +import java.lang.Boolean; +import java.lang.String; + +public class IfTest{ + Integer m1(Boolean b) { + Integer i; + String b; + if(b) { + return i; + }else{ + return b; + } + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Import.jav b/resources/bytecode/javFiles/Import.jav new file mode 100644 index 0000000..c658568 --- /dev/null +++ b/resources/bytecode/javFiles/Import.jav @@ -0,0 +1,8 @@ +import java.util.Vector; + +class Import { + void methode(){ + Vector v = new Vector<>(); + v.add("X"); + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Inf.jav b/resources/bytecode/javFiles/Inf.jav new file mode 100644 index 0000000..6002994 --- /dev/null +++ b/resources/bytecode/javFiles/Inf.jav @@ -0,0 +1,65 @@ +public class Inf { + m(x,y,a){ + var z; + var v; + var w; + var b; + y=x; + z=x; + v=y; + w=y; + y=a; + b=a; + var c; + var d; + c = v; + d = v; + } +} + +/* +TPH M m(TPH N x, TPH O y, TPH P a)({ + TPH Q z; + TPH R v; + TPH S w; + TPH T b; + (y)::TPH O = (x)::TPH N; + (z)::TPH Q = (x)::TPH N; + (v)::TPH R = (y)::TPH O; + (w)::TPH S = (y)::TPH O; + (y)::TPH O = (a)::TPH P; + (b)::TPH T = (a)::TPH P; + TPH U c; + TPH V d; + (c)::TPH U = (v)::TPH R; + (d)::TPH V = (v)::TPH R; + return; +})::TPH W + + Inf()({ + super(()); + })::TPH Z + +} +// c::U d::V +// \ / +// v::R w::S +// \ / +// z::Q y::O b::T +// \ / \ / +// x::N a::P + +RESULT Final: [[(TPH N < TPH O), (TPH R < TPH V), (TPH N < TPH Q), (TPH P < TPH O), (TPH R < TPH U), (TPH M = void), (TPH O < TPH S), (TPH O < TPH R), (TPH P < TPH T)]] +Simplified constraints: [(TPH O < TPH S), (TPH P < TPH O), (TPH O < TPH R), (TPH P < TPH T), (TPH N < TPH O), (TPH N < TPH Q)] +m: [(TPH DDV = java.lang.Object), (TPH DDX = java.lang.Object), (TPH DDX < TPH DDV), (TPH N < TPH DDX), (TPH P < TPH DDX)] +Class Inf: [] +Inf: [] + +Unify nach Oder-Constraints-Anpassung: +UND:[(void =. M, , -1 WC: false, IT: false), (N <. O, 1 WC: false, IT: false, 1 WC: false, IT: false), (P <. O, 1 WC: false, IT: false, 1 WC: false, IT: false), (N <. Q, 1 WC: false, IT: false, 0 WC: true, IT: false), (O <. S, 1 WC: false, IT: false, 0 WC: true, IT: false), (O <. R, 1 WC: false, IT: false, 0 WC: true, IT: false), (P <. T, 1 WC: false, IT: false, 0 WC: true, IT: false)] +isInherited = false +isStatement = false + +ODER: +*/ + diff --git a/resources/bytecode/javFiles/Infimum.jav b/resources/bytecode/javFiles/Infimum.jav new file mode 100644 index 0000000..7c47539 --- /dev/null +++ b/resources/bytecode/javFiles/Infimum.jav @@ -0,0 +1,6 @@ +class Infimum { + m(x, y, z) { + y = x; + z = x; + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Inherit.jav b/resources/bytecode/javFiles/Inherit.jav new file mode 100644 index 0000000..8808d8c --- /dev/null +++ b/resources/bytecode/javFiles/Inherit.jav @@ -0,0 +1,21 @@ +import java.util.Vector; + +import java.lang.Integer; +import java.lang.String; +import AA; +import BB; +import CC; +import DD; + +public class Inherit { + + public main(d, i) { + return d.m(i); + } + + public main(v, i) { + var aa = v.elementAt(0); + return aa.m(i); + } + +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Inherit2.jav b/resources/bytecode/javFiles/Inherit2.jav new file mode 100644 index 0000000..58a6ebb --- /dev/null +++ b/resources/bytecode/javFiles/Inherit2.jav @@ -0,0 +1,20 @@ +import java.util.Vector; + +import java.lang.Integer; +import java.lang.String; +import AA; +import BB; +import CC; +import DD; + +public class Inherit2 { + + public main(d) { + return d.m2(d); + } + + public main(v) { + var aa = v.elementAt(0); + return aa.m2(aa); + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/InstanceOf.jav b/resources/bytecode/javFiles/InstanceOf.jav new file mode 100644 index 0000000..52a7473 --- /dev/null +++ b/resources/bytecode/javFiles/InstanceOf.jav @@ -0,0 +1,18 @@ +import java.lang.Object; +import java.lang.Integer; +import java.lang.Boolean; + +interface Interface {} + +class Test implements Interface { +} +class Test2 { +} + +public class InstanceOf { + a = new Test(); + + public test1() { return this.a instanceof Test; } + public test2() { return this.a instanceof Interface; } + public test3() { return this.a instanceof Integer; } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Interface1.jav b/resources/bytecode/javFiles/Interface1.jav new file mode 100644 index 0000000..b741819 --- /dev/null +++ b/resources/bytecode/javFiles/Interface1.jav @@ -0,0 +1,3 @@ +public interface Interface1{ + public void test(); +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Interfaces.jav b/resources/bytecode/javFiles/Interfaces.jav new file mode 100644 index 0000000..0c4cd21 --- /dev/null +++ b/resources/bytecode/javFiles/Interfaces.jav @@ -0,0 +1,33 @@ +import java.lang.Integer; + +interface A { + void method1(); + default method2() { + } +} + +interface B { + void method3(); +} + +interface C { + Integer myInt(); +} + +class ClassX implements A { +} + +record ClassY(Integer myInt) implements C {} + +public class Interfaces implements A, B { + public void method1() { + } + public void method3() { + var intf = new Interfaces(); + intf = new ClassX(); + intf.method1(); + + C c = new ClassY(10); + c.myInt(); + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/KompTph.jav b/resources/bytecode/javFiles/KompTph.jav new file mode 100644 index 0000000..ec34e15 --- /dev/null +++ b/resources/bytecode/javFiles/KompTph.jav @@ -0,0 +1,13 @@ +public class KompTph { + public m(a, b, c) { + var d = a; + var e = a; + a = b; + c = b; + m2(a,c); + } + + public m2(a,b){ + m(a,a,b); + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/LamRunnable.jav b/resources/bytecode/javFiles/LamRunnable.jav new file mode 100644 index 0000000..d0da84c --- /dev/null +++ b/resources/bytecode/javFiles/LamRunnable.jav @@ -0,0 +1,16 @@ +import java.lang.Runnable; +import java.lang.System; +import java.lang.String; +import java.io.PrintStream; + +public class LamRunnable { + + public LamRunnable() { + Runnable lam = () -> { + System.out.println("lambda"); + }; + + lam.run(); + } +} + \ No newline at end of file diff --git a/resources/bytecode/javFiles/Lambda.jav b/resources/bytecode/javFiles/Lambda.jav new file mode 100644 index 0000000..2e725bf --- /dev/null +++ b/resources/bytecode/javFiles/Lambda.jav @@ -0,0 +1,11 @@ +import java.lang.Integer; + +public class Lambda { + + public m() { + var lam1 = (x) -> { + return x; + }; + return lam1; + } +} diff --git a/resources/bytecode/javFiles/Lambda2.jav b/resources/bytecode/javFiles/Lambda2.jav new file mode 100644 index 0000000..92f32b7 --- /dev/null +++ b/resources/bytecode/javFiles/Lambda2.jav @@ -0,0 +1,35 @@ +import java.lang.String; + +public class Lambda2 +{ + public static void main(List args){ + var listOfStrings = new List(); + var listOfObjects; + listOfObjects = map(listOfStrings, (a) -> a); +} + +public map(a , b){ + b.apply(a); + return a; +} + +/* +public static List map(List input, Function func) { + List output; + output = new List(); + output.add(func.apply(input.get())); + return output; +} +*/ +} + +class List{ + /* A get(); + void add(A); + */ +} +/* +class Function{ + B apply(A a); +} +*/ \ No newline at end of file diff --git a/resources/bytecode/javFiles/Lambda3.jav b/resources/bytecode/javFiles/Lambda3.jav new file mode 100644 index 0000000..9c4e960 --- /dev/null +++ b/resources/bytecode/javFiles/Lambda3.jav @@ -0,0 +1,23 @@ + +public class Lambda2 +{ + /* + public static List map(List input, + Function func){ + input.add(func.apply(input.get())); + } + */ + public map(input,func){ + input.add(func.apply(input.get())); + return map(new List(), func); + } +} + +class List{ + A get(); + void add(A); +} + +class Function{ + B apply(A a); +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Lambda4.jav b/resources/bytecode/javFiles/Lambda4.jav new file mode 100644 index 0000000..378eb4d --- /dev/null +++ b/resources/bytecode/javFiles/Lambda4.jav @@ -0,0 +1,18 @@ +class Lambda{ + +methode(){ + return ((f) -> f); +} +} +/* +interface Fun0{ + A apply(); +} + +interface Fun1{ + A apply(B b); +} +*/ +interface Fun2{ + A apply(B b, C c); +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/LambdaCapture.jav b/resources/bytecode/javFiles/LambdaCapture.jav new file mode 100644 index 0000000..ab1751f --- /dev/null +++ b/resources/bytecode/javFiles/LambdaCapture.jav @@ -0,0 +1,12 @@ +import java.lang.Integer; +public class LambdaCapture { + Integer i = 8; + f; + public LambdaCapture(){ + Integer w = 7; + f = j ->{ + return w+i;}; + + } + +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/LambdaField.jav b/resources/bytecode/javFiles/LambdaField.jav new file mode 100644 index 0000000..4eb5373 --- /dev/null +++ b/resources/bytecode/javFiles/LambdaField.jav @@ -0,0 +1,6 @@ +public class LambdaField { + + f = x -> x; + +} + diff --git a/resources/bytecode/javFiles/LambdaRunnable.jav b/resources/bytecode/javFiles/LambdaRunnable.jav new file mode 100644 index 0000000..9dff3a8 --- /dev/null +++ b/resources/bytecode/javFiles/LambdaRunnable.jav @@ -0,0 +1,17 @@ +import java.lang.Runnable; +import java.lang.String; +import java.lang.System; +import java.io.PrintStream; + +public class LambdaRunnable { + + public LambdaRunnable(){ + + + Runnable lam = () -> { + System.out.println("Runnable is running"); + }; + lam.run(); + } +} + diff --git a/resources/bytecode/javFiles/LambdaVoid.jav b/resources/bytecode/javFiles/LambdaVoid.jav new file mode 100644 index 0000000..dc16fcb --- /dev/null +++ b/resources/bytecode/javFiles/LambdaVoid.jav @@ -0,0 +1,9 @@ +import java.lang.Integer; + +public class Lambda { + + m () { + var lam1 = (x) -> { }; + return lam1; + } +} diff --git a/resources/bytecode/javFiles/LessEqual.jav b/resources/bytecode/javFiles/LessEqual.jav new file mode 100644 index 0000000..02714fc --- /dev/null +++ b/resources/bytecode/javFiles/LessEqual.jav @@ -0,0 +1,56 @@ +import java.lang.Integer; +import java.lang.Long; +import java.lang.Float; +import java.lang.Double; + +public class LessEqual { + public lessEqual(Integer a, Integer b){ + var c = a<=b; + return c; + } + + public lessEqual(Long a, Long b){ + var c = a<=b; + return c; + } + + public lessEqual(Float a, Float b){ + var c = a<=b; + return c; + } + + public lessEqual(Double a, Double b){ + var c = a<=b; + return c; + } + + public lessEqual(Long a, Integer b){ + var c = a<=b; + return c; + } + + public lessEqual(Float a, Integer b){ + var c = a<=b; + return c; + } + + public lessEqual(Double a, Integer b){ + var c = a<=b; + return c; + } + + public lessEqual(Float a, Long b){ + var c = a<=b; + return c; + } + + public lessEqual(Double a, Long b){ + var c = a<=b; + return c; + } + + public lessEqual(Double a, Float b){ + var c = a<=b; + return c; + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/LessThan.jav b/resources/bytecode/javFiles/LessThan.jav new file mode 100644 index 0000000..a4c5be9 --- /dev/null +++ b/resources/bytecode/javFiles/LessThan.jav @@ -0,0 +1,57 @@ +import java.lang.Integer; +import java.lang.Long; +import java.lang.Float; +import java.lang.Double; + +public class LessThan { + + public lessThan(Integer a, Integer b){ + var c = a> { + + Matrix () { + } + + public Matrix(vv) { + Integer i; + i = 0; + while(i < vv.size()) { +// Boolean a = this.add(vv.elementAt(i)); + this.add(vv.elementAt(i)); + i=i+1; + } + } + + public mul(m) { + var ret = new Matrix(); + var i = 0; + while(i < size()) { + var v1 = this.elementAt(i); + var v2 = new Vector(); + var j = 0; + while(j < v1.size()) { + var erg = 0; + var k = 0; + while(k < v1.size()) { + erg = erg + v1.elementAt(k) + * m.elementAt(k).elementAt(j); + k++; } +// v2.addElement(new Integer(erg)); + v2.addElement(erg); + j++; } + ret.addElement(v2); + i++; + } + return ret; + } +} diff --git a/resources/bytecode/javFiles/MatrixOP.jav b/resources/bytecode/javFiles/MatrixOP.jav new file mode 100644 index 0000000..749f208 --- /dev/null +++ b/resources/bytecode/javFiles/MatrixOP.jav @@ -0,0 +1,43 @@ +import java.util.Vector; +import java.lang.Integer; +//import java.lang.Byte; +import java.lang.Boolean; + +public class MatrixOP extends Vector> { + + MatrixOP () { + } + + public MatrixOP(vv) { + Integer i; + i = 0; + while(i < vv.size()) { +// Boolean a = this.add(vv.elementAt(i)); + this.add(vv.elementAt(i)); + i=i+1; + } + } + + public mul = (m1, m2) -> { + var ret = new MatrixOP(); + var i = 0; + while(i < m1.size()) { + var v1 = m1.elementAt(i); + var v2 = new Vector(); + var j = 0; + while(j < v1.size()) { + var erg = 0; + var k = 0; + while(k < v1.size()) { + erg = erg + v1.elementAt(k) + * m2.elementAt(k).elementAt(j); + k++; } +// v2.addElement(new Integer(erg)); + v2.addElement(erg); + j++; } + ret.addElement(v2); + i++; + } + return ret; + }; +} diff --git a/resources/bytecode/javFiles/Merge.jav b/resources/bytecode/javFiles/Merge.jav new file mode 100644 index 0000000..c25c00a --- /dev/null +++ b/resources/bytecode/javFiles/Merge.jav @@ -0,0 +1,20 @@ +import java.util.List; +import java.lang.Integer; +//import java.util.Collection; + +public class Merge { + + public merge(a, b) { + a.addAll(b); + return a; + } + + + + public sort(in){ + var firstHalf = in.subList(1,2); + var secondHalf = in.subList(1,2); + return merge(sort(firstHalf), sort(secondHalf)); + } + +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Meth_Gen.jav b/resources/bytecode/javFiles/Meth_Gen.jav new file mode 100644 index 0000000..056dd82 --- /dev/null +++ b/resources/bytecode/javFiles/Meth_Gen.jav @@ -0,0 +1,11 @@ +class Meth_Gen { + + m1(x, y) { + m2(x); + x = y; + } + + m2(y) { + m1(y, y); + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/MethodCallGenerics.jav b/resources/bytecode/javFiles/MethodCallGenerics.jav new file mode 100644 index 0000000..0d02509 --- /dev/null +++ b/resources/bytecode/javFiles/MethodCallGenerics.jav @@ -0,0 +1,14 @@ +import java.lang.String; + +class Generics { + // A mt1(A a, B b){ + B mt1(B a, B b){ + return mt1(a, a); + } +} + +class Test { + methode(String s){ + return new Generics().mt1(s,s); + } +} diff --git a/resources/bytecode/javFiles/MethodWildcardGen.jav b/resources/bytecode/javFiles/MethodWildcardGen.jav new file mode 100644 index 0000000..c982c44 --- /dev/null +++ b/resources/bytecode/javFiles/MethodWildcardGen.jav @@ -0,0 +1,21 @@ +/* +class C{ + A f; + m(b, c){ + c.f = b; + c.m(b, c); + } +} +*/ +class C{ + X f; + m(b, c, d){ + this.f = b; + this.f = c.f; + c.m2(d); + } + + m2(a){ + a.f = this.f; + } +} diff --git a/resources/bytecode/javFiles/Methods.jav b/resources/bytecode/javFiles/Methods.jav new file mode 100644 index 0000000..3c46739 --- /dev/null +++ b/resources/bytecode/javFiles/Methods.jav @@ -0,0 +1,14 @@ +import java.lang.Integer; + +class Methods { + + m(a,b){ + var c=a+b; + return c; + } + + method2(x){ + Integer i = this.m(x,2); + return i; + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/MethodsEasy.jav b/resources/bytecode/javFiles/MethodsEasy.jav new file mode 100644 index 0000000..ee6f9da --- /dev/null +++ b/resources/bytecode/javFiles/MethodsEasy.jav @@ -0,0 +1,7 @@ + +class Methods { + mt4(a,b,c) { return a.mt3(b).mt3(c) ; } + + mt3(a) {return a.mt3(a); } +} + diff --git a/resources/bytecode/javFiles/OL.jav b/resources/bytecode/javFiles/OL.jav new file mode 100644 index 0000000..a30edca --- /dev/null +++ b/resources/bytecode/javFiles/OL.jav @@ -0,0 +1,16 @@ +import java.lang.Double; +import java.lang.String; +import java.lang.Long; +import java.lang.Integer; + +public class OL { + public m (x) { return x + x; } +} + +public class OLMain { + public main(x) { + var ol; + ol = new OL(); + return ol.m(x); + } +} diff --git a/resources/bytecode/javFiles/OLConstructor.jav b/resources/bytecode/javFiles/OLConstructor.jav new file mode 100644 index 0000000..1e31509 --- /dev/null +++ b/resources/bytecode/javFiles/OLConstructor.jav @@ -0,0 +1,17 @@ +import java.lang.Integer; + +public class Parent { + public Integer x; + + public Parent(Integer a) { + this.x = a; + } + + public Parent() {} +} + +public class Child extends Parent { + public Child() { + super(3); + } +} diff --git a/resources/bytecode/javFiles/OLFun.jav b/resources/bytecode/javFiles/OLFun.jav new file mode 100644 index 0000000..50d30b7 --- /dev/null +++ b/resources/bytecode/javFiles/OLFun.jav @@ -0,0 +1,19 @@ +import java.lang.String; +import java.lang.Integer; +import java.lang.Double; +import java.util.Vector; +import java.lang.Boolean; + +public class OLFun { + + //f = x -> {return x + x;}; + m(f, x) { + x = f.apply(x+x); + return x; + } + + m2(y) { + m(x -> x * 2, y); + return; + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/OLFun2.jav b/resources/bytecode/javFiles/OLFun2.jav new file mode 100644 index 0000000..6b6f38a --- /dev/null +++ b/resources/bytecode/javFiles/OLFun2.jav @@ -0,0 +1,13 @@ +import java.lang.String; +import java.lang.Integer; +import java.lang.Double; +import java.util.Vector; +import java.lang.Boolean; + +public class OLFun2 { + + x; + m(f){ + x = f.apply(x + x); + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Op.jav b/resources/bytecode/javFiles/Op.jav new file mode 100644 index 0000000..082f48d --- /dev/null +++ b/resources/bytecode/javFiles/Op.jav @@ -0,0 +1,16 @@ +import java.lang.Integer; +import java.lang.String; +import java.lang.Long; +import java.lang.Float; +import java.lang.Double; +import java.lang.Boolean; +import java.lang.Short; +import java.lang.Byte; + +public class Op { + + m(a, b) { + //var c = a+b; + return a+b; + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Op1.jav b/resources/bytecode/javFiles/Op1.jav new file mode 100644 index 0000000..48af9df --- /dev/null +++ b/resources/bytecode/javFiles/Op1.jav @@ -0,0 +1,34 @@ +import java.lang.Boolean; +import java.lang.Integer; + +public class Op1 { + public not() { + var b = false; + var c = !b; + return c; + } + + public or() { + var a = 10; + var b = 20; + return a | b; + } + + public and() { + var a = 10; + var b = 20; + return a & b; + } + + public xor() { + var a = 10; + var b = 20; + return a ^ b; + } + + public mod() { + var a = 10; + var b = 2; + return a % b; + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Op2.jav b/resources/bytecode/javFiles/Op2.jav new file mode 100644 index 0000000..cda23ae --- /dev/null +++ b/resources/bytecode/javFiles/Op2.jav @@ -0,0 +1,17 @@ +import java.lang.Integer; +import java.lang.Double; +import java.lang.String; + +public class Op2 { + public m(){ + var x = ""; + var a = 5+x; + + Integer x = 10; + Double y = 10.5; + + var a = x - y; + + return a; + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/OverlaodGen.jav b/resources/bytecode/javFiles/OverlaodGen.jav new file mode 100644 index 0000000..d594649 --- /dev/null +++ b/resources/bytecode/javFiles/OverlaodGen.jav @@ -0,0 +1,11 @@ +import java.util.Vector; + +class OverlaodGen { + void method(Vector v) { +// Integer i = v.get(0); + } + + void method(Vector v) { +// String s = v.get(0); + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/OverloadPattern.jav b/resources/bytecode/javFiles/OverloadPattern.jav new file mode 100644 index 0000000..e7f777d --- /dev/null +++ b/resources/bytecode/javFiles/OverloadPattern.jav @@ -0,0 +1,50 @@ +import java.lang.Integer; +import java.lang.Number; +import java.lang.Float; + +record Point(Number x, Number y) {} + +public class OverloadPattern { + public m(Point(Integer x, Integer y)) { + return x + y; + } + + public m(Point(Float x, Float y)) { + return x * y; + } + + public m(Integer x) { + return x; + } +} + +/* +public class OverloadPattern { + Integer m$Point$_$java$lang$Integer$_$java$lang$Integer$_$(Point point) { + var x = point.x(); + var y = point.y(); + return x + y; + } + + Float m$Point$_$java$lang$Float$_$java$lang$Float$_$(Point point) { + var x = point.x(); + var y = point.y(); + return x * y; + } + + Number m(Point point) { + return switch(point) { + case Point(Integer x, Integer y) -> + m$Point$_$java$lang$Integer$_$java$lang$Integer$_$(point); + case Point(Float x, Float y) -> + m$Point$_$java$lang$Float$_$java$lang$Float$_$(point); + default -> throw new IllegalArgumentException(); + } + } + + Integer m(Integer x) { + return x; + } +} + +*/ \ No newline at end of file diff --git a/resources/bytecode/javFiles/Overloading.jav b/resources/bytecode/javFiles/Overloading.jav new file mode 100644 index 0000000..c44a7a9 --- /dev/null +++ b/resources/bytecode/javFiles/Overloading.jav @@ -0,0 +1,18 @@ +import java.lang.String; + +public class Overloading{ + + public test(x){ + return x.methode(); + } + + public methode(){ + return "Overloading"; + } +} + +public class Overloading2{ + public methode(){ + return "Overloading2"; + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/OverrideEquals.jav b/resources/bytecode/javFiles/OverrideEquals.jav new file mode 100644 index 0000000..cabb6d4 --- /dev/null +++ b/resources/bytecode/javFiles/OverrideEquals.jav @@ -0,0 +1,12 @@ +import java.lang.Object; +import java.lang.Boolean; + +public class OverrideEquals extends OverrideRoot { + public boolean equals(Object o) { + return true; + } + + public int method(int var1, float var2) { + return 0; + } +} diff --git a/resources/bytecode/javFiles/OverrideRoot.java b/resources/bytecode/javFiles/OverrideRoot.java new file mode 100644 index 0000000..5d09759 --- /dev/null +++ b/resources/bytecode/javFiles/OverrideRoot.java @@ -0,0 +1,3 @@ +public abstract class OverrideRoot { + public abstract int method(int a, float b); +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Package.jav b/resources/bytecode/javFiles/Package.jav new file mode 100644 index 0000000..bbc1e51 --- /dev/null +++ b/resources/bytecode/javFiles/Package.jav @@ -0,0 +1,5 @@ +package strucType.input; + +class Neu +{ +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Pair.jav b/resources/bytecode/javFiles/Pair.jav new file mode 100644 index 0000000..4547ad1 --- /dev/null +++ b/resources/bytecode/javFiles/Pair.jav @@ -0,0 +1,17 @@ +import java.util.Vector; +import java.lang.Boolean; +import java.lang.Object; + + +public class Pair { + T x; + U y; + + public fst() { + return x; + } + + public snd() { + return y; + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/PairNoGenerics.jav b/resources/bytecode/javFiles/PairNoGenerics.jav new file mode 100644 index 0000000..e69de29 diff --git a/resources/bytecode/javFiles/Plus.jav b/resources/bytecode/javFiles/Plus.jav new file mode 100644 index 0000000..74bdc61 --- /dev/null +++ b/resources/bytecode/javFiles/Plus.jav @@ -0,0 +1,9 @@ +import java.lang.Integer; +import java.lang.String; + +public class Plus { + + public m(a,b) { + return a+b; + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/PostIncDec.jav b/resources/bytecode/javFiles/PostIncDec.jav new file mode 100644 index 0000000..d3672aa --- /dev/null +++ b/resources/bytecode/javFiles/PostIncDec.jav @@ -0,0 +1,27 @@ +import java.lang.Integer; + +public class PostIncDec { + public m() { + var i = 0; + i++; + return i; + } + + public m2() { + var i = 0; + var j = i++; + return j; + } + + public d() { + var i = 0; + i--; + return i; + } + + public d2() { + var i = 0; + var j = i--; + return j; + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/PreInc.jav b/resources/bytecode/javFiles/PreInc.jav new file mode 100644 index 0000000..df66797 --- /dev/null +++ b/resources/bytecode/javFiles/PreInc.jav @@ -0,0 +1,28 @@ +import java.lang.Integer; + +public class PreInc { + public m() { + var i = 0; + ++i; + return i; + } + + public m2() { + var i = 0; + var j = ++i; + return j; + } + + public d() { + var i = 0; + --i; + return i; + } + + public d2() { + var i = 0; + var j = --i; + return j; + } + +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Put.jav b/resources/bytecode/javFiles/Put.jav new file mode 100644 index 0000000..113f284 --- /dev/null +++ b/resources/bytecode/javFiles/Put.jav @@ -0,0 +1,19 @@ +import java.util.Vector; +import java.util.Stack; + +public class Put { + + public putElement(ele, v) { + v.addElement(ele); + } + + public putElement(ele, s) { + s.push(ele); + } + + + public main(ele, x) { + putElement(ele, x); + } + +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/RecordTest.jav b/resources/bytecode/javFiles/RecordTest.jav new file mode 100644 index 0000000..a19d1f0 --- /dev/null +++ b/resources/bytecode/javFiles/RecordTest.jav @@ -0,0 +1,22 @@ +import java.lang.Integer; + +record Rec(Integer a, Integer b) {} + +/*public class Rec { + x; y; + Rec(Integer a, Integer b) { + x = a; + y = b; + } +}*/ + +public class RecordTest { + Rec a = new Rec(10, 20); + Rec b = new Rec(10, 20); + Rec c = new Rec(20, 40); + + public doesEqual() { return a.equals(b); } + public doesNotEqual() { return b.equals(c); } + public hashCode() { return a.hashCode(); } + public toString() { return a.toString(); } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/RecursiveMeth.jav b/resources/bytecode/javFiles/RecursiveMeth.jav new file mode 100644 index 0000000..be35a43 --- /dev/null +++ b/resources/bytecode/javFiles/RecursiveMeth.jav @@ -0,0 +1,5 @@ +public class RecursiveMeth{ + public Integer test(){ + return this.test(); + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/RelOps.jav b/resources/bytecode/javFiles/RelOps.jav new file mode 100644 index 0000000..63491d9 --- /dev/null +++ b/resources/bytecode/javFiles/RelOps.jav @@ -0,0 +1,8 @@ +import java.lang.Integer; +import java.lang.Boolean; + +public class RelOps { + public m(a,b){ + return a { + + public Scalar(v) { + Integer i; + i = 0; + while(i < v.size()) { + this.add(v.elementAt(i)); + i=i+1; + } + } + + public mul(v) { + var ret = 0; + var i = 0; + while(i < size()) { + ret = ret + this.elementAt(i) * v.elementAt(i); + i = i+1; + } + return ret; + } +} diff --git a/resources/bytecode/javFiles/SimpleCycle.jav b/resources/bytecode/javFiles/SimpleCycle.jav new file mode 100644 index 0000000..92f505b --- /dev/null +++ b/resources/bytecode/javFiles/SimpleCycle.jav @@ -0,0 +1,25 @@ +public class SimpleCycle { + + m(){ + var g; + var h; + g = h; + h = g; + /* + var y; + var z; + y=z; + z=y; + + var j = z; + var x; + b = a; + var c = b; + var f = d; + b = x; + var l = c; + a = l; + */ + } + +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Sorting.jav b/resources/bytecode/javFiles/Sorting.jav new file mode 100644 index 0000000..345819d --- /dev/null +++ b/resources/bytecode/javFiles/Sorting.jav @@ -0,0 +1,23 @@ +import java.util.List; +import java.util.ArrayList; +import java.lang.String; + +public class Sorting{ + merge(a, b){ + a.addAll(b); + return a; + } + +sort(in){ + var firstHalf = in; + var secondHalf = in; + return merge(sort(firstHalf), sort(secondHalf)); +} + + + /* + void sort(a){ + a = merge(a,a); + } + */ +} diff --git a/resources/bytecode/javFiles/Static.jav b/resources/bytecode/javFiles/Static.jav new file mode 100644 index 0000000..a02ef3c --- /dev/null +++ b/resources/bytecode/javFiles/Static.jav @@ -0,0 +1,18 @@ +import java.lang.Integer; + +class Other { + static field = 20; +} + +public class Static { + static i = 20; + + static { + var x = 30; + i = x; + } + + public static m() { + return i + Other.field; + } +} diff --git a/resources/bytecode/javFiles/StaticM.jav b/resources/bytecode/javFiles/StaticM.jav new file mode 100644 index 0000000..6689003 --- /dev/null +++ b/resources/bytecode/javFiles/StaticM.jav @@ -0,0 +1,10 @@ +public class StaticM { + + public static void m() { + System.out.println("Test"); + } + + public static void m2() { + m(); + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/SubMatrix.jav b/resources/bytecode/javFiles/SubMatrix.jav new file mode 100644 index 0000000..f761321 --- /dev/null +++ b/resources/bytecode/javFiles/SubMatrix.jav @@ -0,0 +1,13 @@ +import java.util.Vector; +import java.lang.Integer; + +public class Matrix2 extends Vector { + +} + +public class SubMatrix extends Matrix2 { + m(){ + Vector v = new Vector(); + v.add(1); + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Subclass.jav b/resources/bytecode/javFiles/Subclass.jav new file mode 100644 index 0000000..fe6e920 --- /dev/null +++ b/resources/bytecode/javFiles/Subclass.jav @@ -0,0 +1,6 @@ +public class Subclass extends Superclass { + + public void printMethod() { + super.printMethod(); + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/SuperCall.jav b/resources/bytecode/javFiles/SuperCall.jav new file mode 100644 index 0000000..08b8a04 --- /dev/null +++ b/resources/bytecode/javFiles/SuperCall.jav @@ -0,0 +1,11 @@ +import java.lang.Integer; + +class Parent { + public Parent(Integer x) {} +} + +public class SuperCall extends Parent { + public SuperCall() { + super(20); + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Superclass.jav b/resources/bytecode/javFiles/Superclass.jav new file mode 100644 index 0000000..d58089d --- /dev/null +++ b/resources/bytecode/javFiles/Superclass.jav @@ -0,0 +1,6 @@ +public class Superclass { + + public void printMethod() { + System.out.println("Printed in Superclass."); + } +} diff --git a/resources/bytecode/javFiles/Switch.jav b/resources/bytecode/javFiles/Switch.jav new file mode 100644 index 0000000..f120f81 --- /dev/null +++ b/resources/bytecode/javFiles/Switch.jav @@ -0,0 +1,17 @@ +import java.lang.Integer; +import java.lang.Object; +import java.lang.Float; + +public record Rec(Integer a, Object b) {} + +public class Switch { + public main(o) { + return switch (o) { + case Rec(Integer a, Integer b) -> a + b; + case Rec(Integer a, Float b) -> a + 10; + case Rec(Integer a, Rec(Integer b, Integer c)) -> a + b + c; + case Integer i -> i; + default -> 0; + }; + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Switch2.jav b/resources/bytecode/javFiles/Switch2.jav new file mode 100644 index 0000000..c75aaa5 --- /dev/null +++ b/resources/bytecode/javFiles/Switch2.jav @@ -0,0 +1,13 @@ +import java.lang.Integer; + +record Point(x, y) {} + +class Switch2 { + m() { + var pt = new Point(10, 20); + return switch (pt) { + case Point(x, y) -> 10; + default -> 20; + }; + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/SwitchString.jav b/resources/bytecode/javFiles/SwitchString.jav new file mode 100644 index 0000000..53dcc93 --- /dev/null +++ b/resources/bytecode/javFiles/SwitchString.jav @@ -0,0 +1,14 @@ +import java.lang.Integer; +import java.lang.String; +import java.lang.Object; + +public class SwitchString { + public main(o) { + return switch (o) { + case "AaAaAa" -> 1; // These two have the same hash code! + case "AaAaBB" -> 2; + case "test", "TEST" -> 3; + default -> 4; + }; + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/TXGenerics.jav b/resources/bytecode/javFiles/TXGenerics.jav new file mode 100644 index 0000000..7f0f708 --- /dev/null +++ b/resources/bytecode/javFiles/TXGenerics.jav @@ -0,0 +1,11 @@ +import java.lang.String; + +public class TXGenerics { + a; + b; + + public test() { + var c = new Cycle(); + c.m(a, b); + } +} diff --git a/resources/bytecode/javFiles/Ternary.jav b/resources/bytecode/javFiles/Ternary.jav new file mode 100644 index 0000000..321490b --- /dev/null +++ b/resources/bytecode/javFiles/Ternary.jav @@ -0,0 +1,9 @@ +import java.lang.Boolean; +import java.lang.String; +import java.lang.Integer; + +public class Ternary { + public main(x) { + return x > 10 ? "big" : "small"; + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Tph.jav b/resources/bytecode/javFiles/Tph.jav new file mode 100644 index 0000000..22f2f94 --- /dev/null +++ b/resources/bytecode/javFiles/Tph.jav @@ -0,0 +1,11 @@ +public class Tph { + + public m(a,b){ + var c = m2(b); + return a; + } + + public m2(b){ + return b; + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Tph2.jav b/resources/bytecode/javFiles/Tph2.jav new file mode 100644 index 0000000..04ea5ba --- /dev/null +++ b/resources/bytecode/javFiles/Tph2.jav @@ -0,0 +1,6 @@ +public class Tph2 { + id = x->x; + id3 (x) { + return id.apply(x); + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Tph3.jav b/resources/bytecode/javFiles/Tph3.jav new file mode 100644 index 0000000..553e274 --- /dev/null +++ b/resources/bytecode/javFiles/Tph3.jav @@ -0,0 +1,14 @@ +public class Tph3 { +// m(a,b){ +// var c = m2(a,b); +// return c; +// } +// +// m2(a,b){ +// return m(a,b); +// } + m1(x, y) { m2(x); x = y; + } + + m2(y) { m1(y, y); } +} diff --git a/resources/bytecode/javFiles/Tph4.jav b/resources/bytecode/javFiles/Tph4.jav new file mode 100644 index 0000000..58fe1d1 --- /dev/null +++ b/resources/bytecode/javFiles/Tph4.jav @@ -0,0 +1,12 @@ +public class Tph4{ + m(a,b){ + var c = m2(b); + var d = m2(c); + return d; + } + + m2(b){ + return b; + } + +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Tph5.jav b/resources/bytecode/javFiles/Tph5.jav new file mode 100644 index 0000000..e73cfa2 --- /dev/null +++ b/resources/bytecode/javFiles/Tph5.jav @@ -0,0 +1,13 @@ +public class Tph5 { +// m(a,b,c){ +// a = c; +// b = c; +// return a; +// } + + m(x,y){ + x = m2(y); + } + + m2(y) { return y; } +} diff --git a/resources/bytecode/javFiles/Tph6.jav b/resources/bytecode/javFiles/Tph6.jav new file mode 100644 index 0000000..2f9e429 --- /dev/null +++ b/resources/bytecode/javFiles/Tph6.jav @@ -0,0 +1,14 @@ +public class Tph6 { +// m(a,b,c){ +// a = c; +// b = c; +// return a; +// } + + m(x,y){ + var c = m2(y); + c = m2(x); + } + + m2(y) { return y; } +} diff --git a/resources/bytecode/javFiles/Tph7.jav b/resources/bytecode/javFiles/Tph7.jav new file mode 100644 index 0000000..cc55afb --- /dev/null +++ b/resources/bytecode/javFiles/Tph7.jav @@ -0,0 +1,11 @@ +public class Tph7 { + + m(a,b){ + var c = m2(b); + return m2(b); + } + + m2(b){ + return b; + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/TypeCast.jav b/resources/bytecode/javFiles/TypeCast.jav new file mode 100644 index 0000000..dffab1a --- /dev/null +++ b/resources/bytecode/javFiles/TypeCast.jav @@ -0,0 +1,11 @@ +import java.lang.Object; +import java.lang.Integer; +import java.util.List; +import java.util.ArrayList; + +public class TypeCast { + public void main() { + Object a = new ArrayList(); + ArrayList b = (ArrayList) a; + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/TypedID.jav b/resources/bytecode/javFiles/TypedID.jav new file mode 100644 index 0000000..aa88583 --- /dev/null +++ b/resources/bytecode/javFiles/TypedID.jav @@ -0,0 +1,12 @@ +public class TypedID/* */ { + + lam = x-> x; + + id(b){ + return b; + } + + m(){ + return lam; + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Vector.jav b/resources/bytecode/javFiles/Vector.jav new file mode 100644 index 0000000..5c21cff --- /dev/null +++ b/resources/bytecode/javFiles/Vector.jav @@ -0,0 +1,23 @@ +import java.util.ArrayList; +import java.util.Vector; +import java.lang.Object; + +class MyVector{ + +id(x){ + Object i; + x.add(i); + x.add(i); + x.add(i); + x.add(i); + x.add(i); + x.add(i); + x.add(i); + x.add(i); + x.add(i); + x.add(i); + x.add(i); + x.add(i); + return x; +} +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/VectorAdd.jav b/resources/bytecode/javFiles/VectorAdd.jav new file mode 100644 index 0000000..2ad73aa --- /dev/null +++ b/resources/bytecode/javFiles/VectorAdd.jav @@ -0,0 +1,26 @@ +import java.util.Vector; +import java.lang.Integer; +import java.lang.String; + +public class VectorAdd { + vectorAdd(v1, v2) { + var i = 0; + v1 = new Vector(); + var erg = new Vector<>(); + while (i < v1.size()) { + erg.addElement(v1.elementAt(i) + v2.elementAt(i)); + i++; + } + return erg; + } + + m(x, y, z) { + x = new Vector(); + y = new Vector(); + x.add(1); + y.add("2"); + //Integer i = x.elementAt(0); + //String s = y.elementAt(0); + return z.addAll(x); + } +} diff --git a/resources/bytecode/javFiles/VectorSuper.jav b/resources/bytecode/javFiles/VectorSuper.jav new file mode 100644 index 0000000..fbadafb --- /dev/null +++ b/resources/bytecode/javFiles/VectorSuper.jav @@ -0,0 +1,11 @@ +import java.util.Vector; +import java.lang.Integer; + +public class VectorSuper { + + m(x){ + Integer y = 1; + x.addElement(y); + //return x; + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/VoidMeth.jav b/resources/bytecode/javFiles/VoidMeth.jav new file mode 100644 index 0000000..6b3ab21 --- /dev/null +++ b/resources/bytecode/javFiles/VoidMeth.jav @@ -0,0 +1,4 @@ +public class VoidMeth{ + public void test(){ + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/WC.jav b/resources/bytecode/javFiles/WC.jav new file mode 100644 index 0000000..389a4fc --- /dev/null +++ b/resources/bytecode/javFiles/WC.jav @@ -0,0 +1,8 @@ +import java.lang.Integer; +import java.util.List; +public class WC { + + void m (List a, List b) { + + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/While.jav b/resources/bytecode/javFiles/While.jav new file mode 100644 index 0000000..df259cf --- /dev/null +++ b/resources/bytecode/javFiles/While.jav @@ -0,0 +1,12 @@ +import java.lang.Integer; +import java.lang.Long; +import java.lang.Double; + +public class While { + public m(x) { + while(x < 2) { + x = x+1; + } + return x; + } +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Wildcards.jav b/resources/bytecode/javFiles/Wildcards.jav new file mode 100644 index 0000000..7dca051 --- /dev/null +++ b/resources/bytecode/javFiles/Wildcards.jav @@ -0,0 +1,8 @@ +import java.util.List; +import java.lang.Number; + +public class Wildcards { + public void m1(List a) {} + public void m2(List a) {} + public void m3(List a) {} +} diff --git a/resources/bytecode/javFiles/Y.jav b/resources/bytecode/javFiles/Y.jav new file mode 100644 index 0000000..0c14b49 --- /dev/null +++ b/resources/bytecode/javFiles/Y.jav @@ -0,0 +1,42 @@ +import java.lang.Integer; + +public class Y { + y; + //factorial; + + public Y() { + y = f -> t -> f.apply(y.apply(f)).apply(t); + //factorial = y.apply(f -> n -> { if (n == 0) return 1; else return n * f.apply(n - 1); }); + } + /* + getY() { + return y; + } + */ +} +/* +class fac1 { + factorial; + + fac1() { + var y; + y = new Y().getY(); + factorial = y.apply(f -> n -> { if (n == 0) return 1; else return n * f.apply(n - 1); }); + } +} + +ergibt Parse-Error +class fac1 { + factorial; + + fac1() { + var y; + y = new Y<>().y; + factorial = y.apply(f -> n -> { if (n == 0) return 1; else return n * f.apply(n - 1); }); + } + public static void main(String args[]) { + System.out.println(new fac1().factorial.apply(3)); + } + +} +*/ \ No newline at end of file diff --git a/resources/bytecode/javFiles/applyLambda.jav b/resources/bytecode/javFiles/applyLambda.jav new file mode 100644 index 0000000..37a3fba --- /dev/null +++ b/resources/bytecode/javFiles/applyLambda.jav @@ -0,0 +1,16 @@ +import java.util.Vector; +class Apply { } + +public class applyLambda { + + public m () { + var lam1 = (x) -> { + return x; + }; + + return lam1.apply(new Apply()); + //return lam1; + //return new Vector(); + } +} + diff --git a/resources/bytecode/javFiles/fc.jav b/resources/bytecode/javFiles/fc.jav new file mode 100644 index 0000000..b387cb9 --- /dev/null +++ b/resources/bytecode/javFiles/fc.jav @@ -0,0 +1,18 @@ +import java.util.List; + +class Test{ + methode(param1, param2, param3) { + param2.add(param3); + return param1.meth(param2); + } +} + +interface Klasse1{ + Klasse1 meth(p); + Klasse1 meth(Klasse2 p); +} + +interface Klasse2{ + Klasse1 meth(Klasse1 p); + Klasse2 meth(Klasse2 p); +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/mathStruc.jav b/resources/bytecode/javFiles/mathStruc.jav new file mode 100644 index 0000000..171881b --- /dev/null +++ b/resources/bytecode/javFiles/mathStruc.jav @@ -0,0 +1,15 @@ +import java.util.Vector; +import java.lang.Integer; + +public class mathStruc { + model; + + //Fun1*, Fun1*,MathStruc >> + innerOp = (o) -> (ms) -> new mathStruc<>(o.apply(model,ms.model)); + + public mathStruc(m) { + model =m; + //innerOp = (o) -> (ms) -> new mathStruc<>(o.apply(this.model,ms.model)); + } +} + diff --git a/resources/bytecode/javFiles/mathStrucInteger.jav b/resources/bytecode/javFiles/mathStrucInteger.jav new file mode 100644 index 0000000..f1f6755 --- /dev/null +++ b/resources/bytecode/javFiles/mathStrucInteger.jav @@ -0,0 +1,23 @@ +import java.util.Vector; +import java.lang.Integer; + +public class mathStrucInteger { + model; + + innerOp = (o) -> (ms) -> new mathStrucInteger<>(o.apply(model,ms.model)); + + public mathStrucInteger(m) { + model =m; + } +} + +class mathStrucIntegerUse { + + main() { + var ms; + ms = new mathStrucInteger<>(2); + var ms2; + ms2 = ms.innerOp.apply((x,y) -> x+y).apply(ms); + return ms2; + } +} diff --git a/resources/bytecode/javFiles/mathStrucMatrixOP.jav b/resources/bytecode/javFiles/mathStrucMatrixOP.jav new file mode 100644 index 0000000..2b24f03 --- /dev/null +++ b/resources/bytecode/javFiles/mathStrucMatrixOP.jav @@ -0,0 +1,91 @@ +//PL 2019-10-24: laeuft nicht durch, zu gross +import java.util.Vector; +import java.lang.Integer; +import java.lang.Boolean; + +public class mathStrucMatrixOP { + model; + + innerOp = (o) -> (ms) -> new mathStrucMatrixOP<>(o.apply(model,ms.model)); + + public mathStrucMatrixOP(m) { + model =m; + } +} + +public class MatrixOP extends Vector> { + + MatrixOP () { + } + + MatrixOP(vv) { + Integer i; + i = 0; + while(i < vv.size()) { +// Boolean a = this.add(vv.elementAt(i)); + this.add(vv.elementAt(i)); + i=i+1; + } + } + + public mul = (m1, m2) -> { + var ret = new MatrixOP(); + var i = 0; + while(i < m1.size()) { + var v1 = m1.elementAt(i); + var v2 = new Vector(); + var j = 0; + while(j < v1.size()) { + var erg = 0; + var k = 0; + while(k < v1.size()) { + erg = erg + v1.elementAt(k) + * m2.elementAt(k).elementAt(j); + k++; } +// v2.addElement(new Integer(erg)); + v2.addElement(erg); + j++; } + ret.addElement(v2); + i++; + } + return ret; + }; +} + + +class mathStrucUseMatrixOP { + + main() { + Vector> vv = new Vector>(); + Vector v1 = new Vector(); + v1.addElement(2); + v1.addElement(2); + Vector v2 = new Vector(); + v2.addElement(3); + v2.addElement(3); + vv.addElement(v1); + vv.addElement(v2); + + MatrixOP m1 = new MatrixOP(vv); + + Vector> vv1 = new Vector>(); + Vector v3 = new Vector(); + v3.addElement(2); + v3.addElement(2); + Vector v4 = new Vector(); + v4.addElement(3); + v4.addElement(3); + vv1.addElement(v3); + vv1.addElement(v4); + + MatrixOP m2 = new MatrixOP(vv1); + + var mms; + mms = new mathStrucMatrixOP<>(m1); + var mms2; + mms2 = new mathStrucMatrixOP<>(m2); + var mms3; + mms3 = mms.innerOp.apply(m1.mul).apply(mms2); + return mms3; + } +} diff --git a/resources/bytecode/javFiles/test.jav b/resources/bytecode/javFiles/test.jav new file mode 100644 index 0000000..303d167 --- /dev/null +++ b/resources/bytecode/javFiles/test.jav @@ -0,0 +1,15 @@ +class Test{ + methode(param1, param2, param3) { + return param1.meth(param2.meth(param3)); + } +} + +interface Klasse1{ + Klasse1 meth(Klasse1 p); + Klasse1 meth(Klasse2 p); +} + +interface Klasse2{ + Klasse1 meth(Klasse1 p); + Klasse2 meth(Klasse2 p); +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/test1.jav b/resources/bytecode/javFiles/test1.jav new file mode 100644 index 0000000..4b34948 --- /dev/null +++ b/resources/bytecode/javFiles/test1.jav @@ -0,0 +1,7 @@ +class Faculty { + + int a; + m (int x) { + return a+x; + } +} diff --git a/resources/insertGenerics/javFiles/TestAny.jav b/resources/insertGenerics/javFiles/TestAny.jav new file mode 100644 index 0000000..86c0ceb --- /dev/null +++ b/resources/insertGenerics/javFiles/TestAny.jav @@ -0,0 +1,13 @@ +class TestAny { + a; + b = a; + anyMethod() { + var f; + return f; + } + otherMethod(e) { + b = e; + e = a; + return e; + } +} \ No newline at end of file diff --git a/resources/insertGenerics/javFiles/TestAssign.jav b/resources/insertGenerics/javFiles/TestAssign.jav new file mode 100644 index 0000000..d401641 --- /dev/null +++ b/resources/insertGenerics/javFiles/TestAssign.jav @@ -0,0 +1,9 @@ +class TestAssign { + assign(x, y) { + x = y; + } + + assign2(x, y) { + assign(x, y); + } +} \ No newline at end of file diff --git a/resources/insertGenerics/javFiles/TestClassField.jav b/resources/insertGenerics/javFiles/TestClassField.jav new file mode 100644 index 0000000..f3d24e5 --- /dev/null +++ b/resources/insertGenerics/javFiles/TestClassField.jav @@ -0,0 +1,6 @@ +class Example{ + f; + fReturn(){ + return f; + } +} \ No newline at end of file diff --git a/resources/insertGenerics/javFiles/TestContraVariant.jav b/resources/insertGenerics/javFiles/TestContraVariant.jav new file mode 100644 index 0000000..9c060f0 --- /dev/null +++ b/resources/insertGenerics/javFiles/TestContraVariant.jav @@ -0,0 +1,38 @@ +public class TestContraVariant { + main(x, y) { + var y2 = m(x, y); + var y3 = y2.snd(); + var z; + y3 = z; + return new Pair<>(x, z); + } + + m(x, y) { + var x2 = main(x, y); + var x3 = x2.fst(); + var z; + x3 = z; + return new Pair<>(z, y); + } +} + +class Pair { + public T x; + public U y; + + public Pair() { + } + + public Pair(T var1, U var2) { + x = var1; + y = var2; + } + + public T fst() { + return x; + } + + public U snd() { + return y; + } +} \ No newline at end of file diff --git a/resources/insertGenerics/javFiles/TestGGFinder.jav b/resources/insertGenerics/javFiles/TestGGFinder.jav new file mode 100644 index 0000000..cc94cad --- /dev/null +++ b/resources/insertGenerics/javFiles/TestGGFinder.jav @@ -0,0 +1,17 @@ +public class TestGGFinder { + a; + + id(b) { + var c = b; + return c; + } + + setA(x) { + a = x; + return a; + } + + m(x,y) { + x = id(y); + } +} \ No newline at end of file diff --git a/resources/insertGenerics/javFiles/TestLocalVarLambda.jav b/resources/insertGenerics/javFiles/TestLocalVarLambda.jav new file mode 100644 index 0000000..ab4455c --- /dev/null +++ b/resources/insertGenerics/javFiles/TestLocalVarLambda.jav @@ -0,0 +1,7 @@ +public class TestLocalVarLambda { + +m(x) { + var id = z -> z; + return id.apply(x); + } +} \ No newline at end of file diff --git a/resources/insertGenerics/javFiles/TestMutualRecursion.jav b/resources/insertGenerics/javFiles/TestMutualRecursion.jav new file mode 100644 index 0000000..60ce72c --- /dev/null +++ b/resources/insertGenerics/javFiles/TestMutualRecursion.jav @@ -0,0 +1,17 @@ +public class TestMutualRecursion { + a; + + id(b) { + var c = b; + return main(b,c); + } + + m(x,y) { + x = id(y); + return x; + } + + main(x,y) { + return m(id(x),y); + } +} \ No newline at end of file diff --git a/resources/insertGenerics/javFiles/TestMutualRecursionWithField.jav b/resources/insertGenerics/javFiles/TestMutualRecursionWithField.jav new file mode 100644 index 0000000..82dc42d --- /dev/null +++ b/resources/insertGenerics/javFiles/TestMutualRecursionWithField.jav @@ -0,0 +1,22 @@ +public class TestMutualRecursionWithField { + a; + + id(b) { + var c = b; + return main(b,c); + } + + setA(x) { + a = x; + return a; + } + + m(x,y) { + x = id(y); + return x; + } + + main(x,y) { + return m(id(x),setA(y)); + } +} \ No newline at end of file diff --git a/resources/insertGenerics/javFiles/TestMutualRecursionWithField2.jav b/resources/insertGenerics/javFiles/TestMutualRecursionWithField2.jav new file mode 100644 index 0000000..727e603 --- /dev/null +++ b/resources/insertGenerics/javFiles/TestMutualRecursionWithField2.jav @@ -0,0 +1,22 @@ +public class TestMutualRecursionWithField2 { + a; + + id(b) { + var c = b; + return main(b,c); + } + + setA(x) { + a = x; + return a; + } + + m(x,y) { + x = id(y); + return x; + } + + main(x,y) { + return m(setA(x),id(y)); + } +} \ No newline at end of file diff --git a/resources/insertGenerics/javFiles/TestMutualRecursionWithField3.jav b/resources/insertGenerics/javFiles/TestMutualRecursionWithField3.jav new file mode 100644 index 0000000..24e0989 --- /dev/null +++ b/resources/insertGenerics/javFiles/TestMutualRecursionWithField3.jav @@ -0,0 +1,23 @@ +public class TestMutualRecursionWithField3 { + a; + + id(b) { + var c = b; + return main(b,c); + } + + setA(x) { + a = x; + return a; + } + + m(x,y) { + x = id(y); + return x; + } + + main(x,y) { + var z = m(setA(x),id(y)); + return z; + } +} \ No newline at end of file diff --git a/resources/insertGenerics/javFiles/TestReturnVar.jav b/resources/insertGenerics/javFiles/TestReturnVar.jav new file mode 100644 index 0000000..0688e5b --- /dev/null +++ b/resources/insertGenerics/javFiles/TestReturnVar.jav @@ -0,0 +1,6 @@ +class VarReturn { + anyMethod() { + var f; + return f; + } +} \ No newline at end of file diff --git a/resources/insertGenerics/javFiles/TestSecondLineOfClassConstraints.jav b/resources/insertGenerics/javFiles/TestSecondLineOfClassConstraints.jav new file mode 100644 index 0000000..16275a5 --- /dev/null +++ b/resources/insertGenerics/javFiles/TestSecondLineOfClassConstraints.jav @@ -0,0 +1,12 @@ +class Example { + a; + b = a; + anyMethod() { + var f; + return f; + } + otherMethod(e) { + e = a; + return e; + } +} \ No newline at end of file diff --git a/resources/insertGenerics/javFiles/TestTPHsAndGenerics.jav b/resources/insertGenerics/javFiles/TestTPHsAndGenerics.jav new file mode 100644 index 0000000..33a79e5 --- /dev/null +++ b/resources/insertGenerics/javFiles/TestTPHsAndGenerics.jav @@ -0,0 +1,13 @@ +class TPHsAndGenerics { + id = x -> x; + id2 (x) { + return id.apply(x); + } + m(a, b){ + var c = m2(a,b); + return a; + } + m2(a, b){ + return b; + } +} \ No newline at end of file diff --git a/resources/insertGenerics/javFiles/TestTPHsAndGenerics2.jav b/resources/insertGenerics/javFiles/TestTPHsAndGenerics2.jav new file mode 100644 index 0000000..2a75e82 --- /dev/null +++ b/resources/insertGenerics/javFiles/TestTPHsAndGenerics2.jav @@ -0,0 +1,14 @@ +class TPHsAndGenerics2 { + id = x -> x; + id2 (x) { + return id.apply(x); + } + m(a, b){ + var c = m2(a,b); + return a; + } + m2(a, b){ + return b; + } + +} \ No newline at end of file diff --git a/resources/insertGenerics/javFiles/TestThreeArgs.jav b/resources/insertGenerics/javFiles/TestThreeArgs.jav new file mode 100644 index 0000000..fe22dd3 --- /dev/null +++ b/resources/insertGenerics/javFiles/TestThreeArgs.jav @@ -0,0 +1,15 @@ +public class TestThreeArgs { + a; + + id(b) { + var a /* = null */; + var c = b; + m(a,a,b); + return c; + } + + m(x,y, z) { + x = id(y); + return x; + } +} \ No newline at end of file diff --git a/resources/insertGenerics/javFiles/TestTwoArgs.jav b/resources/insertGenerics/javFiles/TestTwoArgs.jav new file mode 100644 index 0000000..b4754fe --- /dev/null +++ b/resources/insertGenerics/javFiles/TestTwoArgs.jav @@ -0,0 +1,29 @@ +public class TestTwoArgs // +{ + //AS + a; + + //AN -> AN + id(b) { + var c = b; + return c; + } + + //T -> AS + setA(x) { + a = x; + return a; + } + + //(AG,Z) -> AG + m(x,y) { + x = id(y); + return x; + } + + // (AI, AH) -> AG + main(x,y) { + return m(id(x),setA(y)); + } +} + diff --git a/resources/insertGenerics/javFiles/TestTwoArgs2.jav b/resources/insertGenerics/javFiles/TestTwoArgs2.jav new file mode 100644 index 0000000..f8c270a --- /dev/null +++ b/resources/insertGenerics/javFiles/TestTwoArgs2.jav @@ -0,0 +1,17 @@ +public class TestTwoArgs2 { + a; + + id(b) { + var c = b; + return c; + } + + m(x,y) { + x = id(y); + return x; + } + + main(x,y) { + return m(id(x),m(x,y)); + } +} \ No newline at end of file diff --git a/resources/insertGenerics/javFiles/TestTwoCalls.jav b/resources/insertGenerics/javFiles/TestTwoCalls.jav new file mode 100644 index 0000000..e3f0cfc --- /dev/null +++ b/resources/insertGenerics/javFiles/TestTwoCalls.jav @@ -0,0 +1,14 @@ +public class TestTwoCalls { + + // O -> O + id(b) { + var c = b; + return c; + } + + // (S, T) -> T + main(x,y) { + id(x); + return id(y); + } +} \ No newline at end of file diff --git a/resources/insertGenerics/javFiles/TestVector.jav b/resources/insertGenerics/javFiles/TestVector.jav new file mode 100644 index 0000000..5f29c83 --- /dev/null +++ b/resources/insertGenerics/javFiles/TestVector.jav @@ -0,0 +1,12 @@ +import java.util.Vector; + +public class TestVector { + + m(v, w) { + w.addElement(id(v.elementAt(0))); + } + + id(x) { + return x; + } +} diff --git a/resources/insertGenerics/javFiles/TestVectorArg.jav b/resources/insertGenerics/javFiles/TestVectorArg.jav new file mode 100644 index 0000000..ca29f82 --- /dev/null +++ b/resources/insertGenerics/javFiles/TestVectorArg.jav @@ -0,0 +1,12 @@ +import java.util.Vector; + +public class TestVectorArg { + + add(v, e) { + v.addElement(e); + } + + main(v, e) { + add(v, e); + } +} \ No newline at end of file diff --git a/resources/insertGenerics/javFiles/TestVoidMeth.jav b/resources/insertGenerics/javFiles/TestVoidMeth.jav new file mode 100644 index 0000000..50ee720 --- /dev/null +++ b/resources/insertGenerics/javFiles/TestVoidMeth.jav @@ -0,0 +1,4 @@ +class VoidMeth { + anyMethod() { + } +} \ No newline at end of file diff --git a/resources/packageTest/pkg/sub/Cycle1.jav b/resources/packageTest/pkg/sub/Cycle1.jav new file mode 100644 index 0000000..79267a0 --- /dev/null +++ b/resources/packageTest/pkg/sub/Cycle1.jav @@ -0,0 +1,11 @@ +package pkg.sub; + +import java.lang.Integer; +import pkg.sub2.Cycle2; + +public class Cycle1 { + test() { + var cycle2 = new Cycle2(); + cycle2.test(); + } +} \ No newline at end of file diff --git a/resources/packageTest/pkg/sub/Interface.jav b/resources/packageTest/pkg/sub/Interface.jav new file mode 100644 index 0000000..388b424 --- /dev/null +++ b/resources/packageTest/pkg/sub/Interface.jav @@ -0,0 +1,3 @@ +package pkg.sub; + +public interface Interface {} diff --git a/resources/packageTest/pkg/sub/Test1.jav b/resources/packageTest/pkg/sub/Test1.jav new file mode 100644 index 0000000..7acebfb --- /dev/null +++ b/resources/packageTest/pkg/sub/Test1.jav @@ -0,0 +1,11 @@ +package pkg.sub; + +import pkg.sub2.Test2; + +public class Test1 { + + main() { + var t2 = new Test2(); + t2.test(); + } +} \ No newline at end of file diff --git a/resources/packageTest/pkg/sub2/Cycle2.jav b/resources/packageTest/pkg/sub2/Cycle2.jav new file mode 100644 index 0000000..8a13e10 --- /dev/null +++ b/resources/packageTest/pkg/sub2/Cycle2.jav @@ -0,0 +1,11 @@ +package pkg.sub2; + +import java.lang.Integer; +import pkg.sub.Cycle1; + +public class Cycle2 { + test() { + var cycle1 = new Cycle1(); + cycle1.test(); + } +} \ No newline at end of file diff --git a/resources/packageTest/pkg/sub2/Test2.jav b/resources/packageTest/pkg/sub2/Test2.jav new file mode 100644 index 0000000..a7f8927 --- /dev/null +++ b/resources/packageTest/pkg/sub2/Test2.jav @@ -0,0 +1,6 @@ +package pkg.sub2; + +public class Test2 { + + test() {} +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/BinaryInMeth.ast b/resources/syntaxtreegenerator/BinaryInMeth.ast new file mode 100644 index 0000000..5bb1379 --- /dev/null +++ b/resources/syntaxtreegenerator/BinaryInMeth.ast @@ -0,0 +1,22 @@ +class BinaryInMeth { + +BinaryInMeth(){ + super(()); + } + TPH CMNB m(TPH CMNC a){ + return ++a; + } + + TPH CMNF m2(TPH CMNG a, TPH CMNH b){ + return this.m Signature: [TPH CMNK, TPH CMNL](a op b); + } + + TPH CMNP m3(TPH CMNQ a){ + return this.m Signature: [TPH CMNT, TPH CMNU](++a); + } + + BinaryInMeth(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/Box.ast b/resources/syntaxtreegenerator/Box.ast new file mode 100644 index 0000000..1bc437b --- /dev/null +++ b/resources/syntaxtreegenerator/Box.ast @@ -0,0 +1,25 @@ +class B { + +B(){ + super(()); + } + B(){ + super(()); + } + +}class Box_Main { + +Box_Main(){ + super(()); + } + TPH T m(TPH U b){ + b.m Signature: [TPH W, TPH X](new Box_Main()); + b.m Signature: [TPH AB, TPH AC](new B()); + return; + } + + Box_Main(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/ClassGenLam.ast b/resources/syntaxtreegenerator/ClassGenLam.ast new file mode 100644 index 0000000..30b4345 --- /dev/null +++ b/resources/syntaxtreegenerator/ClassGenLam.ast @@ -0,0 +1,14 @@ +class ClassGenLam { + + TPH HWDB lam; +ClassGenLam(){ + super(()); + this.lam = (TPH HWDC x) -> { + return x; + }; + } + ClassGenLam(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/Cycle.ast b/resources/syntaxtreegenerator/Cycle.ast new file mode 100644 index 0000000..18b435a --- /dev/null +++ b/resources/syntaxtreegenerator/Cycle.ast @@ -0,0 +1,16 @@ +class Cycle { + +Cycle(){ + super(()); + } + TPH GGXG m(TPH GGXH x, TPH GGXI y){ + y = x; + x = y; + return; + } + + Cycle(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/Fac.ast b/resources/syntaxtreegenerator/Fac.ast new file mode 100644 index 0000000..b15ecdd --- /dev/null +++ b/resources/syntaxtreegenerator/Fac.ast @@ -0,0 +1,22 @@ +class Fac { + +Fac(){ + super(()); + } + TPH BSTE getFac(TPH BSTF n){ + TPH BSTG res; + res = 1; + TPH BSTI i; + i = 1; + while(i op n){ + res = res op i; + i++; + }; + return res; + } + + Fac(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/Faculty.ast b/resources/syntaxtreegenerator/Faculty.ast new file mode 100644 index 0000000..66c777a --- /dev/null +++ b/resources/syntaxtreegenerator/Faculty.ast @@ -0,0 +1,25 @@ +class Faculty { + + TPH DDAL fact; +Faculty(){ + super(()); + } + TPH DDBK getFact(java.lang.Integer x){ + return this.fact.apply Signature: [TPH DDBM, TPH DDBN](x); + } + + Faculty(){ + super(()); + this.fact = (TPH DDAO x) -> { + if(x op 1) + { + return 1; + } + else + { + return x op this.fact.apply Signature: [TPH DDAW, TPH DDAX](x op 1); + }; + }; + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/Field.ast b/resources/syntaxtreegenerator/Field.ast new file mode 100644 index 0000000..43ffa1a --- /dev/null +++ b/resources/syntaxtreegenerator/Field.ast @@ -0,0 +1,16 @@ +class Field { + + TPH JBCG x; +Field(){ + super(()); + this.x = 5; + } + TPH JBCJ m(){ + return this.x; + } + + Field(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/FieldTph2.ast b/resources/syntaxtreegenerator/FieldTph2.ast new file mode 100644 index 0000000..23c7c16 --- /dev/null +++ b/resources/syntaxtreegenerator/FieldTph2.ast @@ -0,0 +1,21 @@ +class FieldTph2 { + + TPH DJBG a; +FieldTph2(){ + super(()); + } + TPH DJBH m(TPH DJBI b){ + b = this.a; + return b; + } + + TPH DJBL m2(TPH DJBM c){ + this.a = c; + return; + } + + FieldTph2(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/FieldTphConsMeth.ast b/resources/syntaxtreegenerator/FieldTphConsMeth.ast new file mode 100644 index 0000000..9ada601 --- /dev/null +++ b/resources/syntaxtreegenerator/FieldTphConsMeth.ast @@ -0,0 +1,27 @@ +class FieldTphConsMeth { + + TPH AINS a; +FieldTphConsMeth(){ + super(()); + } + TPH AIOE id(TPH AIOF b){ + return b; + } + + TPH AIOH setA(TPH AIOI x){ + this.a = x; + return this.a; + } + + TPH AIOM m(TPH AION x, TPH AIOO y){ + x = this.id Signature: [TPH AIOQ, TPH AIOR](y); + return; + } + + FieldTphConsMeth(TPH AINU c){ + super(()); + this.a = this.id Signature: [TPH AINX, TPH AINY](c); + return; + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/FieldTphMMeth.ast b/resources/syntaxtreegenerator/FieldTphMMeth.ast new file mode 100644 index 0000000..3a0cacd --- /dev/null +++ b/resources/syntaxtreegenerator/FieldTphMMeth.ast @@ -0,0 +1,33 @@ +class FieldTphMMeth { + + TPH HBWQ a; +FieldTphMMeth(){ + super(()); + } + TPH HBXG m(TPH HBXH b, TPH HBXI d, TPH HBXJ e){ + if(e) + { + return this.m3 Signature: [TPH HBXL, TPH HBXM](b); + } + else + { + return this.m3 Signature: [TPH HBXR, TPH HBXS](d); + }; + } + + TPH HBXY m2(TPH HBXZ b){ + this.a = this.m3 Signature: [TPH HBYC, TPH HBYD](b); + return; + } + + TPH HBYH m3(TPH HBYI b){ + return b; + } + + FieldTphMMeth(TPH HBWS c, TPH HBWT d, TPH HBWU e){ + super(()); + this.a = this.m Signature: [TPH HBWX, TPH HBWY, TPH HBWZ, TPH HBXA](c, d, e); + return; + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/Gen.ast b/resources/syntaxtreegenerator/Gen.ast new file mode 100644 index 0000000..20f5484 --- /dev/null +++ b/resources/syntaxtreegenerator/Gen.ast @@ -0,0 +1,14 @@ +class Gen { + +Gen(){ + super(()); + } + java.util.Vector m(java.util.Vector v){ + return v; + } + + Gen(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/Id.ast b/resources/syntaxtreegenerator/Id.ast new file mode 100644 index 0000000..4b375d2 --- /dev/null +++ b/resources/syntaxtreegenerator/Id.ast @@ -0,0 +1,18 @@ +class Id { + + TPH BDGF id2; +Id(){ + super(()); + this.id2 = (TPH BDGG x) -> { + return x; + }; + } + TPH BDGM id3(TPH BDGN x){ + return this.id2.apply Signature: [TPH BDGP, TPH BDGQ](x); + } + + Id(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/Inf.ast b/resources/syntaxtreegenerator/Inf.ast new file mode 100644 index 0000000..5425c25 --- /dev/null +++ b/resources/syntaxtreegenerator/Inf.ast @@ -0,0 +1,28 @@ +class Inf { + +Inf(){ + super(()); + } + TPH KYAM m(TPH KYAN x, TPH KYAO y, TPH KYAP a){ + TPH KYAQ z; + TPH KYAR v; + TPH KYAS w; + TPH KYAT b; + y = x; + z = x; + v = y; + w = y; + y = a; + b = a; + TPH KYAU c; + TPH KYAV d; + c = v; + d = v; + return; + } + + Inf(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/Instanceof.ast b/resources/syntaxtreegenerator/Instanceof.ast new file mode 100644 index 0000000..29d0754 --- /dev/null +++ b/resources/syntaxtreegenerator/Instanceof.ast @@ -0,0 +1,44 @@ +class Instanceof { + +Instanceof(){ + super(()); + } + void checkInstanceof(){ + TPH a; + a = 4; + return a instanceof java.lang.Integer; + } + + void checkInstanceOfWithPattern(){ + TPH b; + b = 4.0; + if(b instanceof d) + { + return d; + } + else + { + return Kein Double; + }; + } + + void checkInstanceOfWithGuardedPattern(){ + TPH obj; + obj = test; + TPH flag; + if(obj instanceof s op s.length Signature: [TPH]() op 5) + { + flag = s.contains Signature: [TPH, TPH](jdk); + }; + return; + } + + java.lang.Boolean equals(java.lang.Object o){ + return o instanceof other op x op other.x op y op other.y; + } + + Instanceof(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/KompTph.ast b/resources/syntaxtreegenerator/KompTph.ast new file mode 100644 index 0000000..0cde632 --- /dev/null +++ b/resources/syntaxtreegenerator/KompTph.ast @@ -0,0 +1,26 @@ +class KompTph { + +KompTph(){ + super(()); + } + TPH EOGX m(TPH EOGY a, TPH EOGZ b, TPH EOHA c){ + TPH EOHB d; + d = a; + TPH EOHC e; + e = a; + a = b; + c = b; + this.m2 Signature: [TPH EOHE, TPH EOHF, TPH EOHG](a, c); + return; + } + + TPH EOHK m2(TPH EOHL a, TPH EOHM b){ + this.m Signature: [TPH EOHO, TPH EOHP, TPH EOHQ, TPH EOHR](a, a, b); + return; + } + + KompTph(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/Lambda.ast b/resources/syntaxtreegenerator/Lambda.ast new file mode 100644 index 0000000..1cdc8f1 --- /dev/null +++ b/resources/syntaxtreegenerator/Lambda.ast @@ -0,0 +1,18 @@ +class Lambda { + +Lambda(){ + super(()); + } + TPH KIZQ m(){ + TPH KIZR lam1; + lam1 = (TPH KIZS x) -> { + return x; + }; + return lam1; + } + + Lambda(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/LambdaCapture.ast b/resources/syntaxtreegenerator/LambdaCapture.ast new file mode 100644 index 0000000..de4944b --- /dev/null +++ b/resources/syntaxtreegenerator/LambdaCapture.ast @@ -0,0 +1,18 @@ +class LambdaCapture { + + java.lang.Integer i; + TPH BIMD f; +LambdaCapture(){ + super(()); + this.i = 8; + } + LambdaCapture(){ + super(()); + java.lang.Integer w; + w = 7; + this.f = (TPH BIMH j) -> { + return w op this.i; + }; + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/Matrix.ast b/resources/syntaxtreegenerator/Matrix.ast new file mode 100644 index 0000000..f4779af --- /dev/null +++ b/resources/syntaxtreegenerator/Matrix.ast @@ -0,0 +1,52 @@ +class Matrix { + +Matrix(){ + super(()); + } + TPH SBB mul(TPH SBC m){ + TPH SBD ret; + ret = new Matrix(); + TPH SBF i; + i = 0; + while(i op this.size Signature: [TPH SBJ]()){ + TPH SBM v1; + v1 = this.elementAt Signature: [TPH SBO, TPH SBP](i); + TPH SBS v2; + v2 = new java.util.Vector(); + TPH SBU j; + j = 0; + while(j op v1.size Signature: [TPH SBX]()){ + TPH SCA erg; + erg = 0; + TPH SCC k; + k = 0; + while(k op v1.size Signature: [TPH SCF]()){ + erg = erg op v1.elementAt Signature: [TPH SCI, TPH SCJ](k) op m.elementAt Signature: [TPH SCM, TPH SCN](k).elementAt Signature: [TPH SCQ, TPH SCR](j); + k++; + }; + v2.addElement Signature: [TPH SCZ, TPH SDA](erg); + j++; + }; + ret.addElement Signature: [TPH SDG, TPH SDH](v2); + i++; + }; + return ret; + } + + Matrix(){ + super(()); + return; + } + + Matrix(TPH SAF vv){ + super(()); + java.lang.Integer i; + i = 0; + while(i op vv.size Signature: [TPH SAI]()){ + this.add Signature: [TPH SAQ, TPH SAR](vv.elementAt Signature: [TPH SAM, TPH SAN](i)); + i = i op 1; + }; + return; + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/MatrixOP.ast b/resources/syntaxtreegenerator/MatrixOP.ast new file mode 100644 index 0000000..4ea4d5e --- /dev/null +++ b/resources/syntaxtreegenerator/MatrixOP.ast @@ -0,0 +1,52 @@ +class MatrixOP { + + TPH JGDT mul; +MatrixOP(){ + super(()); + this.mul = (TPH JGDU m1, TPH JGDV m2) -> { + TPH JGDW ret; + ret = new MatrixOP(); + TPH JGDY i; + i = 0; + while(i op m1.size Signature: [TPH JGEB]()){ + TPH JGEE v1; + v1 = m1.elementAt Signature: [TPH JGEF, TPH JGEG](i); + TPH JGEJ v2; + v2 = new java.util.Vector(); + TPH JGEL j; + j = 0; + while(j op v1.size Signature: [TPH JGEO]()){ + TPH JGER erg; + erg = 0; + TPH JGET k; + k = 0; + while(k op v1.size Signature: [TPH JGEW]()){ + erg = erg op v1.elementAt Signature: [TPH JGEZ, TPH JGFA](k) op m2.elementAt Signature: [TPH JGFD, TPH JGFE](k).elementAt Signature: [TPH JGFH, TPH JGFI](j); + k++; + }; + v2.addElement Signature: [TPH JGFQ, TPH JGFR](erg); + j++; + }; + ret.addElement Signature: [TPH JGFX, TPH JGFY](v2); + i++; + }; + return ret; + }; + } + MatrixOP(){ + super(()); + return; + } + + MatrixOP(TPH JGGP vv){ + super(()); + java.lang.Integer i; + i = 0; + while(i op vv.size Signature: [TPH JGGS]()){ + this.add Signature: [TPH JGHA, TPH JGHB](vv.elementAt Signature: [TPH JGGW, TPH JGGX](i)); + i = i op 1; + }; + return; + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/Merge.ast b/resources/syntaxtreegenerator/Merge.ast new file mode 100644 index 0000000..c3632d1 --- /dev/null +++ b/resources/syntaxtreegenerator/Merge.ast @@ -0,0 +1,23 @@ +class Merge { + +Merge(){ + super(()); + } + TPH JQYM merge(TPH JQYN a, TPH JQYO b){ + a.addAll Signature: [TPH JQYP, TPH JQYQ](b); + return a; + } + + TPH JQYU sort(TPH JQYV in){ + TPH JQYW firstHalf; + firstHalf = in.subList Signature: [TPH JQYZ, TPH JQZA, TPH JQZB](1, 2); + TPH JQZE secondHalf; + secondHalf = in.subList Signature: [TPH JQZH, TPH JQZI, TPH JQZJ](1, 2); + return this.merge Signature: [TPH JQZX, TPH JQZY, TPH JQZZ](this.sort Signature: [TPH JQZO, TPH JQZP](firstHalf), this.sort Signature: [TPH JQZT, TPH JQZU](secondHalf)); + } + + Merge(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/OL.ast b/resources/syntaxtreegenerator/OL.ast new file mode 100644 index 0000000..96ea150 --- /dev/null +++ b/resources/syntaxtreegenerator/OL.ast @@ -0,0 +1,41 @@ +class OL { + +OL(){ + super(()); + } + java.lang.Double m(java.lang.Double x){ + return x op x; + } + + java.lang.Integer m(java.lang.Integer x){ + return x op x; + } + + java.lang.String m(java.lang.String x){ + return x op x; + } + + java.lang.Boolean m(java.lang.Boolean x){ + return x; + } + + OL(){ + super(()); + } + +}class OLMain { + +OLMain(){ + super(()); + } + TPH BYOF main(TPH BYOG x){ + TPH BYOH ol; + ol = new OL(); + return ol.m Signature: [TPH BYOJ, TPH BYOK](x); + } + + OLMain(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/OLFun.ast b/resources/syntaxtreegenerator/OLFun.ast new file mode 100644 index 0000000..4f5e08f --- /dev/null +++ b/resources/syntaxtreegenerator/OLFun.ast @@ -0,0 +1,22 @@ +class OLFun { + +OLFun(){ + super(()); + } + TPH JXJR m(TPH JXJS f, TPH JXJT x){ + x = f.apply Signature: [TPH JXJV, TPH JXJW](x op x); + return x; + } + + TPH JXKA m2(TPH JXKB y){ + this.m Signature: [TPH JXKK, TPH JXKL, TPH JXKM]((TPH JXKD x) -> { + return x op 2; + }, y); + return; + } + + OLFun(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/OLFun2.ast b/resources/syntaxtreegenerator/OLFun2.ast new file mode 100644 index 0000000..57415e3 --- /dev/null +++ b/resources/syntaxtreegenerator/OLFun2.ast @@ -0,0 +1,16 @@ +class OLFun2 { + + TPH CTXA x; +OLFun2(){ + super(()); + } + TPH CTXB m(TPH CTXC f){ + this.x = f.apply Signature: [TPH CTXH, TPH CTXI](this.x op this.x); + return; + } + + OLFun2(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/Overloading.ast b/resources/syntaxtreegenerator/Overloading.ast new file mode 100644 index 0000000..29fd0bb --- /dev/null +++ b/resources/syntaxtreegenerator/Overloading.ast @@ -0,0 +1,31 @@ +class Overloading { + +Overloading(){ + super(()); + } + TPH N test(TPH O x){ + return x.methode Signature: [TPH P](); + } + + TPH T methode(){ + return Overloading; + } + + Overloading(){ + super(()); + } + +}class Overloading2 { + +Overloading2(){ + super(()); + } + TPH AO methode(){ + return Overloading2; + } + + Overloading2(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/Pair.ast b/resources/syntaxtreegenerator/Pair.ast new file mode 100644 index 0000000..67a0183 --- /dev/null +++ b/resources/syntaxtreegenerator/Pair.ast @@ -0,0 +1,20 @@ +class Pair { + + U a; + T b; +Pair(){ + super(()); + } + TPH IURS make(TPH IURT x){ + TPH IURU ret; + ret = new Pair(); + ret.a = x.elementAt Signature: [TPH IUSA, TPH IUSB](0); + ret.b = x.elementAt Signature: [TPH IUSG, TPH IUSH](1); + return ret; + } + + Pair(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/PatternMatching.ast b/resources/syntaxtreegenerator/PatternMatching.ast new file mode 100644 index 0000000..41a2453 --- /dev/null +++ b/resources/syntaxtreegenerator/PatternMatching.ast @@ -0,0 +1,120 @@ +class Point { + + java.lang.Integer x; + java.lang.Integer y; +Point(java.lang.Integer x, java.lang.Integer y){ + super(()); + this.x = x; + this.y = y; + } + java.lang.Integer x(){ + return this.x; + } + + java.lang.Integer y(){ + return this.y; + } + + Point(java.lang.Integer x, java.lang.Integer y){ + super(()); + this.x = x; + this.y = y; + } + +}class Shape { + +}class ColoredPoint { + + Point pt; + java.lang.String color; +ColoredPoint(Point pt, java.lang.String color){ + super(()); + this.pt = pt; + this.color = color; + } + Point pt(){ + return this.pt; + } + + java.lang.String color(){ + return this.color; + } + + ColoredPoint(Point pt, java.lang.String color){ + super(()); + this.pt = pt; + this.color = color; + } + +}class Rectangle { + + ColoredPoint upperLeft; + ColoredPoint lowerRight; +Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight){ + super(()); + this.upperLeft = upperLeft; + this.lowerRight = lowerRight; + } + ColoredPoint upperLeft(){ + return this.upperLeft; + } + + ColoredPoint lowerRight(){ + return this.lowerRight; + } + + Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight){ + super(()); + this.upperLeft = upperLeft; + this.lowerRight = lowerRight; + } + +}class Color { + +Color(){ + super(()); + } + Color(){ + super(()); + } + +}class Blue { + +Blue(){ + super(()); + } + Blue(){ + super(()); + } + +}class Red { + +Red(){ + super(()); + } + Red(){ + super(()); + } + +}class PatternMatching { + +PatternMatching(){ + super(()); + } + void printColorOfUpperLeftPoint(Shape shape){ + switch(shape){ + case Rectangle(ColoredPoint(Point pt, java.lang.String color), ColoredPoint lowerRight): + System.out.println Signature: [TPH, TPH](x: op pt.x Signature: [TPH]() op / color: op color op / lowerRight: op lowerRight); + + default: + System.out.println Signature: [TPH, TPH](not a rectangle); + + }; + return; + } + + PatternMatching(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/Plus.ast b/resources/syntaxtreegenerator/Plus.ast new file mode 100644 index 0000000..c395f00 --- /dev/null +++ b/resources/syntaxtreegenerator/Plus.ast @@ -0,0 +1,14 @@ +class Plus { + +Plus(){ + super(()); + } + TPH ACHZ m(TPH ACIA a, TPH ACIB b){ + return a op b; + } + + Plus(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/Record.ast b/resources/syntaxtreegenerator/Record.ast new file mode 100644 index 0000000..26d9587 --- /dev/null +++ b/resources/syntaxtreegenerator/Record.ast @@ -0,0 +1,47 @@ +class Point { + + TPH x; + TPH y; +Point(TPH x, TPH y){ + super(()); + this.x = x; + this.y = y; + } + TPH x(){ + return this.x; + } + + TPH y(){ + return this.y; + } + + Point(TPH x, TPH y){ + super(()); + this.x = x; + this.y = y; + } + +}class Line { + + TPH pt1; + TPH pt2; +Line(TPH pt1, TPH pt2){ + super(()); + this.pt1 = pt1; + this.pt2 = pt2; + } + TPH pt1(){ + return this.pt1; + } + + TPH pt2(){ + return this.pt2; + } + + Line(TPH pt1, TPH pt2){ + super(()); + this.pt1 = pt1; + this.pt2 = pt2; + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/RelOps.ast b/resources/syntaxtreegenerator/RelOps.ast new file mode 100644 index 0000000..4b8fa1d --- /dev/null +++ b/resources/syntaxtreegenerator/RelOps.ast @@ -0,0 +1,14 @@ +class RelOps { + +RelOps(){ + super(()); + } + TPH IPBY m(TPH IPBZ a, TPH IPCA b){ + return a op b; + } + + RelOps(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/Scalar.ast b/resources/syntaxtreegenerator/Scalar.ast new file mode 100644 index 0000000..fddde3a --- /dev/null +++ b/resources/syntaxtreegenerator/Scalar.ast @@ -0,0 +1,29 @@ +class Scalar { + +Scalar(){ + super(()); + } + TPH KOXT mul(TPH KOXU v){ + TPH KOXV ret; + ret = 0; + TPH KOXX i; + i = 0; + while(i op this.size Signature: [TPH KOYB]()){ + ret = ret op this.elementAt Signature: [TPH KOYF, TPH KOYG](i) op v.elementAt Signature: [TPH KOYJ, TPH KOYK](i); + i = i op 1; + }; + return ret; + } + + Scalar(TPH KOWX v){ + super(()); + java.lang.Integer i; + i = 0; + while(i op v.size Signature: [TPH KOXA]()){ + this.add Signature: [TPH KOXI, TPH KOXJ](v.elementAt Signature: [TPH KOXE, TPH KOXF](i)); + i = i op 1; + }; + return; + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/Sealed.ast b/resources/syntaxtreegenerator/Sealed.ast new file mode 100644 index 0000000..24423ca --- /dev/null +++ b/resources/syntaxtreegenerator/Sealed.ast @@ -0,0 +1,144 @@ +class Shape { + +Shape(){ + super(()); + } + Shape(){ + super(()); + } + +}class Circle { + +Circle(){ + super(()); + } + Circle(){ + super(()); + } + +}class Rectangle { + +Rectangle(){ + super(()); + } + Rectangle(){ + super(()); + } + +}class TransparentRectangle { + +TransparentRectangle(){ + super(()); + } + TransparentRectangle(){ + super(()); + } + +}class FilledRectangle { + +FilledRectangle(){ + super(()); + } + FilledRectangle(){ + super(()); + } + +}class Square { + +Square(){ + super(()); + } + Square(){ + super(()); + } + +}class WeirdShape { + +WeirdShape(){ + super(()); + } + WeirdShape(){ + super(()); + } + +}class Expr { + +}class ConstantExpr { + + java.lang.Integer i; +ConstantExpr(java.lang.Integer i){ + super(()); + this.i = i; + } + java.lang.Integer i(){ + return this.i; + } + + ConstantExpr(java.lang.Integer i){ + super(()); + this.i = i; + } + +}class PlusExpr { + + Expr a; + Expr b; +PlusExpr(Expr a, Expr b){ + super(()); + this.a = a; + this.b = b; + } + Expr a(){ + return this.a; + } + + Expr b(){ + return this.b; + } + + PlusExpr(Expr a, Expr b){ + super(()); + this.a = a; + this.b = b; + } + +}class TimesExpr { + + Expr a; + Expr b; +TimesExpr(Expr a, Expr b){ + super(()); + this.a = a; + this.b = b; + } + Expr a(){ + return this.a; + } + + Expr b(){ + return this.b; + } + + TimesExpr(Expr a, Expr b){ + super(()); + this.a = a; + this.b = b; + } + +}class NegExpr { + + Expr e; +NegExpr(Expr e){ + super(()); + this.e = e; + } + Expr e(){ + return this.e; + } + + NegExpr(Expr e){ + super(()); + this.e = e; + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/SimpleCycle.ast b/resources/syntaxtreegenerator/SimpleCycle.ast new file mode 100644 index 0000000..771757a --- /dev/null +++ b/resources/syntaxtreegenerator/SimpleCycle.ast @@ -0,0 +1,18 @@ +class SimpleCycle { + +SimpleCycle(){ + super(()); + } + TPH ETMJ m(){ + TPH ETMK g; + TPH ETML h; + g = h; + h = g; + return; + } + + SimpleCycle(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/Sorting.ast b/resources/syntaxtreegenerator/Sorting.ast new file mode 100644 index 0000000..979d268 --- /dev/null +++ b/resources/syntaxtreegenerator/Sorting.ast @@ -0,0 +1,23 @@ +class Sorting { + +Sorting(){ + super(()); + } + TPH JNN merge(TPH JNO a, TPH JNP b){ + a.addAll Signature: [TPH JNQ, TPH JNR](b); + return a; + } + + TPH JNV sort(TPH JNW in){ + TPH JNX firstHalf; + firstHalf = in; + TPH JNY secondHalf; + secondHalf = in; + return this.merge Signature: [TPH JOK, TPH JOL, TPH JOM](this.sort Signature: [TPH JOB, TPH JOC](firstHalf), this.sort Signature: [TPH JOG, TPH JOH](secondHalf)); + } + + Sorting(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/SubMatrix.ast b/resources/syntaxtreegenerator/SubMatrix.ast new file mode 100644 index 0000000..61ab2f2 --- /dev/null +++ b/resources/syntaxtreegenerator/SubMatrix.ast @@ -0,0 +1,26 @@ +class Matrix2 { + +Matrix2(){ + super(()); + } + Matrix2(){ + super(()); + } + +}class SubMatrix { + +SubMatrix(){ + super(()); + } + TPH DOFK m(){ + java.util.Vector v; + v = new java.util.Vector(); + v.add Signature: [TPH DOFN, TPH DOFO](1); + return; + } + + SubMatrix(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/Switch.ast b/resources/syntaxtreegenerator/Switch.ast new file mode 100644 index 0000000..f6dfd8f --- /dev/null +++ b/resources/syntaxtreegenerator/Switch.ast @@ -0,0 +1,96 @@ +class SwitchStatement { + +SwitchStatement(){ + super(()); + } + TPH switchStandard(){ + str = SwitchMe; + switch(str){ + case java.lang.String s: + return true; + + default: + return false; + + }; + } + + TPH switchInteger(){ + i = 5; + switch(i){ + case java.lang.Integer j: + case java.lang.String s: + i = 6; + break; + + default: + i = 0; + break; + + }; + return i op 0; + } + + TPH guardedPattern(){ + TPH i; + i = 1; + switch(i){ + case java.lang.Integer j: + return true; + + default: + return false; + + }; + } + + TPH recordPattern(java.lang.Object obj){ + switch(obj){ + case Coordinates(java.lang.Double lat, java.lang.Double lon): + return true; + + default: + return false; + + }; + } + + SwitchStatement(){ + super(()); + } + +}class SwitchExpression { + + java.lang.Integer x; + java.lang.Integer y; +SwitchExpression(java.lang.Integer x, java.lang.Integer y){ + super(()); + this.x = x; + this.y = y; + } + java.lang.Integer x(){ + return this.x; + } + + java.lang.Integer y(){ + return this.y; + } + + java.lang.Boolean switchStandard(TPH str){ + return switch(str){ + case java.lang.String s: + yield true; + + default: + yield false; + + }; + } + + SwitchExpression(java.lang.Integer x, java.lang.Integer y){ + super(()); + this.x = x; + this.y = y; + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/TXGenerics.ast b/resources/syntaxtreegenerator/TXGenerics.ast new file mode 100644 index 0000000..1c4a0ea --- /dev/null +++ b/resources/syntaxtreegenerator/TXGenerics.ast @@ -0,0 +1,19 @@ +class TXGenerics { + + TPH GLEG a; + TPH GLEH b; +TXGenerics(){ + super(()); + } + TPH GLEI test(){ + TPH GLEJ c; + c = new Cycle(); + c.m Signature: [TPH GLEN, TPH GLEO, TPH GLEP](this.a, this.b); + return; + } + + TXGenerics(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/Tph.ast b/resources/syntaxtreegenerator/Tph.ast new file mode 100644 index 0000000..939f9a5 --- /dev/null +++ b/resources/syntaxtreegenerator/Tph.ast @@ -0,0 +1,20 @@ +class Tph { + +Tph(){ + super(()); + } + TPH BNOP m(TPH BNOQ a, TPH BNOR b){ + TPH BNOS c; + c = this.m2 Signature: [TPH BNOU, TPH BNOV](b); + return a; + } + + TPH BNOZ m2(TPH BNPA b){ + return b; + } + + Tph(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/Tph2.ast b/resources/syntaxtreegenerator/Tph2.ast new file mode 100644 index 0000000..f138866 --- /dev/null +++ b/resources/syntaxtreegenerator/Tph2.ast @@ -0,0 +1,18 @@ +class Tph2 { + + TPH FGYW id; +Tph2(){ + super(()); + this.id = (TPH FGYX x) -> { + return x; + }; + } + TPH FGZD id3(TPH FGZE x){ + return this.id.apply Signature: [TPH FGZG, TPH FGZH](x); + } + + Tph2(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/Tph3.ast b/resources/syntaxtreegenerator/Tph3.ast new file mode 100644 index 0000000..cfbf0bc --- /dev/null +++ b/resources/syntaxtreegenerator/Tph3.ast @@ -0,0 +1,21 @@ +class Tph3 { + +Tph3(){ + super(()); + } + TPH FMEJ m1(TPH FMEK x, TPH FMEL y){ + this.m2 Signature: [TPH FMEN, TPH FMEO](x); + x = y; + return; + } + + TPH FMES m2(TPH FMET y){ + this.m1 Signature: [TPH FMEV, TPH FMEW, TPH FMEX](y, y); + return; + } + + Tph3(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/Tph4.ast b/resources/syntaxtreegenerator/Tph4.ast new file mode 100644 index 0000000..2ed453b --- /dev/null +++ b/resources/syntaxtreegenerator/Tph4.ast @@ -0,0 +1,22 @@ +class Tph4 { + +Tph4(){ + super(()); + } + TPH FRJD m(TPH FRJE a, TPH FRJF b){ + TPH FRJG c; + c = this.m2 Signature: [TPH FRJI, TPH FRJJ](b); + TPH FRJM d; + d = this.m2 Signature: [TPH FRJO, TPH FRJP](c); + return d; + } + + TPH FRJT m2(TPH FRJU b){ + return b; + } + + Tph4(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/Tph5.ast b/resources/syntaxtreegenerator/Tph5.ast new file mode 100644 index 0000000..dfdda9d --- /dev/null +++ b/resources/syntaxtreegenerator/Tph5.ast @@ -0,0 +1,19 @@ +class Tph5 { + +Tph5(){ + super(()); + } + TPH FWNY m(TPH FWNZ x, TPH FWOA y){ + x = this.m2 Signature: [TPH FWOC, TPH FWOD](y); + return; + } + + TPH FWOH m2(TPH FWOI y){ + return y; + } + + Tph5(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/Tph6.ast b/resources/syntaxtreegenerator/Tph6.ast new file mode 100644 index 0000000..eba65bc --- /dev/null +++ b/resources/syntaxtreegenerator/Tph6.ast @@ -0,0 +1,21 @@ +class Tph6 { + +Tph6(){ + super(()); + } + TPH GBSM m(TPH GBSN x, TPH GBSO y){ + TPH GBSP c; + c = this.m2 Signature: [TPH GBSR, TPH GBSS](y); + c = this.m2 Signature: [TPH GBSW, TPH GBSX](x); + return; + } + + TPH GBTB m2(TPH GBTC y){ + return y; + } + + Tph6(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/Tph7.ast b/resources/syntaxtreegenerator/Tph7.ast new file mode 100644 index 0000000..8d2ebe4 --- /dev/null +++ b/resources/syntaxtreegenerator/Tph7.ast @@ -0,0 +1,20 @@ +class Tph7 { + +Tph7(){ + super(()); + } + TPH GQRI m(TPH GQRJ a, TPH GQRK b){ + TPH GQRL c; + c = this.m2 Signature: [TPH GQRN, TPH GQRO](b); + return this.m2 Signature: [TPH GQRS, TPH GQRT](b); + } + + TPH GQRX m2(TPH GQRY b){ + return b; + } + + Tph7(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/TypedID.ast b/resources/syntaxtreegenerator/TypedID.ast new file mode 100644 index 0000000..0a56861 --- /dev/null +++ b/resources/syntaxtreegenerator/TypedID.ast @@ -0,0 +1,22 @@ +class TypedID { + + TPH GVWK lam; +TypedID(){ + super(()); + this.lam = (TPH GVWL x) -> { + return x; + }; + } + TPH GVWR id(TPH GVWS b){ + return b; + } + + TPH GVWU m(){ + return this.lam; + } + + TypedID(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/VectorAdd.ast b/resources/syntaxtreegenerator/VectorAdd.ast new file mode 100644 index 0000000..992c9c1 --- /dev/null +++ b/resources/syntaxtreegenerator/VectorAdd.ast @@ -0,0 +1,31 @@ +class VectorAdd { + +VectorAdd(){ + super(()); + } + TPH EXVJ vectorAdd(TPH EXVK v1, TPH EXVL v2){ + TPH EXVM i; + i = 0; + v1 = new java.util.Vector(); + TPH EXVP erg; + erg = new java.util.Vector(); + while(i op v1.size Signature: [TPH EXVT]()){ + erg.addElement Signature: [TPH EXWF, TPH EXWG](v1.elementAt Signature: [TPH EXVW, TPH EXVX](i) op v2.elementAt Signature: [TPH EXWA, TPH EXWB](i)); + i++; + }; + return erg; + } + + TPH EXWN m(TPH EXWO x, TPH EXWP y, TPH EXWQ z){ + x = new java.util.Vector(); + y = new java.util.Vector(); + x.add Signature: [TPH EXWU, TPH EXWV](1); + y.add Signature: [TPH EXWY, TPH EXWZ](2); + return z.addAll Signature: [TPH EXXC, TPH EXXD](x); + } + + VectorAdd(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/VectorSuper.ast b/resources/syntaxtreegenerator/VectorSuper.ast new file mode 100644 index 0000000..ec2faf3 --- /dev/null +++ b/resources/syntaxtreegenerator/VectorSuper.ast @@ -0,0 +1,17 @@ +class VectorSuper { + +VectorSuper(){ + super(()); + } + TPH HPGR m(TPH HPGS x){ + java.lang.Integer y; + y = 1; + x.addElement Signature: [TPH HPGU, TPH HPGV](y); + return; + } + + VectorSuper(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/Y.ast b/resources/syntaxtreegenerator/Y.ast new file mode 100644 index 0000000..6a73619 --- /dev/null +++ b/resources/syntaxtreegenerator/Y.ast @@ -0,0 +1,16 @@ +class Y { + + TPH IBFH y; +Y(){ + super(()); + } + Y(){ + super(()); + this.y = (TPH IBFK f) -> { + return (TPH IBFL t) -> { + return f.apply Signature: [TPH IBFR, TPH IBFS](this.y.apply Signature: [TPH IBFN, TPH IBFO](f)).apply Signature: [TPH IBFV, TPH IBFW](t); + }; + }; + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/applyLambda.ast b/resources/syntaxtreegenerator/applyLambda.ast new file mode 100644 index 0000000..504ddde --- /dev/null +++ b/resources/syntaxtreegenerator/applyLambda.ast @@ -0,0 +1,27 @@ +class Apply { + +Apply(){ + super(()); + } + Apply(){ + super(()); + } + +}class applyLambda { + +applyLambda(){ + super(()); + } + TPH ASWH m(){ + TPH ASWI lam1; + lam1 = (TPH ASWJ x) -> { + return x; + }; + return lam1.apply Signature: [TPH ASWP, TPH ASWQ](new Apply()); + } + + applyLambda(){ + super(()); + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/javFiles/Instanceof.jav b/resources/syntaxtreegenerator/javFiles/Instanceof.jav new file mode 100644 index 0000000..c9a2d0b --- /dev/null +++ b/resources/syntaxtreegenerator/javFiles/Instanceof.jav @@ -0,0 +1,36 @@ +import java.lang.Integer; +import java.lang.Double; +import java.lang.String; +import java.lang.Object; + +public class Instanceof{ + void checkInstanceof() { + var a = 4; + return (a instanceof java.lang.Integer); + } + + void checkInstanceOfWithPattern(){ + var b = 4.0; + if(b instanceof java.lang.Double d){ + return d; + }else{ + return "Kein Double"; + } + } + + void checkInstanceOfWithGuardedPattern(){ + var obj = "test"; + var flag; + if (obj instanceof String s && s.length() > 5) { + flag = s.contains("jdk"); + } + } + + record Point(int x, int y){ } + + boolean equals(Object o) { + return (o instanceof Point other) + && x == other.x + && y == other.y; + } +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/javFiles/PatternMatching.jav b/resources/syntaxtreegenerator/javFiles/PatternMatching.jav new file mode 100644 index 0000000..d256ac0 --- /dev/null +++ b/resources/syntaxtreegenerator/javFiles/PatternMatching.jav @@ -0,0 +1,19 @@ +import java.lang.String; + +record Point(int x, int y) {} +interface Shape {} +record ColoredPoint(Point pt, String color) {} +record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) implements Shape {} +sealed class Color permits Blue, Red {} +class Blue extends Color {} +class Red extends Color {} + +class PatternMatching { +void printColorOfUpperLeftPoint(Shape shape) +{ + switch (shape) { + case Rectangle(ColoredPoint(Point pt, String color), ColoredPoint lowerRight) -> System.out.println("x: " + pt.x() + " / color: " + color + " / lowerRight: " + lowerRight); + default -> System.out.println("not a rectangle"); + }; +} +} diff --git a/resources/syntaxtreegenerator/javFiles/Record.jav b/resources/syntaxtreegenerator/javFiles/Record.jav new file mode 100644 index 0000000..31edc83 --- /dev/null +++ b/resources/syntaxtreegenerator/javFiles/Record.jav @@ -0,0 +1,5 @@ +// Simple records +record Point(x, y){ } + +//Combination of records +record Line(pt1, pt2){} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/javFiles/Sealed.jav b/resources/syntaxtreegenerator/javFiles/Sealed.jav new file mode 100644 index 0000000..b7a68e5 --- /dev/null +++ b/resources/syntaxtreegenerator/javFiles/Sealed.jav @@ -0,0 +1,21 @@ +public abstract sealed class Shape + permits Circle, Rectangle, Square, WeirdShape { } + +public final class Circle extends Shape { } + +public sealed class Rectangle extends Shape + permits TransparentRectangle, FilledRectangle { } +public final class TransparentRectangle extends Rectangle { } +public final class FilledRectangle extends Rectangle { } + +public final class Square extends Shape { } + +public non-sealed class WeirdShape extends Shape { } + +public sealed interface Expr + permits ConstantExpr, PlusExpr, TimesExpr, NegExpr { } + +public record ConstantExpr(int i) implements Expr { } +public record PlusExpr(Expr a, Expr b) implements Expr { } +public record TimesExpr(Expr a, Expr b) implements Expr { } +public record NegExpr(Expr e) implements Expr { } \ No newline at end of file diff --git a/resources/syntaxtreegenerator/javFiles/Switch.jav b/resources/syntaxtreegenerator/javFiles/Switch.jav new file mode 100644 index 0000000..6c0f68a --- /dev/null +++ b/resources/syntaxtreegenerator/javFiles/Switch.jav @@ -0,0 +1,52 @@ +import java.lang.Integer; +import java.lang.Boolean; +import java.lang.String; +import java.lang.Object; + +class SwitchStatement { + + switchStandard(){ + str = "SwitchMe"; + switch(str){ + case String s: return true; + default: return false; + } + } + + switchInteger(){ + i = 5; + switch(i){ + case Integer j: + case String s: i = 6; break; + default: i = 0; break; + } + return (i==0); + } + + guardedPattern(){ + var i = 1; + switch(i){ + case Integer j && j == 1: return true; + default: return false; + } + } + + record Coordinates(double x, double y) {} + + recordPattern(Object obj){ + switch(obj){ + case Coordinates(double lat, double lon): return true; + default: return false; + } + } +} + +record SwitchExpression(int x, int y){ + + boolean switchStandard(str){ + return switch(str){ + case String s -> yield true; + default -> yield false; + }; + } +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/mathStruc.ast b/resources/syntaxtreegenerator/mathStruc.ast new file mode 100644 index 0000000..8531850 --- /dev/null +++ b/resources/syntaxtreegenerator/mathStruc.ast @@ -0,0 +1,19 @@ +class mathStruc { + + TPH IHHZ model; + TPH IHIA innerOp; +mathStruc(){ + super(()); + this.innerOp = (TPH IHIB o) -> { + return (TPH IHIC ms) -> { + return new mathStruc(o.apply Signature: [TPH IHIF, TPH IHIG, TPH IHIH](this.model, ms.model)); + }; + }; + } + mathStruc(TPH IHIW m){ + super(()); + this.model = m; + return; + } + +} \ No newline at end of file diff --git a/resources/syntaxtreegenerator/mathStrucInteger.ast b/resources/syntaxtreegenerator/mathStrucInteger.ast new file mode 100644 index 0000000..c36d537 --- /dev/null +++ b/resources/syntaxtreegenerator/mathStrucInteger.ast @@ -0,0 +1,38 @@ +class mathStrucInteger { + + TPH EBJW model; + TPH EBJX innerOp; +mathStrucInteger(){ + super(()); + this.innerOp = (TPH EBJY o) -> { + return (TPH EBJZ ms) -> { + return new mathStrucInteger(o.apply Signature: [TPH EBKC, TPH EBKD, TPH EBKE](this.model, ms.model)); + }; + }; + } + mathStrucInteger(TPH EBKT m){ + super(()); + this.model = m; + return; + } + +}class mathStrucIntegerUse { + +mathStrucIntegerUse(){ + super(()); + } + TPH EBLO main(){ + TPH EBLP ms; + ms = new mathStrucInteger(2); + TPH EBLT ms2; + ms2 = ms.innerOp.apply Signature: [TPH EBMD, TPH EBME]((TPH EBLV x, TPH EBLW y) -> { + return x op y; + }).apply Signature: [TPH EBMH, TPH EBMI](ms); + return ms2; + } + + mathStrucIntegerUse(){ + super(()); + } + +} \ No newline at end of file diff --git a/tests/TestComplete.java b/tests/TestComplete.java new file mode 100644 index 0000000..daa3ab7 --- /dev/null +++ b/tests/TestComplete.java @@ -0,0 +1,944 @@ + +import de.dhbwstuttgart.environment.ByteArrayClassLoader; +import org.junit.Ignore; +import org.junit.Test; + +import java.lang.reflect.*; +import java.util.Arrays; +import java.util.Vector; + +import targetast.TestCodegen; + +import static org.junit.Assert.*; +import static targetast.TestCodegen.generateClassFiles; + +public class TestComplete { + + + // @Test + // public void applyLambdaTest() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "applyLambda.jav"); + // var applyLambda = classFiles.get("applyLambda"); + // var instance = applyLambda.getDeclaredConstructor().newInstance(); + // var m = applyLambda.getDeclaredMethod("m"); + // var result = m.invoke(instance); + + // assertEquals(result.getClass(), classFiles.get("Apply")); + // } + + @Test + public void binaryTest() throws Exception { + var classFiles = generateClassFiles(new ByteArrayClassLoader(), "BinaryInMeth.jav"); + var binaryInMeth = classFiles.get("BinaryInMeth"); + var instance = binaryInMeth.getDeclaredConstructor().newInstance(); + + var m2 = binaryInMeth.getDeclaredMethod("m2", Integer.class, Integer.class); + var m3 = binaryInMeth.getDeclaredMethod("m3", Integer.class); + assertEquals(6, m2.invoke(instance, 2, 3)); + assertEquals(4, m3.invoke(instance, 2)); + } + + // @Test + // public void classGenLamTest() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "ClassGenLam.jav"); + // classFiles.get("ClassGenLam").getDeclaredConstructor().newInstance(); + // } + + // @Test + // public void facTest() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Fac.jav"); + // var fac = classFiles.get("Fac"); + // var instance = fac.getDeclaredConstructor().newInstance(); + + // var getFac = fac.getDeclaredMethod("getFac", Integer.class); + // // assertEquals(6, getFac.invoke(instance, 3)); TODO This could be either an Integer or a Double so this simple test fails + // } + + // @Test + // public void facultyTest() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Faculty.jav"); + + // var fac = classFiles.get("Faculty"); + // var constructor = fac.getDeclaredConstructor(); + // constructor.setAccessible(true); + // var instance = constructor.newInstance(); + + // var getFact = fac.getDeclaredMethod("getFact", Integer.class); + // assertEquals(6, getFact.invoke(instance, 3)); + // } + + // @Test + // public void fieldTest() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Field.jav"); + // var field = classFiles.get("Field"); + // var instance = field.getDeclaredConstructor().newInstance(); + // assertEquals(1, field.getFields().length); + // } + + // @Test + // public void fieldTph2Test() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "FieldTph2.jav"); + // var fieldtph2 = classFiles.get("FieldTph2"); + // var instance = fieldtph2.getDeclaredConstructor().newInstance(); + + // var a = fieldtph2.getDeclaredField("a"); + // var m2 = fieldtph2.getDeclaredMethod("m2", Object.class); + // m2.invoke(instance, 1); + + // var m = fieldtph2.getDeclaredMethod("m", Object.class); + // assertEquals(1, m.invoke(instance, 1)); + // } + + // @Test + // public void fieldTphConsMethTest() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "FieldTphConsMeth.jav"); + // var fieldTphConsMeth = classFiles.get("FieldTphConsMeth"); + + // var ctor = fieldTphConsMeth.getDeclaredConstructor(Object.class); + // var instance = ctor.newInstance("C"); + // var a = fieldTphConsMeth.getDeclaredField("a"); + // var id = fieldTphConsMeth.getDeclaredMethod("id", Object.class); + + // assertEquals(42, id.invoke(instance, 42)); + // assertEquals("C", a.get(instance)); + // } + + // @Test + // public void fieldTphMMethTest() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "FieldTphMMeth.jav"); + // var fieldTphMMeth = classFiles.get("FieldTphMMeth"); + // var ctor = fieldTphMMeth.getDeclaredConstructor(Object.class, Object.class, Boolean.class); + + // var instance1 = ctor.newInstance("C", 42, true); + // var instance2 = ctor.newInstance("C", 42, false); + + // var m = fieldTphMMeth.getDeclaredMethod("m", Object.class, Object.class, Boolean.class); + // assertEquals(42, m.invoke(instance1, "C", 42, false)); + + // var a = fieldTphMMeth.getDeclaredField("a"); + // assertEquals("C", a.get(instance1)); + // assertEquals(42, a.get(instance2)); + // } + + // @Test + // public void genTest() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Gen.jav"); + // } + + // @Test + // public void idTest() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Id.jav"); + // var instance = classFiles.get("Id").getDeclaredConstructor().newInstance(); + // } + + // @Test + // public void infTest() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Inf.jav"); + // var instance = classFiles.get("Inf").getDeclaredConstructor().newInstance(); + // // TODO check generics + // } + + // @Test + // public void kompTphTest() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "KompTph.jav"); + // var instance = classFiles.get("KompTph").getDeclaredConstructor().newInstance(); + // } + + // @Test + // public void lambdaCaptureTest() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "LambdaCapture.jav"); + // var instance = classFiles.get("LambdaCapture").getDeclaredConstructor().newInstance(); + // } + + // @Test + // public void lambdaTest() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Lambda.jav"); + // var classToTest = classFiles.get("Lambda"); + // var instanceOfClass = classToTest.getDeclaredConstructor().newInstance(); + + // var m = classToTest.getDeclaredMethod("m"); + // var lambda = m.invoke(instanceOfClass).getClass(); + // var apply = lambda.getMethod("apply", Object.class); + // apply.setAccessible(true); + + // var i = Integer.valueOf(77); + // assertEquals(i, apply.invoke(m.invoke(instanceOfClass), i)); + // } + + // @Test + // public void mathStrucInteger() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "mathStrucInteger.jav"); + // var mathStrucInteger = classFiles.get("mathStrucInteger"); + // mathStrucInteger.getDeclaredConstructor(Integer.class).newInstance(10); + // } + + // @Test + // public void mathStruc() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "mathStruc.jav"); + // var mathStruc = classFiles.get("mathStruc"); + // mathStruc.getDeclaredConstructor(Object.class).newInstance("A"); + // } + + // @Test + // public void matrixOpTest() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "MatrixOP.jav"); + // var matrixOP = classFiles.get("MatrixOP"); + + // Vector> vv = new Vector<>(); + // Vector v1 = new Vector<>(); + // v1.addElement(2); + // v1.addElement(2); + // Vector v2 = new Vector<>(); + // v2.addElement(3); + // v2.addElement(3); + // vv.addElement(v1); + // vv.addElement(v2); + + // var instanceOfClass_m1 = matrixOP.getDeclaredConstructor(Vector.class).newInstance(vv); + + // Vector> vv1 = new Vector<>(); + // Vector v3 = new Vector<>(); + // v3.addElement(2); + // v3.addElement(2); + // Vector v4 = new Vector<>(); + // v4.addElement(3); + // v4.addElement(3); + // vv1.addElement(v3); + // vv1.addElement(v4); + + // var instanceOfClass_m2 = matrixOP.getDeclaredConstructor(Vector.class).newInstance(vv1);// Matrix m2 = new Matrix(vv1); + + // var mul = matrixOP.getField("mul"); + // mul.setAccessible(true); + + // var lambda = mul.get(instanceOfClass_m1).getClass(); + // var apply = lambda.getMethod("apply", Object.class, Object.class); + // apply.setAccessible(true); + + // var result = apply.invoke(mul.get(instanceOfClass_m1), instanceOfClass_m1, instanceOfClass_m2); + // System.out.println(instanceOfClass_m1.toString() + " * " + instanceOfClass_m2.toString() + " = " + result.toString()); + + // Vector> res = new Vector<>(); + // Vector v5 = new Vector<>(); + // v5.addElement(10); + // v5.addElement(10); + // Vector v6 = new Vector<>(); + // v6.addElement(15); + // v6.addElement(15); + // res.addElement(v5); + // res.addElement(v6); + + // var instanceOfClass_m3 = matrixOP.getDeclaredConstructor(Vector.class).newInstance(res); + // assertEquals(result, instanceOfClass_m3); + // } + + // @Test + // //@Ignore("This is too complex") + // public void matrixTest() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Matrix.jav"); + // var matrix = classFiles.get("Matrix"); + + // Vector> vv = new Vector<>(); + // Vector v1 = new Vector<>(); + // v1.addElement(2); + // v1.addElement(2); + // Vector v2 = new Vector<>(); + // v2.addElement(3); + // v2.addElement(3); + // vv.addElement(v1); + // vv.addElement(v2); + + // var instanceOfClass_m1 = matrix.getDeclaredConstructor(Vector.class).newInstance(vv); + + // Vector> vv1 = new Vector<>(); + // Vector v3 = new Vector<>(); + // v3.addElement(2); + // v3.addElement(2); + // Vector v4 = new Vector<>(); + // v4.addElement(3); + // v4.addElement(3); + // vv1.addElement(v3); + // vv1.addElement(v4); + + // var instanceOfClass_m2 = matrix.getDeclaredConstructor(Vector.class).newInstance(vv1); + + // var mul = matrix.getDeclaredMethod("mul", Vector.class); + // var result = mul.invoke(instanceOfClass_m1, instanceOfClass_m2); + // System.out.println(instanceOfClass_m1.toString() + " * " + instanceOfClass_m2.toString() + " = " + result.toString()); + + // Vector> res = new Vector<>(); + // Vector v5 = new Vector<>(); + // v5.addElement(10); + // v5.addElement(10); + // Vector v6 = new Vector<>(); + // v6.addElement(15); + // v6.addElement(15); + // res.addElement(v5); + // res.addElement(v6); + + // var instanceOfClass_m3 = matrix.getDeclaredConstructor(Vector.class).newInstance(res); + // assertEquals(result, instanceOfClass_m3); + // } + + // @Test + // public void scalarTest() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Scalar.jav"); + // var scalar = classFiles.get("Scalar"); + + // Vector> vv = new Vector<>(); + // Vector v1 = new Vector<>(); + // v1.addElement(2); + // v1.addElement(2); + + // var instanceOfClass_s1 = scalar.getDeclaredConstructor(Vector.class).newInstance(v1); + + // Vector v2 = new Vector<>(); + // v2.addElement(2); + // v2.addElement(2); + + // var instanceOfClass_s2 = scalar.getDeclaredConstructor(Vector.class).newInstance(v2); + + // var mul = scalar.getDeclaredMethod("mul", Vector.class); + // var result = mul.invoke(instanceOfClass_s1, instanceOfClass_s2); + // System.out.println(instanceOfClass_s1.toString() + " * " + instanceOfClass_s2.toString() + " = " + result.toString()); + + // assertEquals(result, 8); + // } + + // @Test + // public void mergeTest() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Merge.jav"); + // var instance = classFiles.get("Merge").getDeclaredConstructor().newInstance(); + // } + + // @Test + // public void overloadingSortingTest() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Sorting.jav"); + // var instance = classFiles.get("Sorting").getDeclaredConstructor().newInstance(); + // } + + // @Test + // public void overloadingTest() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Overloading.jav"); + // var overloading = classFiles.get("Overloading"); + // var overloading2 = classFiles.get("Overloading2"); + // var instance1 = overloading.getDeclaredConstructor().newInstance(); + // var instance2 = overloading2.getDeclaredConstructor().newInstance(); + + // var m1 = overloading.getDeclaredMethod("test", overloading); + // assertEquals("Overloading", m1.invoke(instance1, instance1)); + // var m2 = overloading.getDeclaredMethod("test", overloading2); + // assertEquals("Overloading2", m2.invoke(instance1, instance2)); + // } + + // @Test + // public void plusTest() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Plus.jav"); + // var plus = classFiles.get("Plus"); + // var instance = plus.getDeclaredConstructor().newInstance(); + + // var addInt = plus.getDeclaredMethod("m", Integer.class, Integer.class); + // assertEquals(10, addInt.invoke(instance, 7, 3)); + + // var addString = plus.getDeclaredMethod("m", String.class, String.class); + // assertEquals("ByteCode", addString.invoke(instance, "Byte", "Code")); + // } + + // @Test + // public void relOpsTest() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "RelOps.jav"); + // var relOps = classFiles.get("RelOps"); + // var instance = relOps.getDeclaredConstructor().newInstance(); + + // var m = relOps.getDeclaredMethod("m", Integer.class, Integer.class); + // assertFalse((Boolean) m.invoke(instance, 7, 3)); + // } + + // @Test + // public void simpleCyclesTest() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "SimpleCycle.jav"); + // var instance = classFiles.get("SimpleCycle").getDeclaredConstructor().newInstance(); + // } + + // @Test + // public void subMatTest() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "SubMatrix.jav"); + // var instance = classFiles.get("SubMatrix").getDeclaredConstructor().newInstance(); + // } + + // @Test + // public void tphTest() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Tph.jav"); + // var tph = classFiles.get("Tph"); + // var instance = tph.getDeclaredConstructor().newInstance(); + // } + + // @Test + // public void tph2Test() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Tph2.jav"); + // var tph2 = classFiles.get("Tph2"); + // var instance = tph2.getDeclaredConstructor().newInstance(); + + // assertEquals(1, tph2.getTypeParameters().length); + // // public class Tph2 + // var DZG = tph2.getTypeParameters()[0]; + + // var id = tph2.getDeclaredField("id"); + // // public Fun1$$ id + // var idParams = ((ParameterizedType) id.getGenericType()).getActualTypeArguments(); + // assertEquals(2, idParams.length); + // assertEquals(DZG, idParams[0]); + // assertEquals(DZG, idParams[1]); + + // var id3 = tph2.getDeclaredMethod("id3", Object.class); + // // public DZG id3(U var1) + // var paraTypes = id3.getGenericParameterTypes(); + // var typeParaTypes = id3.getTypeParameters(); + + // var U = Arrays.stream(typeParaTypes).filter(t -> t.equals(paraTypes[0])).findFirst().get(); + // assertEquals(DZG, U.getBounds()[0]); + // assertEquals(DZG, id3.getGenericReturnType()); + // } + + // @Test + // public void tph3Test() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Tph3.jav"); + // var tph3 = classFiles.get("Tph3"); + // var instance = tph3.getDeclaredConstructor().newInstance(); + // var m1 = tph3.getDeclaredMethod("m1", Object.class, Object.class); + + // // public void m1(DXBD var1, DXBE var2) + // var paraTypes = m1.getGenericParameterTypes(); + // var typeParaTypes = m1.getTypeParameters(); + + // var DXBD = Arrays.stream(typeParaTypes).filter(t -> t.equals(paraTypes[0])).findFirst().get(); + // assertEquals(Object.class, DXBD.getBounds()[0]); + // var DXBE = Arrays.stream(typeParaTypes).filter(t -> t.equals(paraTypes[1])).findFirst().get(); + // assertEquals(DXBD, DXBE.getBounds()[0]); + + // var m2 = tph3.getDeclaredMethod("m2", Object.class); + + // // public void m2(V var1) + // var paraTypes2 = m2.getGenericParameterTypes(); + // var typeParaTypes2 = m2.getTypeParameters(); + + // var V = Arrays.stream(typeParaTypes2).filter(t -> t.equals(paraTypes2[0])).findFirst().get(); + // assertEquals(Object.class, V.getBounds()[0]); + // } + + // @Test + // public void tph4Test() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Tph4.jav"); + // var tph4 = classFiles.get("Tph4"); + // var instance = tph4.getDeclaredConstructor().newInstance(); + // var m = tph4.getDeclaredMethod("m", Object.class, Object.class); + + // // public N m(O var1, N var2) { + // var paraTypes = m.getGenericParameterTypes(); + // var typeParaTypes = m.getTypeParameters(); + + // var N = Arrays.stream(typeParaTypes).filter(t -> t.equals(m.getGenericReturnType())).findFirst().get(); + // assertEquals(Object.class, N.getBounds()[0]); + + // var O = Arrays.stream(typeParaTypes).filter(t -> t.equals(paraTypes[0])).findFirst().get(); + // var N2 = Arrays.stream(typeParaTypes).filter(t -> t.equals(paraTypes[1])).findFirst().get(); + // assertEquals(N, N2); + // assertEquals(N.getBounds()[0], Object.class); + // assertEquals(O.getBounds()[0], Object.class); + + // var m2 = tph4.getDeclaredMethod("m2", Object.class); + + // // public X m2(X var1) + // var paraTypes2 = m2.getGenericParameterTypes(); + // var typeParaTypes2 = m2.getTypeParameters(); + + // var X = Arrays.stream(typeParaTypes2).filter(t -> t.equals(paraTypes2[0])).findFirst().get(); + // assertEquals(Object.class, X.getBounds()[0]); + // assertEquals(X, m2.getGenericReturnType()); + // } + + // @Test + // public void tph5Test() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Tph5.jav"); + // var tph5 = classFiles.get("Tph5"); + // var instance = tph5.getDeclaredConstructor().newInstance(); + // var m = tph5.getDeclaredMethod("m", Object.class, Object.class); + + // // public void m(N var1, O var2) + // var paraTypes = m.getGenericParameterTypes(); + // var typeParaTypes = m.getTypeParameters(); + + // var N = Arrays.stream(typeParaTypes).filter(t -> t.equals(paraTypes[0])).findFirst().get(); + // var O = Arrays.stream(typeParaTypes).filter(t -> t.equals(paraTypes[1])).findFirst().get(); + + // assertEquals(O.getBounds()[0], N); + // assertEquals(Object.class, N.getBounds()[0]); + + // var m2 = tph5.getDeclaredMethod("m2", Object.class); + + // // public R m2(R var1) + // var paraTypes2 = m2.getGenericParameterTypes(); + // var typeParaTypes2 = m2.getTypeParameters(); + + // var R = Arrays.stream(typeParaTypes2).filter(t -> t.equals(paraTypes2[0])).findFirst().get(); + // assertEquals(Object.class, R.getBounds()[0]); + // assertEquals(R, m2.getGenericReturnType()); + // } + + // @Test + // public void tph6Test() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Tph6.jav"); + // var tph5 = classFiles.get("Tph6"); + // var instance = tph5.getDeclaredConstructor().newInstance(); + // var m = tph5.getDeclaredMethod("m", Object.class, Object.class); + + // // public void m(O var1, P var2) + // var paraTypes = m.getGenericParameterTypes(); + // var typeParaTypes = m.getTypeParameters(); + + // var P = Arrays.stream(typeParaTypes).filter(t -> t.equals(paraTypes[0])).findFirst().get(); + // var O = Arrays.stream(typeParaTypes).filter(t -> t.equals(paraTypes[1])).findFirst().get(); + + // assertEquals(P.getBounds()[0], Object.class); + // assertEquals(O.getBounds()[0], Object.class); + + // var m2 = tph5.getDeclaredMethod("m2", Object.class); + + // // public W m2(W var1) + // var paraTypes2 = m2.getGenericParameterTypes(); + // var typeParaTypes2 = m2.getTypeParameters(); + + // var W = Arrays.stream(typeParaTypes2).filter(t -> t.equals(paraTypes2[0])).findFirst().get(); + // assertEquals(Object.class, W.getBounds()[0]); + // assertEquals(W, m2.getGenericReturnType()); + // } + + // @Test + // public void Tph7Test() throws Exception { + // var classFiles = TestCodegen.generateClassFiles(new ByteArrayClassLoader(), "Tph7.jav"); + // var classToTest = classFiles.get("Tph7"); + // var instanceOfClass = classToTest.getDeclaredConstructor().newInstance(); + + // // public N m(O var1, N var2) + // Method m = classToTest.getDeclaredMethod("m", Object.class, Object.class); + + // // System.out.println(m.toString()); + + // // Argumenttypes of the method m + // var paraTypes = m.getGenericParameterTypes(); + + // // Typeparameters of the method m + // var typeParaTypes = m.getTypeParameters(); + + // // Typeparameters are extracted from the argumenttypes + // // Conditions for the extracted typeparameters are set + + // // paraTypes[0] = O + // var boundFstArg = Arrays.stream(typeParaTypes).filter(x -> x.equals(paraTypes[0])).findFirst().get().getBounds(); + + // // Bound of O has to be Object + // assertEquals(Object.class, Arrays.stream(boundFstArg).findFirst().get()); + + // // paraTypes[1] = N + // var N = Arrays.stream(typeParaTypes).filter(x -> x.equals(paraTypes[1])).findFirst().get(); + // var boundSndArg = N.getBounds(); + + // // Bound of H has to be Object + // assertEquals(Object.class, Arrays.stream(boundSndArg).findFirst().get()); + + // // N has to be the return type of m + // assertEquals(N, m.getGenericReturnType()); + + // // public DZU m2(DZU); + // Method m2 = classToTest.getDeclaredMethod("m2", Object.class); + + // // Argumenttypes of the method m2 + // var paraTypesm2 = m2.getGenericParameterTypes(); + + // // Typeparameters of the method m2 + // var typeParaTypesm2 = m2.getTypeParameters(); + + // // Typeparameters are extracted from the argumenttypes + // // Conditions for the extracted typeparameters are set + + // // paraTypes[0] = DZU + // var fstArgm2 = Arrays.stream(typeParaTypesm2).filter(x -> x.equals(paraTypesm2[0])).findFirst().get(); + + // // Bound of DZU has to be Object + // assertEquals(Object.class, Arrays.stream(fstArgm2.getBounds()).findFirst().get()); + + // // DZU has to be the return type of m + // assertEquals(fstArgm2, m2.getGenericReturnType()); + // } + + // @Test + // public void testTXGenerics() throws Exception { + // var classLoader = new ByteArrayClassLoader(); + // generateClassFiles(classLoader, "Cycle.jav"); + // var classFiles = generateClassFiles(classLoader, "TXGenerics.jav"); + // var instance = classFiles.get("TXGenerics").getDeclaredConstructor().newInstance(); + // } + + // @Test + // public void typedIdTest() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "TypedID.jav"); + // var instance = classFiles.get("TypedID").getDeclaredConstructor().newInstance(); + // } + + // @Test + // public void vectorAddTest() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "VectorAdd.jav"); + // var instance = classFiles.get("VectorAdd").getDeclaredConstructor().newInstance(); + // } + + // @Test + // public void vectorSuperTest() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "VectorSuper.jav"); + // var instance = classFiles.get("VectorSuper").getDeclaredConstructor().newInstance(); + // } + + // @Test + // public void yTest() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Y.jav"); + // var instance = classFiles.get("Y").getDeclaredConstructor().newInstance(); + // } + + // @Test + // @Ignore("This one isn't working") + // public void boxTest() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Box.jav"); + // var instance = classFiles.get("Box_Main").getDeclaredConstructor().newInstance(); + // } + + // @Test + // public void cycleTest() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Cycle.jav"); + // var instance = classFiles.get("Cycle").getDeclaredConstructor().newInstance(); + // } + + // @Test + // public void olFunTest() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "OLFun.jav"); + // var instance = classFiles.get("OLFun").getDeclaredConstructor().newInstance(); + // } + + // @Test + // public void olFun2Test() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "OLFun2.jav"); + // var instance = classFiles.get("OLFun2").getDeclaredConstructor().newInstance(); + // } + + // @Test + // public void pairTest() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Pair.jav"); + // var instance = classFiles.get("Pair").getDeclaredConstructor().newInstance(); + // } + + // @Test + // public void olTest() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "OL.jav"); + // var instance = classFiles.get("OL").getDeclaredConstructor().newInstance(); + // } + + // @Test + // public void recordTest() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "RecordTest.jav"); + // var clazz = classFiles.get("RecordTest"); + // var instance = clazz.getDeclaredConstructor().newInstance(); + // assertTrue((Boolean) clazz.getDeclaredMethod("doesEqual").invoke(instance)); + // assertFalse((Boolean) clazz.getDeclaredMethod("doesNotEqual").invoke(instance)); + // System.out.println(clazz.getDeclaredMethod("hashCode").invoke(instance)); + // System.out.println(clazz.getDeclaredMethod("toString").invoke(instance)); + // } + + // @Test + // public void testSwitch() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Switch.jav"); + // var clazz = classFiles.get("Switch"); + // var instance = clazz.getDeclaredConstructor().newInstance(); + // var swtch = clazz.getDeclaredMethod("main", Object.class); + + // var record = classFiles.get("Rec"); + // var ctor = record.getDeclaredConstructor(Integer.class, Object.class); + // var r1 = ctor.newInstance(10, 20); + // var r2 = ctor.newInstance(10, 20f); + // var r3 = ctor.newInstance(10, r1); + + // assertEquals(swtch.invoke(instance, r1), 30); + // assertEquals(swtch.invoke(instance, r2), 20); + // assertEquals(swtch.invoke(instance, r3), 40); + // assertEquals(swtch.invoke(instance, 50), 50); + // assertEquals(swtch.invoke(instance, "Some string"), 0); + // } + + // @Ignore("Not implemented") + // @Test + // public void testSwitch2() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Switch2.jav"); + // var clazz = classFiles.get("Switch2"); + // var instance = clazz.getDeclaredConstructor().newInstance(); + // } + + // @Test + // public void testStringSwitch() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "SwitchString.jav"); + // var clazz = classFiles.get("SwitchString"); + // var instance = clazz.getDeclaredConstructor().newInstance(); + // var main = clazz.getDeclaredMethod("main", String.class); + + // assertEquals(main.invoke(instance, "AaAaAa"), 1); + // assertEquals(main.invoke(instance, "AaAaBB"), 2); + // assertEquals(main.invoke(instance, "test"), 3); + // assertEquals(main.invoke(instance, "TEST"), 3); + // assertEquals(main.invoke(instance, "awawa"), 4); + // } + + // @Test + // public void testInstanceOfPattern() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "InstanceOf.jav"); + // var clazz = classFiles.get("InstanceOf"); + // var instance = clazz.getDeclaredConstructor().newInstance(); + // } + + // @Ignore("Not implemented") + // @Test + // public void testOverloadPattern() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "OverloadPattern.jav"); + // var clazz = classFiles.get("OverloadPattern"); + // var rec = classFiles.get("Point"); + + // var instance = clazz.getDeclaredConstructor().newInstance(); + // var m1 = clazz.getDeclaredMethod("m", rec); + // var m2 = clazz.getDeclaredMethod("m", Integer.class); + + // var pt = rec.getDeclaredConstructor(Number.class, Number.class).newInstance(10, 20); + // assertEquals(m1.invoke(instance, pt), 30); + // assertEquals(m2.invoke(instance, 10), 10); + // } + + // @Test + // public void testInterfaces() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Interfaces.jav"); + // var clazz = classFiles.get("Interfaces"); + // var instance = clazz.getDeclaredConstructor().newInstance(); + // } + // @Test + // public void testStatic() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Static.jav"); + // var clazz = classFiles.get("Static"); + // var m = clazz.getDeclaredMethod("m"); + // assertEquals(m.invoke(null), 50); + // } + + // @Test + // public void testFor() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "For.jav"); + // var clazz = classFiles.get("For"); + // var instance = clazz.getDeclaredConstructor().newInstance(); + // var m = clazz.getDeclaredMethod("m", Integer.class); + // assertEquals(m.invoke(instance, 10), 60); + // } + + // @Test + // public void testForEach() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "ForEach.jav"); + // var clazz = classFiles.get("ForEach"); + // var instance = clazz.getDeclaredConstructor().newInstance(); + // var m = clazz.getDeclaredMethod("m"); + // assertEquals(m.invoke(instance), 6); + // } + + // @Test + // public void testLambdaRunnable() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "LambdaRunnable.jav"); + // var clazz = classFiles.get("LambdaRunnable"); + // var instance = clazz.getDeclaredConstructor().newInstance(); + // //var m = clazz.getDeclaredMethod("m", Integer.class); + // //assertEquals(m.invoke(instance, 10), 60); + // } + + // @Test + // public void testFunctionalInterface() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "FunctionalInterface.jav"); + // var clazz = classFiles.get("FunctionalInterface"); + // var instance = clazz.getDeclaredConstructor().newInstance(); + // var m = clazz.getDeclaredMethod("m"); + // assertEquals(m.invoke(instance), 200); + // } + + // @Test + // public void testChain() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Chain.jav"); + // var clazz = classFiles.get("Chain"); + // var instance = clazz.getDeclaredConstructor().newInstance(); + // var m = clazz.getDeclaredMethod("m"); + // assertEquals(m.invoke(instance), 5); + // } + + // @Test + // public void testHelloWorld() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "HelloWorld.jav"); + // var clazz = classFiles.get("HelloWorld"); + // var hello = clazz.getDeclaredMethod("hello"); + // hello.invoke(null); + // } + + // @Test + // public void testSuperCall() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "SuperCall.jav"); + // var clazz = classFiles.get("SuperCall"); + // var instance = clazz.getDeclaredConstructor().newInstance(); + // } + + // @Test + // public void testInstanceOf() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "InstanceOf.jav"); + // var clazz = classFiles.get("InstanceOf"); + // var instance = clazz.getDeclaredConstructor().newInstance(); + + // assertTrue((Boolean) clazz.getDeclaredMethod("test1").invoke(instance)); + // assertTrue((Boolean) clazz.getDeclaredMethod("test2").invoke(instance)); + // assertFalse((Boolean) clazz.getDeclaredMethod("test3").invoke(instance)); + // } + + // @Test + // public void testExceptions() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Exceptions.jav"); + // var clazz = classFiles.get("Exceptions"); + // var instance = clazz.getDeclaredConstructor().newInstance(); + + // try { + // clazz.getDeclaredMethod("m").invoke(instance); + // fail("No exception thrown!"); + // } catch (InvocationTargetException exception) { + // var exc = exception.getTargetException(); + // if (!(exc instanceof RuntimeException rexp) || !rexp.getMessage().equals("Some Exception")) { + // fail("Wrong exception thrown!"); + // } + // } + // } + + // @Test + // public void testLiteral() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Literal.jav"); + // var clazz = classFiles.get("Literal"); + // var instance = clazz.getDeclaredConstructor().newInstance(); + + // assertNull(clazz.getDeclaredMethod("m").invoke(instance)); + // assertEquals(clazz.getDeclaredMethod("m2").invoke(instance), 'C'); + // } + + // @Test + // public void testOLConstructor() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "OLConstructor.jav"); + // var clazz = classFiles.get("Child"); + // var instance = clazz.getDeclaredConstructor().newInstance(); + // assertEquals(clazz.getSuperclass().getDeclaredField("x").get(instance), 3); + // } + + // @Ignore("Not implemented") + // @Test + // public void testStringConcat() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Op2.jav"); + // var clazz = classFiles.get("Op2"); + // var instance = clazz.getDeclaredConstructor().newInstance(); + // } + + // @Test + // public void testLamRunnable() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "LamRunnable.jav"); + // var clazz = classFiles.get("LamRunnable"); + // var instance = clazz.getDeclaredConstructor().newInstance(); + // } + + // @Test + // public void testAccess() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Access.jav"); + // var clazzPublic = classFiles.get("Access"); + // var clazzDefault = classFiles.get("AccessDefault"); + + // assertEquals(clazzPublic.getModifiers(), Modifier.PUBLIC); + // assertEquals(clazzDefault.getModifiers(), 0); + + // assertEquals(clazzPublic.getDeclaredMethod("mPublic").getModifiers(), Modifier.PUBLIC); + // assertEquals(clazzPublic.getDeclaredMethod("mProtected").getModifiers(), Modifier.PROTECTED); + // assertEquals(clazzPublic.getDeclaredMethod("mDefault").getModifiers(), 0); + // assertEquals(clazzPublic.getDeclaredMethod("mPrivate").getModifiers(), Modifier.PRIVATE); + + // assertEquals(clazzPublic.getDeclaredField("fPublic").getModifiers(), Modifier.PUBLIC); + // assertEquals(clazzPublic.getDeclaredField("fProtected").getModifiers(), Modifier.PROTECTED); + // assertEquals(clazzPublic.getDeclaredField("fDefault").getModifiers(), 0); + // assertEquals(clazzPublic.getDeclaredField("fPrivate").getModifiers(), Modifier.PRIVATE); + // } + + // @Test + // public void testTypeCast() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "TypeCast.jav"); + // var clazz = classFiles.get("TypeCast"); + // var instance = clazz.getDeclaredConstructor().newInstance(); + // } + + // @Test + // public void testAnnotation() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Annotation.jav"); + // var clazz = classFiles.get("Annotation"); + // var instance = clazz.getDeclaredConstructor().newInstance(); + // } + + // @Test + // public void testWilcards() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Wildcards.jav"); + // var clazz = classFiles.get("Wildcards"); + // var instance = clazz.getDeclaredConstructor().newInstance(); + // } + + + // @Test + // public void testBug122() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Bug122.jav"); + // var clazz = classFiles.get("Bug122"); + // var instance = clazz.getDeclaredConstructor().newInstance(); + // } + + // @Test + // public void testBug123() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Bug123.jav"); + // var clazz = classFiles.get("Bug123"); + // var instance = clazz.getDeclaredConstructor().newInstance(); + // } + + // @Test + // public void testBug125() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Bug125.jav"); + // var clazz = classFiles.get("Bug125"); + // var instance = clazz.getDeclaredConstructor().newInstance(); + // } + + // @Test + // public void testBug112() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Bug112.jav"); + // var clazz = classFiles.get("Bug112"); + // var instance = clazz.getDeclaredConstructor().newInstance(); + // } + + // @Test + // public void testBug285() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Bug285.jav"); + // var clazz = classFiles.get("Bug285"); + // var instance = clazz.getDeclaredConstructor().newInstance(); + // } + + // @Test + // public void testBug290() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Bug290A.jav"); + // var clazz = classFiles.get("Bug290A"); + // var instance = clazz.getDeclaredConstructor().newInstance(); + // } + + // @Test + // public void testBug293() throws Exception { + // var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Bug293.jav"); + // var clazz = classFiles.get("Bug293"); + // var instance = clazz.getDeclaredConstructor().newInstance(); + // } +} diff --git a/tests/targetast/ASTToTypedTargetAST.java b/tests/targetast/ASTToTypedTargetAST.java new file mode 100644 index 0000000..e10b325 --- /dev/null +++ b/tests/targetast/ASTToTypedTargetAST.java @@ -0,0 +1,163 @@ +package targetast; + +import com.google.common.reflect.TypeToken; +import de.dhbwstuttgart.core.JavaTXCompiler; +import de.dhbwstuttgart.environment.ByteArrayClassLoader; +import de.dhbwstuttgart.parser.NullToken; +import de.dhbwstuttgart.parser.scope.JavaClassName; +import de.dhbwstuttgart.syntaxtree.*; +import de.dhbwstuttgart.syntaxtree.type.RefType; +import de.dhbwstuttgart.target.generate.ASTToTargetAST; +import de.dhbwstuttgart.target.tree.TargetStructure; +import de.dhbwstuttgart.typeinference.result.ResultSet; +import org.junit.Ignore; +import org.junit.Test; + +import java.nio.file.Path; +import java.util.*; + +import static org.junit.Assert.*; + +public class ASTToTypedTargetAST { + + @Test + public void emptyClass() { + ClassOrInterface emptyClass = new ClassOrInterface(0, new JavaClassName("EmptyClass"), new ArrayList<>(), Optional.empty(), Optional.empty(), new ArrayList<>(), new ArrayList<>(), new GenericDeclarationList(new ArrayList<>(), new NullToken()), new RefType(new JavaClassName("Object"), new NullToken()), false, false, new ArrayList<>(), new ArrayList<>(), new NullToken(), null); + ResultSet emptyResultSet = new ResultSet(new HashSet<>()); + TargetStructure emptyTargetClass = new ASTToTargetAST(List.of(emptyResultSet)).convert(emptyClass); + assert emptyTargetClass.getName().equals("EmptyClass"); + assert emptyTargetClass.methods().size() == 0; + assert emptyTargetClass.fields().size() == 0; + } + + @Test + public void overloading() throws Exception { + var file = Path.of(System.getProperty("user.dir"), "/resources/bytecode/javFiles/Overloading.jav").toFile(); + var compiler = new JavaTXCompiler(file); + var resultSet = compiler.typeInference(); + var converter = new ASTToTargetAST(compiler, resultSet); + var classes = compiler.sourceFiles.get(file).getClasses(); + + var classLoader = new ByteArrayClassLoader(); + var overloading = TestCodegen.generateClass(converter.convert(classes.get(0)), classLoader); + var overloading2 = TestCodegen.generateClass(converter.convert(classes.get(1)), classLoader); + + var test1 = overloading.getDeclaredMethod("test", overloading); + test1.setAccessible(true); + var test2 = overloading.getDeclaredMethod("test", overloading2); + test2.setAccessible(true); + Object overloadingInstance = overloading.getDeclaredConstructor().newInstance(); + Object overloading2Instance = overloading2.getDeclaredConstructor().newInstance(); + assertEquals(test1.invoke(overloadingInstance, overloadingInstance), "Overloading"); + assertEquals(test2.invoke(overloadingInstance, overloading2Instance), "Overloading2"); + } + + @Test + public void tphsAndGenerics() throws Exception { + var file = Path.of(System.getProperty("user.dir"), "/resources/bytecode/javFiles/Tph2.jav").toFile(); + var compiler = new JavaTXCompiler(file); + var resultSet = compiler.typeInference(); + var converter = new ASTToTargetAST(resultSet); + var classes = compiler.sourceFiles.get(file).getClasses(); + + var tphAndGenerics = TestCodegen.generateClass(converter.convert(classes.get(0)), new ByteArrayClassLoader()); + } + + @Test + public void cycles() throws Exception { + var file = Path.of(System.getProperty("user.dir"), "/resources/bytecode/javFiles/Cycle.jav").toFile(); + var compiler = new JavaTXCompiler(file); + var resultSet = compiler.typeInference(); + var converter = new ASTToTargetAST(resultSet); + var classes = compiler.sourceFiles.get(file).getClasses(); + + var cycle = TestCodegen.generateClass(converter.convert(classes.get(0)), new ByteArrayClassLoader()); + } + + @Test + public void infimum() throws Exception { + var file = Path.of(System.getProperty("user.dir"), "/resources/bytecode/javFiles/Infimum.jav").toFile(); + var compiler = new JavaTXCompiler(file); + var resultSet = compiler.typeInference(); + var converter = new ASTToTargetAST(resultSet); + var classes = compiler.sourceFiles.get(file).getClasses(); + + var infimum = TestCodegen.generateClass(converter.convert(classes.get(0)), new ByteArrayClassLoader()); + } + + @Test + public void gen() throws Exception { + var file = Path.of(System.getProperty("user.dir"), "/resources/bytecode/javFiles/Gen.jav").toFile(); + var compiler = new JavaTXCompiler(file); + var resultSet = compiler.typeInference(); + var converter = new ASTToTargetAST(resultSet); + var classes = compiler.sourceFiles.get(file).getClasses(); + + var generics = TestCodegen.generateClass(converter.convert(classes.get(0)), new ByteArrayClassLoader()); + var m = generics.getDeclaredMethod("m", Vector.class); + var mReturnType = m.getGenericReturnType(); + assertEquals(mReturnType, m.getParameters()[0].getParameterizedType()); + assertEquals(mReturnType, new TypeToken>() { + }.getType()); + } + + @Test + public void definedGenerics() throws Exception { + var file = Path.of(System.getProperty("user.dir"), "/resources/bytecode/javFiles/Generics.jav").toFile(); + var compiler = new JavaTXCompiler(file); + var resultSet = compiler.typeInference(); + var converter = new ASTToTargetAST(compiler, resultSet); + var classes = compiler.sourceFiles.get(file).getClasses(); + + var generics = TestCodegen.generateClass(converter.convert(classes.get(0)), new ByteArrayClassLoader()); + var B = generics.getTypeParameters()[0]; + var mt1 = generics.getDeclaredMethod("mt1", Object.class); + var constructor = generics.getDeclaredConstructor(Object.class); + + assertEquals(B, mt1.getGenericReturnType()); + assertEquals(B, mt1.getParameters()[0].getParameterizedType()); + assertEquals(B, constructor.getParameters()[0].getParameterizedType()); + } + + @Test + public void definedGenerics2() throws Exception { + var file = Path.of(System.getProperty("user.dir"), "/resources/bytecode/javFiles/Generics2.jav").toFile(); + var compiler = new JavaTXCompiler(file); + var resultSet = compiler.typeInference(); + var converter = new ASTToTargetAST(resultSet); + var classes = compiler.sourceFiles.get(file).getClasses(); + + var generics2 = TestCodegen.generateClass(converter.convert(classes.get(0)), new ByteArrayClassLoader()); + assertEquals(generics2.getTypeParameters()[0].getBounds()[0], String.class); + var m = generics2.getDeclaredMethod("m1", Object.class); + assertEquals(m.getTypeParameters()[0].getBounds()[0], Integer.class); + var param = m.getTypeParameters()[0]; + } + + @Test + @Ignore("Not implemented") + public void definedGenerics3() throws Exception { + var file = Path.of(System.getProperty("user.dir"), "/resources/bytecode/javFiles/Generics3.jav").toFile(); + var compiler = new JavaTXCompiler(file); + var resultSet = compiler.typeInference(); + var converter = new ASTToTargetAST(resultSet); + var classes = compiler.sourceFiles.get(file).getClasses(); + + var generics3 = TestCodegen.generateClass(converter.convert(classes.get(0)), new ByteArrayClassLoader()); + } + + @Test + public void definedGenerics4() throws Exception { + var file = Path.of(System.getProperty("user.dir"), "/resources/bytecode/javFiles/Generics4.jav").toFile(); + var compiler = new JavaTXCompiler(file); + var resultSet = compiler.typeInference(); + var converter = new ASTToTargetAST(compiler, resultSet); + var classes = compiler.sourceFiles.get(file).getClasses(); + + var generics4 = TestCodegen.generateClass(converter.convert(classes.get(0)), new ByteArrayClassLoader()); + + // var instance = generics4.getDeclaredConstructor().newInstance(); + // var method = generics4.getDeclaredMethod("m2", Object.class); + // method.invoke(instance, new Object()); + } +} diff --git a/tests/targetast/GreaterEqualTest.java b/tests/targetast/GreaterEqualTest.java new file mode 100644 index 0000000..1edda1d --- /dev/null +++ b/tests/targetast/GreaterEqualTest.java @@ -0,0 +1,135 @@ +package targetast; + +import de.dhbwstuttgart.environment.ByteArrayClassLoader; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +public class GreaterEqualTest { + static Class classToTest; + static Object instance; + + @BeforeClass + public static void beforeClass() throws Exception { + var classFiles = TestCodegen.generateClassFiles(new ByteArrayClassLoader(), "GreaterEqual.jav"); + classToTest = classFiles.get("GreaterEqual"); + instance = classToTest.getDeclaredConstructor().newInstance(); + } + + @Test + public void testIntegers() throws Exception { + Method gE = classToTest.getDeclaredMethod("gE", Integer.class, Integer.class); + gE.setAccessible(true); + Boolean result = (Boolean) gE.invoke(instance, 7, 5); + assertTrue(result); + } + + @Test + public void testIntegers2() throws Exception { + Method gE = classToTest.getDeclaredMethod("gE", Integer.class, Integer.class); + gE.setAccessible(true); + Boolean result = (Boolean) gE.invoke(instance, 5, 7); + assertFalse(result); + } + + @Test + public void testEqIntegers() throws Exception { + Method gE = classToTest.getDeclaredMethod("gE", Integer.class, Integer.class); + gE.setAccessible(true); + Boolean result = (Boolean) gE.invoke(instance, 5, 5); + assertTrue(result); + } + + @Test + public void testLongs() throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { + Method gE = classToTest.getDeclaredMethod("gE", Long.class, Long.class); + gE.setAccessible(true); + Boolean result = (Boolean) gE.invoke(instance, 10L, 7L); + assertTrue(result); + } + + @Test + public void testFloats() throws Exception { + Method gE = classToTest.getDeclaredMethod("gE", Float.class, Float.class); + gE.setAccessible(true); + Boolean result = (Boolean) gE.invoke(instance, 5F, 7F); + assertFalse(result); + } + + @Test + public void testDoubles() throws Exception { + Method gE = classToTest.getDeclaredMethod("gE", Double.class, Double.class); + gE.setAccessible(true); + Boolean result = (Boolean) gE.invoke(instance, 5.0, 7.0); + assertFalse(result); + } + + @Test + public void testLongInt() throws Exception { + Method gE = classToTest.getDeclaredMethod("gE", Long.class, Integer.class); + gE.setAccessible(true); + Boolean result = (Boolean) gE.invoke(instance, 15L, 7); + assertTrue(result); + } + + @Test + public void testFloatInt() throws Exception { + Method gE = classToTest.getDeclaredMethod("gE", Float.class, Integer.class); + gE.setAccessible(true); + Boolean result = (Boolean) gE.invoke(instance, 5F, 7); + assertFalse(result); + } + + @Test + public void testDoubleInt() throws Exception { + Method gE = classToTest.getDeclaredMethod("gE", Double.class, Integer.class); + gE.setAccessible(true); + Boolean result = (Boolean) gE.invoke(instance, 25.0, 17); + assertTrue(result); + } + + @Test + public void testFloatLong() throws Exception { + Method gE = classToTest.getDeclaredMethod("gE", Float.class, Long.class); + gE.setAccessible(true); + Boolean result = (Boolean) gE.invoke(instance, 75F, 70L); + assertTrue(result); + } + + @Test + public void testDoubleLong() throws Exception { + Method gE = classToTest.getDeclaredMethod("gE", Double.class, Long.class); + gE.setAccessible(true); + Boolean result = (Boolean) gE.invoke(instance, 5.0, 7L); + assertFalse(result); + } + + @Test + public void testEqDoubleFloat() throws Exception { + Method gE = classToTest.getDeclaredMethod("gE", Double.class, Float.class); + gE.setAccessible(true); + Boolean result = (Boolean) gE.invoke(instance, 7.0, 7F); + assertTrue(result); + } + + @Test + public void testDoubleFloat() throws Exception { + Method gE = classToTest.getDeclaredMethod("gE", Double.class, Float.class); + gE.setAccessible(true); + Boolean result = (Boolean) gE.invoke(instance, 15.0, 7F); + assertTrue(result); + } + + @Test + public void testDoubleFloat3() throws Exception { + Method gE = classToTest.getDeclaredMethod("gE", Double.class, Float.class); + gE.setAccessible(true); + Boolean result = (Boolean) gE.invoke(instance, 9.0, 17F); + assertFalse(result); + } +} diff --git a/tests/targetast/GreaterThanTest.java b/tests/targetast/GreaterThanTest.java new file mode 100644 index 0000000..4174492 --- /dev/null +++ b/tests/targetast/GreaterThanTest.java @@ -0,0 +1,133 @@ +package targetast; + +import de.dhbwstuttgart.environment.ByteArrayClassLoader; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.lang.reflect.Method; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +public class GreaterThanTest { + static Class classToTest; + static Object instance; + + @BeforeClass + public static void beforeClass() throws Exception { + var classFiles = TestCodegen.generateClassFiles(new ByteArrayClassLoader(), "GreaterThan.jav"); + classToTest = classFiles.get("GreaterThan"); + instance = classToTest.getDeclaredConstructor().newInstance(); + } + + @Test + public void testIntegers() throws Exception { + Method gT = classToTest.getDeclaredMethod("gT", Integer.class, Integer.class); + gT.setAccessible(true); + Boolean result = (Boolean) gT.invoke(instance, 7, 5); + assertTrue(result); + } + + @Test + public void testIntegers2() throws Exception { + Method gT = classToTest.getDeclaredMethod("gT", Integer.class, Integer.class); + gT.setAccessible(true); + Boolean result = (Boolean) gT.invoke(instance, 5, 7); + assertFalse(result); + } + + @Test + public void testEqIntegers() throws Exception { + Method gT = classToTest.getDeclaredMethod("gT", Integer.class, Integer.class); + gT.setAccessible(true); + Boolean result = (Boolean) gT.invoke(instance, 5, 5); + assertFalse(result); + } + + @Test + public void testLongs() throws Exception { + Method gT = classToTest.getDeclaredMethod("gT", Long.class, Long.class); + gT.setAccessible(true); + Boolean result = (Boolean) gT.invoke(instance, 10L,7L); + assertTrue(result); + }@Test + + public void testFloats() throws Exception { + Method gT = classToTest.getDeclaredMethod("gT", Float.class, Float.class); + gT.setAccessible(true); + Boolean result = (Boolean) gT.invoke(instance, 5F,7F); + assertFalse(result); + } + + @Test + public void testDoubles() throws Exception { + Method gT = classToTest.getDeclaredMethod("gT", Double.class, Double.class); + gT.setAccessible(true); + Boolean result = (Boolean) gT.invoke(instance, 5.0,7.0); + assertFalse(result); + } + + @Test + public void testLongInt() throws Exception { + Method gT = classToTest.getDeclaredMethod("gT", Long.class, Integer.class); + gT.setAccessible(true); + Boolean result = (Boolean) gT.invoke(instance, 15L,7); + assertTrue(result); + } + + @Test + public void testFloatInt() throws Exception { + Method gT = classToTest.getDeclaredMethod("gT", Float.class, Integer.class); + gT.setAccessible(true); + Boolean result = (Boolean) gT.invoke(instance, 5F,7); + assertFalse(result); + } + + @Test + public void testDoubleInt() throws Exception { + Method gT = classToTest.getDeclaredMethod("gT", Double.class, Integer.class); + gT.setAccessible(true); + Boolean result = (Boolean) gT.invoke(instance, 25.0,17); + assertTrue(result); + } + + @Test + public void testFloatLong() throws Exception { + Method gT = classToTest.getDeclaredMethod("gT", Float.class, Long.class); + gT.setAccessible(true); + Boolean result = (Boolean) gT.invoke(instance, 75F,70L); + assertTrue(result); + } + + @Test + public void testDoubleLong() throws Exception { + Method gT = classToTest.getDeclaredMethod("gT", Double.class, Long.class); + gT.setAccessible(true); + Boolean result = (Boolean) gT.invoke(instance, 5.0,7L); + assertFalse(result); + } + + @Test + public void testEqDoubleFloat() throws Exception { + Method gT = classToTest.getDeclaredMethod("gT", Double.class, Float.class); + gT.setAccessible(true); + Boolean result = (Boolean) gT.invoke(instance, 7.0,7F); + assertFalse(result); + } + + @Test + public void testDoubleFloat() throws Exception { + Method gT = classToTest.getDeclaredMethod("gT", Double.class, Float.class); + gT.setAccessible(true); + Boolean result = (Boolean) gT.invoke(instance, 15.0,7F); + assertTrue(result); + } + + @Test + public void testDoubleFloat3() throws Exception { + Method gT = classToTest.getDeclaredMethod("gT", Double.class, Float.class); + gT.setAccessible(true); + Boolean result = (Boolean) gT.invoke(instance, 9.0,17F); + assertFalse(result); + } +} diff --git a/tests/targetast/InheritTest.java b/tests/targetast/InheritTest.java new file mode 100644 index 0000000..9a8de6f --- /dev/null +++ b/tests/targetast/InheritTest.java @@ -0,0 +1,105 @@ +package targetast; + +import de.dhbwstuttgart.environment.ByteArrayClassLoader; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.lang.reflect.Method; +import java.nio.file.Path; +import java.util.Vector; + +import static org.junit.Assert.assertEquals; + +public class InheritTest { + private static Class classToTest, classToTestAA, classToTestBB, classToTestCC, classToTestDD; + private static Object instanceOfClass, instanceOfClassAA, instanceOfClassBB, instanceOfClassCC, instanceOfClassDD; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + var classLoader = new ByteArrayClassLoader(); + + classToTestAA = TestCodegen.generateClassFiles(classLoader, "AA.jav").get("AA"); + classToTestBB = TestCodegen.generateClassFiles(classLoader, "BB.jav").get("BB"); + classToTestCC = TestCodegen.generateClassFiles(classLoader, "CC.jav").get("CC"); + classToTestDD = TestCodegen.generateClassFiles(classLoader, "DD.jav").get("DD"); + classToTest = TestCodegen.generateClassFiles(classLoader, "Inherit.jav").get("Inherit"); + + instanceOfClass = classToTest.getDeclaredConstructor().newInstance(); + instanceOfClassAA = classToTestAA.getDeclaredConstructor().newInstance(); + instanceOfClassBB = classToTestBB.getDeclaredConstructor().newInstance(); + instanceOfClassCC = classToTestCC.getDeclaredConstructor().newInstance(); + instanceOfClassDD = classToTestDD.getDeclaredConstructor().newInstance(); + } + + @Test + public void testmainAA() throws Exception { + Method m = classToTestAA.getDeclaredMethod("m", Integer.class); + assertEquals(m.invoke(instanceOfClassAA, 5), "AA"); + Method main = classToTest.getDeclaredMethod("main", classToTestAA, Integer.class); + assertEquals(main.invoke(instanceOfClass, instanceOfClassAA, 5), "AA"); + } + + @Test + public void testmainBB() throws Exception { + Method m = classToTestAA.getDeclaredMethod("m", Integer.class); + assertEquals(m.invoke(instanceOfClassBB, 5), "AA"); + Method main = classToTest.getDeclaredMethod("main", classToTestAA, Integer.class); + assertEquals(main.invoke(instanceOfClass, instanceOfClassBB, 5), "AA"); + } + + @Test + public void testmainCC() throws Exception { + Method m = classToTestCC.getDeclaredMethod("m", Integer.class); + assertEquals(m.invoke(instanceOfClassCC, 5), "CC"); + Method main = classToTest.getDeclaredMethod("main", classToTestCC, Integer.class); + assertEquals(main.invoke(instanceOfClass, instanceOfClassCC, 5), "CC"); + } + + @Test + public void testmainDD() throws Exception { + Method m = classToTestCC.getDeclaredMethod("m", Integer.class); + assertEquals(m.invoke(instanceOfClassDD, 5), "CC"); + Method main = classToTest.getDeclaredMethod("main", classToTestCC, Integer.class); + assertEquals(main.invoke(instanceOfClass, instanceOfClassDD, 5), "CC"); + } + + @Test + public void testmainVectorAA() throws Exception { + Method m = classToTestAA.getDeclaredMethod("m", Integer.class); + assertEquals(m.invoke(instanceOfClassAA, 5), "AA"); + Vector v = new Vector<>(); + v.add(instanceOfClassAA); + Method main = classToTest.getDeclaredMethod("main", Vector.class, Integer.class); + assertEquals(main.invoke(instanceOfClass, v, 5), "AA"); + } + + @Test + public void testmainVectorBB() throws Exception { + Method m = classToTestAA.getDeclaredMethod("m", Integer.class); + assertEquals(m.invoke(instanceOfClassBB, 5), "AA"); + Vector v = new Vector<>(); + v.add(instanceOfClassBB); + Method main = classToTest.getDeclaredMethod("main", Vector.class, Integer.class); + assertEquals(main.invoke(instanceOfClass, v, 5), "AA"); + } + + @Test + public void testmainVectorCC() throws Exception { + Method m = classToTestCC.getDeclaredMethod("m", Integer.class); + assertEquals(m.invoke(instanceOfClassCC, 5), "CC"); + Vector v = new Vector<>(); + v.add(instanceOfClassCC); + Method main = classToTest.getDeclaredMethod("main", Vector.class, Integer.class); + assertEquals(main.invoke(instanceOfClass, v, 5), "CC"); + } + + @Test + public void testmainVectorDD() throws Exception { + Method m = classToTestCC.getDeclaredMethod("m", Integer.class); + assertEquals(m.invoke(instanceOfClassDD, 5), "CC"); + Vector v = new Vector<>(); + v.add(instanceOfClassDD); + Method main = classToTest.getDeclaredMethod("main", Vector.class, Integer.class); + assertEquals(main.invoke(instanceOfClass, v, 5), "CC"); + } +} diff --git a/tests/targetast/InheritTest2.java b/tests/targetast/InheritTest2.java new file mode 100644 index 0000000..1f7a0f0 --- /dev/null +++ b/tests/targetast/InheritTest2.java @@ -0,0 +1,121 @@ +package targetast; + +import de.dhbwstuttgart.environment.ByteArrayClassLoader; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; + +import java.lang.reflect.Method; +import java.util.Vector; + +import static org.junit.Assert.assertEquals; + +@Ignore("FIXME") +public class InheritTest2 { + private static Class classToTest, classToTestAA, classToTestBB, classToTestCC, classToTestDD; + private static Object instanceOfClass, instanceOfClassAA, instanceOfClassBB, instanceOfClassCC, instanceOfClassDD; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + var classLoader = new ByteArrayClassLoader(); + classToTest = TestCodegen.generateClassFiles(classLoader, "Inherit2.jav").get("Inherit2"); + classToTestAA = TestCodegen.generateClassFiles(classLoader, "AA.jav").get("AA"); + classToTestBB = TestCodegen.generateClassFiles(classLoader, "BB.jav").get("BB"); + classToTestCC = TestCodegen.generateClassFiles(classLoader, "CC.jav").get("CC"); + classToTestDD = TestCodegen.generateClassFiles(classLoader,"DD.jav").get("DD"); + + instanceOfClass = classToTest.getDeclaredConstructor().newInstance(); + instanceOfClassAA = classToTestAA.getDeclaredConstructor().newInstance(); + instanceOfClassBB = classToTestBB.getDeclaredConstructor().newInstance(); + instanceOfClassCC = classToTestCC.getDeclaredConstructor().newInstance(); + instanceOfClassDD = classToTestDD.getDeclaredConstructor().newInstance(); + } + + @Test + public void testmainAA() throws Exception { + Method m2 = classToTestAA.getDeclaredMethod("m2", classToTestAA); + assertEquals(m2.invoke(instanceOfClassAA, instanceOfClassAA), "AA"); + Method main = classToTest.getDeclaredMethod("main", classToTestAA); + assertEquals(main.invoke(instanceOfClass, instanceOfClassAA), "AA"); + } + + @Test + public void testmainBB() throws Exception { + Method m2 = classToTestAA.getDeclaredMethod("m2", classToTestAA); + assertEquals(m2.invoke(instanceOfClassAA, instanceOfClassAA), "AA"); + Method main = classToTest.getDeclaredMethod("main", classToTestAA); + assertEquals(main.invoke(instanceOfClass, instanceOfClassBB), "AA"); + } + + @Test + public void testmainCC() throws Exception { + Method m2 = classToTestCC.getDeclaredMethod("m2", classToTestCC); + assertEquals(m2.invoke(instanceOfClassCC, instanceOfClassCC), "CC"); + Method main = classToTest.getDeclaredMethod("main", classToTestCC); + assertEquals(main.invoke(instanceOfClass, instanceOfClassCC), "CC"); + } + + @Test + public void testmainDD() throws Exception { + Method m2 = classToTestCC.getDeclaredMethod("m2", classToTestCC); + assertEquals(m2.invoke(instanceOfClassCC, instanceOfClassCC), "CC"); + Method main = classToTest.getDeclaredMethod("main", classToTestCC); + assertEquals(main.invoke(instanceOfClass, instanceOfClassDD), "CC"); + } + + + //PL 2020-05-12: Die folgenden Test funktionieren erst, wenn Generics im Bytecode implementiert sind + @Test + public void testmainVectorAA() throws Exception { + Method m2 = classToTestAA.getDeclaredMethod("m2", classToTestAA); + assertEquals(m2.invoke(instanceOfClassAA, instanceOfClassAA), "AA"); + Vector v = new Vector<>(); + v.add(instanceOfClassAA); + Method main = classToTest.getDeclaredMethod("main", Vector.class); + try { + assertEquals(main.invoke(instanceOfClass, v), "AA"); + } + catch (java.lang.reflect.InvocationTargetException e) { + testmainVectorCC(); + } + } + + @Test + public void testmainVectorBB() throws Exception { + Method m2 = classToTestAA.getDeclaredMethod("m2", classToTestAA); + assertEquals(m2.invoke(instanceOfClassAA, instanceOfClassAA), "AA"); + Vector v = new Vector<>(); + v.add(instanceOfClassBB); + Method main = classToTest.getDeclaredMethod("main", Vector.class); + try { + assertEquals(main.invoke(instanceOfClass, v), "AA"); + } + catch (java.lang.reflect.InvocationTargetException e) { + testmainVectorCC(); + } + } + + @Test + public void testmainVectorCC() throws Exception { + Method m2 = classToTestCC.getDeclaredMethod("m2", classToTestCC); + assertEquals(m2.invoke(instanceOfClassCC, instanceOfClassCC), "CC"); + Vector v = new Vector<>(); + v.add(instanceOfClassCC); + Method main = classToTest.getDeclaredMethod("main", Vector.class); + String erg; + assertEquals(erg= (String) main.invoke(instanceOfClass, v), + erg.equals("CC")? "CC": "AA"); + } + + @Test + public void testmainVectorDD() throws Exception { + Method m2 = classToTestCC.getDeclaredMethod("m2", classToTestCC); + assertEquals(m2.invoke(instanceOfClassCC, instanceOfClassCC), "CC"); + Vector v = new Vector<>(); + v.add(instanceOfClassDD); + Method main = classToTest.getDeclaredMethod("main", Vector.class); + String erg; + assertEquals(erg= (String) main.invoke(instanceOfClass, v), + erg.equals("CC")? "CC": "AA"); + } +} diff --git a/tests/targetast/LessEqualTest.java b/tests/targetast/LessEqualTest.java new file mode 100644 index 0000000..bb1fe88 --- /dev/null +++ b/tests/targetast/LessEqualTest.java @@ -0,0 +1,112 @@ +package targetast; + +import de.dhbwstuttgart.environment.ByteArrayClassLoader; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.lang.reflect.Method; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +public class LessEqualTest { + static Class classToTest; + static Object instance; + + @BeforeClass + public static void beforeClass() throws Exception { + var classFiles = TestCodegen.generateClassFiles(new ByteArrayClassLoader(), "LessEqual.jav"); + classToTest = classFiles.get("LessEqual"); + instance = classToTest.getDeclaredConstructor().newInstance(); + } + + @Test + public void testIntegers() throws Exception { + Method lessEqual = classToTest.getDeclaredMethod("lessEqual", Integer.class, Integer.class); + Boolean result = (Boolean) lessEqual.invoke(instance, 5,7); + assertTrue(result); + } + + @Test + public void testEqualIntegers() throws Exception { + Method lessEqual = classToTest.getDeclaredMethod("lessEqual", Integer.class, Integer.class); + Boolean result = (Boolean) lessEqual.invoke(instance, 5,5); + assertTrue(result); + } + + @Test + public void testLongs() throws Exception { + Method lessEqual = classToTest.getDeclaredMethod("lessEqual", Long.class, Long.class); + Boolean result = (Boolean) lessEqual.invoke(instance, 5L,7L); + assertTrue(result); + }@Test + + public void testFloats() throws Exception { + Method lessEqual = classToTest.getDeclaredMethod("lessEqual", Float.class, Float.class); + Boolean result = (Boolean) lessEqual.invoke(instance, 5F,7F); + assertTrue(result); + } + + @Test + public void testDoubles() throws Exception { + Method lessEqual = classToTest.getDeclaredMethod("lessEqual", Double.class, Double.class); + Boolean result = (Boolean) lessEqual.invoke(instance, 5.0,7.0); + assertTrue(result); + } + + @Test + public void testLongInt() throws Exception { + Method lessEqual = classToTest.getDeclaredMethod("lessEqual", Long.class, Integer.class); + Boolean result = (Boolean) lessEqual.invoke(instance, 5L,7); + assertTrue(result); + } + + @Test + public void testFloatInt() throws Exception { + Method lessEqual = classToTest.getDeclaredMethod("lessEqual", Float.class, Integer.class); + Boolean result = (Boolean) lessEqual.invoke(instance, 5F,7); + assertTrue(result); + } + + @Test + public void testDoubleInt() throws Exception { + Method lessEqual = classToTest.getDeclaredMethod("lessEqual", Double.class, Integer.class); + Boolean result = (Boolean) lessEqual.invoke(instance, 5.0,7); + assertTrue(result); + } + + @Test + public void testFloatLong() throws Exception { + Method lessEqual = classToTest.getDeclaredMethod("lessEqual", Float.class, Long.class); + Boolean result = (Boolean) lessEqual.invoke(instance, 5F,7L); + assertTrue(result); + } + + @Test + public void testDoubleLong() throws Exception { + Method lessEqual = classToTest.getDeclaredMethod("lessEqual", Double.class, Long.class); + Boolean result = (Boolean) lessEqual.invoke(instance, 5.0,7L); + assertTrue(result); + } + + @Test + public void testEqDoubleFloat() throws Exception { + Method lessEqual = classToTest.getDeclaredMethod("lessEqual", Double.class, Float.class); + Boolean result = (Boolean) lessEqual.invoke(instance, 7.0,7F); + assertTrue(result); + } + + @Test + public void testDoubleFloat() throws Exception { + Method lessEqual = classToTest.getDeclaredMethod("lessEqual", Double.class, Float.class); + Boolean result = (Boolean) lessEqual.invoke(instance, 5.0,7F); + assertTrue(result); + } + + @Test + public void testDoubleFloat3() throws Exception { + Method lessEqual = classToTest.getDeclaredMethod("lessEqual", Double.class, Float.class); + Boolean result = (Boolean) lessEqual.invoke(instance, 9.0,7F); + assertFalse(result); + } +} diff --git a/tests/targetast/LessThanTest.java b/tests/targetast/LessThanTest.java new file mode 100644 index 0000000..75eeb1b --- /dev/null +++ b/tests/targetast/LessThanTest.java @@ -0,0 +1,120 @@ +package targetast; + +import de.dhbwstuttgart.environment.ByteArrayClassLoader; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.lang.reflect.Method; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +public class LessThanTest { + static Class classToTest; + static Object instance; + + @BeforeClass + public static void beforeClass() throws Exception { + var classFiles = TestCodegen.generateClassFiles(new ByteArrayClassLoader(), "LessThan.jav"); + classToTest = classFiles.get("LessThan"); + instance = classToTest.getDeclaredConstructor().newInstance(); + } + + @Test + public void testLessThanInt() throws Exception { + Method lessThan = classToTest.getDeclaredMethod("lessThan", Integer.class,Integer.class); + Boolean result = (Boolean) lessThan.invoke(instance, 5, 7); + assertTrue(result); + } + + @Test + public void testLessThanInt2() throws Exception { + Method lessThan = classToTest.getDeclaredMethod("lessThan", Integer.class, Integer.class); + Boolean result = (Boolean) lessThan.invoke(instance, 7, 5); + assertFalse(result); + } + + @Test + public void testLessThanInt3() throws Exception { + Method lessThan = classToTest.getDeclaredMethod("lessThan", Integer.class, Integer.class); + Boolean result = (Boolean) lessThan.invoke(instance, 5, 5); + assertFalse(result); + } + + @Test + public void testLessThanLong() throws Exception { + Method lessThan = classToTest.getDeclaredMethod("lessThan", Long.class,Long.class); + Boolean result = (Boolean) lessThan.invoke(instance, 5L, 7L); + assertTrue(result); + } + + @Test + public void testLessThanLong2() throws Exception { + Method lessThan = classToTest.getDeclaredMethod("lessThan", Long.class, Long.class); + Boolean result = (Boolean) lessThan.invoke(instance, 7L, 5L); + assertFalse(result); + } + + @Test + public void testLessThanLong3() throws Exception { + Method lessThan = classToTest.getDeclaredMethod("lessThan", Long.class, Long.class); + Boolean result = (Boolean) lessThan.invoke(instance, 5L, 5L); + assertFalse(result); + } + + @Test + public void testLessThanFloat() throws Exception { + Method lessThan = classToTest.getDeclaredMethod("lessThan", Float.class, Float.class); + Boolean result = (Boolean) lessThan.invoke(instance, 7F, 5F); + assertFalse(result); + } + + @Test + public void testLessThanDouble() throws Exception { + Method lessThan = classToTest.getDeclaredMethod("lessThan", Double.class, Double.class); + Boolean result = (Boolean) lessThan.invoke(instance, 7.0, 5.0); + assertFalse(result); + } + + @Test + public void testLessThanLongInt() throws Exception { + Method lessThan = classToTest.getDeclaredMethod("lessThan", Long.class, Integer.class); + Boolean result = (Boolean) lessThan.invoke(instance, 7L, 5); + assertFalse(result); + } + + @Test + public void testLessThanFloatInt() throws Exception { + Method lessThan = classToTest.getDeclaredMethod("lessThan", Float.class, Integer.class); + Boolean result = (Boolean) lessThan.invoke(instance, 7F, 5); + assertFalse(result); + } + + @Test + public void testLessThanDoubleInt() throws Exception { + Method lessThan = classToTest.getDeclaredMethod("lessThan", Double.class, Integer.class); + Boolean result = (Boolean) lessThan.invoke(instance, 7.0, 5); + assertFalse(result); + } + + @Test + public void testLessThanFloatLong() throws Exception { + Method lessThan = classToTest.getDeclaredMethod("lessThan", Float.class, Long.class); + Boolean result = (Boolean) lessThan.invoke(instance, 7F, 5L); + assertFalse(result); + } + + @Test + public void testLessThanDoubleLong() throws Exception { + Method lessThan = classToTest.getDeclaredMethod("lessThan", Double.class, Long.class); + Boolean result = (Boolean) lessThan.invoke(instance, 7.0, 5L); + assertFalse(result); + } + + @Test + public void testLessThanDoubleFloat() throws Exception { + Method lessThan = classToTest.getDeclaredMethod("lessThan", Double.class, Float.class); + Boolean result = (Boolean) lessThan.invoke(instance, 7.0, 5F); + assertFalse(result); + } +} diff --git a/tests/targetast/OLTest.java b/tests/targetast/OLTest.java new file mode 100644 index 0000000..44f7241 --- /dev/null +++ b/tests/targetast/OLTest.java @@ -0,0 +1,72 @@ +package targetast; + +import de.dhbwstuttgart.environment.ByteArrayClassLoader; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.lang.reflect.Method; + +import static org.junit.Assert.assertEquals; + +public class OLTest { + private static Class classToTest; + private static Class classToTest1; + private static Object instanceOfClass; + private static Object instanceOfClass1; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + var classFiles = TestCodegen.generateClassFiles(new ByteArrayClassLoader(), "OL.jav"); + classToTest = classFiles.get("OL"); + instanceOfClass = classToTest.getDeclaredConstructor().newInstance(); + classToTest1 = classFiles.get("OLMain"); + instanceOfClass1 = classToTest1.getDeclaredConstructor().newInstance(); + } + + @Test + public void testmInt() throws Exception { + Method m = classToTest.getDeclaredMethod("m", Integer.class); + Integer result = (Integer) m.invoke(instanceOfClass, 5); + assertEquals(new Integer(10), result); + } + + @Test + public void testmDouble() throws Exception { + Method m = classToTest.getDeclaredMethod("m", Double.class); + Double result = (Double) m.invoke(instanceOfClass, 5.0); + assertEquals(new Double(10.0), result); + } + + @Test + public void testmString() throws Exception { + Method m = classToTest.getDeclaredMethod("m", String.class); + String result = (String) m.invoke(instanceOfClass, "xxx"); + assertEquals("xxxxxx", result); + } + + @Test + public void testOLMainClassName() { + assertEquals("OLMain", classToTest1.getName()); + } + + @Test + public void testmainInt() throws Exception { + Method main = classToTest1.getDeclaredMethod("main", Integer.class); + Integer result = (Integer) main.invoke(instanceOfClass1, 5); + assertEquals(Integer.valueOf(10), result); + } + + @Test + public void testmainDouble() throws Exception { + Method main = classToTest1.getDeclaredMethod("main", Double.class); + Double result = (Double) main.invoke(instanceOfClass1, 5.0); + assertEquals(Double.valueOf(10.0), result); + } + + @Test + public void testmainString() throws Exception { + Method main = classToTest1.getDeclaredMethod("main", String.class); + String result = (String) main.invoke(instanceOfClass1, "xxx"); + assertEquals("xxxxxx", result); + } +} diff --git a/tests/targetast/PostIncTest.java b/tests/targetast/PostIncTest.java new file mode 100644 index 0000000..98fafc8 --- /dev/null +++ b/tests/targetast/PostIncTest.java @@ -0,0 +1,50 @@ +package targetast; + +import de.dhbwstuttgart.environment.ByteArrayClassLoader; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.lang.reflect.Method; + +import static org.junit.Assert.assertEquals; + +public class PostIncTest { + private static Class classToTest; + private static Object instanceOfClass; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + var classFiles = TestCodegen.generateClassFiles(new ByteArrayClassLoader(), "PostIncDec.jav"); + classToTest = classFiles.get("PostIncDec"); + instanceOfClass = classToTest.getDeclaredConstructor().newInstance(); + } + + @Test + public void testM1() throws Exception { + Method m = classToTest.getDeclaredMethod("m"); + Integer res = (Integer) m.invoke(instanceOfClass); + assertEquals(Integer.valueOf(1), res); + } + + @Test + public void testM2() throws Exception { + Method m = classToTest.getDeclaredMethod("m2"); + Integer res = (Integer) m.invoke(instanceOfClass); + assertEquals(Integer.valueOf(0), res); + } + + @Test + public void testD1() throws Exception { + Method m = classToTest.getDeclaredMethod("d"); + Integer res = (Integer) m.invoke(instanceOfClass); + assertEquals(Integer.valueOf(-1), res); + } + + @Test + public void testD2() throws Exception { + Method m = classToTest.getDeclaredMethod("d2"); + Integer res = (Integer) m.invoke(instanceOfClass); + assertEquals(Integer.valueOf(0), res); + } + +} diff --git a/tests/targetast/PreIncTest.java b/tests/targetast/PreIncTest.java new file mode 100644 index 0000000..8c23ea8 --- /dev/null +++ b/tests/targetast/PreIncTest.java @@ -0,0 +1,50 @@ +package targetast; + +import de.dhbwstuttgart.environment.ByteArrayClassLoader; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.lang.reflect.Method; + +import static org.junit.Assert.assertEquals; + +public class PreIncTest { + private static Class classToTest; + private static Object instanceOfClass; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + var classFiles = TestCodegen.generateClassFiles(new ByteArrayClassLoader(), "PreInc.jav"); + classToTest = classFiles.get("PreInc"); + instanceOfClass = classToTest.getDeclaredConstructor().newInstance(); + } + + @Test + public void testM() throws Exception { + Method m = classToTest.getDeclaredMethod("m"); + Integer res = (Integer) m.invoke(instanceOfClass); + assertEquals(Integer.valueOf(1), res); + } + + @Test + public void testM2() throws Exception { + Method m = classToTest.getDeclaredMethod("m2"); + Integer res = (Integer) m.invoke(instanceOfClass); + assertEquals(Integer.valueOf(1), res); + } + + @Test + public void testD() throws Exception { + Method m = classToTest.getDeclaredMethod("d"); + Integer res = (Integer) m.invoke(instanceOfClass); + assertEquals(Integer.valueOf(-1), res); + } + + @Test + public void testD2() throws Exception { + Method m = classToTest.getDeclaredMethod("d2"); + Integer res = (Integer) m.invoke(instanceOfClass); + assertEquals(Integer.valueOf(-1), res); + } + +} diff --git a/tests/targetast/PutTest.java b/tests/targetast/PutTest.java new file mode 100644 index 0000000..8a4b881 --- /dev/null +++ b/tests/targetast/PutTest.java @@ -0,0 +1,59 @@ +package targetast; + +import de.dhbwstuttgart.environment.ByteArrayClassLoader; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.lang.reflect.Method; +import java.util.Stack; +import java.util.Vector; + +import static org.junit.Assert.assertEquals; + +public class PutTest { + private static Class classToTest; + private static Object instanceOfClass; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + var classFiles = TestCodegen.generateClassFiles(new ByteArrayClassLoader(), "Put.jav"); + classToTest = classFiles.get("Put"); + instanceOfClass = classToTest.getDeclaredConstructor().newInstance(); + } + + @Test + public void testPutElementVector() throws Exception { + Method m = classToTest.getDeclaredMethod("putElement", Object.class, Vector.class); + Vector v_invoke = new Vector<>(); + m.invoke(instanceOfClass, 5, v_invoke); + Vector v = new Vector<>(); + v.add(5); + assertEquals(v, v_invoke); + } + + @Test + public void testPutElementStack() throws Exception { + Method m = classToTest.getDeclaredMethod("putElement", Object.class, Stack.class); + Stack s_invoke = new Stack<>(); + m.invoke(instanceOfClass, 5, s_invoke); + assertEquals(new Integer(5), s_invoke.pop()); + } + + @Test + public void testMainVector() throws Exception { + Method m = classToTest.getDeclaredMethod("main", Object.class, Vector.class); + Vector v_invoke = new Vector<>(); + m.invoke(instanceOfClass, 6, v_invoke); + Vector v = new Vector<>(); + v.add(6); + assertEquals(v, v_invoke); + } + + @Test + public void testMainStack() throws Exception { + Method m = classToTest.getDeclaredMethod("main", Object.class, Stack.class); + Stack s_invoke = new Stack<>(); + m.invoke(instanceOfClass, 6, s_invoke); + assertEquals(new Integer(6), s_invoke.pop()); + } +} diff --git a/tests/targetast/TestCodegen.java b/tests/targetast/TestCodegen.java new file mode 100644 index 0000000..7e82bf9 --- /dev/null +++ b/tests/targetast/TestCodegen.java @@ -0,0 +1,279 @@ +package targetast; + +import de.dhbwstuttgart.core.JavaTXCompiler; +import de.dhbwstuttgart.bytecode.Codegen; +import de.dhbwstuttgart.environment.ByteArrayClassLoader; +import de.dhbwstuttgart.environment.IByteArrayClassLoader; +import de.dhbwstuttgart.parser.scope.JavaClassName; +import de.dhbwstuttgart.target.generate.ASTToTargetAST; +import de.dhbwstuttgart.target.tree.MethodParameter; +import de.dhbwstuttgart.target.tree.TargetClass; +import de.dhbwstuttgart.target.tree.TargetStructure; +import de.dhbwstuttgart.target.tree.expression.*; +import de.dhbwstuttgart.target.tree.type.TargetFunNType; +import de.dhbwstuttgart.target.tree.type.TargetRefType; +import de.dhbwstuttgart.target.tree.type.TargetType; +import org.junit.Ignore; +import org.junit.Test; + +import static org.junit.Assert.*; + +import org.objectweb.asm.Opcodes; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; + +public class TestCodegen { + static final Path outputPath = Path.of(System.getProperty("user.dir"), "/targetTest"); + + private static void writeClassFile(String name, byte[] code) throws IOException { + Files.createDirectories(outputPath); + Files.write(outputPath.resolve(name + ".class"), code); + } + + public static Map> generateClassFiles(IByteArrayClassLoader classLoader, String... files) throws IOException, ClassNotFoundException { + var path = Path.of(System.getProperty("user.dir"), "resources/bytecode/javFiles/"); + Files.createDirectories(outputPath); + var filenames = Arrays.stream(files).map(filename -> Path.of(path.toString(), filename).toFile()).toList(); + var compiler = new JavaTXCompiler(filenames, List.of(path.toFile(), outputPath.toFile())); + var resultSet = compiler.typeInference(); + + var result = new HashMap>(); + for (var file : filenames) { + var sourceFile = compiler.sourceFiles.get(file); + var converter = new ASTToTargetAST(compiler, resultSet, sourceFile, classLoader); + var classes = compiler.sourceFiles.get(file).getClasses(); + + result.putAll(classes.stream().map(cli -> { + try { + return generateClass(converter.convert(cli), classLoader, compiler); + } catch (IOException exception) { + throw new RuntimeException(exception); + } + }).collect(Collectors.toMap(Class::getName, Function.identity()))); + + for (var entry : converter.auxiliaries.entrySet()) { + writeClassFile(entry.getKey(), entry.getValue()); + } + } + + return result; + } + + public static Class generateClass(TargetStructure clazz, IByteArrayClassLoader classLoader) throws IOException, ClassNotFoundException { + Codegen codegen = new Codegen(clazz, new JavaTXCompiler(List.of())); + var code = codegen.generate(); + writeClassFile(clazz.qualifiedName().getClassName(), code); + return classLoader.loadClass(code); + } + + public static Class generateClass(TargetStructure clazz, IByteArrayClassLoader classLoader, JavaTXCompiler compiler) throws IOException { + Codegen codegen = new Codegen(clazz, compiler); + var code = codegen.generate(); + writeClassFile(clazz.qualifiedName().getClassName(), code); + return classLoader.loadClass(code); + } + + public static Map> generateClassFiles(String filename, IByteArrayClassLoader classLoader) throws IOException, ClassNotFoundException { + var file = Path.of(System.getProperty("user.dir"), "/resources/bytecode/javFiles/", filename).toFile(); + var compiler = new JavaTXCompiler(List.of(file), List.of(file.getParentFile())); + var resultSet = compiler.typeInference(); + + var sourceFile = compiler.sourceFiles.get(file); + var converter = new ASTToTargetAST(compiler, resultSet, sourceFile, classLoader); + var classes = compiler.sourceFiles.get(file).getClasses(); + + var result = classes.stream().map(cli -> { + try { + return generateClass(converter.convert(cli), classLoader, compiler); + } catch (IOException exception) { + throw new RuntimeException(exception); + } + }).collect(Collectors.toMap(Class::getName, Function.identity())); + + for (var entry : converter.auxiliaries.entrySet()) { + writeClassFile(entry.getKey(), entry.getValue()); + } + + return result; + } + + @Test + public void testEmptyClass() throws Exception { + var clazz = new TargetClass(Opcodes.ACC_PUBLIC, new JavaClassName("Empty")); + clazz.addMethod(Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC, "main", List.of(), null, new TargetBlock(List.of())); + generateClass(clazz, new ByteArrayClassLoader()).getDeclaredMethod("main").invoke(null); + } + + @Test + public void testArithmetic() throws Exception { + var targetClass = new TargetClass(Opcodes.ACC_PUBLIC, new JavaClassName("Arithmetic")); + + targetClass.addMethod(Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC, "add", List.of(new MethodParameter(TargetType.Integer, "a"), new MethodParameter(TargetType.Integer, "b")), TargetType.Integer, new TargetBlock(List.of(new TargetReturn(new TargetBinaryOp.Add(TargetType.Integer, new TargetLocalVar(TargetType.Integer, "a"), new TargetLocalVar(TargetType.Integer, "b")))))); + targetClass.addMethod(Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC, "sub", List.of(new MethodParameter(TargetType.Integer, "a"), new MethodParameter(TargetType.Integer, "b")), TargetType.Integer, new TargetBlock(List.of(new TargetReturn(new TargetBinaryOp.Sub(TargetType.Integer, new TargetLocalVar(TargetType.Integer, "a"), new TargetLocalVar(TargetType.Integer, "b")))))); + targetClass.addMethod(Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC, "div", List.of(new MethodParameter(TargetType.Integer, "a"), new MethodParameter(TargetType.Integer, "b")), TargetType.Integer, new TargetBlock(List.of(new TargetReturn(new TargetBinaryOp.Div(TargetType.Integer, new TargetLocalVar(TargetType.Integer, "a"), new TargetLocalVar(TargetType.Integer, "b")))))); + targetClass.addMethod(Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC, "mul", List.of(new MethodParameter(TargetType.Integer, "a"), new MethodParameter(TargetType.Integer, "b")), TargetType.Integer, new TargetBlock(List.of(new TargetReturn(new TargetBinaryOp.Mul(TargetType.Integer, new TargetLocalVar(TargetType.Integer, "a"), new TargetLocalVar(TargetType.Integer, "b")))))); + targetClass.addMethod(Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC, "rem", List.of(new MethodParameter(TargetType.Integer, "a"), new MethodParameter(TargetType.Integer, "b")), TargetType.Integer, new TargetBlock(List.of(new TargetReturn(new TargetBinaryOp.Rem(TargetType.Integer, new TargetLocalVar(TargetType.Integer, "a"), new TargetLocalVar(TargetType.Integer, "b")))))); + + var clazz = generateClass(targetClass, new ByteArrayClassLoader()); + assertEquals(clazz.getDeclaredMethod("add", Integer.class, Integer.class).invoke(null, 10, 10), 20); + assertEquals(clazz.getDeclaredMethod("sub", Integer.class, Integer.class).invoke(null, 20, 10), 10); + assertEquals(clazz.getDeclaredMethod("div", Integer.class, Integer.class).invoke(null, 20, 10), 2); + assertEquals(clazz.getDeclaredMethod("mul", Integer.class, Integer.class).invoke(null, 20, 10), 200); + assertEquals(clazz.getDeclaredMethod("rem", Integer.class, Integer.class).invoke(null, 10, 3), 1); + } + + @Test + public void testUnary() throws Exception { + var targetClass = new TargetClass(Opcodes.ACC_PUBLIC, new JavaClassName("Unary")); + + targetClass.addMethod(Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC, "not", List.of(new MethodParameter(TargetType.Integer, "a")), TargetType.Integer, new TargetBlock(List.of(new TargetReturn(new TargetUnaryOp.Not(TargetType.Integer, new TargetLocalVar(TargetType.Integer, "a")))))); + targetClass.addMethod(Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC, "neg", List.of(new MethodParameter(TargetType.Integer, "a")), TargetType.Integer, new TargetBlock(List.of(new TargetReturn(new TargetUnaryOp.Negate(TargetType.Integer, new TargetLocalVar(TargetType.Integer, "a")))))); + targetClass.addMethod(Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC, "add", List.of(new MethodParameter(TargetType.Integer, "a")), TargetType.Integer, new TargetBlock(List.of(new TargetReturn(new TargetUnaryOp.Add(TargetType.Integer, new TargetLocalVar(TargetType.Integer, "a")))))); + + var clazz = generateClass(targetClass, new ByteArrayClassLoader()); + assertEquals(clazz.getDeclaredMethod("not", Integer.class).invoke(null, 10), -11); + assertEquals(clazz.getDeclaredMethod("neg", Integer.class).invoke(null, 10), -10); + assertEquals(clazz.getDeclaredMethod("add", Integer.class).invoke(null, 10), 10); + + } + + @Test + public void testConditional() throws Exception { + var targetClass = new TargetClass(Opcodes.ACC_PUBLIC, new JavaClassName("Conditional")); + + targetClass.addMethod(Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC, "and", List.of(new MethodParameter(TargetType.Boolean, "a"), new MethodParameter(TargetType.Boolean, "b")), TargetType.Boolean, new TargetBlock(List.of(new TargetReturn(new TargetBinaryOp.And(TargetType.Boolean, new TargetLocalVar(TargetType.Boolean, "a"), new TargetLocalVar(TargetType.Boolean, "b")))))); + targetClass.addMethod(Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC, "or", List.of(new MethodParameter(TargetType.Boolean, "a"), new MethodParameter(TargetType.Boolean, "b")), TargetType.Boolean, new TargetBlock(List.of(new TargetReturn(new TargetBinaryOp.Or(TargetType.Boolean, new TargetLocalVar(TargetType.Boolean, "a"), new TargetLocalVar(TargetType.Boolean, "b")))))); + + var clazz = generateClass(targetClass, new ByteArrayClassLoader()); + var and = clazz.getDeclaredMethod("and", Boolean.class, Boolean.class); + var or = clazz.getDeclaredMethod("or", Boolean.class, Boolean.class); + assertEquals(and.invoke(null, true, false), false); + assertEquals(and.invoke(null, true, true), true); + assertEquals(or.invoke(null, false, false), false); + assertEquals(or.invoke(null, true, false), true); + } + + // When adding two numbers and the return type is Long it needs to convert both values to Long + @Test + public void testArithmeticConvert() throws Exception { + var targetClass = new TargetClass(Opcodes.ACC_PUBLIC, new JavaClassName("ArithmeticConvert")); + targetClass.addMethod(Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC, "add", List.of(), TargetType.Long, new TargetBlock(List.of(new TargetReturn(new TargetBinaryOp.Add(TargetType.Long, new TargetLiteral.CharLiteral((char) 10), new TargetLiteral.LongLiteral((long) 20)))))); + var clazz = generateClass(targetClass, new ByteArrayClassLoader()); + assertEquals(clazz.getDeclaredMethod("add").invoke(null), (long) 30); + } + + @Test + public void testMethodCall() throws Exception { + var targetClass = new TargetClass(Opcodes.ACC_PUBLIC, new JavaClassName("HelloWorld")); + targetClass.addMethod(Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC, "helloWorld", List.of(), null, new TargetBlock(List.of(new TargetMethodCall(null, new TargetFieldVar(new TargetRefType("java.io.PrintStream"), new TargetRefType("java.lang.System"), true, new TargetClassName(new TargetRefType("java.lang.System")), "out"), List.of(new TargetLiteral.StringLiteral("Hello World!")), new TargetRefType("java.io.PrintStream"), "println", false, false)))); + + var clazz = generateClass(targetClass, new ByteArrayClassLoader()); + clazz.getDeclaredMethod("helloWorld").invoke(null); + } + + @Test + public void testIfStatement() throws Exception { + var targetClass = new TargetClass(Opcodes.ACC_PUBLIC, new JavaClassName("IfStmt")); + targetClass.addMethod(Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC, "ifStmt", List.of(new MethodParameter(TargetType.Integer, "val")), TargetType.Integer, new TargetBlock(List.of(new TargetIf(new TargetBinaryOp.Equal(TargetType.Integer, new TargetLocalVar(TargetType.Integer, "val"), new TargetLiteral.IntLiteral(10)), new TargetReturn(new TargetLiteral.IntLiteral(1)), new TargetIf(new TargetBinaryOp.Less(TargetType.Integer, new TargetLocalVar(TargetType.Integer, "val"), new TargetLiteral.IntLiteral(5)), new TargetReturn(new TargetLiteral.IntLiteral(2)), new TargetReturn(new TargetLiteral.IntLiteral(3))))))); + var clazz = generateClass(targetClass, new ByteArrayClassLoader()); + var ifStmt = clazz.getDeclaredMethod("ifStmt", Integer.class); + assertEquals(ifStmt.invoke(null, 10), 1); + assertEquals(ifStmt.invoke(null, 3), 2); + assertEquals(ifStmt.invoke(null, 20), 3); + } + + @Test + public void testFor() throws Exception { + var targetClass = new TargetClass(Opcodes.ACC_PUBLIC, new JavaClassName("For")); + targetClass.addMethod(Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC, "forLoop", List.of(), TargetType.Integer, new TargetBlock(List.of(new TargetVarDecl(TargetType.Integer, "sum", new TargetLiteral.IntLiteral(0)), new TargetFor(List.of(new TargetVarDecl(TargetType.Integer, "i", new TargetLiteral.IntLiteral(0))), new TargetBinaryOp.Less(TargetType.Integer, new TargetLocalVar(TargetType.Integer, "i"), new TargetLiteral.IntLiteral(10)), List.of(new TargetAssign(TargetType.Integer, new TargetLocalVar(TargetType.Integer, "i"), new TargetBinaryOp.Add(TargetType.Integer, new TargetLocalVar(TargetType.Integer, "i"), new TargetLiteral.IntLiteral(1)))), new TargetBlock(List.of(new TargetAssign(TargetType.Integer, new TargetLocalVar(TargetType.Integer, "sum"), new TargetBinaryOp.Add(TargetType.Integer, new TargetLocalVar(TargetType.Integer, "sum"), new TargetLocalVar(TargetType.Integer, "i")))))), new TargetReturn(new TargetLocalVar(TargetType.Integer, "sum"))))); + var clazz = generateClass(targetClass, new ByteArrayClassLoader()); + assertEquals(clazz.getDeclaredMethod("forLoop").invoke(null), 45); + } + + @Test + public void testWhile() throws Exception { + var targetClass = new TargetClass(Opcodes.ACC_PUBLIC, new JavaClassName("While")); + targetClass.addMethod(Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC, "whileLoop", List.of(), TargetType.Integer, new TargetBlock(List.of(new TargetVarDecl(TargetType.Integer, "i", new TargetLiteral.IntLiteral(0)), new TargetWhile(new TargetBinaryOp.Less(TargetType.Integer, new TargetLocalVar(TargetType.Integer, "i"), new TargetLiteral.IntLiteral(10)), new TargetBlock(List.of(new TargetAssign(TargetType.Integer, new TargetLocalVar(TargetType.Integer, "i"), new TargetBinaryOp.Add(TargetType.Integer, new TargetLocalVar(TargetType.Integer, "i"), new TargetLiteral.IntLiteral(1)))))), new TargetReturn(new TargetLocalVar(TargetType.Integer, "i"))))); + var clazz = generateClass(targetClass, new ByteArrayClassLoader()); + assertEquals(clazz.getDeclaredMethod("whileLoop").invoke(null), 10); + } + + @Test + public void testClassicSwitch() throws Exception { + var targetClass = new TargetClass(Opcodes.ACC_PUBLIC , new JavaClassName("SwitchClassic")); + targetClass.addMethod(Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC, "switchClassic", List.of(new MethodParameter(TargetType.Integer, "i")), TargetType.Integer, new TargetBlock(List.of( + new TargetVarDecl(TargetType.Integer, "res", null), + new TargetSwitch(new TargetLocalVar(TargetType.Integer, "i"), List.of( + new TargetSwitch.Case(List.of(new TargetLiteral.IntLiteral(10)), new TargetBlock( + List.of(new TargetAssign(TargetType.Integer, new TargetLocalVar(TargetType.Integer, "res"), new TargetLiteral.IntLiteral(0)), new TargetBreak()) + )), + new TargetSwitch.Case(List.of(new TargetLiteral.IntLiteral(15), new TargetLiteral.IntLiteral(20)), new TargetBlock(List.of())), + new TargetSwitch.Case(List.of(new TargetLiteral.IntLiteral(30)), new TargetBlock( + List.of(new TargetAssign(TargetType.Integer, new TargetLocalVar(TargetType.Integer, "res"), new TargetLiteral.IntLiteral(1)), new TargetBreak()) + )) + ), new TargetSwitch.Case(new TargetBlock( + List.of(new TargetAssign(TargetType.Integer, new TargetLocalVar(TargetType.Integer, "res"), new TargetLiteral.IntLiteral(2)), new TargetBreak()) + ), false)), + new TargetReturn(new TargetLocalVar(TargetType.Integer, "res")) + ))); + + var clazz = generateClass(targetClass, new ByteArrayClassLoader()); + var m = clazz.getDeclaredMethod("switchClassic", Integer.class); + assertEquals(m.invoke(null, 10), 0); + assertEquals(m.invoke(null, 15), 1); + assertEquals(m.invoke(null, 20), 1); + assertEquals(m.invoke(null, 30), 1); + assertEquals(m.invoke(null, 99), 2); + } + + @Test + public void testTypeSwitch() throws Exception { + var targetClass = new TargetClass(Opcodes.ACC_PUBLIC, new JavaClassName("SwitchEnhanced")); + targetClass.addMethod(Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC, "switchType", List.of(new MethodParameter(TargetType.Object, "obj")), TargetType.Integer, new TargetBlock(List.of( + new TargetReturn(new TargetSwitch(new TargetLocalVar(TargetType.Object, "obj"), List.of( + new TargetSwitch.Case(List.of(new TargetTypePattern(TargetType.String, "aString")), new TargetBlock( + List.of(new TargetYield(new TargetLiteral.IntLiteral(0))) + ), false), + new TargetSwitch.Case(List.of( + new TargetGuard(new TargetTypePattern(TargetType.Integer, "i"), new TargetBinaryOp.Less(TargetType.Integer, new TargetLocalVar(TargetType.Integer, "i"), new TargetLiteral.IntLiteral(10))) + ), new TargetBlock( + List.of(new TargetLiteral.IntLiteral(3)) + ), true), + new TargetSwitch.Case(List.of(new TargetTypePattern(TargetType.Integer, "anInteger")), new TargetBlock( + List.of(new TargetLiteral.IntLiteral(1)) + ), true) + ), new TargetSwitch.Case(new TargetBlock( + List.of(new TargetLiteral.IntLiteral(2)) + ), true), TargetType.Integer) + )))); + var clazz = generateClass(targetClass, new ByteArrayClassLoader()); + var m = clazz.getDeclaredMethod("switchType", Object.class); + assertEquals(m.invoke(null, "String"), 0); + assertEquals(m.invoke(null, 10), 1); + assertEquals(m.invoke(null, 'A'), 2); + assertEquals(m.invoke(null, 5), 3); + } + + @Test + @Ignore("The lambda class is not generated because we don't call ASTToTargetAST") + public void testLambda() throws Exception { + var classLoader = new ByteArrayClassLoader(); + // var fun = classLoader.loadClass(Path.of(System.getProperty("user.dir"), "src/test/java/targetast/Fun1$$.class")); + var interfaceType = TargetFunNType.fromParams(List.of(TargetType.Integer)); + + var targetClass = new TargetClass(Opcodes.ACC_PUBLIC, new JavaClassName("CGLambda")); + targetClass.addConstructor(Opcodes.ACC_PUBLIC, List.of(), new TargetBlock(List.of(new TargetMethodCall(null, new TargetSuper(TargetType.Object), List.of(), TargetType.Object, "", false, false)))); + targetClass.addMethod(Opcodes.ACC_PUBLIC, "lambda", List.of(), TargetType.Integer, new TargetBlock(List.of(new TargetVarDecl(interfaceType, "by2", new TargetLambdaExpression(interfaceType, List.of(), List.of(new MethodParameter(TargetType.Integer, "num")), TargetType.Integer, new TargetBlock(List.of(new TargetReturn(new TargetBinaryOp.Mul(TargetType.Integer, new TargetLocalVar(TargetType.Integer, "num"), new TargetLiteral.IntLiteral(2))))))), new TargetReturn(new TargetCast(TargetType.Integer, new TargetMethodCall(TargetType.Object, TargetType.Object, List.of(TargetType.Object), new TargetLocalVar(interfaceType, "by2"), List.of(new TargetLiteral.IntLiteral(10)), interfaceType, "apply", false, true)))))); + var clazz = generateClass(targetClass, classLoader); + var instance = clazz.getConstructor().newInstance(); + assertEquals(clazz.getDeclaredMethod("lambda").invoke(instance), 20); + } +} diff --git a/tests/targetast/TestGenerics.java b/tests/targetast/TestGenerics.java new file mode 100644 index 0000000..867f895 --- /dev/null +++ b/tests/targetast/TestGenerics.java @@ -0,0 +1,396 @@ +package targetast; + +import de.dhbwstuttgart.core.JavaTXCompiler; +import de.dhbwstuttgart.syntaxtree.ClassOrInterface; +import de.dhbwstuttgart.syntaxtree.Field; +import de.dhbwstuttgart.syntaxtree.Method; +import de.dhbwstuttgart.syntaxtree.type.RefType; +import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; +import de.dhbwstuttgart.target.generate.ASTToTargetAST; +import static de.dhbwstuttgart.target.generate.ASTToTargetAST.OBJECT; +import de.dhbwstuttgart.target.generate.Bound; +import static de.dhbwstuttgart.target.generate.Bound.*; +import de.dhbwstuttgart.target.generate.BoundsList; +import de.dhbwstuttgart.target.generate.GenericsResult; +import org.junit.Ignore; +import org.junit.Test; +import static org.junit.Assert.*; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.List; + +@Ignore("TODO: Rewrite with the new algorithm") +public class TestGenerics { + private static final String rootDirectory = System.getProperty("user.dir") + "/resources/insertGenerics/javFiles/"; + private static final String bytecodeDirectory = System.getProperty("user.dir") + "targetTest"; + + private record Result(List genericsResults, ClassOrInterface clazz) { + Method findMethod(String name) { + return clazz.getMethods().stream().filter(m -> m.getName().equals(name)).findFirst().orElse(null); + } + + Field findField(String name) { + return clazz.getFieldDecl().stream().filter(field -> field.getName().equals(name)).findFirst().orElse(null); + } + } + + private static void assertStrictlyEquals(BoundsList a, BoundsList b) { + assertEquals(a.base, b.base); + assertEquals(a, b); + } + + private static void assertStrictlyNotEquals(BoundsList a, BoundsList b) { + assertNotEquals(a.base, b.base); + } + + private static Result computeGenerics(String filename) throws IOException, ClassNotFoundException { + var file = Path.of(rootDirectory + filename).toFile(); + var compiler = new JavaTXCompiler(List.of(file), List.of(file.getParentFile())); + var inference = compiler.typeInference(); + compiler.generateBytecode(new File(bytecodeDirectory), inference); + var sf = compiler.sourceFiles.get(file); + var clazz = sf.getClasses().get(0); + return new Result(compiler.getGeneratedGenerics().get(sf), clazz); + } + + @Test + public void testAny() throws Exception { + var result = computeGenerics("TestAny.jav"); + var anyMethod = result.findMethod("anyMethod"); + var otherMethod = result.findMethod("otherMethod"); + var a = result.findField("a"); + var b = result.findField("b"); + + var generics = result.genericsResults.get(0); + assertEquals(1, generics.get(anyMethod).size()); + assertEquals(2, generics.get(result.clazz).size()); + + var ECK1 = generics.getBounds(otherMethod.getParameterList().getParameterAt(0).getType(), result.clazz, anyMethod); + var ECK2 = generics.getBounds(otherMethod.getReturnType(), result.clazz, anyMethod); + var ECKChain = new BoundsList(onClass(OBJECT)); + assertStrictlyEquals(ECK1, ECK2); + assertEquals(ECK2, generics.getBounds(b.getType(), result.clazz)); + + var M = generics.getBounds(a.getType(), result.clazz); + var MChain = new BoundsList(onClass("ECK"), onClass(OBJECT)); + assertEquals(M, MChain); + } + + @Test + public void testClassField() throws Exception { + var result = computeGenerics("TestClassField.jav"); + var fReturn = result.findMethod("fReturn"); + + var generics = result.genericsResults.get(0); + assertEquals(1, generics.get(result.clazz).size()); + assertEquals(0, generics.get(fReturn).size()); + + var N = generics.getBounds(fReturn.getReturnType(), result.clazz); + var NChain = new BoundsList(onClass(OBJECT)); + assertEquals(N, NChain); + } + + @Test + public void testContraVariant() throws Exception { + var result = computeGenerics("TestContraVariant.jav"); + var m = result.findMethod("m"); + var main = result.findMethod("main"); + + var generics = result.genericsResults.get(0); + assertEquals(0, generics.get(result.clazz).size()); + assertEquals(3, generics.get(m).size()); + assertEquals(3, generics.get(main).size()); + + { + var AJ = generics.getBounds(m.getParameterList().getParameterAt(0).getType(), result.clazz, m); + var AK = generics.getBounds(m.getParameterList().getParameterAt(1).getType(), result.clazz, m); + var KWU = generics.getBounds(((RefType) generics.resolve(m.getReturnType())).getParaList().get(0), result.clazz, m); + var AK2 = generics.getBounds(((RefType) generics.resolve(m.getReturnType())).getParaList().get(1), result.clazz, m); + + assertStrictlyEquals(AK, AK2); + assertStrictlyNotEquals(AJ, KWU); + var NChain = new BoundsList(onMethod(OBJECT)); + assertEquals(AJ, NChain); + assertEquals(AK, NChain); + assertEquals(KWU, NChain); + } + + { + var O = generics.getBounds(main.getParameterList().getParameterAt(0).getType(), result.clazz, main); + var P = generics.getBounds(main.getParameterList().getParameterAt(1).getType(), result.clazz, main); + var KWQ = generics.getBounds(((RefType) generics.resolve(main.getReturnType())).getParaList().get(1), result.clazz, main); + var O2 = generics.getBounds(((RefType) generics.resolve(main.getReturnType())).getParaList().get(0), result.clazz, main); + + assertStrictlyEquals(O, O2); + assertStrictlyNotEquals(P, KWQ); + var NChain = new BoundsList(onMethod(OBJECT)); + assertEquals(O, NChain); + assertEquals(P, NChain); + assertEquals(KWQ, NChain); + } + } + + @Test + public void testGGFinder() throws Exception { + var result = computeGenerics("TestGGFinder.jav"); + var id = result.findMethod("id"); + var setA = result.findMethod("setA"); + var m = result.findMethod("m"); + var a = result.findField("a"); + + var generics = result.genericsResults.get(0); + assertEquals(1, generics.get(result.clazz).size()); + assertEquals(2, generics.get(id).size()); + assertEquals(1, generics.get(setA).size()); + assertEquals(2, generics.get(m).size()); + + var R = generics.getBounds(a.getType(), result.clazz); + var RChain = new BoundsList(onClass(OBJECT)); + assertEquals(R, RChain); + + var O = generics.getBounds(id.getParameterList().getParameterAt(0).getType(), result.clazz, id); + var AB = generics.getBounds(id.getReturnType(), result.clazz, id); + assertEquals(O, AB); + assertEquals(AB, new BoundsList(onMethod(OBJECT))); + + var S = generics.getBounds(setA.getParameterList().getParameterAt(0).getType(), result.clazz, setA); + assertEquals(S, RChain); + assertEquals(generics.getBounds(setA.getReturnType(), result.clazz, setA), RChain); + + var X = generics.getBounds(m.getParameterList().getParameterAt(0).getType(), result.clazz, m); + var Y = generics.getBounds(m.getParameterList().getParameterAt(1).getType(), result.clazz, m); + var XChain = new BoundsList(onMethod(OBJECT)); + assertEquals(X, XChain); + assertEquals(Y, X); + } + + @Test + public void testLocalVarLambda() throws Exception { + var result = computeGenerics("TestLocalVarLambda.jav"); + // TODO Generics of lambdas + } + + @Test + public void testMutualRecursion() throws Exception { + var result = computeGenerics("TestMutualRecursion.jav"); + var id = result.findMethod("id"); + var m = result.findMethod("m"); + var main = result.findMethod("main"); + var a = result.findField("a"); + + var generics = result.genericsResults.get(0); + assertEquals(1, generics.get(result.clazz).size()); + assertEquals(2, generics.get(id).size()); + assertEquals(2, generics.get(m).size()); + assertEquals(3, generics.get(main).size()); + + var N = generics.getBounds(a.getType(), result.clazz); + assertEquals(N, new BoundsList(onClass(OBJECT))); + + var P = generics.getBounds(id.getParameterList().getParameterAt(0).getType(), result.clazz, id); + var O = generics.getBounds(id.getReturnType(), result.clazz, id); + assertEquals(P, O); + assertEquals(O, new BoundsList(onMethod(OBJECT))); + + assertEquals(generics.resolve(m.getParameterList().getParameterAt(0).getType()), generics.resolve(m.getReturnType())); + var Y = generics.getBounds(m.getParameterList().getParameterAt(0).getType(), result.clazz, m); + var AA = generics.getBounds(m.getParameterList().getParameterAt(1).getType(), result.clazz, m); + assertEquals(Y, AA); + assertEquals(AA, new BoundsList(onMethod(OBJECT))); + + var AI = generics.getBounds(m.getParameterList().getParameterAt(0).getType(), result.clazz, m); + var AJ = generics.getBounds(m.getParameterList().getParameterAt(1).getType(), result.clazz, m); + var AH = generics.getBounds(m.getReturnType(), result.clazz, m); + assertEquals(AI, AJ); + assertEquals(AJ, AH); + assertEquals(AH, new BoundsList(onMethod(OBJECT))); + } + + @Test + public void testReturnVar() throws Exception { + var result = computeGenerics("TestReturnVar.jav"); + var anyMethod = result.findMethod("anyMethod"); + + var generics = result.genericsResults.get(0); + assertEquals(1, generics.get(anyMethod).size()); + + var M = generics.getBounds(anyMethod.getReturnType(), result.clazz, anyMethod); + assertEquals(M, new BoundsList(onMethod(OBJECT))); + } + + @Test + public void testSecondLineOfClassConstraints() throws Exception { + var result = computeGenerics("TestSecondLineOfClassConstraints.jav"); + var a = result.findField("a"); + var b = result.findField("b"); + var anyMethod = result.findMethod("anyMethod"); + var otherMethod = result.findMethod("otherMethod"); + + var generics = result.genericsResults.get(0); + var M = generics.getBounds(a.getType(), result.clazz); + var DYX = generics.getBounds(b.getType(), result.clazz); + var MChain = new BoundsList(onClass("DYX"), onClass(OBJECT)); + var DYXChain = new BoundsList(onClass(OBJECT)); + assertEquals(M, MChain); + + var Q = generics.getBounds(anyMethod.getReturnType(), result.clazz, anyMethod); + assertEquals(Q, new BoundsList(onMethod(OBJECT))); + + System.out.println(otherMethod.getReturnType()); + var DYX2 = generics.getBounds(otherMethod.getReturnType(), result.clazz, otherMethod); + assertEquals(DYX, DYX2); + assertEquals(DYX, generics.getBounds(otherMethod.getReturnType(), result.clazz, otherMethod)); + } + + @Test + public void testThreeArgs() throws Exception { + var result = computeGenerics("TestThreeArgs.jav"); + } + + @Test + public void testTPHsAndGenerics() throws Exception { + var result = computeGenerics("TestTPHsAndGenerics.jav"); + var id2 = result.findMethod("id2"); + var m = result.findMethod("m"); + var m2 = result.findMethod("m2"); + + var generics = result.genericsResults.get(0); + var U = generics.getBounds(id2.getParameterList().getParameterAt(0).getType(), result.clazz, id2); + var FPT = generics.getBounds(id2.getReturnType(), result.clazz, id2); + assertEquals(U, new BoundsList(onMethod("FPT"), onClass(OBJECT))); + assertEquals(FPT, new BoundsList(onClass(OBJECT))); + + var AA = generics.getBounds(m.getReturnType(), result.clazz, m); + var AC = generics.getBounds(m.getParameterList().getParameterAt(1).getType(), result.clazz, m); + assertEquals(AA, new BoundsList(onMethod(OBJECT))); + assertEquals(AC, new BoundsList(onMethod(OBJECT))); + + var AH = generics.getBounds(m2.getReturnType(), result.clazz, m2); + var AL = generics.getBounds(m2.getParameterList().getParameterAt(0).getType(), result.clazz, m2); + assertEquals(AH, new BoundsList(onMethod(OBJECT))); + assertEquals(AH, AL); + } + + @Test + public void testTwoArgs() throws Exception { + var result = computeGenerics("TestTwoArgs.jav"); + + var a = result.findField("a"); + var id = result.findMethod("id"); + var setA = result.findMethod("setA"); + var m = result.findMethod("m"); + var main = result.findMethod("main"); + + var generics = result.genericsResults.get(0); + var AO = generics.getBounds(a.getType(), result.clazz); + var AOBound = new BoundsList( + onClass("Y"), + onClass("AK"), + onClass("AE"), + onClass(OBJECT) + ); + assertEquals(AO, AOBound); + + var S = generics.getBounds(setA.getParameterList().getParameterAt(0).getType(), result.clazz, setA); + var c = new ArrayList(); + c.add(onMethod("AO")); + c.addAll(AOBound); + var SChain = new BoundsList(c); + assertEquals(S, SChain); + + var Y = generics.getBounds(m.getParameterList().getParameterAt(1).getType(), result.clazz, m); + var YChain = new BoundsList(onMethod("AE"), onClass(OBJECT)); + var AE = generics.getBounds(m.getReturnType(), result.clazz, m); + assertEquals(Y, YChain); + assertEquals(AE, new BoundsList(onClass(OBJECT))); + + // TODO main seems to change between runs + /*var AE2 = generics.getBounds(main.getReturnType(), result.clazz, main); + var AF = generics.getBounds(main.getParameterList().getParameterAt(0).getType(), result.clazz, main); + var AG = generics.getBounds(main.getParameterList().getParameterAt(1).getType(), result.clazz, main); + assertEquals(AE, AE2)); + assertEquals(AF, new BoundsList(onMethod("AK"), onMethod("AE"), onClass(OBJECT)))); + assertEquals(AG, SChain));*/ + } + + @Test + public void testTwoArgs2() throws Exception { + var result = computeGenerics("TestTwoArgs2.jav"); + // TODO Test generics + } + + @Test + public void testTwoCalls() throws Exception { + var result = computeGenerics("TestTwoCalls.jav"); + var id = result.findMethod("id"); + var main = result.findMethod("main"); + + var generics = result.genericsResults.get(0); + var O = generics.getBounds(id.getReturnType(), result.clazz, id); + var O2 = generics.getBounds(id.getParameterList().getParameterAt(0).getType(), result.clazz, id); + assertStrictlyEquals(O, O2); + assertEquals(O2, new BoundsList(onMethod(OBJECT))); + + // TODO Maybe test in other ways if the parameter generics equals the return generics + var S = generics.getBounds(main.getReturnType(), result.clazz, main); + var S2 = generics.getBounds(main.getParameterList().getParameterAt(1).getType(), result.clazz, main); + var T = generics.getBounds(main.getParameterList().getParameterAt(0).getType(), result.clazz, main); + assertStrictlyEquals(S, S2); + assertEquals(S2, new BoundsList(onMethod(OBJECT))); + assertEquals(T, new BoundsList(onMethod(OBJECT))); + } + + @Test + public void testVector() throws Exception { + var result = computeGenerics("TestVector.jav"); + var m = result.findMethod("m"); + var id = result.findMethod("id"); + + var generics = result.genericsResults.get(0); + var par1 = generics.resolve(m.getParameterList().getParameterAt(0).getType()); + var par2 = generics.resolve(m.getParameterList().getParameterAt(1).getType()); + + var S = generics.getBounds(((RefType) par1).getParaList().get(0), result.clazz, m); + var ACM = generics.getBounds(((RefType) par2).getParaList().get(0), result.clazz, m); + assertEquals(S, new BoundsList(onMethod("V"), onMethod(OBJECT))); + assertEquals(ACM, new BoundsList(onMethod(OBJECT))); + + var Y = generics.getBounds(id.getParameterList().getParameterAt(0).getType(), result.clazz, id); + assertEquals(Y, new BoundsList(onMethod(OBJECT))); + assertEquals(Y, generics.getBounds(id.getReturnType(), result.clazz, id)); + } + + @Test + public void testVectorArg() throws Exception { + var result = computeGenerics("TestVectorArg.jav"); + var add = result.findMethod("add"); + var main = result.findMethod("main"); + + var generics = result.genericsResults.get(0); + var par1 = generics.resolve(add.getParameterList().getParameterAt(0).getType()); + var ACK = generics.getBounds(((RefType) par1).getParaList().get(0), result.clazz, add); + var O = generics.getBounds(add.getParameterList().getParameterAt(1).getType(), result.clazz, add); + assertEquals(ACK, new BoundsList(onMethod(OBJECT))); + assertEquals(O, new BoundsList(onMethod("ACK"), onMethod(OBJECT))); + + var par2 = generics.resolve(main.getParameterList().getParameterAt(0).getType()); + var ACK2 = generics.getBounds(((RefType) par2).getParaList().get(0), result.clazz, add); + var V = generics.getBounds(add.getParameterList().getParameterAt(1).getType(), result.clazz, add); + assertStrictlyEquals(ACK2, ACK); + assertEquals(V, O); + } + + @Test + public void testVoidMeth() throws Exception { + var result = computeGenerics("TestVoidMeth.jav"); + } + + @Test + public void testAssign() throws Exception { + // TODO Check generics + var result = computeGenerics("TestAssign.jav"); + } +} diff --git a/tests/targetast/TphTest.java b/tests/targetast/TphTest.java new file mode 100644 index 0000000..3fd6fa2 --- /dev/null +++ b/tests/targetast/TphTest.java @@ -0,0 +1,55 @@ +package targetast; + +import de.dhbwstuttgart.environment.ByteArrayClassLoader; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.lang.reflect.Method; + +import static org.junit.Assert.assertEquals; + +public class TphTest { + + private static Class classToTest; + private static Object instanceOfClass; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + var classFiles = TestCodegen.generateClassFiles(new ByteArrayClassLoader(), "Tph.jav"); + classToTest = classFiles.get("Tph"); + instanceOfClass = classToTest.getDeclaredConstructor().newInstance(); + } + + @Test + public void test1() throws Exception { + Method m = classToTest.getDeclaredMethod("m", Object.class, Object.class); + Object result = m.invoke(instanceOfClass, 1,2); + + assertEquals(1,result); + } + + @Test + public void test2() throws Exception { + Method m = classToTest.getDeclaredMethod("m", Object.class, Object.class); + Object result = m.invoke(instanceOfClass, 1, "sss"); + + assertEquals(1,result); + } + + @Test + public void test3() throws Exception { + Method m = classToTest.getDeclaredMethod("m2", Object.class); + Object result = m.invoke(instanceOfClass, 2); + + assertEquals(2,result); + } + + @Test + public void test4() throws Exception { + Method m = classToTest.getDeclaredMethod("m2", Object.class); + Object result = m.invoke(instanceOfClass,"xxx"); + + assertEquals("xxx",result); + } + +} diff --git a/tests/targetast/WhileTest.java b/tests/targetast/WhileTest.java new file mode 100644 index 0000000..50371d1 --- /dev/null +++ b/tests/targetast/WhileTest.java @@ -0,0 +1,43 @@ +package targetast; + +import de.dhbwstuttgart.environment.ByteArrayClassLoader; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.lang.reflect.Method; + +import static org.junit.Assert.assertEquals; + +public class WhileTest { + private static Class classToTest; + private static Object instanceOfClass; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + var classFiles = TestCodegen.generateClassFiles(new ByteArrayClassLoader(), "While.jav"); + classToTest = classFiles.get("While"); + instanceOfClass = classToTest.getDeclaredConstructor().newInstance(); + } + + @Test + public void test() throws Exception { + Method m = classToTest.getDeclaredMethod("m", Integer.class); + Integer result = (Integer) m.invoke(instanceOfClass, 0); + assertEquals(Integer.valueOf(2), result); + } + + @Test + public void testDouble() throws Exception { + Method m = classToTest.getDeclaredMethod("m", Double.class); + Double result = (Double) m.invoke(instanceOfClass, 0.0); + assertEquals(Double.valueOf(2.0), result); + } + + @Test + public void testLong() throws Exception { + Method m = classToTest.getDeclaredMethod("m", Long.class); + Long result = (Long) m.invoke(instanceOfClass, 0l); + assertEquals(Long.valueOf(2l), result); + } + +}