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

Example project: massive number of code quality / correctness warnings

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Trivial
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 6.2.0.CR1
    • Component/s: None
    • Labels:
      None

      Description

      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

        Gliffy Diagrams

          Activity

          Hide
          h.peter Peter Horvath added a comment -

          Screenshot of Eclipse displaying warnings found in Drools example projects

          Show
          h.peter Peter Horvath added a comment - Screenshot of Eclipse displaying warnings found in Drools example projects

            People

            • Assignee:
              mfusco Mario Fusco
              Reporter:
              h.peter Peter Horvath
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development