IllegalType inccorectly detect type with illegalClassNames #78

Closed
romani opened this Issue Dec 9, 2013 · 1 comment

2 participants

@romani
Member
romani commented Dec 9, 2013

SF issue: 478
Created: 2007-04-17
Creator: Julien De Santis-Caron

here is the definition of our check:

    <module name="IllegalType">
      <property name="severity" value="error"/>
      <property name="id" value="IllegalTypeDate"/>
      <property name="illegalClassNames" value="java.util.Calendar"/>
      <property name="format" value="^(.*[\\.])?Mock.*$"/>
    </module>

Unfortunately, this check is positive if we use any class in the classpath that have the same file name than the classes specified.

for instance, we have a jar in the classpath containing a class with the canonical name : test.Calendar,

if we use this class like the following:

package test.mytest;
import test.Calendar;
public class MyClass {

   Calendar cal = AnObject.getInstance().getTestCalendar();
   java.util.Date date = null;

}

We get a false positive return for the illegalTypeCheck like this:

Declaring variables, return values or parameters of type 'Calendar' is not allowed.

Observe that for some errors, the illegalTypeCheck returns
Declaring variables, return values or parameters of type 'java.util.Date' is not allowed.

Notice also that test.Calendar does not extend nor use in any way the specified java.util.Calendar.

@alexkravin alexkravin was assigned by romani Dec 17, 2014
@alexkravin alexkravin added a commit to alexkravin/checkstyle that referenced this issue Dec 18, 2014
@alexkravin alexkravin Illegal Type Check, fixed false positives on same file names, added s…
…upport of start imports, issue #78
29bcb1e
@alexkravin alexkravin added a commit to alexkravin/checkstyle that referenced this issue Dec 18, 2014
@alexkravin alexkravin Illegal Type Check, fixed false positives on same file names, added s…
…upport of start imports, issue #78
fb54dc1
@alexkravin alexkravin added a commit to alexkravin/checkstyle that referenced this issue Dec 18, 2014
@alexkravin alexkravin Illegal Type Check, fixed false positives on same file names, added s…
…upport of start imports, issue #78
2ac0079
@alexkravin alexkravin added a commit to alexkravin/checkstyle that referenced this issue Dec 18, 2014
@alexkravin alexkravin Illegal Type Check, fixed false positives on same file names, added s…
…upport of start imports, issue #78
a9c2184
@alexkravin alexkravin added a commit to alexkravin/checkstyle that referenced this issue Dec 23, 2014
@alexkravin alexkravin Illegal Type Check, fixed false positives on same file names, added s…
…upport of start imports, issue #78
060e676
@alexkravin alexkravin added a commit to alexkravin/checkstyle that referenced this issue Dec 23, 2014
@alexkravin alexkravin Illegal Type Check, fixed false positives on same file names, added s…
…upport of start imports, issue #78
d5ee6fd
@alexkravin alexkravin added a commit to alexkravin/checkstyle that referenced this issue Dec 23, 2014
@alexkravin alexkravin Illegal Type Check, fixed false positives on same file names, added s…
…upport of start imports, issue #78
b6d1fcf
@alexkravin alexkravin added a commit to alexkravin/checkstyle that referenced this issue Dec 23, 2014
@alexkravin alexkravin Illegal Type Check, fixed false positives on same file names, added s…
…upport of start imports, issue #78
eae372a
@alexkravin alexkravin added a commit to alexkravin/checkstyle that referenced this issue Dec 23, 2014
@alexkravin alexkravin Illegal Type Check, fixed false positives on same file names, added s…
…upport of start imports, issue #78
4c4921d
@alexkravin alexkravin added a commit to alexkravin/checkstyle that referenced this issue Dec 23, 2014
@alexkravin alexkravin Illegal Type Check, fixed false positives on same file names, added s…
…upport of start imports, issue #78
e0f0c02
@alexkravin alexkravin added a commit to alexkravin/checkstyle that referenced this issue Dec 25, 2014
@alexkravin alexkravin Illegal Type Check, fixed false positives on same file names, added s…
…upport of analyzing imports, issue #78
b787e85
@alexkravin alexkravin added a commit to alexkravin/checkstyle that referenced this issue Jan 2, 2015
@alexkravin alexkravin Illegal Type Check, fixed false positives on same file names, added s…
…upport of analyzing imports, issue #78
cad76f4
@alexkravin alexkravin added a commit to alexkravin/checkstyle that referenced this issue Jan 2, 2015
@alexkravin alexkravin Illegal Type Check, fixed false positives on same file names, added s…
…upport of analyzing imports, issue #78
76ac011
@alexkravin alexkravin added a commit to alexkravin/checkstyle that referenced this issue Jan 6, 2015
@alexkravin alexkravin Illegal Type Check, fixed false positives on same file names, added s…
…upport of analyzing imports, issue #78
a08d0cb
@alexkravin alexkravin added a commit to alexkravin/checkstyle that referenced this issue Jan 6, 2015
@alexkravin alexkravin Illegal Type Check, fixed false positives on same file names, added s…
…upport of analyzing imports, issue #78
5f38a1c
@romani romani added a commit that referenced this issue Jan 6, 2015
@alexkravin @romani alexkravin + romani Illegal Type Check, fixed false positives on same file names, added s…
…upport of analyzing imports, issue #78
b06e2e0
@romani
Member
romani commented Jan 6, 2015

fixed, additional issue is created to let this Check produce less false positives - #567.

@romani romani closed this Jan 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment