CMS Snapshot Analysis - Run Analyzer - Warnings - JEE with extension - JEE Analyzer - JAVA068: Duplicate class declaration

Description

When you get warnings related to duplicate class declarations like below, then it means that the same class has been found more than once in the source files.

2018-10-22 04:06:10.897295    Information    MODULMSG ; Job execution    Parsing Java file (phase 1) : S:\Sources\MYAPP\Analyzed\my_package\WEB-INF\classes\com\mycompany\SomeClass.java  
2018-10-22 04:06:10.899248    Warning    MODULMSG ; Job execution    JAVA068: Duplicate class declaration : com.mycompany.SomeClass S:\Sources\MYAPP\Analyzed\my_package\WEB-INF\classes\com\mycompany\SomeClass.java

Observed in CAST Extension

ReleaseYes/No
JEE 1.0.x
JEE 1.1.x
JEE 1.2.x

Observed on RDBMS

RDBMSYes/No
Oracle Server
Microsoft SQL Server
CSS3
CSS2

Step by Step Scenario

Below is the step-by-step scenario leading to the problem:

  1. Package and deliver the application.
  2. Set as current version.
  3. Run the analysis.
  4. Check the analysis log file.
  5. Warnings “JAVA068: Duplicate class declaration”

Impact of the Problem

The impact of the problem on the analysis can be wrong links or missing links, due to wrong resolution.

Example :

  • class A is defined in both files C:\Folder_One\A.java and C:\Folder_Two\A.java
  • class B is defined in both files C:\Folder_One\B.java and C:\Folder_Two\B.java
  • class B has a method bMethod referring to class A.

The analyzer will resolve with the first matching object encountered. The result will be the following :

  • Both methods bMethod will have a link to the same class A (the one defined in folder Folder_One)
  • No link to the second class A (the one defined in folder Folder_Two)

Functionally speaking this is not correct. We should have :

  • Method bMethod from class B defined in folder FolderOne should have a link to class A defined in folder FolderOne
  • Method bMethod from class B defined in folder FolderTwo should have a link to class A defined in folder FolderTwo

This is a limitation of the analyzer.

Action Plan

To overcome this limitation, the architecture of the application should be studied further. Check

  1. If there is unnecessarily duplicated code, it should be excluded from the application.
  2. If there are several Java applications gathered into this CAST Application : consider splitting them into several applications and redoing the on-boarding.
  3. If the previous steps do not solve the issue, then contact CAST Technical Support, with the Relevant input in order to reproduce the issue

Notes/comments

Ticket # 14560 , 14341, 17648,  17706

Related Pages