[Fb-contrib-commit] SF.net SVN: fb-contrib: [534] trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/det
Brought to you by:
dbrosius
From: <dbr...@us...> - 2006-05-15 02:06:58
|
Revision: 534 Author: dbrosius Date: 2006-05-14 19:06:52 -0700 (Sun, 14 May 2006) ViewCVS: http://svn.sourceforge.net/fb-contrib/?rev=534&view=rev Log Message: ----------- javadoc Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java 2006-05-12 04:39:51 UTC (rev 533) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java 2006-05-15 02:06:52 UTC (rev 534) @@ -106,6 +106,12 @@ this.bugReporter = bugReporter; } + /** + * implements the visitor to clear the collectionFields and stack + * and to report collections that remain unmodified out of clinit or init + * + * @param classContext the context object of the currently parsed class + */ @Override public void visitClassContext(ClassContext classContext) { try { @@ -131,6 +137,11 @@ } } + /** + * implements the visitor to find collection fields + * + * @param obj the context object of the currently parse field + */ @Override public void visitField(Field obj) { if (obj.isPrivate()) { @@ -149,6 +160,11 @@ } } + /** + * implements the visitor to set the state based on the type of method being parsed + * + * @param obj the context object of the currently parsed code block + */ @Override public void visitCode(Code obj) { if (collectionFields.size() > 0) { @@ -165,6 +181,11 @@ } } + /** + * implements the visitor to call the approriate visitor based on state + * + * @param seen the opcode of the currently parsed instruction + */ @Override public void sawOpcode(int seen) { switch (state) { @@ -182,6 +203,12 @@ } } + /** + * handle <clinit> blocks by looking for putstatic calls referencing + * synchronized collections + * + * @param seen the opcode of the currently parsed instruction + */ private void sawCLInitOpcode(int seen) { boolean isSyncCollection = false; try { @@ -200,6 +227,12 @@ } } + /** + * handle <init> blocks by looking for putfield calls referencing + * synchronized collections + * + * @param seen the opcode of the currently parsed instruction + */ private void sawInitOpcode(int seen) { boolean isSyncCollection = false; try { @@ -218,6 +251,12 @@ } } + /** + * handles regular methods by looking for methods on collections that + * are modifying and removes those collections from the ones under review + * + * @param seen the opcode of the currently parsed instruction + */ private void sawMethodOpcode(int seen) { boolean isSyncCollection = false; try { @@ -290,6 +329,12 @@ } + /** + * returns whether this instruction is creating a synchronized collection + * + * @param seen the opcode of the currently parsed instruction + * @return whether a synchronized collection has just been created + */ private boolean isSyncCollectionCreation(int seen) { if (seen == INVOKESPECIAL) { if ("<init>".equals(getNameConstantOperand())) { @@ -303,6 +348,12 @@ return false; } + /** + * sets the source line annotation of a store to a collection if that collection + * is synchronized. + * + * @param seen the opcode of the currently parsed instruction + */ private void processCollectionStore(int seen) { String fieldClassName = getDottedClassConstantOperand(); String fieldName = getNameConstantOperand(); @@ -322,6 +373,10 @@ } } + /** + * holds information about a field, namely the annotation and + * whether the collection is synchronized. + */ static class FieldInfo { private FieldAnnotation fieldAnnotation; private boolean isSynchronized; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |