Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-506

Example project: massive number of code quality / correctness warnings

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Trivial Trivial
    • 6.2.0.CR1
    • None
    • None
    • None

      The Drools example project contains code snippets that yield warnings: while I absolutely understand that resources are limited and examples might not be the priority and the core code of the engine is of good quality, I do think it is important to display dedication to high quality products.

      Having an example project full of code quality issues just gives a very bad first impression of the whole Drools project...

      Examples:

      org.drools.examples.cashflow.CashFlowMain
      public class CashFlowMain {
      
          public static void main(String[] args) throws Exception {
              SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
      

      yields WARNING: The value of the local variable sdf is not used

      org.drools.examples.sudoku.Sudoku.dumpGrid()
          /**
           * Nice printout of the grid.
           */
          public void dumpGrid() {
              Formatter fmt = new Formatter(System.out);
      

      yields WARNING: Resource leak: 'fmt' is never closed

      org.drools.games.pong.PongUI
      import java.awt.*;
      import java.awt.event.KeyEvent;
      import java.awt.event.KeyListener;
      import java.awt.event.MouseEvent;
      import java.awt.event.MouseListener;
      import java.awt.font.FontRenderContext;
      import java.awt.font.TextLayout;
      import java.awt.image.BufferedImage;
      
      import javax.swing.*;
      
      import org.drools.games.GameConfiguration;
      import org.drools.games.GameUI;
      import org.kie.api.runtime.KieSession;
      import org.kie.internal.runtime.StatefulKnowledgeSession;
      import org.kie.api.runtime.rule.FactHandle;
      import org.kie.api.runtime.rule.EntryPoint;
      
      public class PongUI extends GameUI {
      

      yields WARNING: The import java.awt.event.KeyEvent is never used
      WARNING: The import java.awt.event.KeyListener is never used
      WARNING: The import java.awt.event.MouseEvent is never used
      WARNING: The import java.awt.event.MouseListener is never used
      WARNING: The import java.awt.image.BufferedImage is never used
      WARNING: The import javax.swing.* is never used
      WARNING: The import org.kie.internal.runtime.StatefulKnowledgeSession is never used
      WARNING: The import org.kie.api.runtime.rule.FactHandle is never used
      WARNING: The import org.kie.api.runtime.rule.EntryPoint is never used

      etc

              mfusco@redhat.com Mario Fusco
              h.peter Peter Horvath (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: