I'm not advocating all of the Java coding practices that cause warnings in 
IDEA, but my guess would be that most folks looking at the Java code used to 
implement Clojure don't use IDEA.  It all compiles without warnings using javac 
and ant or Maven.

Also, in looking at some of these warnings myself in IDEA, out of curiosity, 
many of them seem to be wrong.  See in-line below for details.

On Nov 23, 2012, at 12:45 AM, Alexander Semenov wrote:

> Hi guys.
> 
> I've opened Clojure source in IDEA and wondered why are there so many 
> warnings? For example in 
> https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java
>  class there are such perls as
> 
> * manual array copy;

A performance warning, sure, but not a bug.

> * initialization of parameterized types using non-parametrized constructor 
> (like ArrayList<Class[]> params = new ArrayList(););
> * using for loops where for each is possible;

Seems like a style warning.

> * a bunch of conditional statements which are always true or false;

I saw one warning like this that was actually true (an "if (true)" statement), 
and a bunch that seem wrong to me, e.g. like these:

        static public Expr parse(Number form){
                if(form instanceof Integer
                        || form instanceof Double
                        || form instanceof Long)
                        return new NumberExpr(form);
                else
                        return new ConstantExpr(form);
        }

IDEA gave warnings that "form instanceOf Integer" is always false.  Maybe I'm 
ignorant of the rules of Java, but Integer is a subclass of Number, so that 
expression definitely looks like it can be true.  Several of the warnings in 
that category I looked at seemed to be incorrect.  It made me wonder whether 
this tool was worth the time to look through its warnings, at least in that 
category.

> * unused parameters and local variables;
> * and so on.
> 
> I also agree that this code does its job well, but why is it so negligent? 
> Doesn't being a good programmer also mean to be accurate when writing code 
> and avoid any warnings? Am I misunderstanding something?
> 
> Regards, Alexander.

Others more familiar with IntelliJ's warnings can speak more accurately on the 
issue than I can, but I've definitely used tools before that did code analysis 
and produced many spurious warnings, such that one learned to avoid wasting 
one's time looking at certain categories of warnings from the tool.

Andy

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to