5402 Commits

Author SHA1 Message Date
Ryan Gustafson
8df01bae99 Update TODO comments for array treatment on allocation expressions (turns out to be more complex than I first thought).
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5863 51baf565-9d33-0410-a72c-fc3788e3496d
2008-03-05 09:00:44 +00:00
Ryan Gustafson
65c6faf511 Update grammar to indicate basic literal type on the ASTLiteral class. Type Resolution can use this to determine the proper Java type (int, long, float, double, char, String) as needed.
This will break the build as I don't have the magic version of JavaCC used to generate the parser.  It's not JavaCC 4.0.

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5862 51baf565-9d33-0410-a72c-fc3788e3496d
2008-03-05 08:40:13 +00:00
Ryan Gustafson
c05badf566 Comment and bug fix.
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5861 51baf565-9d33-0410-a72c-fc3788e3496d
2008-03-05 06:38:52 +00:00
Ryan Gustafson
40a46d11a9 Vast expansion of Type Resolution scope on the AST to cover every possible (AFAIK) node which can meaningfully have a Type. Type information is being rolled up the AST to the top most nodes, based on expression and operator rules defined in the JLS.
The ternary operator, and PrimaryExpressions are not yet done.  This feature will not work very well until PrimaryExpression are handled, as this node appears very often.  A failure at this level could stop the progress of the rollup, seriously limiting utility.

Also, some Parser changes are needed to (1) annotate literals with their type, and (2) know the dimensionality of array types.

Yeah, need to write a boatload of test cases too. :)


git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5860 51baf565-9d33-0410-a72c-fc3788e3496d
2008-03-05 06:36:33 +00:00
Ryan Gustafson
8253ad505c Change a bunch of the AST nodes to also be TypeNodes.
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5859 51baf565-9d33-0410-a72c-fc3788e3496d
2008-03-05 06:22:49 +00:00
Xavier Le Vourch
765742556d local scope only for block statements, based on comments from Ryan
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5858 51baf565-9d33-0410-a72c-fc3788e3496d
2008-03-05 02:28:57 +00:00
Ryan Gustafson
2c5babd8c6 Reverse genericization of java.lang.Class due to incompatible changes w.r.t Java 5 and Java 6.
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5857 51baf565-9d33-0410-a72c-fc3788e3496d
2008-03-05 01:58:00 +00:00
Ryan Gustafson
08bd834cd3 Refactor to add SimpleJavaTypeNode based class for TypeNode interface. Extracted an AccessNode interface and added base classes SimpleJavaAccessNode and SimpleJavaAccessTypeNode (will need this later one as I expand scope of Type Resolution).
Note: For now please do not change usages of AccessNode to be usages of SimpleJavaAccessNode so that class hierarchy compatibility is preserved.  We can do that post 4.2.

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5856 51baf565-9d33-0410-a72c-fc3788e3496d
2008-03-04 22:22:16 +00:00
Ryan Gustafson
57d35ddb88 Add info about RuleChain for performance. Also, pre-commit instructions.
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5855 51baf565-9d33-0410-a72c-fc3788e3496d
2008-03-04 21:49:01 +00:00
Xavier Le Vourch
7e71181ebe bug fix: local variables in constructors were created in the method scope
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5854 51baf565-9d33-0410-a72c-fc3788e3496d
2008-03-04 18:55:00 +00:00
Romain Pelisse
f3025e1624 Reducing rule priority. We can't say that call explicitly GC is going to "break" the application.
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5853 51baf565-9d33-0410-a72c-fc3788e3496d
2008-03-04 11:42:02 +00:00
Romain Pelisse
49e28b8601 Adding a small documentation page about all the QA stuff and piece of knowledge, i have learn since i join the project.
I think this will be helpful (unless we decide to force every new commiter to read ALL the commit message since PM 1.0 ! :) )

Note: this page is far from being finished, so i didn't include it in the website navigation.

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5852 51baf565-9d33-0410-a72c-fc3788e3496d
2008-03-04 11:07:19 +00:00
Xavier Le Vourch
6dc2a50686 optimization: DoNotCallGarbageCollectionExplicitly rewritten. The new implementation
only takes 40% of the time.

Note: when writing a new rule, using command line option "-benchmark" on a few rules
can give an indication on how the rule compares to others. To get the full picture,
use the rulesets/internal/all-java.xml ruleset with "-benchmark".

This rule was the slowest when running on the jdk source tree: it took 69s to complete.
The new version only takes 27s.


git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5851 51baf565-9d33-0410-a72c-fc3788e3496d
2008-03-03 23:34:11 +00:00
Xavier Le Vourch
1a6dffa690 bug fixes for AbstractClassWithoutAnyMethod:
test cases were not included correctly

abstract class with constructors should not raise a warning

incorrect test case


git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5850 51baf565-9d33-0410-a72c-fc3788e3496d
2008-03-03 22:06:31 +00:00
Xavier Le Vourch
84235d0a29 another regression problem with AvoidReassigningParameters: incorrect warnings for local variables in constructors
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5849 51baf565-9d33-0410-a72c-fc3788e3496d
2008-03-03 21:14:22 +00:00
Xavier Le Vourch
3ff43ca4c8 regression in AvoidReassigningParameters: starting with 'this' or 'super' in not enough,
a '.' needs to be there too...

(found by regression test on jdk source)


git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5848 51baf565-9d33-0410-a72c-fc3788e3496d
2008-03-03 20:13:17 +00:00
Romain Pelisse
0cb98fae1d Bug fix for 1902351 - AvoidReassigningParameters not identify parent field
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5847 51baf565-9d33-0410-a72c-fc3788e3496d
2008-03-03 13:36:05 +00:00
Xavier Le Vourch
17eb8a8ce8 temp file shouldn't have been included in last commit
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5846 51baf565-9d33-0410-a72c-fc3788e3496d
2008-03-02 19:59:37 +00:00
Xavier Le Vourch
25eb7d5bd3 new test case showing xml parsing problem that occurs only on Windows with the jdk 1.4 version. Test is not part of regression suite, use 'test14' target to run it
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5845 51baf565-9d33-0410-a72c-fc3788e3496d
2008-03-02 19:58:32 +00:00
Xavier Le Vourch
dd9ce02db8 refactoring: static method TestDescriptor.inRegressionTestMode() gets the 'pmd.regress' property
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5844 51baf565-9d33-0410-a72c-fc3788e3496d
2008-03-02 19:13:57 +00:00
Xavier Le Vourch
55a729a3f0 message parameter wasn't used in assertEqualsRuleSet()
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5843 51baf565-9d33-0410-a72c-fc3788e3496d
2008-03-02 18:40:22 +00:00
Xavier Le Vourch
3451f93a35 weird parsing problem only occuring for regress14 on Windows
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5842 51baf565-9d33-0410-a72c-fc3788e3496d
2008-03-02 04:45:23 +00:00
Xavier Le Vourch
3f93d2a5b6 version number moved: PMD <version> API
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5841 51baf565-9d33-0410-a72c-fc3788e3496d
2008-03-01 21:52:53 +00:00
Xavier Le Vourch
71aa17dcdd code cleanup: javadoc warnings fixed
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5840 51baf565-9d33-0410-a72c-fc3788e3496d
2008-03-01 21:45:10 +00:00
Xavier Le Vourch
4df4c24f6d new target "qa" to run most of the tests (used by continuous integration process)
javadoc tweaks: @todo ignored, ant task path specified, version displayed on main page


git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5839 51baf565-9d33-0410-a72c-fc3788e3496d
2008-03-01 21:44:28 +00:00
Ryan Gustafson
ebd446d765 Remove dependency on JUnit from this Rule so it does not blow up if JUnit is not in the classpath.
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5838 51baf565-9d33-0410-a72c-fc3788e3496d
2008-03-01 20:16:09 +00:00
Romain Pelisse
5ef2bbb6bc Fixed bug 1808158 - Constructor args could also be final
Modified AvoidReassigningParameter to also check constructor arguments for reassignement
Added test case for each.

Also modifier inheritance to AstractJavaRule, and added some @Override...


git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5837 51baf565-9d33-0410-a72c-fc3788e3496d
2008-03-01 18:55:58 +00:00
Xavier Le Vourch
dc600b9b1b bug fix for qualified names for inner classes: name and enclosing class were inverted
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5836 51baf565-9d33-0410-a72c-fc3788e3496d
2008-03-01 04:47:21 +00:00
Xavier Le Vourch
810a6d5d07 bug fixes in SimplifyBooleanReturns:
NPE during parsing

only methods returning booleans should be checked

test case was incorrect (not a boolean method)


git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5835 51baf565-9d33-0410-a72c-fc3788e3496d
2008-03-01 03:43:55 +00:00
Xavier Le Vourch
8c52e3ce5a SimplifyBooleanReturns rule should not complain as return type is void, not boolean
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5834 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-29 22:40:31 +00:00
Xavier Le Vourch
c1e8dcd5d0 SimplifyBooleanReturns test case should fail
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5833 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-29 22:11:39 +00:00
Romain Pelisse
a800b0dcd7 Committing bugfixes on SimplifyBooleanReturns to correct the NPE issue that Ryan pointed out.
Note that the commited patch also had new test case

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5832 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-29 17:02:43 +00:00
Romain Pelisse
dea79a1e39 Some "french" fixes in the messages.
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5831 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-29 10:11:51 +00:00
Ryan Gustafson
4f89fdf8e6 Remove Workspace Preference DFA option, use DataflowAnomalyAnalysis rule instead
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5830 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-28 21:07:12 +00:00
Ryan Gustafson
5a9b99b353 Remove Workspace Preference DFA option, use DataflowAnomalyAnalysis rule instead
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5829 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-28 21:06:57 +00:00
Ryan Gustafson
103f965181 Remove Workspace Preference DFA option, use DataflowAnomalyAnalysis rule instead
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5828 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-28 21:06:50 +00:00
Ryan Gustafson
21d99c90af Allow enabling/disabling of use of Project Build Path as a Workspace PMD Preference.
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5827 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-28 20:49:30 +00:00
Ryan Gustafson
3aa436aad2 Allow enabling/disabling of use of Project Build Path as a Workspace PMD Preference.
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5826 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-28 20:49:20 +00:00
Ryan Gustafson
d14bed6bcb Allow enabling/disabling of use of Project Build Path as a Workspace PMD Preference.
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5825 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-28 20:49:11 +00:00
Ryan Gustafson
c5af5fb7ce Allow the ClassLoader used by PMD for Type Resolution to be specified.
Forgot to handle PMDRunnable case, which is a subclass of PMD.  ClassLoader is now passed, along with the existing instance specific values (e.g. excludeMarker, sourceType).

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5824 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-28 20:17:02 +00:00
Ryan Gustafson
2d33b4d457 Add test case which causes current rule implementation to explode.
Corrected the test case. It wasn't legitimate Java code.

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5823 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-28 18:34:35 +00:00
Ryan Gustafson
f169b96678 Add JavaProjectClassLoader which serves as a ClassLoader for an IJavaProject. Pass this ClassLoader to the PMD instance.
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5822 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-28 09:56:35 +00:00
Ryan Gustafson
f02e2f8cdc Add JavaProjectClassLoader which serves as a ClassLoader for an IJavaProject. Pass this ClassLoader to the PMD instance.
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5821 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-28 09:56:19 +00:00
Ryan Gustafson
8564544d8f Oops, didn't intend the primitives to be instance data (abandoned that approach).
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5820 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-28 09:40:25 +00:00
Ryan Gustafson
00249eb78d Allow the ClassLoader used by PMD for Type Resolution to be specified. This ClassLoader can be distinctly different than the ClassLoader used to load PMD itself.
IDE plugins can create ClassLoaders representing the "project" settings in the IDE, providing PMD with that ClassLoader, such that PMD can truly see the classes being represented in the IDE.  In the specific case of Eclipse, the IDE plugin runs in a ClassLoader which does not contain the details of the "project" settings, which means without this feature PMD would never be able to do proper Type Resolution.

I've not had a chance to benchmark this change.  I expect there to be some performance changes given that 'static' reference to the PMDASMClassLoader is no longer used.  Further tuning may need to be done.

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5819 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-28 09:34:24 +00:00
Ryan Gustafson
9fe5813354 Fix 1903578 - Ensure plugin XML element ids are unique with the document.
Gah, guess those IDs are used in the code.  Reverted them to the minimum changes needed to fix the message from Eclipse.  I checked to ensure the changed IDs are not referenced in the code.

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5818 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-28 04:46:07 +00:00
Ryan Gustafson
8feb0e047c Add test case which causes current rule implementation to explode.
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5817 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-28 04:28:39 +00:00
Ryan Gustafson
ac62ff53e5 Fix 1903578 - Ensure plugin XML element ids are unique with the document.
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5816 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-28 02:19:22 +00:00
Ryan Gustafson
e4c2307bee Fix 1903578 - Ensure plugin XML element ids are unique with the document.
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5815 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-28 02:19:08 +00:00
Ryan Gustafson
d0b4574c25 Changes to Workspace exclude/include patterns are now reflected on the Projects.
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5814 51baf565-9d33-0410-a72c-fc3788e3496d
2008-02-27 23:17:41 +00:00