Home | Overview | Wasp for Java | Download | Support | Purchase | Research | Contact Us

Examples of Wasp messages for Jess program

Examples of Wasp messages are presented here for the Java program Jess of the early alpha version 5.0a3. Jess is the Java Expert System Shell for building Java applets and applications that have the capacity to "reason" using knowledge you supply in the form of declarative rules.

Two bugs in the Jess program were found from the Wasp messages.

  1. The m_type field of Value class has no proper value that may be recognized on the base of the following message:
    [J] (t/jess/Value.java 522,48) variable $new240.m_type
                                   used before assignment
                           "type = " + m_type#);
     #REFERENCES this^=$new240!
     #DECLARATIONS $new240:(t/jess/Jesp.java,942,22)
                   this:(517,24)
     #CONTEXT jess/Value.resetValue(522,48?) <-
              jess/Value.Value(53,4) <-
              jess/Jesp.doParseDefrule(t/jess/Jesp.java,942,31?)
    
  2. The break statement is erroneously omitted in the following source code fragment:
      case RU.MULTIVARIABLE:
        r = new ReteException("Value::" + routine,
                              "Uninitialized variable",
                              (String) m_objectval);
      default:
        r = new ReteException("Value::" + routine,
                              msg + " " + toString(),
                              "type = " + m_type);
    
    This bug was found due the following warning message:
     [W] (t/jess/Value.java 291,10) variable r assigned but not used
                 r #= new ReteException("Value::" + routine,
    

Below the part (approximately a fourth) of the Wasp message listing for the Jess program is presented. Analysed configuration of the program includes at about 3000 lines of source code.

########### Variable usage before assignment  (CONDITIONAL ERRORS) #########

[J] (t/jess/Value.java 522,48) variable $new240.m_type used before assignment
                                  "type = " + m_type#);
  #REFERENCES this^=$new240!
  #DECLARATIONS $new240:(t/jess/Jesp.java,942,22) this:(517,24)
  #CONTEXT jess/Value.resetValue(522,48?) <- jess/Value.Value(53,4) <-
       jess/Jesp.doParseDefrule(t/jess/Jesp.java,942,31?)

[J] (t/jess/Value.java 558,48) variables $new163.m_type,$new158.m_type  used
   before assignment
                                  "type = " + m_type#);
  #REFERENCES this^=$new163,$new158!
  #DECLARATIONS $new163:(t/jess/Jesp.java,1386,28)
       $new158:(t/jess/Jesp.java,800,36) this:(553,24)
  #CONTEXT jess/Value.resetValue(558,48?) <- jess/Value.Value(73,4) <-
       jess/Jesp.parseDeftemplate(t/jess/Jesp.java,800,45?),
       jess/Jesp.parseDeffunction(t/jess/Jesp.java,1386,37?)

###################### Unassigned Variables (WARNINGS) #####################

[W] (t/jess/Value.java 387,17) variable $new190.m_type moved before assignment
        return m_type#;
  #REFERENCES this^=$new190?
  #DECLARATIONS $new190:(t/jess/Jesp.java,417,18) this:(385,23)
  #CONTEXT jess/Value.type(387,17) <-
       jess/Deftemplate.getSlotType(t/jess/Deftemplate.java,215,62)

############################ UNREACHABLE BRANCHES ##########################

[W] (t/jess/Rete.java 241,18) true condition - unreachable else-branch
                if (t #== null)
  #CONTEXT addInputRouter(241,18) <- initTransientMembers(473,8?)
[W] (t/jess/Rete.java 489,4) unreachable catch clause
        #catch (ReteException re)

[W] (t/jess/Jesp.java 56,4) false condition - unreachable then-branch
        #if (prompt)
[W] (t/jess/Jesp.java 62,11) false while-condition - loop body never executed
        while (#!val.equals(Funcall.EOF))

[W] (t/jess/Value.java 419,25) unreachable branch in switch
            return (m_intval #== v.m_intval);
[W] (t/jess/Value.java 491,8) unreachable default branch in switch
            #throw new ReteException("Value::resetValue",
[W] (t/jess/Value.java 537,27) false condition - unreachable then-branch
        if (type != RU.FUNCALL #&& type != RU.FACT && type != RU.LIST)
[W] (t/jess/Value.java 537,35) true operand in &&/|| operator
        if (type != RU.FUNCALL && type #!= RU.FACT && type != RU.LIST)

[W] (t/jess/ValueVector.java 82,10) false condition - unreachable then-branch
        if (i #> m_v.length)
  #CONTEXT setLength(82,10) <-
       Fact.createNewFact(t/jess/Fact.java,65,9),
       Deftemplate.Deftemplate(t/jess/Deftemplate.java,92,11)

[W] (t/jess/Tokenizer.java 141,8) do statement executed only once
            #do
[W] (t/jess/Deftemplate.java 54,4) unreachable catch clause
        #catch (ReteException re) { /* can't happen */ }

[W] (t/jess/Deftemplate.java 228,21) false condition - body of for cycle
   never executed
        for (int i = 0; i #< n; i++)

######################## UNUSABLE VARIABLES (Strong) #######################

[W] (t/jess/Rete.java 121,43) variable $new34.m_resetGlobals assigned but
   not used
      transient private boolean m_resetGlobals #= true;
  #REFERENCES this^=$new34!
  #DECLARATIONS $new34:(t/jess/Main.java,21,20) this:(19,13)
[W] (t/jess/Value.java 286,20) variable r assigned but not used
        ReteException r #= null; // Microsoft's JVC wants this
[W] (t/jess/Value.java 291,10) variable r assigned but not used
            r #= new ReteException("Value::" + routine,

[W] (t/jess/Deftemplate.java 224,33) formal parameter slotname not used
      public int getSlotIndex(String #slotname) throws ReteException
  #CONTEXT jess/Deftemplate.getSlotIndex(224,33) <-
       jess/Deftemplate.addMultiSlot(161,15) <-
       jess/Rete.createDeftemplate(t/jess/Rete.java,994,13) <-
       jess/Fact.Fact(t/jess/Fact.java,43,20) <-
       jess/Rete.initTransientMembers(t/jess/Rete.java,486,32?)


######################### UNUSABLE VARIABLES (Weak) ########################

[W] (t/jess/ValueVector.java 88,10) variable $new178'.m_ptr assigned but not
   used
        m_ptr #= i;
  #REFERENCES this^=$new178'?
  #DECLARATIONS $new178':(t/jess/Jesp.java,382,23) this:(80,29)
  #CONTEXT jess/ValueVector.setLength(88,10) <-
       jess/Deftemplate.addMultiSlot(t/jess/Deftemplate.java,167,11?) <-
       jess/Rete.createDeftemplate(t/jess/Rete.java,994,13?) <-
       jess/Pattern.Pattern(t/jess/Pattern.java,89,20)
Copyright 2000, 2001 AcademSoft. All rights reserved.