<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Introducing the Quick Fix for the Petri Net Modeling Tool Renew</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Jan Hicken</string-name>
          <email>1hicken@informatik.uni-hamburg.de</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Lawrence Cabac</string-name>
          <email>cabac@informatik.uni-hamburg.de</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Michael Haustermann</string-name>
          <email>haustermann@informatik.uni-hamburg.de</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>University of Hamburg, Faculty of Mathematics</institution>
          ,
          <addr-line>Informatics and Natural Sciences</addr-line>
          ,
          <institution>Department of Informatics</institution>
        </aff>
      </contrib-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>
        Many modern integrated development environments (IDEs) such as Eclipse [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]
support developers by providing a quick fix feature. If the application detects
syntax errors in the source code, it can propose fixes addressing the error by
providing context-sensitive alternatives the developer can choose from
interactively.
      </p>
      <p>
        Considering Petri net modeling tools, similar functionality can be useful
for inscriptions for high-level nets. We want to transfer the functionality to
Renew [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ], where the Java-based inscriptions may be treated analogously to
source code in IDEs. This includes a mechanism for detecting and
highlighting errors for developer on the one hand and algorithms for suggesting possible
fixes to these errors on the other hand. Furthermore, the feature shall apply
these fixes automatically, so that the developer has to adjust as little as possible
source code manually.
      </p>
      <p>The first category of suggestions consists of Java fields: The choices consist
of the declared and accessible fields for a denoted class in the source code. If an
entered field is unknown, the quick fix can provide a list of fields using the Java
Reflect API. However, this can lead to a lot of choices being presented to the
developer, when the class defines a great amount of fields. In order to address
excessive lists of suggestions, lists may be filtered to fields having the same prefix
as entered by the developer.</p>
      <p>Similar to the fields, methods can also be searched by using the Java
Reflect API. Filtering the list of methods declared by a class may also be done
by comparing prefixes. In addition to that, the entered parameters need to be
considered when providing suggestions to the user. A method giving the wrong
parameter types, the feature can suggest possible method overloads.</p>
      <p>Variables, that are used in the Petri net can be declared in Renew’s
declaration node. If the net contains a declaration node with at least one declared
variable, all used variables have to be declared. An undeclared variable causes the
quick fix to suggest possible types for that variable and adding the corresponding
statement in the declaration node.</p>
      <p>When assigning a value to a variable, the value can either be a literal, a
newly constructed object or the returned value from a method call. Determining</p>
      <p>PNSE’15 – Petri Nets and Software Engineering
the type in the first case is trivial, because the corresponding literal’s primitive
type can be evaluated by the compiler immediately. To determine the type of
a newly constructed object, the constructor’s class name has to be well-known,
which means the class name is either fully qualified or an already imported
class. Giving the case of a well-known class name, the corresponding declaration
statement can also be generated easily. Moreover, the information of a
fullyqualified class name can be used to construct an import statement for that class
or its whole package right away. The last case is also rather trivial, because the
return type of a method and its corresponding class object can be determined
using the Java Reflect API.</p>
      <p>With the quick fix feature, we achieved a further integration of modeling
support, which helps the developer reaching his goals. Errors in the source code
are explicitly highlighted and possible fixes can be applied interactively. In
addition to the management of development errors, the feature can be used similar
to an autocomplete feature. The developer does not have to look up every class
member he wants to use in the API documentation but can choose from any
alternatives the quick fix provides. We streamlined the development process by
enabling a much faster development in an integrated environment, which is easily
extensible.</p>
      <p>When suggesting fields or methods for a class, the quick xfi can provide all
known members. If the amount of class members is high, the filtering only applies
to suggestions with the same prefix as the entered text. It is possible to extend
this feature to filter for matching types and parameters, which also enables a
prioritization of suggestions. The suggestions for variables are reliable when it
comes to assignments, where the right part of the expression is parseable and the
type is known. However, when it comes to arc inscriptions and variable types,
which have not been imported, the current algorithm does not give sufficient
results. The former case may require an analyzation of other in- and outgoing
arcs regarding the particular place or transition and its inscriptions. Supporting
unimported types depends highly on the ability to automatically import classes
found in the classpath. In addition to that, the class hierarchies are not part of
the suggestion mechanism at all.</p>
      <p>Furthermore, the quick fix feature not only is applicable to Java source code
within inscriptions but also affects modeling errors. Common Petri net properties
are yet verifiable through algorithms. These may be used to address unwanted
discrepancies between wanted and actual net properties using the quick fix.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Kummer</surname>
            ,
            <given-names>O.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Wienberg</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Duvigneau</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          : Renew - the
          <source>Reference Net Workshop (Jun</source>
          <year>2015</year>
          ), http://www.renew.de/,
          <source>release 2.4.2</source>
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2. The Eclipse Foundation:
          <article-title>Eclipse: The Eclipse Foundation open source community website</article-title>
          (
          <year>Jun 2015</year>
          ), http://www.eclipse.org/
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>