forked from JavaTX/JavaCompilerCore
UnifyTypeFactory angefügt
This commit is contained in:
parent
92c284a04b
commit
c8beb9579e
@ -109,7 +109,7 @@ var activeTableTab = "activeTableTab";
|
||||
<li><a href="../../../../de/dhbwstuttgart/syntaxtree/type/ObjectType.html" title="class in de.dhbwstuttgart.syntaxtree.type">de.dhbwstuttgart.syntaxtree.type.ObjectType</a></li>
|
||||
<li>
|
||||
<ul class="inheritance">
|
||||
<li><a href="../../../../de/dhbwstuttgart/syntaxtree/type/RefType.html" title="class in de.dhbwstuttgart.syntaxtree.type">de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH</a></li>
|
||||
<li><a href="../../../../de/dhbwstuttgart/syntaxtree/type/RefType.html" title="class in de.dhbwstuttgart.syntaxtree.type">de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric</a></li>
|
||||
<li>
|
||||
<ul class="inheritance">
|
||||
<li>de.dhbwstuttgart.syntaxtree.type.Void</li>
|
||||
@ -219,7 +219,7 @@ extends <a href="../../../../de/dhbwstuttgart/syntaxtree/type/RefType.html" titl
|
||||
</tr>
|
||||
</table>
|
||||
<ul class="blockList">
|
||||
<li class="blockList"><a name="methods.inherited.from.class.de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH">
|
||||
<li class="blockList"><a name="methods.inherited.from.class.de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric">
|
||||
<!-- -->
|
||||
</a>
|
||||
<h3>Methods inherited from class de.dhbwstuttgart.syntaxtree.type.<a href="../../../../de/dhbwstuttgart/syntaxtree/type/RefType.html" title="class in de.dhbwstuttgart.syntaxtree.type">RefType</a></h3>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<html lang="de">
|
||||
<head>
|
||||
<!-- Generated by javadoc (1.8.0_05) on Tue May 12 19:56:24 CEST 2015 -->
|
||||
<title>Uses of Class de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH</title>
|
||||
<title>Uses of Class de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric</title>
|
||||
<meta name="date" content="2015-05-12">
|
||||
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
|
||||
<script type="text/javascript" src="../../../../../script.js"></script>
|
||||
@ -70,7 +70,7 @@
|
||||
</a></div>
|
||||
<!-- ========= END OF TOP NAVBAR ========= -->
|
||||
<div class="header">
|
||||
<h2 title="Uses of Class de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH" class="title">Uses of Class<br>de.dhbwstuttgart.syntaxtree.type.RefType</h2>
|
||||
<h2 title="Uses of Class de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric" class="title">Uses of Class<br>de.dhbwstuttgart.syntaxtree.type.RefType</h2>
|
||||
</div>
|
||||
<div class="classUseContainer">
|
||||
<ul class="blockList">
|
||||
|
@ -100,7 +100,7 @@ var activeTableTab = "activeTableTab";
|
||||
<li>java.lang.Object</li>
|
||||
<li>
|
||||
<ul class="inheritance">
|
||||
<li><a href="../../../de/dhbwstuttgart/typeinference/UndMenge.html" title="class in de.dhbwstuttgart.typeinference">de.dhbwstuttgart.typeinference.UndMenge</a><<a href="../../../de/dhbwstuttgart/typeinference/Pair.html" title="class in de.dhbwstuttgart.typeinference">Pair</a>></li>
|
||||
<li><a href="../../../de/dhbwstuttgart/typeinference/UndMenge.html" title="class in de.dhbwstuttgart.typeinference">de.dhbwstuttgart.typeinference.constraints.UndMenge</a><<a href="../../../de/dhbwstuttgart/typeinference/Pair.html" title="class in de.dhbwstuttgart.typeinference">Pair</a>></li>
|
||||
<li>
|
||||
<ul class="inheritance">
|
||||
<li>de.dhbwstuttgart.typeinference.ConstraintsSet</li>
|
||||
@ -148,7 +148,7 @@ extends <a href="../../../de/dhbwstuttgart/typeinference/UndMenge.html" title="c
|
||||
</tr>
|
||||
</table>
|
||||
<ul class="blockList">
|
||||
<li class="blockList"><a name="fields.inherited.from.class.de.dhbwstuttgart.typeinference.UndMenge">
|
||||
<li class="blockList"><a name="fields.inherited.from.class.de.dhbwstuttgart.typeinference.constraints.UndMenge">
|
||||
<!-- -->
|
||||
</a>
|
||||
<h3>Fields inherited from class de.dhbwstuttgart.typeinference.<a href="../../../de/dhbwstuttgart/typeinference/UndMenge.html" title="class in de.dhbwstuttgart.typeinference">UndMenge</a></h3>
|
||||
@ -213,7 +213,7 @@ extends <a href="../../../de/dhbwstuttgart/typeinference/UndMenge.html" title="c
|
||||
</tr>
|
||||
</table>
|
||||
<ul class="blockList">
|
||||
<li class="blockList"><a name="methods.inherited.from.class.de.dhbwstuttgart.typeinference.UndMenge">
|
||||
<li class="blockList"><a name="methods.inherited.from.class.de.dhbwstuttgart.typeinference.constraints.UndMenge">
|
||||
<!-- -->
|
||||
</a>
|
||||
<h3>Methods inherited from class de.dhbwstuttgart.typeinference.<a href="../../../de/dhbwstuttgart/typeinference/UndMenge.html" title="class in de.dhbwstuttgart.typeinference">UndMenge</a></h3>
|
||||
|
@ -109,7 +109,7 @@ var activeTableTab = "activeTableTab";
|
||||
<li><a href="../../../de/dhbwstuttgart/syntaxtree/type/ObjectType.html" title="class in de.dhbwstuttgart.syntaxtree.type">de.dhbwstuttgart.syntaxtree.type.ObjectType</a></li>
|
||||
<li>
|
||||
<ul class="inheritance">
|
||||
<li><a href="../../../de/dhbwstuttgart/syntaxtree/type/RefType.html" title="class in de.dhbwstuttgart.syntaxtree.type">de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH</a></li>
|
||||
<li><a href="../../../de/dhbwstuttgart/syntaxtree/type/RefType.html" title="class in de.dhbwstuttgart.syntaxtree.type">de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric</a></li>
|
||||
<li>
|
||||
<ul class="inheritance">
|
||||
<li>de.dhbwstuttgart.typeinference.FunN</li>
|
||||
@ -245,7 +245,7 @@ extends <a href="../../../de/dhbwstuttgart/syntaxtree/type/RefType.html" title="
|
||||
</tr>
|
||||
</table>
|
||||
<ul class="blockList">
|
||||
<li class="blockList"><a name="methods.inherited.from.class.de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH">
|
||||
<li class="blockList"><a name="methods.inherited.from.class.de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric">
|
||||
<!-- -->
|
||||
</a>
|
||||
<h3>Methods inherited from class de.dhbwstuttgart.syntaxtree.type.<a href="../../../de/dhbwstuttgart/syntaxtree/type/RefType.html" title="class in de.dhbwstuttgart.syntaxtree.type">RefType</a></h3>
|
||||
|
@ -100,10 +100,10 @@ var activeTableTab = "activeTableTab";
|
||||
<li>java.lang.Object</li>
|
||||
<li>
|
||||
<ul class="inheritance">
|
||||
<li><a href="../../../de/dhbwstuttgart/typeinference/OderMenge.html" title="class in de.dhbwstuttgart.typeinference">de.dhbwstuttgart.typeinference.OderMenge</a><<a href="../../../de/dhbwstuttgart/typeinference/Pair.html" title="class in de.dhbwstuttgart.typeinference">Pair</a>></li>
|
||||
<li><a href="../../../de/dhbwstuttgart/typeinference/OderMenge.html" title="class in de.dhbwstuttgart.typeinference">de.dhbwstuttgart.typeinference.constraints.OderMenge</a><<a href="../../../de/dhbwstuttgart/typeinference/Pair.html" title="class in de.dhbwstuttgart.typeinference">Pair</a>></li>
|
||||
<li>
|
||||
<ul class="inheritance">
|
||||
<li>de.dhbwstuttgart.typeinference.OderConstraint</li>
|
||||
<li>de.dhbwstuttgart.typeinference.constraints.OderConstraint</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@ -144,7 +144,7 @@ extends <a href="../../../de/dhbwstuttgart/typeinference/OderMenge.html" title="
|
||||
</tr>
|
||||
</table>
|
||||
<ul class="blockList">
|
||||
<li class="blockList"><a name="fields.inherited.from.class.de.dhbwstuttgart.typeinference.OderMenge">
|
||||
<li class="blockList"><a name="fields.inherited.from.class.de.dhbwstuttgart.typeinference.constraints.OderMenge">
|
||||
<!-- -->
|
||||
</a>
|
||||
<h3>Fields inherited from class de.dhbwstuttgart.typeinference.<a href="../../../de/dhbwstuttgart/typeinference/OderMenge.html" title="class in de.dhbwstuttgart.typeinference">OderMenge</a></h3>
|
||||
@ -214,7 +214,7 @@ extends <a href="../../../de/dhbwstuttgart/typeinference/OderMenge.html" title="
|
||||
</tr>
|
||||
</table>
|
||||
<ul class="blockList">
|
||||
<li class="blockList"><a name="methods.inherited.from.class.de.dhbwstuttgart.typeinference.OderMenge">
|
||||
<li class="blockList"><a name="methods.inherited.from.class.de.dhbwstuttgart.typeinference.constraints.OderMenge">
|
||||
<!-- -->
|
||||
</a>
|
||||
<h3>Methods inherited from class de.dhbwstuttgart.typeinference.<a href="../../../de/dhbwstuttgart/typeinference/OderMenge.html" title="class in de.dhbwstuttgart.typeinference">OderMenge</a></h3>
|
||||
|
@ -103,7 +103,7 @@ var activeTableTab = "activeTableTab";
|
||||
<li>java.lang.Enum<<a href="../../../de/dhbwstuttgart/typeinference/Pair.PairOperator.html" title="enum in de.dhbwstuttgart.typeinference">Pair.PairOperator</a>></li>
|
||||
<li>
|
||||
<ul class="inheritance">
|
||||
<li>de.dhbwstuttgart.typeinference.Pair.PairOperator</li>
|
||||
<li>de.dhbwstuttgart.typeinference.constraints.Pair.PairOperator</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -100,7 +100,7 @@ var activeTableTab = "activeTableTab";
|
||||
<li>java.lang.Object</li>
|
||||
<li>
|
||||
<ul class="inheritance">
|
||||
<li>de.dhbwstuttgart.typeinference.Pair</li>
|
||||
<li>de.dhbwstuttgart.typeinference.constraints.Pair</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@ -381,7 +381,7 @@ extends java.lang.Object</pre>
|
||||
<a href="../../../de/dhbwstuttgart/syntaxtree/type/Type.html" title="class in de.dhbwstuttgart.syntaxtree.type">Type</a> TA2)</pre>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="Pair-de.dhbwstuttgart.syntaxtree.type.Type-de.dhbwstuttgart.syntaxtree.type.Type-de.dhbwstuttgart.typeinference.Pair.PairOperator-">
|
||||
<a name="Pair-de.dhbwstuttgart.syntaxtree.type.Type-de.dhbwstuttgart.syntaxtree.type.Type-de.dhbwstuttgart.typeinference.constraints.Pair.PairOperator-">
|
||||
<!-- -->
|
||||
</a>
|
||||
<ul class="blockList">
|
||||
@ -392,7 +392,7 @@ extends java.lang.Object</pre>
|
||||
<a href="../../../de/dhbwstuttgart/typeinference/Pair.PairOperator.html" title="enum in de.dhbwstuttgart.typeinference">Pair.PairOperator</a> eOp)</pre>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="Pair-de.dhbwstuttgart.syntaxtree.type.Type-de.dhbwstuttgart.syntaxtree.type.Type-de.dhbwstuttgart.typeinference.Pair.PairOperator-boolean-">
|
||||
<a name="Pair-de.dhbwstuttgart.syntaxtree.type.Type-de.dhbwstuttgart.syntaxtree.type.Type-de.dhbwstuttgart.typeinference.constraints.Pair.PairOperator-boolean-">
|
||||
<!-- -->
|
||||
</a>
|
||||
<ul class="blockListLast">
|
||||
@ -560,7 +560,7 @@ extends java.lang.Object</pre>
|
||||
Gibt den Operator zurück.</div>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="SetOperator-de.dhbwstuttgart.typeinference.Pair.PairOperator-">
|
||||
<a name="SetOperator-de.dhbwstuttgart.typeinference.constraints.Pair.PairOperator-">
|
||||
<!-- -->
|
||||
</a>
|
||||
<ul class="blockList">
|
||||
|
@ -100,7 +100,7 @@ var activeTableTab = "activeTableTab";
|
||||
<li>java.lang.Object</li>
|
||||
<li>
|
||||
<ul class="inheritance">
|
||||
<li><a href="../../../de/dhbwstuttgart/typeinference/EinzelElement.html" title="class in de.dhbwstuttgart.typeinference">de.dhbwstuttgart.typeinference.EinzelElement</a><<a href="../../../de/dhbwstuttgart/typeinference/Pair.html" title="class in de.dhbwstuttgart.typeinference">Pair</a>></li>
|
||||
<li><a href="../../../de/dhbwstuttgart/typeinference/EinzelElement.html" title="class in de.dhbwstuttgart.typeinference">de.dhbwstuttgart.typeinference.constraints.EinzelElement</a><<a href="../../../de/dhbwstuttgart/typeinference/Pair.html" title="class in de.dhbwstuttgart.typeinference">Pair</a>></li>
|
||||
<li>
|
||||
<ul class="inheritance">
|
||||
<li>de.dhbwstuttgart.typeinference.SingleConstraint</li>
|
||||
@ -178,7 +178,7 @@ extends <a href="../../../de/dhbwstuttgart/typeinference/EinzelElement.html" tit
|
||||
</tr>
|
||||
</table>
|
||||
<ul class="blockList">
|
||||
<li class="blockList"><a name="methods.inherited.from.class.de.dhbwstuttgart.typeinference.EinzelElement">
|
||||
<li class="blockList"><a name="methods.inherited.from.class.de.dhbwstuttgart.typeinference.constraints.EinzelElement">
|
||||
<!-- -->
|
||||
</a>
|
||||
<h3>Methods inherited from class de.dhbwstuttgart.typeinference.<a href="../../../de/dhbwstuttgart/typeinference/EinzelElement.html" title="class in de.dhbwstuttgart.typeinference">EinzelElement</a></h3>
|
||||
|
@ -75,7 +75,7 @@ var activeTableTab = "activeTableTab";
|
||||
<ul class="subNavList">
|
||||
<li>Summary: </li>
|
||||
<li>Nested | </li>
|
||||
<li><a href="#fields.inherited.from.class.de.dhbwstuttgart.typeinference.UndMenge">Field</a> | </li>
|
||||
<li><a href="#fields.inherited.from.class.de.dhbwstuttgart.typeinference.constraints.UndMenge">Field</a> | </li>
|
||||
<li><a href="#constructor.summary">Constr</a> | </li>
|
||||
<li><a href="#method.summary">Method</a></li>
|
||||
</ul>
|
||||
@ -100,10 +100,10 @@ var activeTableTab = "activeTableTab";
|
||||
<li>java.lang.Object</li>
|
||||
<li>
|
||||
<ul class="inheritance">
|
||||
<li><a href="../../../de/dhbwstuttgart/typeinference/UndMenge.html" title="class in de.dhbwstuttgart.typeinference">de.dhbwstuttgart.typeinference.UndMenge</a><<a href="../../../de/dhbwstuttgart/typeinference/Pair.html" title="class in de.dhbwstuttgart.typeinference">Pair</a>></li>
|
||||
<li><a href="../../../de/dhbwstuttgart/typeinference/UndMenge.html" title="class in de.dhbwstuttgart.typeinference">de.dhbwstuttgart.typeinference.constraints.UndMenge</a><<a href="../../../de/dhbwstuttgart/typeinference/Pair.html" title="class in de.dhbwstuttgart.typeinference">Pair</a>></li>
|
||||
<li>
|
||||
<ul class="inheritance">
|
||||
<li>de.dhbwstuttgart.typeinference.UndConstraint</li>
|
||||
<li>de.dhbwstuttgart.typeinference.constraints.UndConstraint</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@ -139,7 +139,7 @@ implements java.lang.Iterable<<a href="../../../de/dhbwstuttgart/typeinferenc
|
||||
</a>
|
||||
<h3>Field Summary</h3>
|
||||
<ul class="blockList">
|
||||
<li class="blockList"><a name="fields.inherited.from.class.de.dhbwstuttgart.typeinference.UndMenge">
|
||||
<li class="blockList"><a name="fields.inherited.from.class.de.dhbwstuttgart.typeinference.constraints.UndMenge">
|
||||
<!-- -->
|
||||
</a>
|
||||
<h3>Fields inherited from class de.dhbwstuttgart.typeinference.<a href="../../../de/dhbwstuttgart/typeinference/UndMenge.html" title="class in de.dhbwstuttgart.typeinference">UndMenge</a></h3>
|
||||
@ -199,7 +199,7 @@ implements java.lang.Iterable<<a href="../../../de/dhbwstuttgart/typeinferenc
|
||||
</tr>
|
||||
</table>
|
||||
<ul class="blockList">
|
||||
<li class="blockList"><a name="methods.inherited.from.class.de.dhbwstuttgart.typeinference.UndMenge">
|
||||
<li class="blockList"><a name="methods.inherited.from.class.de.dhbwstuttgart.typeinference.constraints.UndMenge">
|
||||
<!-- -->
|
||||
</a>
|
||||
<h3>Methods inherited from class de.dhbwstuttgart.typeinference.<a href="../../../de/dhbwstuttgart/typeinference/UndMenge.html" title="class in de.dhbwstuttgart.typeinference">UndMenge</a></h3>
|
||||
@ -359,7 +359,7 @@ implements java.lang.Iterable<<a href="../../../de/dhbwstuttgart/typeinferenc
|
||||
<ul class="subNavList">
|
||||
<li>Summary: </li>
|
||||
<li>Nested | </li>
|
||||
<li><a href="#fields.inherited.from.class.de.dhbwstuttgart.typeinference.UndMenge">Field</a> | </li>
|
||||
<li><a href="#fields.inherited.from.class.de.dhbwstuttgart.typeinference.constraints.UndMenge">Field</a> | </li>
|
||||
<li><a href="#constructor.summary">Constr</a> | </li>
|
||||
<li><a href="#method.summary">Method</a></li>
|
||||
</ul>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<html lang="de">
|
||||
<head>
|
||||
<!-- Generated by javadoc (1.8.0_05) on Tue May 12 19:56:24 CEST 2015 -->
|
||||
<title>Uses of Class de.dhbwstuttgart.typeinference.EinzelElement</title>
|
||||
<title>Uses of Class de.dhbwstuttgart.typeinference.constraints.EinzelElement</title>
|
||||
<meta name="date" content="2015-05-12">
|
||||
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
|
||||
<script type="text/javascript" src="../../../../script.js"></script>
|
||||
@ -70,7 +70,7 @@
|
||||
</a></div>
|
||||
<!-- ========= END OF TOP NAVBAR ========= -->
|
||||
<div class="header">
|
||||
<h2 title="Uses of Class de.dhbwstuttgart.typeinference.EinzelElement" class="title">Uses of Class<br>de.dhbwstuttgart.typeinference.EinzelElement</h2>
|
||||
<h2 title="Uses of Class de.dhbwstuttgart.typeinference.constraints.EinzelElement" class="title">Uses of Class<br>de.dhbwstuttgart.typeinference.EinzelElement</h2>
|
||||
</div>
|
||||
<div class="classUseContainer">
|
||||
<ul class="blockList">
|
||||
|
@ -3,7 +3,7 @@
|
||||
<html lang="de">
|
||||
<head>
|
||||
<!-- Generated by javadoc (1.8.0_05) on Tue May 12 19:56:24 CEST 2015 -->
|
||||
<title>Uses of Interface de.dhbwstuttgart.typeinference.KomplexeMenge</title>
|
||||
<title>Uses of Interface de.dhbwstuttgart.typeinference.constraints.KomplexeMenge</title>
|
||||
<meta name="date" content="2015-05-12">
|
||||
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
|
||||
<script type="text/javascript" src="../../../../script.js"></script>
|
||||
@ -70,7 +70,7 @@
|
||||
</a></div>
|
||||
<!-- ========= END OF TOP NAVBAR ========= -->
|
||||
<div class="header">
|
||||
<h2 title="Uses of Interface de.dhbwstuttgart.typeinference.KomplexeMenge" class="title">Uses of Interface<br>de.dhbwstuttgart.typeinference.KomplexeMenge</h2>
|
||||
<h2 title="Uses of Interface de.dhbwstuttgart.typeinference.constraints.KomplexeMenge" class="title">Uses of Interface<br>de.dhbwstuttgart.typeinference.KomplexeMenge</h2>
|
||||
</div>
|
||||
<div class="classUseContainer">
|
||||
<ul class="blockList">
|
||||
|
@ -3,7 +3,7 @@
|
||||
<html lang="de">
|
||||
<head>
|
||||
<!-- Generated by javadoc (1.8.0_05) on Tue May 12 19:56:24 CEST 2015 -->
|
||||
<title>Uses of Class de.dhbwstuttgart.typeinference.OderConstraint</title>
|
||||
<title>Uses of Class de.dhbwstuttgart.typeinference.constraints.OderConstraint</title>
|
||||
<meta name="date" content="2015-05-12">
|
||||
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
|
||||
<script type="text/javascript" src="../../../../script.js"></script>
|
||||
@ -70,9 +70,9 @@
|
||||
</a></div>
|
||||
<!-- ========= END OF TOP NAVBAR ========= -->
|
||||
<div class="header">
|
||||
<h2 title="Uses of Class de.dhbwstuttgart.typeinference.OderConstraint" class="title">Uses of Class<br>de.dhbwstuttgart.typeinference.OderConstraint</h2>
|
||||
<h2 title="Uses of Class de.dhbwstuttgart.typeinference.constraints.OderConstraint" class="title">Uses of Class<br>de.dhbwstuttgart.typeinference.OderConstraint</h2>
|
||||
</div>
|
||||
<div class="classUseContainer">No usage of de.dhbwstuttgart.typeinference.OderConstraint</div>
|
||||
<div class="classUseContainer">No usage of de.dhbwstuttgart.typeinference.constraints.OderConstraint</div>
|
||||
<!-- ======= START OF BOTTOM NAVBAR ====== -->
|
||||
<div class="bottomNav"><a name="navbar.bottom">
|
||||
<!-- -->
|
||||
|
@ -3,7 +3,7 @@
|
||||
<html lang="de">
|
||||
<head>
|
||||
<!-- Generated by javadoc (1.8.0_05) on Tue May 12 19:56:24 CEST 2015 -->
|
||||
<title>Uses of Class de.dhbwstuttgart.typeinference.OderMenge</title>
|
||||
<title>Uses of Class de.dhbwstuttgart.typeinference.constraints.OderMenge</title>
|
||||
<meta name="date" content="2015-05-12">
|
||||
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
|
||||
<script type="text/javascript" src="../../../../script.js"></script>
|
||||
@ -70,7 +70,7 @@
|
||||
</a></div>
|
||||
<!-- ========= END OF TOP NAVBAR ========= -->
|
||||
<div class="header">
|
||||
<h2 title="Uses of Class de.dhbwstuttgart.typeinference.OderMenge" class="title">Uses of Class<br>de.dhbwstuttgart.typeinference.OderMenge</h2>
|
||||
<h2 title="Uses of Class de.dhbwstuttgart.typeinference.constraints.OderMenge" class="title">Uses of Class<br>de.dhbwstuttgart.typeinference.OderMenge</h2>
|
||||
</div>
|
||||
<div class="classUseContainer">
|
||||
<ul class="blockList">
|
||||
|
@ -3,7 +3,7 @@
|
||||
<html lang="de">
|
||||
<head>
|
||||
<!-- Generated by javadoc (1.8.0_05) on Tue May 12 19:56:24 CEST 2015 -->
|
||||
<title>Uses of Class de.dhbwstuttgart.typeinference.Pair.PairOperator</title>
|
||||
<title>Uses of Class de.dhbwstuttgart.typeinference.constraints.Pair.PairOperator</title>
|
||||
<meta name="date" content="2015-05-12">
|
||||
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
|
||||
<script type="text/javascript" src="../../../../script.js"></script>
|
||||
@ -12,13 +12,12 @@
|
||||
<script type="text/javascript"><!--
|
||||
try {
|
||||
if (location.href.indexOf('is-external=true') == -1) {
|
||||
parent.document.title="Uses of Class de.dhbwstuttgart.typeinference.Pair.PairOperator";
|
||||
parent.document.title="Uses of Class de.dhbwstuttgart.typeinference.constraints.Pair.PairOperator";
|
||||
}
|
||||
}
|
||||
catch(err) {
|
||||
}
|
||||
//-->
|
||||
</script>
|
||||
//--></script>
|
||||
<noscript>
|
||||
<div>JavaScript is disabled on your browser.</div>
|
||||
</noscript>
|
||||
@ -70,7 +69,7 @@
|
||||
</a></div>
|
||||
<!-- ========= END OF TOP NAVBAR ========= -->
|
||||
<div class="header">
|
||||
<h2 title="Uses of Class de.dhbwstuttgart.typeinference.Pair.PairOperator" class="title">Uses of Class<br>de.dhbwstuttgart.typeinference.Pair.PairOperator</h2>
|
||||
<h2 title="Uses of Class de.dhbwstuttgart.typeinference.constraints.Pair.PairOperator" class="title">Uses of Class<br>de.dhbwstuttgart.typeinference.Pair.PairOperator</h2>
|
||||
</div>
|
||||
<div class="classUseContainer">
|
||||
<ul class="blockList">
|
||||
|
@ -3,7 +3,7 @@
|
||||
<html lang="de">
|
||||
<head>
|
||||
<!-- Generated by javadoc (1.8.0_05) on Tue May 12 19:56:24 CEST 2015 -->
|
||||
<title>Uses of Class de.dhbwstuttgart.typeinference.Pair</title>
|
||||
<title>Uses of Class de.dhbwstuttgart.typeinference.constraints.Pair</title>
|
||||
<meta name="date" content="2015-05-12">
|
||||
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
|
||||
<script type="text/javascript" src="../../../../script.js"></script>
|
||||
@ -70,7 +70,7 @@
|
||||
</a></div>
|
||||
<!-- ========= END OF TOP NAVBAR ========= -->
|
||||
<div class="header">
|
||||
<h2 title="Uses of Class de.dhbwstuttgart.typeinference.Pair" class="title">Uses of Class<br>de.dhbwstuttgart.typeinference.Pair</h2>
|
||||
<h2 title="Uses of Class de.dhbwstuttgart.typeinference.constraints.Pair" class="title">Uses of Class<br>de.dhbwstuttgart.typeinference.Pair</h2>
|
||||
</div>
|
||||
<div class="classUseContainer">
|
||||
<ul class="blockList">
|
||||
|
@ -3,7 +3,7 @@
|
||||
<html lang="de">
|
||||
<head>
|
||||
<!-- Generated by javadoc (1.8.0_05) on Tue May 12 19:56:24 CEST 2015 -->
|
||||
<title>Uses of Class de.dhbwstuttgart.typeinference.UndConstraint</title>
|
||||
<title>Uses of Class de.dhbwstuttgart.typeinference.constraints.UndConstraint</title>
|
||||
<meta name="date" content="2015-05-12">
|
||||
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
|
||||
<script type="text/javascript" src="../../../../script.js"></script>
|
||||
@ -70,7 +70,7 @@
|
||||
</a></div>
|
||||
<!-- ========= END OF TOP NAVBAR ========= -->
|
||||
<div class="header">
|
||||
<h2 title="Uses of Class de.dhbwstuttgart.typeinference.UndConstraint" class="title">Uses of Class<br>de.dhbwstuttgart.typeinference.UndConstraint</h2>
|
||||
<h2 title="Uses of Class de.dhbwstuttgart.typeinference.constraints.UndConstraint" class="title">Uses of Class<br>de.dhbwstuttgart.typeinference.UndConstraint</h2>
|
||||
</div>
|
||||
<div class="classUseContainer">
|
||||
<ul class="blockList">
|
||||
|
@ -3,7 +3,7 @@
|
||||
<html lang="de">
|
||||
<head>
|
||||
<!-- Generated by javadoc (1.8.0_05) on Tue May 12 19:56:24 CEST 2015 -->
|
||||
<title>Uses of Class de.dhbwstuttgart.typeinference.UndMenge</title>
|
||||
<title>Uses of Class de.dhbwstuttgart.typeinference.constraints.UndMenge</title>
|
||||
<meta name="date" content="2015-05-12">
|
||||
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
|
||||
<script type="text/javascript" src="../../../../script.js"></script>
|
||||
@ -70,7 +70,7 @@
|
||||
</a></div>
|
||||
<!-- ========= END OF TOP NAVBAR ========= -->
|
||||
<div class="header">
|
||||
<h2 title="Uses of Class de.dhbwstuttgart.typeinference.UndMenge" class="title">Uses of Class<br>de.dhbwstuttgart.typeinference.UndMenge</h2>
|
||||
<h2 title="Uses of Class de.dhbwstuttgart.typeinference.constraints.UndMenge" class="title">Uses of Class<br>de.dhbwstuttgart.typeinference.UndMenge</h2>
|
||||
</div>
|
||||
<div class="classUseContainer">
|
||||
<ul class="blockList">
|
||||
|
@ -100,7 +100,7 @@ var activeTableTab = "activeTableTab";
|
||||
<li>java.lang.Object</li>
|
||||
<li>
|
||||
<ul class="inheritance">
|
||||
<li><a href="../../../../de/dhbwstuttgart/typeinference/UndMenge.html" title="class in de.dhbwstuttgart.typeinference">de.dhbwstuttgart.typeinference.UndMenge</a><<a href="../../../../de/dhbwstuttgart/typeinference/Pair.html" title="class in de.dhbwstuttgart.typeinference">Pair</a>></li>
|
||||
<li><a href="../../../../de/dhbwstuttgart/typeinference/UndMenge.html" title="class in de.dhbwstuttgart.typeinference">de.dhbwstuttgart.typeinference.constraints.UndMenge</a><<a href="../../../../de/dhbwstuttgart/typeinference/Pair.html" title="class in de.dhbwstuttgart.typeinference">Pair</a>></li>
|
||||
<li>
|
||||
<ul class="inheritance">
|
||||
<li><a href="../../../../de/dhbwstuttgart/typeinference/ConstraintsSet.html" title="class in de.dhbwstuttgart.typeinference">de.dhbwstuttgart.typeinference.ConstraintsSet</a></li>
|
||||
@ -173,7 +173,7 @@ extends <a href="../../../../de/dhbwstuttgart/typeinference/ConstraintsSet.html"
|
||||
<code><a href="../../../../de/dhbwstuttgart/typeinference/ConstraintsSet.html#add-de.dhbwstuttgart.typeinference.ConstraintsSet-">add</a>, <a href="../../../../de/dhbwstuttgart/typeinference/ConstraintsSet.html#add-de.dhbwstuttgart.typeinference.KomplexeMenge-">add</a>, <a href="../../../../de/dhbwstuttgart/typeinference/ConstraintsSet.html#filterWrongConstraints-de.dhbwstuttgart.typeinference.unify.Unifier-">filterWrongConstraints</a>, <a href="../../../../de/dhbwstuttgart/typeinference/ConstraintsSet.html#unifyUndConstraints-de.dhbwstuttgart.typeinference.unify.Unifier-">unifyUndConstraints</a></code></li>
|
||||
</ul>
|
||||
<ul class="blockList">
|
||||
<li class="blockList"><a name="methods.inherited.from.class.de.dhbwstuttgart.typeinference.UndMenge">
|
||||
<li class="blockList"><a name="methods.inherited.from.class.de.dhbwstuttgart.typeinference.constraints.UndMenge">
|
||||
<!-- -->
|
||||
</a>
|
||||
<h3>Methods inherited from class de.dhbwstuttgart.typeinference.<a href="../../../../de/dhbwstuttgart/typeinference/UndMenge.html" title="class in de.dhbwstuttgart.typeinference">UndMenge</a></h3>
|
||||
|
@ -2,14 +2,19 @@ package de.dhbwstuttgart.core;
|
||||
|
||||
import de.dhbwstuttgart.parser.JavaTXParser;
|
||||
import de.dhbwstuttgart.syntaxtree.SourceFile;
|
||||
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
|
||||
import de.dhbwstuttgart.typeinference.ConstraintSet;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceInformation;
|
||||
import de.dhbwstuttgart.syntaxtree.factory.UnifyTypeFactory;
|
||||
import de.dhbwstuttgart.typeinference.constraints.Constraint;
|
||||
import de.dhbwstuttgart.typeinference.constraints.ConstraintSet;
|
||||
import de.dhbwstuttgart.typeinference.unify.TypeUnify;
|
||||
import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.UnifyPair;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class JavaTXCompiler {
|
||||
|
||||
@ -20,7 +25,14 @@ public class JavaTXCompiler {
|
||||
for(SourceFile sf : sourceFiles){
|
||||
cons.addAll(sf.getConstraints(sf.getTypeInferenceInformation(sourceFiles)));
|
||||
}
|
||||
System.out.println(cons);
|
||||
ConstraintSet<UnifyPair> unifyCons = UnifyTypeFactory.convert(cons);
|
||||
/*
|
||||
TypeUnify unify = new TypeUnify();
|
||||
for(List<Constraint<UnifyPair>> xCons : unifyCons.cartesianProduct()){
|
||||
IFiniteClosure finiteClosure;
|
||||
unify.unify(Arrays.asList(, finiteClosure);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
public void parse(File sourceFile) throws IOException, ClassNotFoundException {
|
||||
|
@ -8,9 +8,8 @@ import de.dhbwstuttgart.syntaxtree.operator.OrOp;
|
||||
import de.dhbwstuttgart.syntaxtree.statement.*;
|
||||
import de.dhbwstuttgart.syntaxtree.statement.literal.*;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
|
||||
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
||||
import de.dhbwstuttgart.typecheck.JavaClassName;
|
||||
import de.dhbwstuttgart.typecheck.JavaClassRegistry;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
import org.antlr.v4.runtime.tree.TerminalNode;
|
||||
@ -36,7 +35,7 @@ public class StatementGenerator {
|
||||
Java8Parser.MethodHeaderContext header = methodDeclarationContext.methodHeader();
|
||||
String name = header.methodDeclarator().Identifier().getText();
|
||||
|
||||
RefTypeOrTPH retType;
|
||||
RefTypeOrTPHOrWildcardOrGeneric retType;
|
||||
if(header.result() != null){
|
||||
if(header.result().unannType() != null){
|
||||
retType = TypeGenerator.convert(header.result().unannType(), reg);
|
||||
@ -78,7 +77,7 @@ public class StatementGenerator {
|
||||
|
||||
for(Java8Parser.FormalParameterContext fp : fps){
|
||||
String paramName = SyntaxTreeGenerator.convert(fp.variableDeclaratorId());
|
||||
RefTypeOrTPH type;
|
||||
RefTypeOrTPHOrWildcardOrGeneric type;
|
||||
if(fp.unannType() != null){
|
||||
type = TypeGenerator.convert(fp.unannType(), reg);
|
||||
}else{
|
||||
@ -418,7 +417,7 @@ public class StatementGenerator {
|
||||
if(declaration.variableModifier() != null && declaration.variableModifier().size() > 0){
|
||||
//TODO
|
||||
}
|
||||
RefTypeOrTPH type;
|
||||
RefTypeOrTPHOrWildcardOrGeneric type;
|
||||
if(declaration.unannType()==null){
|
||||
type = TypePlaceholder.fresh(declaration.getStart());
|
||||
}else{
|
||||
|
@ -1,14 +1,11 @@
|
||||
package de.dhbwstuttgart.parser.SyntaxTreeGenerator;
|
||||
|
||||
import de.dhbwstuttgart.parser.InvalidClassNameException;
|
||||
import de.dhbwstuttgart.parser.NullToken;
|
||||
import de.dhbwstuttgart.parser.PackageCrawler;
|
||||
import de.dhbwstuttgart.parser.antlr.Java8Parser;
|
||||
import de.dhbwstuttgart.syntaxtree.*;
|
||||
import de.dhbwstuttgart.syntaxtree.statement.*;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH;
|
||||
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
|
||||
import de.dhbwstuttgart.typecheck.*;
|
||||
|
||||
import java.lang.reflect.Modifier;
|
||||
@ -19,8 +16,6 @@ import java.util.List;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
import org.antlr.v4.runtime.tree.TerminalNode;
|
||||
|
||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||
|
||||
public class SyntaxTreeGenerator{
|
||||
private JavaClassRegistry reg;
|
||||
private String pkgName = "";
|
||||
@ -204,9 +199,9 @@ public class SyntaxTreeGenerator{
|
||||
List<Method> methods = convertMethods(ctx.classBody());
|
||||
GenericDeclarationList genericClassParameters = null;
|
||||
Token offset = ctx.getStart();
|
||||
RefTypeOrTPH superClass = null;
|
||||
RefTypeOrTPHOrWildcardOrGeneric superClass = null;
|
||||
Boolean isInterface = false;
|
||||
List<RefTypeOrTPH> implementedInterfaces = null;
|
||||
List<RefTypeOrTPHOrWildcardOrGeneric> implementedInterfaces = null;
|
||||
return new ClassOrInterface(modifiers, name, fielddecl, methods, genericClassParameters, superClass, isInterface, implementedInterfaces, offset);
|
||||
}
|
||||
|
||||
@ -255,7 +250,7 @@ public class SyntaxTreeGenerator{
|
||||
for(Java8Parser.FieldModifierContext fieldModifierContext : fieldDeclarationContext.fieldModifier()){
|
||||
modifiers+=(convert(fieldModifierContext));
|
||||
}
|
||||
RefTypeOrTPH fieldType = TypeGenerator.convert(fieldDeclarationContext.unannType(), reg);
|
||||
RefTypeOrTPHOrWildcardOrGeneric fieldType = TypeGenerator.convert(fieldDeclarationContext.unannType(), reg);
|
||||
for(Java8Parser.VariableDeclaratorContext varCtx : fieldDeclarationContext.variableDeclaratorList().variableDeclarator()){
|
||||
String fieldName = convert(varCtx.variableDeclaratorId());
|
||||
if(varCtx.variableInitializer() != null){
|
||||
|
@ -3,20 +3,20 @@ package de.dhbwstuttgart.parser.SyntaxTreeGenerator;
|
||||
import de.dhbwstuttgart.parser.antlr.Java8Parser;
|
||||
import de.dhbwstuttgart.syntaxtree.GenericDeclarationList;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
|
||||
import de.dhbwstuttgart.typecheck.JavaClassName;
|
||||
import de.dhbwstuttgart.typecheck.JavaClassRegistry;
|
||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||
|
||||
public class TypeGenerator {
|
||||
|
||||
public static RefTypeOrTPH convert(Java8Parser.UnannClassOrInterfaceTypeContext unannClassOrInterfaceTypeContext, JavaClassRegistry reg) {
|
||||
public static RefTypeOrTPHOrWildcardOrGeneric convert(Java8Parser.UnannClassOrInterfaceTypeContext unannClassOrInterfaceTypeContext, JavaClassRegistry reg) {
|
||||
String name = unannClassOrInterfaceTypeContext.getText();
|
||||
|
||||
return new RefType(reg.getName(name), unannClassOrInterfaceTypeContext.getStart());
|
||||
}
|
||||
|
||||
public static RefTypeOrTPH convert(Java8Parser.UnannTypeContext unannTypeContext, JavaClassRegistry reg) {
|
||||
public static RefTypeOrTPHOrWildcardOrGeneric convert(Java8Parser.UnannTypeContext unannTypeContext, JavaClassRegistry reg) {
|
||||
if(unannTypeContext.unannPrimitiveType()!=null){
|
||||
throw new NotImplementedException();
|
||||
}else
|
||||
|
@ -3,8 +3,8 @@ package de.dhbwstuttgart.syntaxtree;
|
||||
import de.dhbwstuttgart.core.IItemWithOffset;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
||||
import de.dhbwstuttgart.typecheck.JavaClassName;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH;
|
||||
import de.dhbwstuttgart.typeinference.ConstraintSet;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
|
||||
import de.dhbwstuttgart.typeinference.constraints.ConstraintSet;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceInformation;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
|
||||
@ -21,12 +21,12 @@ public class ClassOrInterface extends GTVDeclarationContext implements IItemWith
|
||||
private List<Method> methods = new ArrayList<>();
|
||||
private GenericDeclarationList genericClassParameters;
|
||||
private Token offset;
|
||||
private RefTypeOrTPH superClass;
|
||||
private RefTypeOrTPHOrWildcardOrGeneric superClass;
|
||||
protected boolean isInterface;
|
||||
private List<? extends RefTypeOrTPH> implementedInterfaces;
|
||||
private List<? extends RefTypeOrTPHOrWildcardOrGeneric> implementedInterfaces;
|
||||
|
||||
public ClassOrInterface(int modifiers, JavaClassName name, List<Field> fielddecl, List<Method> methods, GenericDeclarationList genericClassParameters,
|
||||
RefTypeOrTPH superClass, Boolean isInterface, List<? extends RefTypeOrTPH> implementedInterfaces, Token offset){
|
||||
RefTypeOrTPHOrWildcardOrGeneric superClass, Boolean isInterface, List<? extends RefTypeOrTPHOrWildcardOrGeneric> implementedInterfaces, Token offset){
|
||||
super(offset);
|
||||
this.modifiers = modifiers;
|
||||
if(name != null){
|
||||
@ -69,7 +69,7 @@ public class ClassOrInterface extends GTVDeclarationContext implements IItemWith
|
||||
public ConstraintSet getConstraints(TypeInferenceInformation info) {
|
||||
ConstraintSet ret = new ConstraintSet();
|
||||
for(Method m : this.getMethods()){
|
||||
m.getConstraints(info);
|
||||
ret.addAll(m.getConstraints(info));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -77,4 +77,8 @@ public class ClassOrInterface extends GTVDeclarationContext implements IItemWith
|
||||
public RefType getType() {
|
||||
return new RefType(this.getClassName(), this.getOffset());
|
||||
}
|
||||
|
||||
public RefTypeOrTPHOrWildcardOrGeneric getSuperClass() {
|
||||
return superClass;
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,14 @@
|
||||
package de.dhbwstuttgart.syntaxtree;
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.statement.Block;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Constructor extends Method {
|
||||
|
||||
|
||||
public Constructor(String name, RefTypeOrTPH returnType, int modifiers, ParameterList parameterList, Block block, GenericDeclarationList gtvDeclarations, Token offset) {
|
||||
public Constructor(String name, RefTypeOrTPHOrWildcardOrGeneric returnType, int modifiers, ParameterList parameterList, Block block, GenericDeclarationList gtvDeclarations, Token offset) {
|
||||
super(name, returnType, modifiers, parameterList, block, gtvDeclarations, offset);
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,14 @@
|
||||
package de.dhbwstuttgart.syntaxtree;
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ExceptionList
|
||||
{
|
||||
private List<RefTypeOrTPH> exceptions;
|
||||
private List<RefTypeOrTPHOrWildcardOrGeneric> exceptions;
|
||||
|
||||
public ExceptionList(List<RefTypeOrTPH> exceptions){
|
||||
public ExceptionList(List<RefTypeOrTPHOrWildcardOrGeneric> exceptions){
|
||||
this.exceptions = exceptions;
|
||||
}
|
||||
}
|
||||
|
@ -1,19 +1,17 @@
|
||||
package de.dhbwstuttgart.syntaxtree;
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Field extends GTVDeclarationContext implements Generic {
|
||||
|
||||
private String name;
|
||||
private RefTypeOrTPH type;
|
||||
private RefTypeOrTPHOrWildcardOrGeneric type;
|
||||
|
||||
|
||||
private GenericDeclarationList genericParameters;
|
||||
|
||||
public Field(String name, RefTypeOrTPH type, int modifier, Token offset){
|
||||
public Field(String name, RefTypeOrTPHOrWildcardOrGeneric type, int modifier, Token offset){
|
||||
super(offset);
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
@ -23,7 +21,7 @@ public class Field extends GTVDeclarationContext implements Generic {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public RefTypeOrTPH getType() {
|
||||
public RefTypeOrTPHOrWildcardOrGeneric getType() {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
@ -3,9 +3,7 @@ package de.dhbwstuttgart.syntaxtree;
|
||||
import de.dhbwstuttgart.syntaxtree.statement.Expression;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH;
|
||||
|
||||
import java.util.List;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
|
||||
|
||||
/**
|
||||
* Eine Feldinitialisation steht für eine Felddeklaration mit gleichzeitiger Wertzuweisung
|
||||
@ -21,7 +19,7 @@ public class FieldDeclaration extends Field{
|
||||
* 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, RefTypeOrTPH typ, int modifier, Expression value, Token offset){
|
||||
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;
|
||||
}
|
||||
|
@ -1,20 +1,20 @@
|
||||
package de.dhbwstuttgart.syntaxtree;
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
|
||||
public class FormalParameter extends SyntaxTreeNode
|
||||
{
|
||||
private RefTypeOrTPH type;
|
||||
private RefTypeOrTPHOrWildcardOrGeneric type;
|
||||
private String name;
|
||||
|
||||
public FormalParameter(String name, RefTypeOrTPH type, Token offset){
|
||||
public FormalParameter(String name, RefTypeOrTPHOrWildcardOrGeneric type, Token offset){
|
||||
super(offset);
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public RefTypeOrTPH getType() {
|
||||
public RefTypeOrTPHOrWildcardOrGeneric getType() {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package de.dhbwstuttgart.syntaxtree;
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -21,15 +21,15 @@ public class GenericTypeVar extends SyntaxTreeNode
|
||||
/**
|
||||
* Hier sind die Bounds in Form von Type-Objekten abgespeichert
|
||||
*/
|
||||
List<? extends RefTypeOrTPH> bounds=new ArrayList<RefTypeOrTPH>();
|
||||
List<? extends RefTypeOrTPHOrWildcardOrGeneric> bounds=new ArrayList<RefTypeOrTPHOrWildcardOrGeneric>();
|
||||
private Token endOffset;
|
||||
private String name;
|
||||
|
||||
public GenericTypeVar(String s, List<? extends RefTypeOrTPH> bounds, Token offset, Token endOffset)
|
||||
public GenericTypeVar(String s, List<? extends RefTypeOrTPHOrWildcardOrGeneric> bounds, Token offset, Token endOffset)
|
||||
{
|
||||
super(offset);
|
||||
name = s;
|
||||
if(bounds != null)for(RefTypeOrTPH t : bounds){
|
||||
if(bounds != null)for(RefTypeOrTPHOrWildcardOrGeneric t : bounds){
|
||||
//if(t!=null)this.extendVars.add(t);
|
||||
}
|
||||
//this.genericTypeVar = new RefType(s,offset);
|
||||
@ -37,7 +37,7 @@ public class GenericTypeVar extends SyntaxTreeNode
|
||||
this.endOffset = endOffset;
|
||||
}
|
||||
|
||||
public List<? extends RefTypeOrTPH> getBounds()
|
||||
public List<? extends RefTypeOrTPHOrWildcardOrGeneric> getBounds()
|
||||
{
|
||||
return bounds;
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
package de.dhbwstuttgart.syntaxtree;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import de.dhbwstuttgart.parser.NullToken;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH;
|
||||
import de.dhbwstuttgart.typeinference.ConstraintSet;
|
||||
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;
|
||||
|
||||
@ -26,7 +26,7 @@ public class Method extends Field implements IItemWithOffset
|
||||
private ParameterList parameterlist = new ParameterList(new ArrayList<>(), new NullToken());
|
||||
private ExceptionList exceptionlist;
|
||||
|
||||
public Method(String name, RefTypeOrTPH returnType, int modifiers, ParameterList parameterList, Block block,
|
||||
public Method(String name, RefTypeOrTPHOrWildcardOrGeneric returnType, int modifiers, ParameterList parameterList, Block block,
|
||||
GenericDeclarationList gtvDeclarations, Token offset) {
|
||||
super(name, returnType, modifiers, offset);
|
||||
this.parameterlist = parameterList;
|
||||
@ -35,8 +35,7 @@ public class Method extends Field implements IItemWithOffset
|
||||
|
||||
public ConstraintSet getConstraints(TypeInferenceInformation info) {
|
||||
ConstraintSet ret = new ConstraintSet();
|
||||
info.setMethodContext(this);
|
||||
ret.addAll(block.getConstraints(info));
|
||||
ret.addAll(block.getConstraints(new TypeInferenceBlockInformation(info.getAvailableClasses(), this)));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ import java.util.*;
|
||||
|
||||
import de.dhbwstuttgart.parser.NullToken;
|
||||
import de.dhbwstuttgart.typecheck.JavaClassName;
|
||||
import de.dhbwstuttgart.typeinference.ConstraintSet;
|
||||
import de.dhbwstuttgart.typeinference.constraints.ConstraintSet;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceInformation;
|
||||
|
||||
|
||||
|
@ -8,8 +8,8 @@ import java.util.List;
|
||||
import de.dhbwstuttgart.parser.NullToken;
|
||||
import de.dhbwstuttgart.syntaxtree.Field;
|
||||
import de.dhbwstuttgart.syntaxtree.Method;
|
||||
import de.dhbwstuttgart.syntaxtree.type.GenericRefType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH;
|
||||
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
|
||||
import de.dhbwstuttgart.typecheck.GenericTypeName;
|
||||
import de.dhbwstuttgart.typecheck.JavaClassName;
|
||||
import de.dhbwstuttgart.typecheck.JavaClassRegistry;
|
||||
@ -19,7 +19,6 @@ import de.dhbwstuttgart.syntaxtree.statement.Statement;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||
import sun.reflect.generics.reflectiveObjects.TypeVariableImpl;
|
||||
|
||||
/**
|
||||
* Anmerkung:
|
||||
@ -49,13 +48,13 @@ public class ASTFactory {
|
||||
java.lang.Class superjreClass = jreClass.getSuperclass();
|
||||
RefType superClass;
|
||||
if(superjreClass != null){
|
||||
superClass = createType(superjreClass);
|
||||
superClass = (RefType) createType(superjreClass);
|
||||
}else{//Jede Klasse und jedes Interface erbt von Object: (auch Object selbst!)
|
||||
superClass = createType(java.lang.Object.class);
|
||||
superClass = (RefType) createType(java.lang.Object.class);
|
||||
}
|
||||
List<RefType> implementedInterfaces = new ArrayList<>();
|
||||
for(java.lang.Class jreInterface : jreClass.getInterfaces()){
|
||||
implementedInterfaces.add(createType(jreInterface));
|
||||
implementedInterfaces.add((RefType) createType(jreInterface));
|
||||
}
|
||||
GenericDeclarationList genericDeclarationList = createGenerics(jreClass.getTypeParameters(), jreClass, null);
|
||||
|
||||
@ -69,11 +68,11 @@ public class ASTFactory {
|
||||
|
||||
public Method createMethod(java.lang.reflect.Method jreMethod, java.lang.Class inClass){
|
||||
String name = jreMethod.getName();
|
||||
RefType returnType = createType(jreMethod.getReturnType());
|
||||
RefTypeOrTPHOrWildcardOrGeneric returnType = createType(jreMethod.getReturnType());
|
||||
Parameter[] jreParams = jreMethod.getParameters();
|
||||
List<FormalParameter> params = new ArrayList<>();
|
||||
for(Parameter jreParam : jreParams){
|
||||
RefType paramType = createType(jreParam.getType());
|
||||
RefTypeOrTPHOrWildcardOrGeneric paramType = createType(jreParam.getType());
|
||||
params.add(new FormalParameter(jreParam.getName(),paramType, new NullToken()));
|
||||
}
|
||||
ParameterList parameterList = new ParameterList(params, new NullToken());
|
||||
@ -86,9 +85,9 @@ public class ASTFactory {
|
||||
}
|
||||
|
||||
public GenericDeclarationList createGenerics(TypeVariable[] typeParameters, Class context, java.lang.reflect.Method contextM){
|
||||
List<GenericTypeVar> gtvs = new ArrayList<>();
|
||||
List<de.dhbwstuttgart.syntaxtree.GenericTypeVar> gtvs = new ArrayList<>();
|
||||
for(TypeVariable jreTV : typeParameters){
|
||||
GenericTypeVar gtv = createGeneric(jreTV, jreTV.getName());
|
||||
de.dhbwstuttgart.syntaxtree.GenericTypeVar gtv = createGeneric(jreTV, jreTV.getName());
|
||||
gtvs.add(gtv);
|
||||
}
|
||||
return new GenericDeclarationList(gtvs,new NullToken());
|
||||
@ -105,13 +104,13 @@ public class ASTFactory {
|
||||
}
|
||||
*/
|
||||
|
||||
public RefType createType(java.lang.reflect.Type type){
|
||||
public RefTypeOrTPHOrWildcardOrGeneric createType(java.lang.reflect.Type type){
|
||||
if(type instanceof TypeVariable){
|
||||
//GTVDeclarationContext via "(TypeVariable) type).getGenericDeclaration()"
|
||||
return new GenericRefType(new GenericTypeName(type.getTypeName(),
|
||||
return new GenericTypeVar(new GenericTypeName(type.getTypeName(),
|
||||
new GTVDeclarationContext(new NullToken()) {}), new NullToken());
|
||||
}
|
||||
List<RefTypeOrTPH> params = new ArrayList<>();
|
||||
List<RefTypeOrTPHOrWildcardOrGeneric> params = new ArrayList<>();
|
||||
if(type instanceof ParameterizedType){
|
||||
for(Type t : ((ParameterizedType)type).getActualTypeArguments()){
|
||||
params.add(createType(t));
|
||||
@ -121,15 +120,15 @@ public class ASTFactory {
|
||||
return ret;
|
||||
}
|
||||
|
||||
public GenericTypeVar createGeneric(TypeVariable jreTypeVar, String name){
|
||||
public de.dhbwstuttgart.syntaxtree.GenericTypeVar createGeneric(TypeVariable jreTypeVar, String name){
|
||||
List<RefType> 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));
|
||||
genericBounds.add((RefType) createType(bound));
|
||||
}
|
||||
}
|
||||
return new GenericTypeVar(name, genericBounds, new NullToken(), new NullToken());
|
||||
return new de.dhbwstuttgart.syntaxtree.GenericTypeVar(name, genericBounds, new NullToken(), new NullToken());
|
||||
}
|
||||
|
||||
public ClassOrInterface createObjectClass() {
|
||||
|
182
src/de/dhbwstuttgart/syntaxtree/factory/UnifyTypeFactory.java
Normal file
182
src/de/dhbwstuttgart/syntaxtree/factory/UnifyTypeFactory.java
Normal file
@ -0,0 +1,182 @@
|
||||
package de.dhbwstuttgart.syntaxtree.factory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import de.dhbwstuttgart.exceptions.NotImplementedException;
|
||||
import de.dhbwstuttgart.syntaxtree.ClassOrInterface;
|
||||
import de.dhbwstuttgart.syntaxtree.type.*;
|
||||
import de.dhbwstuttgart.typeinference.constraints.ConstraintSet;
|
||||
import de.dhbwstuttgart.typeinference.constraints.Pair;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.ExtendsType;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.FiniteClosure;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.FunNType;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.UnifyPair;
|
||||
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.UnifyType;
|
||||
|
||||
|
||||
public class UnifyTypeFactory {
|
||||
|
||||
public static FiniteClosure generateFC(List<ClassOrInterface> fromAvailableClasses){
|
||||
HashSet<UnifyPair> pairs = new HashSet<>();
|
||||
for(ClassOrInterface cl : fromAvailableClasses){
|
||||
UnifyType t1 = UnifyTypeFactory.convert(cl.getType());
|
||||
UnifyType t2 = UnifyTypeFactory.convert(cl.getSuperClass());
|
||||
pairs.add(generateSmallerPair(t1, t2));
|
||||
}
|
||||
return new FiniteClosure(pairs);
|
||||
}
|
||||
|
||||
public static UnifyPair generateSmallerPair(UnifyType tl, UnifyType tr){
|
||||
return new UnifyPair(tl, tr, PairOperator.SMALLER);
|
||||
}
|
||||
|
||||
public static UnifyPair generateSmallerDotPair(UnifyType tl, UnifyType tr){
|
||||
return new UnifyPair(tl, tr, PairOperator.SMALLERDOT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert from
|
||||
* ASTType -> UnifyType
|
||||
*/
|
||||
public static UnifyType convert(RefTypeOrTPHOrWildcardOrGeneric t){
|
||||
if(t instanceof GenericTypeVar){
|
||||
return UnifyTypeFactory.convert((GenericTypeVar)t);
|
||||
}else
|
||||
if(t instanceof FunN){
|
||||
return UnifyTypeFactory.convert((FunN)t);
|
||||
}else if(t instanceof TypePlaceholder){
|
||||
return UnifyTypeFactory.convert((TypePlaceholder)t);
|
||||
}else if(t instanceof ExtendsWildcardType){
|
||||
return UnifyTypeFactory.convert((ExtendsWildcardType)t);
|
||||
}else if(t instanceof SuperWildcardType){
|
||||
return UnifyTypeFactory.convert((SuperWildcardType)t);
|
||||
}else if(t instanceof RefType){
|
||||
return UnifyTypeFactory.convert((RefType)t);
|
||||
}
|
||||
//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){
|
||||
UnifyType ret;
|
||||
if(t.getParaList() != null && t.getParaList().size() > 0){
|
||||
List<UnifyType> params = new ArrayList<>();
|
||||
for(RefTypeOrTPHOrWildcardOrGeneric pT : t.getParaList()){
|
||||
params.add(UnifyTypeFactory.convert(pT));
|
||||
}
|
||||
ret = new ReferenceType(t.getName().toString(),new TypeParams(params));
|
||||
}else{
|
||||
ret = new ReferenceType(t.getName().toString());
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static UnifyType convert(FunN t){
|
||||
UnifyType ret;
|
||||
List<UnifyType> params = new ArrayList<>();
|
||||
if(t.getParaList() != null && t.getParaList().size() > 0){
|
||||
for(RefTypeOrTPHOrWildcardOrGeneric pT : t.getParaList()){
|
||||
params.add(UnifyTypeFactory.convert(pT));
|
||||
}
|
||||
}
|
||||
ret = FunNType.getFunNType(new TypeParams(params));
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static UnifyType convert(TypePlaceholder tph){
|
||||
return new PlaceholderType(tph.getName());
|
||||
}
|
||||
|
||||
public static UnifyType convert(GenericTypeVar t){
|
||||
return new PlaceholderType(TypePlaceholder.fresh(t.getOffset()).getName());
|
||||
}
|
||||
|
||||
public static UnifyType convert(WildcardType t){
|
||||
if(t.isExtends())
|
||||
return new ExtendsType(UnifyTypeFactory.convert(t.getInnerType()));
|
||||
else if(t.isSuper())
|
||||
return new SuperType(UnifyTypeFactory.convert(t.getInnerType()));
|
||||
else throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
public static ConstraintSet<UnifyPair> convert(ConstraintSet<Pair> constraints) {
|
||||
return constraints.map(UnifyTypeFactory::convert);
|
||||
}
|
||||
|
||||
public static UnifyPair convert(Pair p) {
|
||||
if(!p.OperatorSmaller())throw new NotImplementedException();
|
||||
UnifyPair ret = generateSmallerDotPair(UnifyTypeFactory.convert(p.TA1)
|
||||
, UnifyTypeFactory.convert(p.TA2));
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert from
|
||||
* UnifyType -> ASTType
|
||||
*/
|
||||
/*
|
||||
public static Pair convert(UnifyPair mp) {
|
||||
Type tl = UnifyTypeFactory.convert(mp.getLhsType());
|
||||
Type tr = UnifyTypeFactory.convert(mp.getRhsType());
|
||||
return new Pair(tl, tr, mp.getPairOp());
|
||||
}
|
||||
|
||||
public static Type convert(ReferenceType t) {
|
||||
//TODO: Hier kann man die GTVs extrahieren
|
||||
if(t.getName().toString().equals(Void.VOID_NAME))return new Void( 0);
|
||||
RefType ret = new RefType(t.getName(),0);
|
||||
ret.set_ParaList(convert(t.getTypeParams()));
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static Type convert(FunNType t) {
|
||||
RefType ret = new RefType(t.getName(),0);
|
||||
ret.set_ParaList(convert(t.getTypeParams()));
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static Type convert(SuperType t) {
|
||||
RefType innerType = new RefType(t.getSuperedType().getName(),0);
|
||||
return new SuperWildcardType(innerType);
|
||||
}
|
||||
|
||||
public static Type convert(ExtendsType t) {
|
||||
RefType innerType = new RefType(t.getExtendedType().getName(),0);
|
||||
return new ExtendsWildcardType(innerType);
|
||||
}
|
||||
|
||||
public static Type convert(PlaceholderType t) {
|
||||
TypePlaceholder ret = TypePlaceholder.getInstance(t.getName());
|
||||
if(ret == null){ //Dieser TPH wurde vom Unifikationsalgorithmus erstellt
|
||||
ret = TypePlaceholder.fresh(t.getName(), NULL_NODE);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static Type convert(UnifyType t) {
|
||||
if(t instanceof FunNType)return convert((FunNType) t);
|
||||
if(t instanceof ReferenceType)return convert((ReferenceType) t);
|
||||
if(t instanceof SuperType)return convert((SuperType) t);
|
||||
if(t instanceof ExtendsType)return convert((ExtendsType) t);
|
||||
if(t instanceof PlaceholderType)return convert((PlaceholderType) t);
|
||||
throw new NotImplementedException("Der Typ "+t+" kann nicht umgewandelt werden");
|
||||
}
|
||||
|
||||
private static List<Type> convert(TypeParams typeParams) {
|
||||
List<Type> ret = new ArrayList<>();
|
||||
for(UnifyType uT : typeParams){
|
||||
Type toAdd = convert(uT);
|
||||
ret.add(toAdd);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
*/
|
||||
}
|
@ -1,8 +1,9 @@
|
||||
|
||||
package de.dhbwstuttgart.syntaxtree.statement;
|
||||
|
||||
import de.dhbwstuttgart.typeinference.ConstraintSet;
|
||||
import de.dhbwstuttgart.typeinference.Pair;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceBlockInformation;
|
||||
import de.dhbwstuttgart.typeinference.constraints.ConstraintSet;
|
||||
import de.dhbwstuttgart.typeinference.constraints.Pair;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceInformation;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
|
||||
@ -19,10 +20,10 @@ public class Assign extends Statement
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConstraintSet getConstraints(TypeInferenceInformation info) {
|
||||
public ConstraintSet getConstraints(TypeInferenceBlockInformation info) {
|
||||
ConstraintSet ret = lefSide.getConstraints(info);
|
||||
ret.addAll(rightSide.getConstraints(info));
|
||||
ret.add(new Pair(rightSide.getType(), lefSide.getType()));
|
||||
ret.addUndConstraint(new Pair(rightSide.getType(), lefSide.getType()));
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package de.dhbwstuttgart.syntaxtree.statement;
|
||||
|
||||
import de.dhbwstuttgart.typeinference.ConstraintSet;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceBlockInformation;
|
||||
import de.dhbwstuttgart.typeinference.constraints.ConstraintSet;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceInformation;
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.operator.Operator;
|
||||
@ -15,7 +16,7 @@ public class Binary extends Expression
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConstraintSet getConstraints(TypeInferenceInformation info) {
|
||||
public ConstraintSet getConstraints(TypeInferenceBlockInformation info) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,16 @@
|
||||
package de.dhbwstuttgart.syntaxtree.statement;
|
||||
import java.util.*;
|
||||
|
||||
import de.dhbwstuttgart.typeinference.ConstraintSet;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceInformation;
|
||||
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceBlockInformation;
|
||||
import de.dhbwstuttgart.typeinference.constraints.ConstraintSet;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
|
||||
|
||||
public class Block extends Statement
|
||||
{
|
||||
public Block(List<Statement> statements, Token offset) {
|
||||
super(null, offset);
|
||||
super(TypePlaceholder.fresh(offset), offset);
|
||||
this.statements = statements;
|
||||
}
|
||||
|
||||
@ -23,7 +24,7 @@ public class Block extends Statement
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConstraintSet getConstraints(TypeInferenceInformation info) {
|
||||
public ConstraintSet getConstraints(TypeInferenceBlockInformation info) {
|
||||
ConstraintSet ret = new ConstraintSet();
|
||||
for(Statement stmt : getStatements()){
|
||||
ret.addAll(stmt.getConstraints(info));
|
||||
|
@ -1,14 +1,14 @@
|
||||
package de.dhbwstuttgart.syntaxtree.statement;
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH;
|
||||
import de.dhbwstuttgart.typeinference.ConstraintSet;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceInformation;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceBlockInformation;
|
||||
import de.dhbwstuttgart.typeinference.constraints.ConstraintSet;
|
||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||
|
||||
|
||||
public class CastExpr extends Expression
|
||||
{
|
||||
public CastExpr(RefTypeOrTPH castType, Expression expr, int offset)
|
||||
public CastExpr(RefTypeOrTPHOrWildcardOrGeneric castType, Expression expr, int offset)
|
||||
{
|
||||
super(null, null);
|
||||
}
|
||||
@ -16,7 +16,7 @@ public class CastExpr extends Expression
|
||||
public Expression expr;
|
||||
|
||||
@Override
|
||||
public ConstraintSet getConstraints(TypeInferenceInformation info) {
|
||||
public ConstraintSet getConstraints(TypeInferenceBlockInformation info) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package de.dhbwstuttgart.syntaxtree.statement;
|
||||
|
||||
import de.dhbwstuttgart.typeinference.ConstraintSet;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceBlockInformation;
|
||||
import de.dhbwstuttgart.typeinference.constraints.ConstraintSet;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceInformation;
|
||||
|
||||
|
||||
@ -13,7 +14,7 @@ public class EmptyStmt extends Statement
|
||||
|
||||
|
||||
@Override
|
||||
public ConstraintSet getConstraints(TypeInferenceInformation info) {
|
||||
public ConstraintSet getConstraints(TypeInferenceBlockInformation info) {
|
||||
return new ConstraintSet();
|
||||
}
|
||||
}
|
||||
|
@ -2,24 +2,26 @@
|
||||
package de.dhbwstuttgart.syntaxtree.statement;
|
||||
|
||||
|
||||
import com.sun.istack.internal.NotNull;
|
||||
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH;
|
||||
import de.dhbwstuttgart.typeinference.ConstraintSet;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceInformation;
|
||||
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 SyntaxTreeNode
|
||||
{
|
||||
private RefTypeOrTPH type;
|
||||
private RefTypeOrTPHOrWildcardOrGeneric type;
|
||||
|
||||
public Expression(RefTypeOrTPH type, Token offset){
|
||||
public Expression(@NotNull RefTypeOrTPHOrWildcardOrGeneric type, Token offset){
|
||||
super(offset);
|
||||
if(type == null)throw new NullPointerException();
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public RefTypeOrTPH getType(){
|
||||
public RefTypeOrTPHOrWildcardOrGeneric getType(){
|
||||
return type;
|
||||
}
|
||||
|
||||
public abstract ConstraintSet getConstraints(TypeInferenceInformation info);
|
||||
public abstract ConstraintSet getConstraints(TypeInferenceBlockInformation info);
|
||||
}
|
||||
|
@ -1,19 +1,18 @@
|
||||
package de.dhbwstuttgart.syntaxtree.statement;
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH;
|
||||
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
||||
import de.dhbwstuttgart.typeinference.ConstraintSet;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceInformation;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceBlockInformation;
|
||||
import de.dhbwstuttgart.typeinference.constraints.ConstraintSet;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||
|
||||
public class FieldVar extends Expression {
|
||||
public FieldVar(Expression receiver, String fieldVarName, RefTypeOrTPH type, Token offset) {
|
||||
public FieldVar(Expression receiver, String fieldVarName, RefTypeOrTPHOrWildcardOrGeneric type, Token offset) {
|
||||
super(type, offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConstraintSet getConstraints(TypeInferenceInformation info) {
|
||||
public ConstraintSet getConstraints(TypeInferenceBlockInformation info) {
|
||||
//for(FieldAssumption fieldAssumption : info.getFields(fieldVarName)){
|
||||
|
||||
//}
|
||||
|
@ -1,7 +1,8 @@
|
||||
|
||||
package de.dhbwstuttgart.syntaxtree.statement;
|
||||
|
||||
import de.dhbwstuttgart.typeinference.ConstraintSet;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceBlockInformation;
|
||||
import de.dhbwstuttgart.typeinference.constraints.ConstraintSet;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceInformation;
|
||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||
|
||||
@ -23,7 +24,7 @@ public class ForStmt extends Statement
|
||||
|
||||
|
||||
@Override
|
||||
public ConstraintSet getConstraints(TypeInferenceInformation info) {
|
||||
public ConstraintSet getConstraints(TypeInferenceBlockInformation info) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package de.dhbwstuttgart.syntaxtree.statement;
|
||||
|
||||
import de.dhbwstuttgart.typeinference.ConstraintSet;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceBlockInformation;
|
||||
import de.dhbwstuttgart.typeinference.constraints.ConstraintSet;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceInformation;
|
||||
|
||||
|
||||
@ -17,7 +18,7 @@ public class IfStmt extends Statement
|
||||
public Statement else_block;
|
||||
|
||||
@Override
|
||||
public ConstraintSet getConstraints(TypeInferenceInformation info) {
|
||||
public ConstraintSet getConstraints(TypeInferenceBlockInformation info) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package de.dhbwstuttgart.syntaxtree.statement;
|
||||
|
||||
import de.dhbwstuttgart.typeinference.ConstraintSet;
|
||||
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 sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||
@ -16,7 +17,7 @@ public class InstVar extends Expression
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConstraintSet getConstraints(TypeInferenceInformation info) {
|
||||
public ConstraintSet getConstraints(TypeInferenceBlockInformation info) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,15 @@
|
||||
package de.dhbwstuttgart.syntaxtree.statement;
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH;
|
||||
import de.dhbwstuttgart.typeinference.ConstraintSet;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceInformation;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceBlockInformation;
|
||||
import de.dhbwstuttgart.typeinference.constraints.ConstraintSet;
|
||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||
|
||||
|
||||
public class InstanceOf extends BinaryExpr
|
||||
{
|
||||
public Expression expr;
|
||||
private RefTypeOrTPH reftype;
|
||||
private RefTypeOrTPHOrWildcardOrGeneric reftype;
|
||||
|
||||
public InstanceOf(int offset,int variableLength)
|
||||
{
|
||||
@ -18,7 +18,7 @@ public class InstanceOf extends BinaryExpr
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConstraintSet getConstraints(TypeInferenceInformation info) {
|
||||
public ConstraintSet getConstraints(TypeInferenceBlockInformation info) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,8 @@ package de.dhbwstuttgart.syntaxtree.statement;
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.ParameterList;
|
||||
import de.dhbwstuttgart.syntaxtree.type.FunN;
|
||||
import de.dhbwstuttgart.typeinference.ConstraintSet;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceBlockInformation;
|
||||
import de.dhbwstuttgart.typeinference.constraints.ConstraintSet;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceInformation;
|
||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||
|
||||
@ -30,7 +31,7 @@ public class LambdaExpression extends Expression{
|
||||
|
||||
|
||||
@Override
|
||||
public ConstraintSet getConstraints(TypeInferenceInformation info) {
|
||||
public ConstraintSet getConstraints(TypeInferenceBlockInformation info) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
package de.dhbwstuttgart.syntaxtree.statement;
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
||||
import de.dhbwstuttgart.typeinference.ConstraintSet;
|
||||
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 sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||
|
||||
public class LocalVar extends Statement{
|
||||
|
||||
@ -23,7 +23,7 @@ public class LocalVar extends Statement{
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConstraintSet getConstraints(TypeInferenceInformation info) {
|
||||
public ConstraintSet getConstraints(TypeInferenceBlockInformation info) {
|
||||
return new ConstraintSet();
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
package de.dhbwstuttgart.syntaxtree.statement;
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.type.Void;
|
||||
import de.dhbwstuttgart.typeinference.ConstraintSet;
|
||||
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 sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||
@ -14,7 +15,7 @@ public class LocalVarBunchDeclaration extends Statement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConstraintSet getConstraints(TypeInferenceInformation info) {
|
||||
public ConstraintSet getConstraints(TypeInferenceBlockInformation info) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
package de.dhbwstuttgart.syntaxtree.statement;
|
||||
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH;
|
||||
import de.dhbwstuttgart.typeinference.ConstraintSet;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceInformation;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceBlockInformation;
|
||||
import de.dhbwstuttgart.typeinference.constraints.ConstraintSet;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||
|
||||
@ -12,14 +12,14 @@ public class LocalVarDecl extends Statement
|
||||
|
||||
private String name;
|
||||
|
||||
public LocalVarDecl(String name, RefTypeOrTPH type, Token offset)
|
||||
public LocalVarDecl(String name, RefTypeOrTPHOrWildcardOrGeneric type, Token offset)
|
||||
{
|
||||
super(type, offset);
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConstraintSet getConstraints(TypeInferenceInformation info) {
|
||||
public ConstraintSet getConstraints(TypeInferenceBlockInformation info) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,18 @@
|
||||
package de.dhbwstuttgart.syntaxtree.statement;
|
||||
|
||||
import de.dhbwstuttgart.typeinference.ConstraintSet;
|
||||
import de.dhbwstuttgart.typeinference.OderConstraint;
|
||||
import de.dhbwstuttgart.typeinference.Pair;
|
||||
import de.dhbwstuttgart.typeinference.UndConstraint;
|
||||
import de.dhbwstuttgart.exceptions.TypeinferenceException;
|
||||
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.assumptions.TypeInferenceInformation;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.MethodAssumption;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
public class MethodCall extends Statement
|
||||
@ -26,21 +29,24 @@ public class MethodCall extends Statement
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConstraintSet getConstraints(TypeInferenceInformation info) {
|
||||
public ConstraintSet getConstraints(TypeInferenceBlockInformation info) {
|
||||
ConstraintSet ret = receiver.getConstraints(info);
|
||||
//Overloading:
|
||||
OderConstraint overloading = new OderConstraint();
|
||||
Set<Constraint> methodConstraints = new HashSet<>();
|
||||
for(MethodAssumption m : info.getMethods(name, arglist)){
|
||||
UndConstraint methodConstraints = new UndConstraint();
|
||||
methodConstraints.addConstraint(receiver.getType(), m.getReceiverType());
|
||||
methodConstraints.addConstraint(m.getReturnType(), this.getType());
|
||||
Constraint methodConstraint = new Constraint();
|
||||
methodConstraint.add(new Pair(receiver.getType(), m.getReceiverType()));
|
||||
methodConstraint.add(new Pair(m.getReturnType(), this.getType()));
|
||||
for(int i = 0;i<arglist.getArguments().size();i++){
|
||||
methodConstraints.addConstraint(m.getArgTypes().get(i),
|
||||
arglist.getArguments().get(i).getType());
|
||||
methodConstraint.add(new Pair(m.getArgTypes().get(i),
|
||||
arglist.getArguments().get(i).getType()));
|
||||
}
|
||||
overloading.addConstraint(methodConstraints);
|
||||
methodConstraints.add(methodConstraint);
|
||||
}
|
||||
ret.add(overloading);
|
||||
if(methodConstraints.size()<1){
|
||||
throw new TypeinferenceException("Methode "+name+" ist nicht vorhanden!",getOffset());
|
||||
}
|
||||
ret.addOderConstraint(methodConstraints);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
package de.dhbwstuttgart.syntaxtree.statement;
|
||||
import java.util.List;
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH;
|
||||
import de.dhbwstuttgart.typeinference.ConstraintSet;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceInformation;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceBlockInformation;
|
||||
import de.dhbwstuttgart.typeinference.constraints.ConstraintSet;
|
||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||
|
||||
|
||||
@ -13,12 +13,12 @@ public class NewArray extends Expression
|
||||
{
|
||||
super(null,null);
|
||||
}
|
||||
private RefTypeOrTPH type;
|
||||
private RefTypeOrTPHOrWildcardOrGeneric type;
|
||||
public List<Expression> expr;
|
||||
|
||||
|
||||
@Override
|
||||
public ConstraintSet getConstraints(TypeInferenceInformation info) {
|
||||
public ConstraintSet getConstraints(TypeInferenceBlockInformation info) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
@ -2,9 +2,9 @@ package de.dhbwstuttgart.syntaxtree.statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH;
|
||||
import de.dhbwstuttgart.typeinference.ConstraintSet;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceInformation;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceBlockInformation;
|
||||
import de.dhbwstuttgart.typeinference.constraints.ConstraintSet;
|
||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ public class NewClass extends Statement
|
||||
|
||||
private ArgumentList arglist;
|
||||
private boolean isStatement = false;
|
||||
private List<RefTypeOrTPH> parameterList = new ArrayList<>();
|
||||
private List<RefTypeOrTPHOrWildcardOrGeneric> parameterList = new ArrayList<>();
|
||||
|
||||
|
||||
public ArgumentList getArgumentList()
|
||||
@ -27,7 +27,7 @@ public class NewClass extends Statement
|
||||
|
||||
|
||||
@Override
|
||||
public ConstraintSet getConstraints(TypeInferenceInformation info) {
|
||||
public ConstraintSet getConstraints(TypeInferenceBlockInformation info) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package de.dhbwstuttgart.syntaxtree.statement;
|
||||
|
||||
import de.dhbwstuttgart.typeinference.ConstraintSet;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceBlockInformation;
|
||||
import de.dhbwstuttgart.typeinference.constraints.ConstraintSet;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceInformation;
|
||||
|
||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||
@ -13,7 +14,7 @@ public class PostIncExpr extends UnaryExpr
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConstraintSet getConstraints(TypeInferenceInformation info) {
|
||||
public ConstraintSet getConstraints(TypeInferenceBlockInformation info) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
package de.dhbwstuttgart.syntaxtree.statement;
|
||||
|
||||
|
||||
import de.dhbwstuttgart.typeinference.ConstraintSet;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceBlockInformation;
|
||||
import de.dhbwstuttgart.typeinference.constraints.ConstraintSet;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceInformation;
|
||||
|
||||
public class Receiver extends Expression
|
||||
@ -18,7 +19,7 @@ public class Receiver extends Expression
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConstraintSet getConstraints(TypeInferenceInformation info) {
|
||||
public ConstraintSet getConstraints(TypeInferenceBlockInformation info) {
|
||||
return expr.getConstraints(info);
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,10 @@
|
||||
package de.dhbwstuttgart.syntaxtree.statement;
|
||||
|
||||
import de.dhbwstuttgart.typeinference.ConstraintSet;
|
||||
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 sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||
|
||||
|
||||
public class Return extends Statement
|
||||
{
|
||||
@ -19,7 +18,7 @@ public class Return extends Statement
|
||||
|
||||
|
||||
@Override
|
||||
public ConstraintSet getConstraints(TypeInferenceInformation info) {
|
||||
public ConstraintSet getConstraints(TypeInferenceBlockInformation info) {
|
||||
return retexpr.getConstraints(info);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package de.dhbwstuttgart.syntaxtree.statement;
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@ public abstract class Statement extends Expression
|
||||
{
|
||||
|
||||
|
||||
public Statement(RefTypeOrTPH type, Token offset)
|
||||
public Statement(RefTypeOrTPHOrWildcardOrGeneric type, Token offset)
|
||||
{
|
||||
super(type, offset);
|
||||
}
|
||||
|
@ -2,7 +2,8 @@ package de.dhbwstuttgart.syntaxtree.statement;
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
||||
import de.dhbwstuttgart.typecheck.JavaClassName;
|
||||
import de.dhbwstuttgart.typeinference.ConstraintSet;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceBlockInformation;
|
||||
import de.dhbwstuttgart.typeinference.constraints.ConstraintSet;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceInformation;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
|
||||
@ -12,7 +13,7 @@ public class StaticClassName extends Expression {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConstraintSet getConstraints(TypeInferenceInformation info) {
|
||||
public ConstraintSet getConstraints(TypeInferenceBlockInformation info) {
|
||||
return new ConstraintSet();
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package de.dhbwstuttgart.syntaxtree.statement;
|
||||
|
||||
import de.dhbwstuttgart.typeinference.ConstraintSet;
|
||||
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 sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||
@ -13,7 +14,7 @@ public class Super extends Expression
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConstraintSet getConstraints(TypeInferenceInformation info) {
|
||||
public ConstraintSet getConstraints(TypeInferenceBlockInformation info) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package de.dhbwstuttgart.syntaxtree.statement;
|
||||
|
||||
import de.dhbwstuttgart.typeinference.ConstraintSet;
|
||||
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 sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||
@ -15,7 +16,7 @@ public class This extends Expression
|
||||
public ArgumentList arglist;
|
||||
|
||||
@Override
|
||||
public ConstraintSet getConstraints(TypeInferenceInformation info) {
|
||||
public ConstraintSet getConstraints(TypeInferenceBlockInformation info) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package de.dhbwstuttgart.syntaxtree.statement;
|
||||
|
||||
import de.dhbwstuttgart.typeinference.ConstraintSet;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceBlockInformation;
|
||||
import de.dhbwstuttgart.typeinference.constraints.ConstraintSet;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceInformation;
|
||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||
|
||||
@ -12,7 +13,7 @@ public class UnaryPlus extends Expression
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConstraintSet getConstraints(TypeInferenceInformation info) {
|
||||
public ConstraintSet getConstraints(TypeInferenceBlockInformation info) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
package de.dhbwstuttgart.syntaxtree.statement;
|
||||
|
||||
|
||||
import de.dhbwstuttgart.typeinference.ConstraintSet;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceBlockInformation;
|
||||
import de.dhbwstuttgart.typeinference.constraints.ConstraintSet;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceInformation;
|
||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||
|
||||
@ -26,7 +27,7 @@ public class WhileStmt extends Statement
|
||||
|
||||
|
||||
@Override
|
||||
public ConstraintSet getConstraints(TypeInferenceInformation info) {
|
||||
public ConstraintSet getConstraints(TypeInferenceBlockInformation info) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package de.dhbwstuttgart.syntaxtree.statement.literal;
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.statement.literal.Literal;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
|
||||
|
||||
@ -10,7 +9,7 @@ public class BoolLiteral extends Literal
|
||||
|
||||
private boolean value;
|
||||
|
||||
public BoolLiteral(RefTypeOrTPH type, boolean value, Token offset)
|
||||
public BoolLiteral(RefTypeOrTPHOrWildcardOrGeneric type, boolean value, Token offset)
|
||||
{
|
||||
super(type,offset);
|
||||
this.value = value;
|
||||
|
@ -1,6 +1,5 @@
|
||||
package de.dhbwstuttgart.syntaxtree.statement.literal;
|
||||
import de.dhbwstuttgart.syntaxtree.statement.literal.Literal;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
|
||||
|
||||
@ -8,7 +7,7 @@ public class CharLiteral extends Literal
|
||||
{
|
||||
private char value;
|
||||
|
||||
public CharLiteral(RefTypeOrTPH type, char value, Token offset)
|
||||
public CharLiteral(RefTypeOrTPHOrWildcardOrGeneric type, char value, Token offset)
|
||||
{
|
||||
super(type,offset);
|
||||
this.value = value;
|
||||
|
@ -2,18 +2,18 @@ package de.dhbwstuttgart.syntaxtree.statement.literal;
|
||||
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.statement.Expression;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH;
|
||||
import de.dhbwstuttgart.typeinference.ConstraintSet;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceInformation;
|
||||
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 Literal extends Expression
|
||||
{
|
||||
public Literal(RefTypeOrTPH type, Token offset) {
|
||||
public Literal(RefTypeOrTPHOrWildcardOrGeneric type, Token offset) {
|
||||
super(type, offset);
|
||||
}
|
||||
|
||||
public ConstraintSet getConstraints(TypeInferenceInformation info){
|
||||
public ConstraintSet getConstraints(TypeInferenceBlockInformation info){
|
||||
return new ConstraintSet();
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,13 @@
|
||||
package de.dhbwstuttgart.syntaxtree.statement.literal;
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.statement.literal.Literal;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
|
||||
|
||||
public class Null extends Literal
|
||||
{
|
||||
|
||||
public Null(RefTypeOrTPH type, Token offset)
|
||||
public Null(RefTypeOrTPHOrWildcardOrGeneric type, Token offset)
|
||||
{
|
||||
super(type,offset);
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package de.dhbwstuttgart.syntaxtree.statement.literal;
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
|
||||
|
||||
@ -9,7 +8,7 @@ public class NumberLiteral extends Literal
|
||||
{
|
||||
private Number value;
|
||||
|
||||
public NumberLiteral(RefTypeOrTPH type, Number value, Token offset)
|
||||
public NumberLiteral(RefTypeOrTPHOrWildcardOrGeneric type, Number value, Token offset)
|
||||
{
|
||||
super(type,offset);
|
||||
this.value = value;
|
||||
|
@ -2,7 +2,6 @@
|
||||
package de.dhbwstuttgart.syntaxtree.statement.literal;
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
|
||||
|
||||
|
@ -22,5 +22,15 @@ public class ExtendsWildcardType extends WildcardType{
|
||||
super(extendsType, offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isExtends() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSuper() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -14,8 +14,8 @@ import java.util.List;
|
||||
*/
|
||||
public class FunN extends RefType {
|
||||
|
||||
private RefTypeOrTPH R;
|
||||
private List<? extends RefTypeOrTPH> T;
|
||||
private RefTypeOrTPHOrWildcardOrGeneric R;
|
||||
private List<? extends RefTypeOrTPHOrWildcardOrGeneric> T;
|
||||
|
||||
/**
|
||||
* @author Andreas Stadelmeier, a10023
|
||||
@ -25,7 +25,7 @@ public class FunN extends RefType {
|
||||
* @param T
|
||||
* @return
|
||||
*/
|
||||
public FunN(RefTypeOrTPH R, List<? extends RefTypeOrTPH> T) {
|
||||
public FunN(RefTypeOrTPHOrWildcardOrGeneric R, List<? extends RefTypeOrTPHOrWildcardOrGeneric> T) {
|
||||
super(null,null);
|
||||
}
|
||||
|
||||
|
@ -13,8 +13,8 @@ import java.util.List;
|
||||
*/
|
||||
public class FunVoidN extends FunN {
|
||||
|
||||
private RefTypeOrTPH R;
|
||||
private List<RefTypeOrTPH> T;
|
||||
private RefTypeOrTPHOrWildcardOrGeneric R;
|
||||
private List<RefTypeOrTPHOrWildcardOrGeneric> T;
|
||||
|
||||
/**
|
||||
* @author Andreas Stadelmeier, a10023
|
||||
@ -23,7 +23,7 @@ public class FunVoidN extends FunN {
|
||||
* @param T
|
||||
* @return
|
||||
*/
|
||||
public FunVoidN(List<RefTypeOrTPH> T) {
|
||||
public FunVoidN(List<RefTypeOrTPHOrWildcardOrGeneric> T) {
|
||||
super(null,T);
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@ public class FunVoidN extends FunN {
|
||||
* Dabei werden bestimmte, von RefType geerbte, Parameter angepasst. Dies ist wichtig für den Typinferenzalgorithmus.
|
||||
*/
|
||||
private void calculateNewParalist(){
|
||||
List<RefTypeOrTPH> t = new ArrayList<>();
|
||||
List<RefTypeOrTPHOrWildcardOrGeneric> t = new ArrayList<>();
|
||||
if(T!=null)t.addAll(T);
|
||||
this.parameter = t;
|
||||
}
|
||||
|
@ -1,13 +0,0 @@
|
||||
package de.dhbwstuttgart.syntaxtree.type;
|
||||
|
||||
import de.dhbwstuttgart.typecheck.JavaClassName;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
|
||||
public class GenericRefType extends RefType
|
||||
{
|
||||
public GenericRefType(JavaClassName fullyQualifiedName, Token offset)
|
||||
{
|
||||
super(fullyQualifiedName, offset);
|
||||
}
|
||||
}
|
||||
|
16
src/de/dhbwstuttgart/syntaxtree/type/GenericTypeVar.java
Executable file
16
src/de/dhbwstuttgart/syntaxtree/type/GenericTypeVar.java
Executable file
@ -0,0 +1,16 @@
|
||||
package de.dhbwstuttgart.syntaxtree.type;
|
||||
|
||||
import de.dhbwstuttgart.typecheck.GenericTypeName;
|
||||
import de.dhbwstuttgart.typecheck.JavaClassName;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
|
||||
public class GenericTypeVar extends RefTypeOrTPHOrWildcardOrGeneric
|
||||
{
|
||||
private GenericTypeName name;
|
||||
public GenericTypeVar(GenericTypeName name, Token offset)
|
||||
{
|
||||
super(offset);
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package de.dhbwstuttgart.syntaxtree.type;
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
|
||||
import de.dhbwstuttgart.typecheck.JavaClassName;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
|
||||
@ -8,7 +7,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class RefType extends RefTypeOrTPH
|
||||
public class RefType extends RefTypeOrTPHOrWildcardOrGeneric
|
||||
{
|
||||
/**
|
||||
* Ist IsArray auf true, muss beim Codegen ein Zeichen [ gesetzt werden
|
||||
@ -18,7 +17,7 @@ public class RefType extends RefTypeOrTPH
|
||||
*/
|
||||
private boolean IsArray = false;
|
||||
protected JavaClassName name;
|
||||
protected List<RefTypeOrTPH> parameter = null;
|
||||
protected List<RefTypeOrTPHOrWildcardOrGeneric> parameter = null;
|
||||
/**
|
||||
* Ist primitiveFlag auf true, muss beim Codegen dieser Reftype durch
|
||||
* den primitiven Datentyp ersetzt werden
|
||||
@ -41,7 +40,7 @@ public class RefType extends RefTypeOrTPH
|
||||
return hash;
|
||||
}
|
||||
|
||||
public RefType(JavaClassName fullyQualifiedName, List<RefTypeOrTPH> parameter, Token offset)
|
||||
public RefType(JavaClassName fullyQualifiedName, List<RefTypeOrTPHOrWildcardOrGeneric> parameter, Token offset)
|
||||
{
|
||||
this(fullyQualifiedName, offset);
|
||||
if(parameter != null && parameter.size()>0)this.parameter = parameter;
|
||||
@ -52,7 +51,7 @@ public class RefType extends RefTypeOrTPH
|
||||
return name;
|
||||
}
|
||||
|
||||
public List<RefTypeOrTPH> getParaList(){
|
||||
public List<RefTypeOrTPHOrWildcardOrGeneric> getParaList(){
|
||||
if(this.parameter==null)return new ArrayList<>();
|
||||
return this.parameter;
|
||||
}
|
||||
|
@ -7,9 +7,9 @@ import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
|
||||
|
||||
public abstract class RefTypeOrTPH extends SyntaxTreeNode
|
||||
public abstract class RefTypeOrTPHOrWildcardOrGeneric extends SyntaxTreeNode
|
||||
{
|
||||
public RefTypeOrTPH(Token offset) {
|
||||
public RefTypeOrTPHOrWildcardOrGeneric(Token offset) {
|
||||
super(offset);
|
||||
}
|
||||
}
|
@ -28,9 +28,18 @@ public class SuperWildcardType extends WildcardType{
|
||||
* Beispiel: ? super Integer.
|
||||
* Integer wird zurückgegeben.
|
||||
*/
|
||||
public RefTypeOrTPH get_SuperType()
|
||||
public RefTypeOrTPHOrWildcardOrGeneric get_SuperType()
|
||||
{
|
||||
return this.innerType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isExtends() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSuper() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package de.dhbwstuttgart.syntaxtree.type;
|
||||
import java.util.Hashtable;
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
|
||||
import de.dhbwstuttgart.syntaxtree.factory.NameGenerator;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
|
||||
/**
|
||||
@ -12,7 +13,7 @@ import org.antlr.v4.runtime.Token;
|
||||
* @author J�rg B�uerle
|
||||
* @version $Date: 2013/06/19 12:45:37 $
|
||||
*/
|
||||
public class TypePlaceholder extends RefTypeOrTPH
|
||||
public class TypePlaceholder extends RefTypeOrTPHOrWildcardOrGeneric
|
||||
{
|
||||
|
||||
private static Hashtable<String, TypePlaceholder> m_TypePlaceholdersRegistry = new Hashtable<String, TypePlaceholder>();
|
||||
@ -38,11 +39,12 @@ public class TypePlaceholder extends RefTypeOrTPH
|
||||
* @param name Der Name des TypePlaceholders
|
||||
* @return Der TypePlaceholder oder <code>null</code>, falls er nicht in der
|
||||
* Registry existiert
|
||||
*/
|
||||
|
||||
public static TypePlaceholder getInstance(String name)
|
||||
{
|
||||
return m_TypePlaceholdersRegistry.get(name);
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Generiert einen neuen TPH mit einem bestimmten Namen.
|
||||
@ -63,7 +65,7 @@ public class TypePlaceholder extends RefTypeOrTPH
|
||||
* @return
|
||||
*/
|
||||
public static TypePlaceholder fresh(Token position){
|
||||
return null;
|
||||
return new TypePlaceholder(NameGenerator.makeNewName(), position);
|
||||
}
|
||||
|
||||
|
||||
@ -87,4 +89,7 @@ public class TypePlaceholder extends RefTypeOrTPH
|
||||
return "TPH " + this.name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
@ -9,9 +9,9 @@ import org.antlr.v4.runtime.Token;
|
||||
*
|
||||
*/
|
||||
|
||||
public abstract class WildcardType extends RefType {
|
||||
public abstract class WildcardType extends RefTypeOrTPHOrWildcardOrGeneric {
|
||||
|
||||
protected RefTypeOrTPH innerType = null;
|
||||
protected RefType innerType = null;
|
||||
|
||||
/**
|
||||
* Author: Arne Lüdtke<br/>
|
||||
@ -19,10 +19,14 @@ public abstract class WildcardType extends RefType {
|
||||
*/
|
||||
public WildcardType(RefType innerType, Token offset)
|
||||
{
|
||||
super(innerType.getName(), offset);
|
||||
super(offset);
|
||||
this.innerType = innerType;
|
||||
}
|
||||
|
||||
public RefType getInnerType(){
|
||||
return innerType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Author: Arne Lüdtke<br/>
|
||||
* Gibt String Entsprechung zurück.
|
||||
@ -33,13 +37,6 @@ public abstract class WildcardType extends RefType {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Author: Arne Lüdtke<br/>
|
||||
* Die Allgemeine Wildcard enthält keinen Typen.
|
||||
*/
|
||||
public RefTypeOrTPH GetWildcardType()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public abstract boolean isExtends();
|
||||
public abstract boolean isSuper();
|
||||
}
|
||||
|
@ -1,15 +0,0 @@
|
||||
package de.dhbwstuttgart.typeinference;
|
||||
|
||||
public class ConstraintSet extends UndConstraint{
|
||||
public void addAll(ConstraintSet constraints) {
|
||||
|
||||
}
|
||||
|
||||
public void add(Pair pair) {
|
||||
|
||||
}
|
||||
|
||||
public void add(KomplexeMenge<Pair> constraint){
|
||||
|
||||
}
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
package de.dhbwstuttgart.typeinference;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
|
||||
public class EinzelElement<A> implements KomplexeMenge<A>{
|
||||
private A item;
|
||||
|
||||
public EinzelElement(A element){
|
||||
item = element;
|
||||
}
|
||||
|
||||
public Set<KomplexeMenge<A>> getSet(){
|
||||
Set<KomplexeMenge<A>> ret = new TreeSet<>();
|
||||
ret.add(this);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Set<A>> cartesianProduct() {
|
||||
Set<Set<A>> ret = new TreeSet<>();
|
||||
Set<A> i = new TreeSet<>();
|
||||
i.add(item);
|
||||
ret.add(i);
|
||||
return ret;
|
||||
//throw new NotImplementedException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
return item.toString();
|
||||
}
|
||||
|
||||
public A getItem(){
|
||||
return item;
|
||||
}
|
||||
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
package de.dhbwstuttgart.typeinference;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public interface KomplexeMenge<A>{
|
||||
Set<? extends KomplexeMenge<A>> getSet();
|
||||
Set<Set<A>> cartesianProduct();
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package de.dhbwstuttgart.typeinference;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
public class OderConstraint extends OderMenge<Pair>{
|
||||
private Set<UndConstraint> oderConstraintPairs;
|
||||
|
||||
public OderConstraint(){
|
||||
oderConstraintPairs = new HashSet<>();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Liefert alle in diesem OderConstraint enthaltene Constraints. Dabei gehen die Verkn<EFBFBD>pfungen (Oder/Und) verloren.
|
||||
* @return
|
||||
*/
|
||||
public Set<Pair> getConstraintPairs(){
|
||||
Set<Pair> ret = new TreeSet<>();
|
||||
for(UndConstraint oC : this.oderConstraintPairs){
|
||||
ret.addAll(oC.getConstraintPairs());
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Falls die Type des toAdd-Pairs nicht vom Typ RefType bzw. TypePlaceholder sind, so werden sie in einen RefType umgewandelt.
|
||||
* @param toAdd
|
||||
*/
|
||||
public void addConstraint(Pair toAdd){
|
||||
UndConstraint uCons = new UndConstraint();
|
||||
uCons.addConstraint(toAdd);
|
||||
oderConstraintPairs.add(uCons);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
String ret = "[";
|
||||
for(UndConstraint p : this.getUndConstraints()){
|
||||
ret += p.toString()+ "| ";
|
||||
}
|
||||
return ret+"]";
|
||||
}
|
||||
|
||||
public Set<UndConstraint> getUndConstraints() {
|
||||
return this.oderConstraintPairs;
|
||||
/*
|
||||
Vector<UndConstraint> ret = new Vector<UndConstraint>();
|
||||
for(Pair p : this.getConstraintPairs()){
|
||||
ret.add(new UndConstraint(p.TA1,p.TA2));
|
||||
}
|
||||
return ret;
|
||||
*/
|
||||
}
|
||||
|
||||
public void addConstraint(UndConstraint constraint) {
|
||||
oderConstraintPairs.add(constraint);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<? extends KomplexeMenge<Pair>> getSet() {
|
||||
return this.oderConstraintPairs;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
package de.dhbwstuttgart.typeinference;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
public abstract class OderMenge<A> implements KomplexeMenge<A>{
|
||||
|
||||
public abstract Set<? extends KomplexeMenge<A>> getSet();
|
||||
|
||||
@Override
|
||||
public Set<Set<A>> cartesianProduct() {
|
||||
Set<Set<A>> ret = new TreeSet<>();
|
||||
for(KomplexeMenge<A> km : this.getSet()){
|
||||
ret.addAll(km.cartesianProduct());
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
String ret = "[";
|
||||
for(KomplexeMenge<A> i : this.getSet()){
|
||||
ret += i.toString() + " | ";
|
||||
}
|
||||
return ret + "]";
|
||||
}
|
||||
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
package de.dhbwstuttgart.typeinference;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import de.dhbwstuttgart.exceptions.DebugException;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH;
|
||||
import de.dhbwstuttgart.typeinference.unify.Unifikationsalgorithmus;
|
||||
|
||||
/**
|
||||
* Stellt ein Constraint dar, welches aus mehreren Constraint-Paaren besteht. Diese gelten alle stets gleichzeitig / sind per "Und" miteinander verknüpft.
|
||||
* @author janulrich
|
||||
*
|
||||
*/
|
||||
public class UndConstraint extends UndMenge<Pair> {
|
||||
|
||||
Set<EinzelElement<Pair>> set = new HashSet<>();
|
||||
|
||||
@Override
|
||||
public Set<? extends KomplexeMenge<Pair>> getSet() {
|
||||
return set;
|
||||
}
|
||||
|
||||
public Set<Pair> getConstraintPairs() {
|
||||
Set<Set<Pair>> ret = this.cartesianProduct();
|
||||
if(ret.size() == 0)return new TreeSet<>();
|
||||
if(ret.size() != 1){
|
||||
//UndConstraints enthalten nur SingleConstraints, wodurch das Karthesische Produkt nur aus einem Element bestehen kann.
|
||||
throw new DebugException("Fehler in ConstraintPairs-Bildung");
|
||||
}
|
||||
return ret.iterator().next();
|
||||
}
|
||||
|
||||
public void addConstraint(RefTypeOrTPH type, RefTypeOrTPH rT) {
|
||||
Pair p = new Pair(type, rT);
|
||||
addConstraint(p);
|
||||
}
|
||||
|
||||
public void addConstraint(Pair toAdd){
|
||||
this.set.add(new EinzelElement<Pair>(toAdd));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String ret = this.getConstraintPairs().toString();
|
||||
return ret;
|
||||
}
|
||||
|
||||
public Set<EinzelElement<Pair>> getPairs(){
|
||||
return set;
|
||||
}
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
package de.dhbwstuttgart.typeinference;
|
||||
|
||||
import de.dhbwstuttgart.typeinference.unify.TypeUnify;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
//import com.rits.cloning.Cloner;
|
||||
|
||||
public abstract class UndMenge<A> implements KomplexeMenge<A>{
|
||||
|
||||
public abstract Set<? extends KomplexeMenge<A>> getSet();
|
||||
|
||||
@Override
|
||||
public Set<Set<A>> cartesianProduct() {
|
||||
Set<Set<A>> ret = null;
|
||||
for(KomplexeMenge<A> km : this.getSet()){
|
||||
if(ret == null){
|
||||
ret = km.cartesianProduct();
|
||||
}else{
|
||||
Set<Set<A>> cartesianProduct = new TreeSet<>();
|
||||
for(Set<A> r : ret)for(Set<A> m : km.cartesianProduct()){ //Für jedes Element aus dem Karthesischen Produkt:
|
||||
Set<A> undElement = new TreeSet<>();
|
||||
undElement.addAll(r);
|
||||
undElement.addAll(m);
|
||||
cartesianProduct.add(undElement);
|
||||
}
|
||||
ret = cartesianProduct;
|
||||
}
|
||||
}
|
||||
if(ret == null)return new TreeSet<>();
|
||||
return ret;
|
||||
}
|
||||
|
||||
public String toString(){
|
||||
String ret = "[";
|
||||
for(KomplexeMenge<A> item : this.getSet()){
|
||||
ret += item.toString() + " , ";
|
||||
}
|
||||
return ret + "]";
|
||||
}
|
||||
}
|
||||
|
@ -2,32 +2,31 @@ package de.dhbwstuttgart.typeinference.assumptions;
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.ParameterList;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH;
|
||||
import org.antlr.v4.runtime.misc.DoubleKeyMap;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class MethodAssumption {
|
||||
private RefType receiver;
|
||||
private RefTypeOrTPH retType;
|
||||
private RefTypeOrTPHOrWildcardOrGeneric retType;
|
||||
ParameterList params;
|
||||
|
||||
public MethodAssumption(RefType receiver, RefTypeOrTPH retType, ParameterList params){
|
||||
public MethodAssumption(RefType receiver, RefTypeOrTPHOrWildcardOrGeneric retType, ParameterList params){
|
||||
this.receiver = receiver;
|
||||
this.retType = retType;
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
public RefType getReceiverType() {
|
||||
return null;
|
||||
return receiver;
|
||||
}
|
||||
|
||||
public RefTypeOrTPH getReturnType() {
|
||||
public RefTypeOrTPHOrWildcardOrGeneric getReturnType() {
|
||||
return retType;
|
||||
}
|
||||
|
||||
public List<RefTypeOrTPH> getArgTypes() {
|
||||
public List<RefTypeOrTPHOrWildcardOrGeneric> getArgTypes() {
|
||||
return params.getFormalparalist().stream().
|
||||
map(formalParameter -> formalParameter.getType()).collect(Collectors.toList());
|
||||
}
|
||||
|
@ -0,0 +1,15 @@
|
||||
package de.dhbwstuttgart.typeinference.assumptions;
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.ClassOrInterface;
|
||||
import de.dhbwstuttgart.syntaxtree.Method;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public class TypeInferenceBlockInformation extends TypeInferenceInformation {
|
||||
private Method methodContext;
|
||||
|
||||
public TypeInferenceBlockInformation(Set<ClassOrInterface> availableClasses, Method methodContext) {
|
||||
super(availableClasses);
|
||||
this.methodContext = methodContext;
|
||||
}
|
||||
}
|
@ -19,17 +19,12 @@ Zweiteres hat den Vorteil, dass bei der Entwicklung leichter Dinge hinzugefügt
|
||||
Die ganze Logik steckt in dieser Klasse.
|
||||
*/
|
||||
public class TypeInferenceInformation {
|
||||
private Method methodContext;
|
||||
private Set<ClassOrInterface> classes;
|
||||
|
||||
public TypeInferenceInformation(Set<ClassOrInterface> availableClasses){
|
||||
classes = availableClasses;
|
||||
}
|
||||
|
||||
public void setMethodContext(Method methodContext) {
|
||||
this.methodContext = methodContext;
|
||||
}
|
||||
|
||||
public List<MethodAssumption> getMethods(String name, ArgumentList arglist) {
|
||||
List<MethodAssumption> ret = new ArrayList<>();
|
||||
for(ClassOrInterface cl : classes){
|
||||
@ -42,4 +37,8 @@ public class TypeInferenceInformation {
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public Set<ClassOrInterface> getAvailableClasses() {
|
||||
return classes;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,7 @@
|
||||
package de.dhbwstuttgart.typeinference.constraints;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class Constraint<A> extends HashSet<A> {
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package de.dhbwstuttgart.typeinference.constraints;
|
||||
|
||||
|
||||
import de.dhbwstuttgart.typeinference.unify.GuavaSetOperations;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.UnifyPair;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ConstraintSet<A> {
|
||||
Constraint<A> undConstraints = new Constraint<>();
|
||||
List<Set<Constraint<A>>> oderConstraints = new ArrayList<>();
|
||||
|
||||
public void addUndConstraint(A p){
|
||||
undConstraints.add(p);
|
||||
}
|
||||
|
||||
public void addOderConstraint(Set<Constraint<A>> methodConstraints) {
|
||||
oderConstraints.add(methodConstraints);
|
||||
}
|
||||
|
||||
public void addAll(ConstraintSet constraints) {
|
||||
this.undConstraints.addAll(constraints.undConstraints);
|
||||
this.oderConstraints.addAll(constraints.oderConstraints);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
return cartesianProduct().toString();
|
||||
}
|
||||
|
||||
public Set<List<Constraint<A>>> cartesianProduct(){
|
||||
Set<Constraint<A>> toAdd = new HashSet<>();
|
||||
toAdd.add(undConstraints);
|
||||
List<Set<Constraint<A>>> allConstraints = new ArrayList<>();
|
||||
allConstraints.add(toAdd);
|
||||
allConstraints.addAll(oderConstraints);
|
||||
return new GuavaSetOperations().cartesianProduct(allConstraints);
|
||||
}
|
||||
|
||||
public <B> ConstraintSet<B> map(Function<? super A,? extends B> o) {
|
||||
ConstraintSet<B> ret = new ConstraintSet<>();
|
||||
ret.undConstraints = undConstraints.stream().map(o).collect(Collectors.toCollection(Constraint<B>::new));
|
||||
List<Set<Constraint<B>>> newOder = new ArrayList<>();
|
||||
for(Set<Constraint<A>> oderConstraint : oderConstraints){
|
||||
newOder.add(
|
||||
oderConstraint.parallelStream().map((Constraint<A> as) ->
|
||||
as.stream().map(o).collect(Collectors.toCollection(Constraint<B>::new))).collect(Collectors.toSet())
|
||||
);
|
||||
}
|
||||
ret.oderConstraints = newOder;
|
||||
return ret;
|
||||
}
|
||||
}
|
@ -1,28 +1,28 @@
|
||||
package de.dhbwstuttgart.typeinference;
|
||||
package de.dhbwstuttgart.typeinference.constraints;
|
||||
import java.io.Serializable;
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH;
|
||||
import com.sun.istack.internal.NotNull;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.PairOperator;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
||||
import de.dhbwstuttgart.syntaxtree.type.WildcardType;
|
||||
|
||||
|
||||
public class Pair implements Serializable
|
||||
{
|
||||
public RefTypeOrTPH TA1;
|
||||
public RefTypeOrTPH TA2;
|
||||
public RefTypeOrTPHOrWildcardOrGeneric TA1;
|
||||
public RefTypeOrTPHOrWildcardOrGeneric TA2;
|
||||
|
||||
private PairOperator eOperator = PairOperator.SMALLER;
|
||||
|
||||
public Pair( RefTypeOrTPH TA1, RefTypeOrTPH TA2 )
|
||||
public Pair(@NotNull RefTypeOrTPHOrWildcardOrGeneric TA1, @NotNull RefTypeOrTPHOrWildcardOrGeneric TA2 )
|
||||
{
|
||||
this.TA1 = TA1;
|
||||
this.TA2 = TA2;
|
||||
if(TA1 == null || TA2 == null)
|
||||
throw new NullPointerException();
|
||||
eOperator = PairOperator.SMALLER;
|
||||
}
|
||||
|
||||
public Pair( RefTypeOrTPH TA1, RefTypeOrTPH TA2, PairOperator eOp)
|
||||
public Pair(RefTypeOrTPHOrWildcardOrGeneric TA1, RefTypeOrTPHOrWildcardOrGeneric TA2, PairOperator eOp)
|
||||
{
|
||||
// Konstruktor
|
||||
this(TA1,TA2);
|
@ -2,6 +2,6 @@
|
||||
class Methods {
|
||||
mt4(a,b,c) { return a.mt3(b).mt3(c) ; }
|
||||
|
||||
mt3(a) {return a.add(); }
|
||||
mt3(a) {return a.mt3(a); }
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user