Codebase list findbugs / 77e952f
Imported Upstream version 3.1.0~preview2 Emmanuel Bourg 7 years ago
140 changed file(s) with 2512 addition(s) and 1721 deletion(s). Raw diff Collapse all Expand all
+0
-5
.checkstyle less more
0 <?xml version="1.0" encoding="UTF-8"?>
1 <fileset-config file-format-version="1.1.0" simple-config="true">
2 <fileset name="all" check-config-name="Sun Checks" enabled="true"><file-match-pattern match-pattern="." include-pattern="true"/>
3 </fileset>
4 </fileset-config>
+0
-41
.classpath less more
0 <?xml version="1.0" encoding="UTF-8"?>
1 <classpath>
2 <classpathentry kind="src" path="src/java"/>
3 <classpathentry kind="src" path="src/antTask"/>
4 <classpathentry kind="src" path="src/tools"/>
5 <classpathentry kind="src" path="etc"/>
6 <classpathentry kind="src" path="src/xsl"/>
7 <classpathentry kind="src" path="src/junit"/>
8 <classpathentry kind="src" path="src/gui"/>
9 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
10 <accessrules>
11 <accessrule kind="accessible" pattern="com/sun/management/*"/>
12 <accessrule kind="nonaccessible" pattern="com/sun/**"/>
13 <accessrule kind="accessible" pattern="com/apple/eawt/*"/>
14 <accessrule kind="nonaccessible" pattern="com/apple/**"/>
15 </accessrules>
16 </classpathentry>
17 <classpathentry exported="true" kind="lib" path="lib/AppleJavaExtensions.jar"/>
18 <classpathentry exported="true" kind="lib" path="lib/dom4j-1.6.1.jar">
19 <attributes>
20 <attribute name="javadoc_location" value="http://dom4j.org/apidocs/"/>
21 </attributes>
22 </classpathentry>
23 <classpathentry exported="true" kind="lib" path="lib/junit.jar"/>
24 <classpathentry exported="true" kind="lib" path="lib/commons-lang-2.6.jar"/>
25 <classpathentry exported="true" kind="lib" path="lib/jcip-annotations.jar"/>
26 <classpathentry exported="true" kind="lib" path="lib/yjp-controller-api-redist.jar"/>
27 <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
28 <classpathentry exported="true" kind="lib" path="lib/jsr305.jar" sourcepath="lib/jsr305.jar"/>
29 <classpathentry exported="true" kind="lib" path="lib/jaxen-1.1.6.jar"/>
30 <classpathentry exported="true" kind="lib" path="lib/jFormatString.jar"/>
31 <classpathentry exported="true" kind="lib" path="lib/jdepend-2.9.jar"/>
32 <classpathentry exported="true" kind="lib" path="lib/ant.jar" sourcepath="lib/apache-ant-1.8.3-src.zip"/>
33 <classpathentry exported="true" kind="lib" path="lib/asm-debug-all-5.0.2.jar" sourcepath="/asm3"/>
34 <classpathentry exported="true" kind="lib" path="lib/bcel-6.0-SNAPSHOT.jar">
35 <attributes>
36 <attribute name="javadoc_location" value="http://commons.apache.org/proper/commons-bcel/apidocs/"/>
37 </attributes>
38 </classpathentry>
39 <classpathentry kind="output" path="classesEclipse"/>
40 </classpath>
+0
-2
.pmd less more
0 <?xml version="1.0" encoding="UTF-8"?>
1 <pmd><useProjectRuleSet>false</useProjectRuleSet><rules><rule><name>UnnecessaryReturn</name><ruleset>Basic Rules</ruleset></rule><rule><name>IdempotentOperations</name><ruleset>Design Rules</ruleset></rule><rule><name>BadComparison</name><ruleset>Design Rules</ruleset></rule><rule><name>EmptyTryBlock</name><ruleset>Basic Rules</ruleset></rule><rule><name>SwitchDensity</name><ruleset>Design Rules</ruleset></rule><rule><name>NonCaseLabelInSwitchStatement</name><ruleset>Design Rules</ruleset></rule><rule><name>CloneMethodMustImplementCloneable</name><ruleset>Clone Implementation Rules</ruleset></rule><rule><name>UnusedModifier</name><ruleset>Controversial Rules</ruleset></rule><rule><name>CloneThrowsCloneNotSupportedException</name><ruleset>Clone Implementation Rules</ruleset></rule><rule><name>AvoidDeeplyNestedIfStmts</name><ruleset>Design Rules</ruleset></rule><rule><name>TooManyFields</name><ruleset>Code Size Rules</ruleset></rule><rule><name>FinalizeShouldBeProtected</name><ruleset>Finalizer Rules</ruleset></rule><rule><name>UnusedFormalParameter</name><ruleset>Unused Code Rules</ruleset></rule><rule><name>ConfusingTernary</name><ruleset>Design Rules</ruleset></rule><rule><name>AbstractClassWithoutAbstractMethod</name><ruleset>Design Rules</ruleset></rule><rule><name>UseAssertSameInsteadOfAssertTrue</name><ruleset>JUnit Rules</ruleset></rule><rule><name>UnnecessaryParentheses</name><ruleset>Controversial Rules</ruleset></rule><rule><name>StringInstantiation</name><ruleset>java.lang.String Rules</ruleset></rule><rule><name>UnusedLocalVariable</name><ruleset>Unused Code Rules</ruleset></rule><rule><name>NoPackage</name><ruleset>Naming Rules</ruleset></rule><rule><name>IfStmtsMustUseBraces</name><ruleset>Braces Rules</ruleset></rule><rule><name>LocalVariableCouldBeFinal</name><ruleset>Optimization Rules</ruleset></rule><rule><name>VariableNamingConventions</name><ruleset>Naming Rules</ruleset></rule><rule><name>UnnecessaryLocalBeforeReturn</name><ruleset>Design Rules</ruleset></rule><rule><name>OnlyOneReturn</name><ruleset>Controversial Rules</ruleset></rule><rule><name>ShortVariable</name><ruleset>Naming Rules</ruleset></rule><rule><name>PackageCase</name><ruleset>Naming Rules</ruleset></rule><rule><name>ExcessiveMethodLength</name><ruleset>Code Size Rules</ruleset></rule><rule><name>JUnitAssertionsShouldIncludeMessage</name><ruleset>JUnit Rules</ruleset></rule><rule><name>AvoidThrowingNullPointerException</name><ruleset>Strict Exception Rules</ruleset></rule><rule><name>WhileLoopsMustUseBraces</name><ruleset>Braces Rules</ruleset></rule><rule><name>DontImportJavaLang</name><ruleset>Import Statement Rules</ruleset></rule><rule><name>DoubleCheckedLocking</name><ruleset>Basic Rules</ruleset></rule><rule><name>NullAssignment</name><ruleset>Controversial Rules</ruleset></rule><rule><name>ReturnFromFinallyBlock</name><ruleset>Basic Rules</ruleset></rule><rule><name>StringToString</name><ruleset>java.lang.String Rules</ruleset></rule><rule><name>UnusedPrivateMethod</name><ruleset>Unused Code Rules</ruleset></rule><rule><name>ImportFromSamePackage</name><ruleset>Import Statement Rules</ruleset></rule><rule><name>DefaultLabelNotLastInSwitchStmt</name><ruleset>Design Rules</ruleset></rule><rule><name>SwitchStmtsShouldHaveDefault</name><ruleset>Design Rules</ruleset></rule><rule><name>FinalizeDoesNotCallSuperFinalize</name><ruleset>Finalizer Rules</ruleset></rule><rule><name>AvoidCallingFinalize</name><ruleset>Finalizer Rules</ruleset></rule><rule><name>FinalizeOverloaded</name><ruleset>Finalizer Rules</ruleset></rule><rule><name>CouplingBetweenObjects</name><ruleset>Coupling Rules</ruleset></rule><rule><name>ExcessiveImports</name><ruleset>Coupling Rules</ruleset></rule><rule><name>SuspiciousOctalEscape</name><ruleset>Controversial Rules</ruleset></rule><rule><name>CollapsibleIfStatements</name><ruleset>Basic Rules</ruleset></rule><rule><name>MoreThanOneLogger</name><ruleset>Java Logging Rules</ruleset></rule><rule><name>SystemPrintln</name><ruleset>Java Logging Rules</ruleset></rule><rule><name>EmptyFinalizer</name><ruleset>Finalizer Rules</ruleset></rule><rule><name>IfElseStmtsMustUseBraces</name><ruleset>Braces Rules</ruleset></rule><rule><name>ForLoopShouldBeWhileLoop</name><ruleset>Basic Rules</ruleset></rule><rule><name>EmptyStaticInitializer</name><ruleset>Basic Rules</ruleset></rule><rule><name>JumbledIncrementer</name><ruleset>Basic Rules</ruleset></rule><rule><name>LoggerIsNotStaticFinal</name><ruleset>Java Logging Rules</ruleset></rule><rule><name>CloseConnection</name><ruleset>Design Rules</ruleset></rule><rule><name>InstantiationToGetClass</name><ruleset>Design Rules</ruleset></rule><rule><name>CallSuperInConstructor</name><ruleset>Controversial Rules</ruleset></rule><rule><name>FinalFieldCouldBeStatic</name><ruleset>Design Rules</ruleset></rule><rule><name>UseSingleton</name><ruleset>Design Rules</ruleset></rule><rule><name>AvoidCatchingNPE</name><ruleset>Strict Exception Rules</ruleset></rule><rule><name>AvoidPrintStackTrace</name><ruleset>Java Logging Rules</ruleset></rule><rule><name>SuspiciousConstantFieldName</name><ruleset>Naming Rules</ruleset></rule><rule><name>ExcessiveClassLength</name><ruleset>Code Size Rules</ruleset></rule><rule><name>ShortMethodName</name><ruleset>Naming Rules</ruleset></rule><rule><name>UnnecessaryConstructor</name><ruleset>Controversial Rules</ruleset></rule><rule><name>CompareObjectsWithEquals</name><ruleset>Design Rules</ruleset></rule><rule><name>AvoidInstantiatingObjectsInLoops</name><ruleset>Optimization Rules</ruleset></rule><rule><name>SimplifyStartsWith</name><ruleset>Optimization Rules</ruleset></rule><rule><name>SimplifyBooleanReturns</name><ruleset>Design Rules</ruleset></rule><rule><name>FinalizeOnlyCallsSuperFinalize</name><ruleset>Finalizer Rules</ruleset></rule><rule><name>MissingSerialVersionUID</name><ruleset>JavaBean Rules</ruleset></rule><rule><name>SimplifyBooleanExpressions</name><ruleset>Design Rules</ruleset></rule><rule><name>DuplicateImports</name><ruleset>Import Statement Rules</ruleset></rule><rule><name>ConstructorCallsOverridableMethod</name><ruleset>Design Rules</ruleset></rule><rule><name>EmptyIfStmt</name><ruleset>Basic Rules</ruleset></rule><rule><name>AvoidInstanceofChecksInCatchClause</name><ruleset>Design Rules</ruleset></rule><rule><name>EmptySynchronizedBlock</name><ruleset>Basic Rules</ruleset></rule><rule><name>BeanMembersShouldSerialize</name><ruleset>JavaBean Rules</ruleset></rule><rule><name>UseAssertEqualsInsteadOfAssertTrue</name><ruleset>JUnit Rules</ruleset></rule><rule><name>EmptyWhileStmt</name><ruleset>Basic Rules</ruleset></rule><rule><name>SimplifyConditional</name><ruleset>Design Rules</ruleset></rule><rule><name>EqualsNull</name><ruleset>Design Rules</ruleset></rule><rule><name>UnnecessaryConversionTemporary</name><ruleset>Basic Rules</ruleset></rule><rule><name>MethodWithSameNameAsEnclosingClass</name><ruleset>Naming Rules</ruleset></rule><rule><name>AvoidProtectedFieldInFinalClass</name><ruleset>Design Rules</ruleset></rule><rule><name>JUnitStaticSuite</name><ruleset>JUnit Rules</ruleset></rule><rule><name>ExcessiveParameterList</name><ruleset>Code Size Rules</ruleset></rule><rule><name>UnusedPrivateField</name><ruleset>Unused Code Rules</ruleset></rule><rule><name>ForLoopsMustUseBraces</name><ruleset>Braces Rules</ruleset></rule><rule><name>LongVariable</name><ruleset>Naming Rules</ruleset></rule><rule><name>OptimizableToArrayCall</name><ruleset>Design Rules</ruleset></rule><rule><name>EmptyCatchBlock</name><ruleset>Basic Rules</ruleset></rule><rule><name>ArrayIsStoredDirectly</name><ruleset>Security Code Guidelines</ruleset></rule><rule><name>MethodArgumentCouldBeFinal</name><ruleset>Optimization Rules</ruleset></rule><rule><name>AvoidDollarSigns</name><ruleset>Naming Rules</ruleset></rule><rule><name>LooseCoupling</name><ruleset>Coupling Rules</ruleset></rule><rule><name>UnconditionalIfStatement</name><ruleset>Basic Rules</ruleset></rule><rule><name>NonStaticInitializer</name><ruleset>Design Rules</ruleset></rule><rule><name>AssignmentToNonFinalStatic</name><ruleset>Design Rules</ruleset></rule><rule><name>EmptyStatementNotInLoop</name><ruleset>Basic Rules</ruleset></rule><rule><name>ImmutableField</name><ruleset>Design Rules</ruleset></rule><rule><name>MethodNamingConventions</name><ruleset>Naming Rules</ruleset></rule><rule><name>AssignmentInOperand</name><ruleset>Controversial Rules</ruleset></rule><rule><name>DontImportSun</name><ruleset>Controversial Rules</ruleset></rule><rule><name>UseNotifyAllInsteadOfNotify</name><ruleset>Design Rules</ruleset></rule><rule><name>BooleanInstantiation</name><ruleset>Basic Rules</ruleset></rule><rule><name>SimpleDateFormatNeedsLocale</name><ruleset>Design Rules</ruleset></rule><rule><name>ProperLogger</name><ruleset>Jakarta Commons Logging Rules</ruleset></rule><rule><name>UnnecessaryCaseChange</name><ruleset>java.lang.String Rules</ruleset></rule><rule><name>EmptyFinallyBlock</name><ruleset>Basic Rules</ruleset></rule><rule><name>UnusedImports</name><ruleset>Import Statement Rules</ruleset></rule><rule><name>UnnecessaryBooleanAssertion</name><ruleset>JUnit Rules</ruleset></rule><rule><name>AvoidFieldNameMatchingMethodName</name><ruleset>Naming Rules</ruleset></rule><rule><name>ExceptionAsFlowControl</name><ruleset>Strict Exception Rules</ruleset></rule><rule><name>JUnitSpelling</name><ruleset>JUnit Rules</ruleset></rule><rule><name>UseLocaleWithCaseConversions</name><ruleset>Design Rules</ruleset></rule><rule><name>JUnitTestsShouldIncludeAssert</name><ruleset>JUnit Rules</ruleset></rule><rule><name>TestClassWithoutTestCases</name><ruleset>JUnit Rules</ruleset></rule><rule><name>MethodReturnsInternalArray</name><ruleset>Security Code Guidelines</ruleset></rule><rule><name>UseArrayListInsteadOfVector</name><ruleset>Optimization Rules</ruleset></rule><rule><name>AvoidReassigningParameters</name><ruleset>Design Rules</ruleset></rule><rule><name>AvoidDuplicateLiterals</name><ruleset>java.lang.String Rules</ruleset></rule><rule><name>SignatureDeclareThrowsException</name><ruleset>Strict Exception Rules</ruleset></rule><rule><name>ClassNamingConventions</name><ruleset>Naming Rules</ruleset></rule><rule><name>PositionLiteralsFirstInComparisons</name><ruleset>Design Rules</ruleset></rule><rule><name>SingularField</name><ruleset>Controversial Rules</ruleset></rule><rule><name>SuspiciousHashcodeMethodName</name><ruleset>Naming Rules</ruleset></rule><rule><name>UselessOverridingMethod</name><ruleset>Basic Rules</ruleset></rule><rule><name>AvoidConcatenatingNonLiteralsInStringBuffer</name><ruleset>java.lang.String Rules</ruleset></rule><rule><name>AvoidSynchronizedAtMethodLevel</name><ruleset>Design Rules</ruleset></rule><rule><name>UseCorrectExceptionLogging</name><ruleset>Jakarta Commons Logging Rules</ruleset></rule><rule><name>OverrideBothEqualsAndHashcode</name><ruleset>Basic Rules</ruleset></rule><rule><name>ProperCloneImplementation</name><ruleset>Clone Implementation Rules</ruleset></rule><rule><name>AtLeastOneConstructor</name><ruleset>Controversial Rules</ruleset></rule><rule><name>AbstractNaming</name><ruleset>Naming Rules</ruleset></rule><rule><name>CyclomaticComplexity</name><ruleset>Code Size Rules</ruleset></rule><rule><name>AvoidFieldNameMatchingTypeName</name><ruleset>Naming Rules</ruleset></rule><rule><name>MissingBreakInSwitch</name><ruleset>Design Rules</ruleset></rule><rule><name>MissingStaticMethodInNonInstantiatableClass</name><ruleset>Design Rules</ruleset></rule><rule><name>AvoidThrowingRawExceptionTypes</name><ruleset>Strict Exception Rules</ruleset></rule><rule><name>ExcessivePublicCount</name><ruleset>Code Size Rules</ruleset></rule><rule><name>AccessorClassGeneration</name><ruleset>Design Rules</ruleset></rule><rule><name>SuspiciousEqualsMethodName</name><ruleset>Naming Rules</ruleset></rule><rule><name>UseStringBufferForStringAppends</name><ruleset>Optimization Rules</ruleset></rule><rule><name>UnnecessaryFinalModifier</name><ruleset>Basic Rules</ruleset></rule><rule><name>EmptySwitchStatements</name><ruleset>Basic Rules</ruleset></rule><rule><name>AvoidCatchingThrowable</name><ruleset>Strict Exception Rules</ruleset></rule><rule><name>AvoidNonConstructorMethodsWithClassName</name><ruleset>Naming Rules</ruleset></rule></rules></pmd>
+0
-45
.project less more
0 <?xml version="1.0" encoding="UTF-8"?>
1 <projectDescription>
2 <name>findbugs</name>
3 <comment></comment>
4 <projects>
5 </projects>
6 <buildSpec>
7 <buildCommand>
8 <name>com.cenqua.clover.core.prejavabuilder</name>
9 <arguments>
10 </arguments>
11 </buildCommand>
12 <buildCommand>
13 <name>org.eclipse.jdt.core.javabuilder</name>
14 <arguments>
15 </arguments>
16 </buildCommand>
17 <buildCommand>
18 <name>com.cenqua.clover.core.postjavabuilder</name>
19 <arguments>
20 </arguments>
21 </buildCommand>
22 <buildCommand>
23 <name>org.eclipse.pde.ManifestBuilder</name>
24 <arguments>
25 </arguments>
26 </buildCommand>
27 <buildCommand>
28 <name>org.eclipse.pde.SchemaBuilder</name>
29 <arguments>
30 </arguments>
31 </buildCommand>
32 <buildCommand>
33 <name>edu.umd.cs.findbugs.plugin.eclipse.findbugsBuilder</name>
34 <arguments>
35 </arguments>
36 </buildCommand>
37 </buildSpec>
38 <natures>
39 <nature>org.eclipse.jdt.core.javanature</nature>
40 <nature>org.eclipse.pde.PluginNature</nature>
41 <nature>com.cenqua.clover.core.clovernature</nature>
42 <nature>edu.umd.cs.findbugs.plugin.eclipse.findbugsNature</nature>
43 </natures>
44 </projectDescription>
+0
-18
.settings/de.loskutov.anyedit.AnyEditTools.prefs less more
0 activeContentFilterList=*.makefile,makefile,*.Makefile,Makefile,Makefile.*,*.mk,.classpath,*.properties,.project
1 addNewLine=true
2 convertActionOnSaave=AnyEdit.CnvrtTabToSpaces
3 eclipse.preferences.version=1
4 fixLineDelimiters=true
5 ignoreBlankLinesWhenTrimming=false
6 inActiveContentFilterList=
7 javaTabWidthForJava=true
8 org.eclipse.jdt.ui.editor.tab.width=4
9 projectPropsEnabled=true
10 removeTrailingSpaces=true
11 replaceAllSpaces=false
12 replaceAllTabs=false
13 saveAndAddLine=true
14 saveAndConvert=true
15 saveAndFixLineDelimiters=true
16 saveAndTrim=true
17 useModulo4Tabs=false
+0
-135
.settings/edu.umd.cs.findbugs.core.prefs less more
0 #FindBugs User Preferences
1 #Wed Jun 18 10:04:41 CEST 2014
2 cloud_id=edu.umd.cs.findbugs.cloud.appengine.findbugs-cloud
3 detectorAppendingToAnObjectOutputStream=AppendingToAnObjectOutputStream|true
4 detectorAtomicityProblem=AtomicityProblem|true
5 detectorBadAppletConstructor=BadAppletConstructor|false
6 detectorBadResultSetAccess=BadResultSetAccess|true
7 detectorBadSyntaxForRegularExpression=BadSyntaxForRegularExpression|true
8 detectorBadUseOfReturnValue=BadUseOfReturnValue|true
9 detectorBadlyOverriddenAdapter=BadlyOverriddenAdapter|true
10 detectorBooleanReturnNull=BooleanReturnNull|true
11 detectorCallToUnsupportedMethod=CallToUnsupportedMethod|true
12 detectorCheckExpectedWarnings=CheckExpectedWarnings|false
13 detectorCheckImmutableAnnotation=CheckImmutableAnnotation|true
14 detectorCheckRelaxingNullnessAnnotation=CheckRelaxingNullnessAnnotation|true
15 detectorCheckTypeQualifiers=CheckTypeQualifiers|true
16 detectorCloneIdiom=CloneIdiom|true
17 detectorComparatorIdiom=ComparatorIdiom|true
18 detectorConfusedInheritance=ConfusedInheritance|true
19 detectorConfusionBetweenInheritedAndOuterMethod=ConfusionBetweenInheritedAndOuterMethod|true
20 detectorCrossSiteScripting=CrossSiteScripting|true
21 detectorDefaultEncodingDetector=DefaultEncodingDetector|true
22 detectorDoInsideDoPrivileged=DoInsideDoPrivileged|true
23 detectorDontCatchIllegalMonitorStateException=DontCatchIllegalMonitorStateException|true
24 detectorDontIgnoreResultOfPutIfAbsent=DontIgnoreResultOfPutIfAbsent|true
25 detectorDontUseEnum=DontUseEnum|true
26 detectorDroppedException=DroppedException|true
27 detectorDumbMethodInvocations=DumbMethodInvocations|true
28 detectorDumbMethods=DumbMethods|true
29 detectorDuplicateBranches=DuplicateBranches|true
30 detectorEmptyZipFileEntry=EmptyZipFileEntry|true
31 detectorEqualsOperandShouldHaveClassCompatibleWithThis=EqualsOperandShouldHaveClassCompatibleWithThis|true
32 detectorExplicitSerialization=ExplicitSerialization|true
33 detectorFinalizerNullsFields=FinalizerNullsFields|true
34 detectorFindBadCast2=FindBadCast2|true
35 detectorFindBadForLoop=FindBadForLoop|true
36 detectorFindCircularDependencies=FindCircularDependencies|false
37 detectorFindDeadLocalStores=FindDeadLocalStores|true
38 detectorFindDoubleCheck=FindDoubleCheck|true
39 detectorFindEmptySynchronizedBlock=FindEmptySynchronizedBlock|true
40 detectorFindFieldSelfAssignment=FindFieldSelfAssignment|true
41 detectorFindFinalizeInvocations=FindFinalizeInvocations|true
42 detectorFindFloatEquality=FindFloatEquality|true
43 detectorFindHEmismatch=FindHEmismatch|true
44 detectorFindInconsistentSync2=FindInconsistentSync2|true
45 detectorFindJSR166LockMonitorenter=FindJSR166LockMonitorenter|true
46 detectorFindLocalSelfAssignment2=FindLocalSelfAssignment2|true
47 detectorFindMaskedFields=FindMaskedFields|true
48 detectorFindMismatchedWaitOrNotify=FindMismatchedWaitOrNotify|true
49 detectorFindNakedNotify=FindNakedNotify|true
50 detectorFindNonShortCircuit=FindNonShortCircuit|true
51 detectorFindNullDeref=FindNullDeref|true
52 detectorFindNullDerefsInvolvingNonShortCircuitEvaluation=FindNullDerefsInvolvingNonShortCircuitEvaluation|true
53 detectorFindOpenStream=FindOpenStream|true
54 detectorFindPuzzlers=FindPuzzlers|true
55 detectorFindRefComparison=FindRefComparison|true
56 detectorFindReturnRef=FindReturnRef|true
57 detectorFindRunInvocations=FindRunInvocations|true
58 detectorFindSelfComparison=FindSelfComparison|true
59 detectorFindSelfComparison2=FindSelfComparison2|true
60 detectorFindSleepWithLockHeld=FindSleepWithLockHeld|true
61 detectorFindSpinLoop=FindSpinLoop|true
62 detectorFindSqlInjection=FindSqlInjection|true
63 detectorFindTwoLockWait=FindTwoLockWait|true
64 detectorFindUncalledPrivateMethods=FindUncalledPrivateMethods|true
65 detectorFindUnconditionalWait=FindUnconditionalWait|true
66 detectorFindUninitializedGet=FindUninitializedGet|true
67 detectorFindUnrelatedTypesInGenericContainer=FindUnrelatedTypesInGenericContainer|true
68 detectorFindUnreleasedLock=FindUnreleasedLock|true
69 detectorFindUnsatisfiedObligation=FindUnsatisfiedObligation|true
70 detectorFindUnsyncGet=FindUnsyncGet|true
71 detectorFindUseOfNonSerializableValue=FindUseOfNonSerializableValue|true
72 detectorFindUselessControlFlow=FindUselessControlFlow|true
73 detectorFormatStringChecker=FormatStringChecker|true
74 detectorHugeSharedStringConstants=HugeSharedStringConstants|true
75 detectorIDivResultCastToDouble=IDivResultCastToDouble|true
76 detectorIncompatMask=IncompatMask|true
77 detectorInconsistentAnnotations=InconsistentAnnotations|true
78 detectorInefficientMemberAccess=InefficientMemberAccess|false
79 detectorInefficientToArray=InefficientToArray|true
80 detectorInfiniteLoop=InfiniteLoop|true
81 detectorInfiniteRecursiveLoop=InfiniteRecursiveLoop|true
82 detectorInheritanceUnsafeGetResource=InheritanceUnsafeGetResource|true
83 detectorInitializationChain=InitializationChain|true
84 detectorInitializeNonnullFieldsInConstructor=InitializeNonnullFieldsInConstructor|true
85 detectorInstantiateStaticClass=InstantiateStaticClass|true
86 detectorIntCast2LongAsInstant=IntCast2LongAsInstant|true
87 detectorInvalidJUnitTest=InvalidJUnitTest|true
88 detectorIteratorIdioms=IteratorIdioms|true
89 detectorLazyInit=LazyInit|true
90 detectorLoadOfKnownNullValue=LoadOfKnownNullValue|true
91 detectorLostLoggerDueToWeakReference=LostLoggerDueToWeakReference|true
92 detectorMethodReturnCheck=MethodReturnCheck|true
93 detectorMultithreadedInstanceAccess=MultithreadedInstanceAccess|true
94 detectorMutableLock=MutableLock|true
95 detectorMutableStaticFields=MutableStaticFields|true
96 detectorNaming=Naming|true
97 detectorNoteUnconditionalParamDerefs=NoteUnconditionalParamDerefs|true
98 detectorNumberConstructor=NumberConstructor|true
99 detectorOptionalReturnNull=OptionalReturnNull|true
100 detectorOverridingEqualsNotSymmetrical=OverridingEqualsNotSymmetrical|true
101 detectorPreferZeroLengthArrays=PreferZeroLengthArrays|true
102 detectorPublicSemaphores=PublicSemaphores|true
103 detectorQuestionableBooleanAssignment=QuestionableBooleanAssignment|true
104 detectorReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass=ReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass|true
105 detectorReadReturnShouldBeChecked=ReadReturnShouldBeChecked|true
106 detectorRedundantInterfaces=RedundantInterfaces|true
107 detectorRepeatedConditionals=RepeatedConditionals|true
108 detectorRuntimeExceptionCapture=RuntimeExceptionCapture|true
109 detectorSerializableIdiom=SerializableIdiom|true
110 detectorStartInConstructor=StartInConstructor|true
111 detectorStaticCalendarDetector=StaticCalendarDetector|true
112 detectorStringConcatenation=StringConcatenation|true
113 detectorSuperfluousInstanceOf=SuperfluousInstanceOf|true
114 detectorSuspiciousThreadInterrupted=SuspiciousThreadInterrupted|true
115 detectorSwitchFallthrough=SwitchFallthrough|true
116 detectorSynchronizeAndNullCheckField=SynchronizeAndNullCheckField|true
117 detectorSynchronizeOnClassLiteralNotGetClass=SynchronizeOnClassLiteralNotGetClass|true
118 detectorSynchronizingOnContentsOfFieldToProtectField=SynchronizingOnContentsOfFieldToProtectField|true
119 detectorURLProblems=URLProblems|true
120 detectorUncallableMethodOfAnonymousClass=UncallableMethodOfAnonymousClass|true
121 detectorUnnecessaryMath=UnnecessaryMath|true
122 detectorUnreadFields=UnreadFields|true
123 detectorUselessSubclassMethod=UselessSubclassMethod|true
124 detectorVarArgsProblems=VarArgsProblems|true
125 detectorVolatileUsage=VolatileUsage|true
126 detectorWaitInLoop=WaitInLoop|true
127 detectorWrongMapIterator=WrongMapIterator|true
128 detectorXMLFactoryBypass=XMLFactoryBypass|true
129 detector_threshold=3
130 effort=default
131 excludefilter0=findbugsExclude.xml|true
132 filter_settings=Low|BAD_PRACTICE,CORRECTNESS,EXPERIMENTAL,I18N,MT_CORRECTNESS,PERFORMANCE,SECURITY,STYLE|false|20
133 filter_settings_neg=MALICIOUS_CODE,NOISE|
134 run_at_full_build=false
+0
-2
.settings/edu.umd.cs.findbugs.plugin.eclipse.prefs less more
0 eclipse.preferences.version=1
1 runAnalysisAsExtraJob=true
+0
-2
.settings/org.eclipse.core.resources.prefs less more
0 eclipse.preferences.version=1
1 encoding/<project>=UTF-8
+0
-2
.settings/org.eclipse.core.runtime.prefs less more
0 eclipse.preferences.version=1
1 line.separator=\n
+0
-424
.settings/org.eclipse.jdt.core.prefs less more
0 eclipse.preferences.version=1
1 org.eclipse.jdt.core.builder.cleanOutputFolder=clean
2 org.eclipse.jdt.core.builder.duplicateResourceTask=warning
3 org.eclipse.jdt.core.builder.invalidClasspath=abort
4 org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore
5 org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
6 org.eclipse.jdt.core.circularClasspath=error
7 org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
8 org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
9 org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=error
10 org.eclipse.jdt.core.codeComplete.argumentPrefixes=
11 org.eclipse.jdt.core.codeComplete.argumentSuffixes=
12 org.eclipse.jdt.core.codeComplete.fieldPrefixes=
13 org.eclipse.jdt.core.codeComplete.fieldSuffixes=
14 org.eclipse.jdt.core.codeComplete.localPrefixes=
15 org.eclipse.jdt.core.codeComplete.localSuffixes=
16 org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
17 org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
18 org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
19 org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
20 org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
21 org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
22 org.eclipse.jdt.core.compiler.annotation.nonnull=javax.annotation.Nonnull
23 org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
24 org.eclipse.jdt.core.compiler.annotation.nonnullisdefault=disabled
25 org.eclipse.jdt.core.compiler.annotation.nullable=javax.annotation.Nullable
26 org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
27 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
28 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
29 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
30 org.eclipse.jdt.core.compiler.compliance=1.7
31 org.eclipse.jdt.core.compiler.debug.lineNumber=generate
32 org.eclipse.jdt.core.compiler.debug.localVariable=generate
33 org.eclipse.jdt.core.compiler.debug.sourceFile=generate
34 org.eclipse.jdt.core.compiler.doc.comment.support=enabled
35 org.eclipse.jdt.core.compiler.maxProblemPerUnit=100
36 org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
37 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
38 org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
39 org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
40 org.eclipse.jdt.core.compiler.problem.deadCode=warning
41 org.eclipse.jdt.core.compiler.problem.deprecation=ignore
42 org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
43 org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
44 org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
45 org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
46 org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
47 org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
48 org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
49 org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
50 org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
51 org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
52 org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
53 org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
54 org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
55 org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=enabled
56 org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
57 org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
58 org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
59 org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
60 org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
61 org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled
62 org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled
63 org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
64 org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
65 org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
66 org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
67 org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
68 org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
69 org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
70 org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
71 org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
72 org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
73 org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=no_tag
74 org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
75 org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
76 org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
77 org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
78 org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
79 org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
80 org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
81 org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning
82 org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
83 org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
84 org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
85 org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
86 org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
87 org.eclipse.jdt.core.compiler.problem.nullReference=warning
88 org.eclipse.jdt.core.compiler.problem.nullSpecInsufficientInfo=warning
89 org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
90 org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=ignore
91 org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
92 org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
93 org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
94 org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
95 org.eclipse.jdt.core.compiler.problem.potentialNullSpecViolation=error
96 org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
97 org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
98 org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
99 org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
100 org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
101 org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
102 org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
103 org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
104 org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
105 org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
106 org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
107 org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
108 org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
109 org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
110 org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
111 org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
112 org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
113 org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
114 org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
115 org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
116 org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
117 org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
118 org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
119 org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation=warning
120 org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
121 org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
122 org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
123 org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
124 org.eclipse.jdt.core.compiler.problem.unusedImport=warning
125 org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
126 org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
127 org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning
128 org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
129 org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
130 org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
131 org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
132 org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
133 org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
134 org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
135 org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
136 org.eclipse.jdt.core.compiler.source=1.7
137 org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled
138 org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL,HIGH
139 org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX,MUSTFIX
140 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
141 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
142 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
143 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
144 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
145 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
146 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
147 org.eclipse.jdt.core.formatter.alignment_for_assignment=0
148 org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
149 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
150 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
151 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
152 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
153 org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
154 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
155 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
156 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
157 org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
158 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
159 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
160 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
161 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
162 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
163 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
164 org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
165 org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
166 org.eclipse.jdt.core.formatter.blank_lines_after_package=1
167 org.eclipse.jdt.core.formatter.blank_lines_before_field=1
168 org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
169 org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
170 org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
171 org.eclipse.jdt.core.formatter.blank_lines_before_method=1
172 org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
173 org.eclipse.jdt.core.formatter.blank_lines_before_package=0
174 org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
175 org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
176 org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
177 org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
178 org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
179 org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
180 org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
181 org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
182 org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
183 org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
184 org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
185 org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
186 org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
187 org.eclipse.jdt.core.formatter.comment.clear_blank_lines=false
188 org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
189 org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
190 org.eclipse.jdt.core.formatter.comment.format_block_comments=true
191 org.eclipse.jdt.core.formatter.comment.format_comments=true
192 org.eclipse.jdt.core.formatter.comment.format_header=false
193 org.eclipse.jdt.core.formatter.comment.format_html=true
194 org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
195 org.eclipse.jdt.core.formatter.comment.format_line_comments=true
196 org.eclipse.jdt.core.formatter.comment.format_source_code=true
197 org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
198 org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
199 org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
200 org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
201 org.eclipse.jdt.core.formatter.comment.line_length=80
202 org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
203 org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
204 org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
205 org.eclipse.jdt.core.formatter.compact_else_if=true
206 org.eclipse.jdt.core.formatter.continuation_indentation=2
207 org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
208 org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
209 org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
210 org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
211 org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
212 org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
213 org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
214 org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
215 org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
216 org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
217 org.eclipse.jdt.core.formatter.indent_empty_lines=false
218 org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
219 org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
220 org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
221 org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
222 org.eclipse.jdt.core.formatter.indentation.size=4
223 org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
224 org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
225 org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
226 org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
227 org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=insert
228 org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
229 org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
230 org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
231 org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
232 org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
233 org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
234 org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
235 org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
236 org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
237 org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
238 org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
239 org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
240 org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
241 org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
242 org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
243 org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
244 org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
245 org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
246 org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
247 org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
248 org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
249 org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
250 org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
251 org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
252 org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
253 org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
254 org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
255 org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
256 org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
257 org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
258 org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
259 org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
260 org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
261 org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
262 org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
263 org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
264 org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
265 org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
266 org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
267 org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
268 org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
269 org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
270 org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
271 org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
272 org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
273 org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
274 org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
275 org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
276 org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
277 org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
278 org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
279 org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
280 org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
281 org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
282 org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
283 org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
284 org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
285 org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
286 org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
287 org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
288 org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
289 org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
290 org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
291 org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
292 org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
293 org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
294 org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
295 org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
296 org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
297 org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
298 org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
299 org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
300 org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
301 org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
302 org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
303 org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
304 org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
305 org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
306 org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
307 org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
308 org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
309 org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
310 org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
311 org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
312 org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
313 org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
314 org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
315 org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
316 org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
317 org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
318 org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
319 org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
320 org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
321 org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
322 org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
323 org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
324 org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
325 org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
326 org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
327 org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
328 org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
329 org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
330 org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
331 org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
332 org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
333 org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
334 org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
335 org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
336 org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
337 org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
338 org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
339 org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
340 org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
341 org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
342 org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
343 org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
344 org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
345 org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
346 org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
347 org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
348 org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
349 org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
350 org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
351 org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
352 org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
353 org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
354 org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
355 org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
356 org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
357 org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
358 org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
359 org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
360 org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
361 org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
362 org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
363 org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
364 org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
365 org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
366 org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
367 org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
368 org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
369 org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
370 org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
371 org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
372 org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
373 org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
374 org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
375 org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
376 org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
377 org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
378 org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
379 org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
380 org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
381 org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
382 org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
383 org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
384 org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
385 org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
386 org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
387 org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
388 org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
389 org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
390 org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
391 org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
392 org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
393 org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
394 org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
395 org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
396 org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
397 org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
398 org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
399 org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
400 org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
401 org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
402 org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
403 org.eclipse.jdt.core.formatter.join_lines_in_comments=true
404 org.eclipse.jdt.core.formatter.join_wrapped_lines=true
405 org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
406 org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
407 org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
408 org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
409 org.eclipse.jdt.core.formatter.lineSplit=130
410 org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
411 org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
412 org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
413 org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
414 org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
415 org.eclipse.jdt.core.formatter.tabulation.char=space
416 org.eclipse.jdt.core.formatter.tabulation.size=4
417 org.eclipse.jdt.core.formatter.use_on_off_tags=false
418 org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=true
419 org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
420 org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
421 org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
422 org.eclipse.jdt.core.incompatibleJDKLevel=ignore
423 org.eclipse.jdt.core.incompleteClasspath=error
+0
-131
.settings/org.eclipse.jdt.ui.prefs less more
0 cleanup.add_default_serial_version_id=true
1 cleanup.add_generated_serial_version_id=false
2 cleanup.add_missing_annotations=true
3 cleanup.add_missing_deprecated_annotations=true
4 cleanup.add_missing_methods=false
5 cleanup.add_missing_nls_tags=false
6 cleanup.add_missing_override_annotations=true
7 cleanup.add_missing_override_annotations_interface_methods=true
8 cleanup.add_serial_version_id=false
9 cleanup.always_use_blocks=true
10 cleanup.always_use_parentheses_in_expressions=false
11 cleanup.always_use_this_for_non_static_field_access=false
12 cleanup.always_use_this_for_non_static_method_access=false
13 cleanup.convert_functional_interfaces=false
14 cleanup.convert_to_enhanced_for_loop=false
15 cleanup.correct_indentation=true
16 cleanup.format_source_code=false
17 cleanup.format_source_code_changes_only=false
18 cleanup.insert_inferred_type_arguments=false
19 cleanup.make_local_variable_final=false
20 cleanup.make_parameters_final=false
21 cleanup.make_private_fields_final=true
22 cleanup.make_type_abstract_if_missing_method=false
23 cleanup.make_variable_declarations_final=true
24 cleanup.never_use_blocks=false
25 cleanup.never_use_parentheses_in_expressions=true
26 cleanup.organize_imports=true
27 cleanup.qualify_static_field_accesses_with_declaring_class=false
28 cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
29 cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
30 cleanup.qualify_static_member_accesses_with_declaring_class=true
31 cleanup.qualify_static_method_accesses_with_declaring_class=false
32 cleanup.remove_private_constructors=true
33 cleanup.remove_redundant_type_arguments=true
34 cleanup.remove_trailing_whitespaces=true
35 cleanup.remove_trailing_whitespaces_all=true
36 cleanup.remove_trailing_whitespaces_ignore_empty=false
37 cleanup.remove_unnecessary_casts=true
38 cleanup.remove_unnecessary_nls_tags=true
39 cleanup.remove_unused_imports=true
40 cleanup.remove_unused_local_variables=false
41 cleanup.remove_unused_private_fields=true
42 cleanup.remove_unused_private_members=false
43 cleanup.remove_unused_private_methods=true
44 cleanup.remove_unused_private_types=true
45 cleanup.sort_members=false
46 cleanup.sort_members_all=false
47 cleanup.use_anonymous_class_creation=false
48 cleanup.use_blocks=true
49 cleanup.use_blocks_only_for_return_and_throw=false
50 cleanup.use_lambda=true
51 cleanup.use_parentheses_in_expressions=false
52 cleanup.use_this_for_non_static_field_access=false
53 cleanup.use_this_for_non_static_field_access_only_if_necessary=true
54 cleanup.use_this_for_non_static_method_access=false
55 cleanup.use_this_for_non_static_method_access_only_if_necessary=true
56 cleanup.use_type_arguments=false
57 cleanup_profile=_FindBugs
58 cleanup_settings_version=2
59 eclipse.preferences.version=1
60 editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
61 formatter_profile=_FindBugs
62 formatter_settings_version=12
63 org.eclipse.jdt.ui.exception.name=e
64 org.eclipse.jdt.ui.gettersetter.use.is=true
65 org.eclipse.jdt.ui.ignorelowercasenames=true
66 org.eclipse.jdt.ui.importorder=java;javax;org;com;
67 org.eclipse.jdt.ui.javadoc=true
68 org.eclipse.jdt.ui.keywordthis=false
69 org.eclipse.jdt.ui.ondemandthreshold=99
70 org.eclipse.jdt.ui.overrideannotation=true
71 org.eclipse.jdt.ui.staticondemandthreshold=2
72 org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return Returns the ${bare_field_name}.\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} The ${bare_field_name} to set.\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*\n * FindBugs - Find Bugs in Java programs\n * Copyright (C) 2003-2008 University of Maryland\n * \n * This library is free software; you can redistribute it and/or\n * modify it under the terms of the GNU Lesser General Public\n * License as published by the Free Software Foundation; either\n * version 2.1 of the License, or (at your option) any later version.\n * \n * This library is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n * \n * You should have received a copy of the GNU Lesser General Public\n * License along with this library; if not, write to the Free Software\n * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n */\n</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * @author ${user}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template></templates>
73 sp_cleanup.add_default_serial_version_id=true
74 sp_cleanup.add_generated_serial_version_id=false
75 sp_cleanup.add_missing_annotations=true
76 sp_cleanup.add_missing_deprecated_annotations=true
77 sp_cleanup.add_missing_methods=false
78 sp_cleanup.add_missing_nls_tags=false
79 sp_cleanup.add_missing_override_annotations=true
80 sp_cleanup.add_missing_override_annotations_interface_methods=true
81 sp_cleanup.add_serial_version_id=false
82 sp_cleanup.always_use_blocks=true
83 sp_cleanup.always_use_parentheses_in_expressions=false
84 sp_cleanup.always_use_this_for_non_static_field_access=false
85 sp_cleanup.always_use_this_for_non_static_method_access=false
86 sp_cleanup.convert_functional_interfaces=false
87 sp_cleanup.convert_to_enhanced_for_loop=false
88 sp_cleanup.correct_indentation=true
89 sp_cleanup.format_source_code=false
90 sp_cleanup.format_source_code_changes_only=false
91 sp_cleanup.insert_inferred_type_arguments=false
92 sp_cleanup.make_local_variable_final=false
93 sp_cleanup.make_parameters_final=false
94 sp_cleanup.make_private_fields_final=true
95 sp_cleanup.make_type_abstract_if_missing_method=false
96 sp_cleanup.make_variable_declarations_final=true
97 sp_cleanup.never_use_blocks=false
98 sp_cleanup.never_use_parentheses_in_expressions=true
99 sp_cleanup.on_save_use_additional_actions=true
100 sp_cleanup.organize_imports=true
101 sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
102 sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
103 sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
104 sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
105 sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
106 sp_cleanup.remove_private_constructors=true
107 sp_cleanup.remove_redundant_type_arguments=false
108 sp_cleanup.remove_trailing_whitespaces=true
109 sp_cleanup.remove_trailing_whitespaces_all=true
110 sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
111 sp_cleanup.remove_unnecessary_casts=true
112 sp_cleanup.remove_unnecessary_nls_tags=false
113 sp_cleanup.remove_unused_imports=true
114 sp_cleanup.remove_unused_local_variables=false
115 sp_cleanup.remove_unused_private_fields=true
116 sp_cleanup.remove_unused_private_members=false
117 sp_cleanup.remove_unused_private_methods=true
118 sp_cleanup.remove_unused_private_types=true
119 sp_cleanup.sort_members=false
120 sp_cleanup.sort_members_all=false
121 sp_cleanup.use_anonymous_class_creation=false
122 sp_cleanup.use_blocks=true
123 sp_cleanup.use_blocks_only_for_return_and_throw=false
124 sp_cleanup.use_lambda=false
125 sp_cleanup.use_parentheses_in_expressions=false
126 sp_cleanup.use_this_for_non_static_field_access=false
127 sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
128 sp_cleanup.use_this_for_non_static_method_access=false
129 sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
130 sp_cleanup.use_type_arguments=false
88 lib/bcel-6.0-SNAPSHOT.jar,
99 lib/dom4j-1.6.1.jar,
1010 lib/junit.jar,
11 lib/asm-debug-all-5.0.2.jar,
11 lib/asm-debug-all-6.0-SNAPSHOT.jar,
1212 lib/jaxen-1.1.6.jar,
1313 lib/jFormatString.jar,
1414 lib/commons-lang-2.6.jar,
9595 org.objectweb.asm.tree.analysis,
9696 org.objectweb.asm.util,
9797 org.objectweb.asm.xml
98 Bundle-RequiredExecutionEnvironment: JavaSE-1.7
98 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
0 This is a folder for jars required for BUILDING, not dependencies of FindBugs itself!
4646 <property name="engine.jar" value="${jar.dir}/findbugs.jar"/>
4747 <property name="oneFourCompatibility.jar" value="${build.dir}/oneFourCompatibility.jar"/>
4848 <property name="annotations.jar" value="${jar.dir}/annotations.jar"/>
49 <property name="findbugs-annotations.jar" value="${jar.dir}/findbugs-annotations.jar"/>
4950 <property name="test.jar" value="${test.dir}/dumb.jar"/>
5051 <property name="sampleoutput.dir" value="build/sampleoutput"/>
5152 <property name="junittests.jar" value="build/junittests.jar"/>
106107 <target name="errorprone" depends="clean,init">
107108 <javac
108109 destdir="${classes.dir}"
109 source="1.7"
110 target="1.7"
110 source="1.8"
111 target="1.8"
111112 includeantruntime="false"
112113 encoding="ISO-8859-1"
113114 deprecation="off"
121122 </javac>
122123 </target>
123124 <target name="classes" depends="init">
124 <echo>Requires JDK 7.x (not 8!), using: ${ant.java.version}</echo>
125 <fail message="Requires JDK 7.x (not 8!), using: ${ant.java.version}">
125 <echo>Requires JDK 8.x (not 7, not 9!), using: ${ant.java.version}</echo>
126 <fail message="Requires JDK 8.x (not 7, not 9!), using: ${ant.java.version}">
126127 <condition>
127 <equals arg1="1.8" arg2="${ant.java.version}"/>
128 <or>
129 <equals arg1="1.7" arg2="${ant.java.version}"/>
130 <equals arg1="1.9" arg2="${ant.java.version}"/>
131 </or>
128132 </condition>
129133 </fail>
130134
132136 <echo level="info" message="compiling findbugs"/>
133137 <javac
134138 destdir="${classes.dir}"
135 source="1.7"
136 target="1.7"
139 source="1.8"
140 target="1.8"
137141 includeantruntime="false"
138142 encoding="ISO-8859-1"
139143 deprecation="off"
165169 <echo level="info" message="compiling junit test cases"/>
166170 <javac srcdir="${junitsrc.dir}"
167171 destdir="${junitclasses.dir}"
168 source="1.7"
169 target="1.7"
172 source="1.8"
173 target="1.8"
170174 includeantruntime="false"
171175 encoding="ISO-8859-1"
172176 deprecation="off"
177181 <echo level="info" message="compiling tools"/>
178182 <javac srcdir="${toolsrc.dir}"
179183 destdir="${classes.dir}"
180 source="1.7"
181 target="1.7"
184 source="1.8"
185 target="1.8"
182186 includeantruntime="false"
183187 encoding="ISO-8859-1"
184188 debug="on"
191195 <echo level="info" message="compiling ant task"/>
192196 <javac srcdir="${anttasksrc.dir}"
193197 destdir="${classes.dir}"
194 source="1.7"
195 target="1.7"
198 source="1.8"
199 target="1.8"
196200 includeantruntime="false"
197201 encoding="ISO-8859-1"
198202 deprecation="off"
299303 </fileset>
300304 <zipfileset src="${jar.dir}/jcip-annotations.jar" excludes="META-INF/**,**/*.html"/>
301305 <zipfileset src="${jar.dir}/jsr305.jar" excludes="META-INF/**,**/*.html"/>
306 </jar>
307
308 <!-- FindBugs only annotations jar file. -->
309 <jar destfile="${findbugs-annotations.jar}" manifest="${etc.dir}/MANIFEST-findbugs-internal-annotations.MF">
310 <fileset dir="${classes.dir}">
311 <include name="**/annotations/*.class"/>
312 </fileset>
313 <fileset dir="${src.dir}">
314 <include name="**/annotations/*.java"/>
315 </fileset>
302316 </jar>
303317 </target>
304318
11651179 </delete>
11661180 </target>
11671181
1168 <target name="init" depends="properties">
1182 <target name="init" depends="properties,getasm6,getbcel6">
11691183 <mkdir dir="${scripts.dir}"/>
11701184 <mkdir dir="${build.dir}"/>
11711185 <mkdir dir="${doc.dir}"/>
12021216 doctitle="FindBugs API Documentation"
12031217 Header="&lt;b&gt;FindBugs&amp;trade; ${release.number}&lt;/b&gt;"
12041218 Windowtitle="FindBugs ${release.number} API"
1205 bottom="&lt;font size='-1'&gt;&lt;a href='http://findbugs.sourceforge.net/' target='_parent'&gt;FindBugs&lt;/a&gt;&amp;trade; is licenced under the LGPL. Copyright &amp;copy; 2006 University of Maryland.&lt;/font&gt;"
1219 bottom="&lt;font size='-1'&gt;&lt;a href='http://findbugs.sourceforge.net/' target='_parent'&gt;FindBugs&lt;/a&gt;&amp;trade; is licensed under the LGPL. Copyright &amp;copy; 2006 University of Maryland.&lt;/font&gt;"
12061220 nodeprecated="false" nodeprecatedlist="false" noindex="false" nonavbar= "false" notree="false"
12071221 sourcepath="src/java:src/gui:src/antTask" splitindex="true" use="true" version="true">
12081222 <classpath refid="findbugs.classpath"/>
12181232 nodeprecated="false" nodeprecatedlist="false" noindex="false" nonavbar= "false" notree="false"
12191233 sourcepath="src/java:src/gui:src/antTask" splitindex="true" use="true" version="true"/>
12201234 </target>
1235
1236 <!-- Download snapshot of asm 6.0 with Java 9 support, built from SVN version 1818 from ASM_6_FUTURE branch,
1237 install resulting jar in lib.
1238
1239 unless="asm6.exists"
1240 -->
1241
1242 <scriptdef name="getAndCheckLibrary" language="javascript">
1243 <attribute name="url"/>
1244 <attribute name="path"/>
1245 <attribute name="checksum"/>
1246 <![CDATA[
1247 var URL = Java.type("java.net.URL");
1248 var File = Java.type("java.io.File");
1249
1250 var path = attributes.get("path");
1251 var url = attributes.get("url");
1252 var checksum = attributes.get("checksum");
1253 print(path + " / " + url + " : " + checksum);
1254
1255 var file = new File(path);
1256
1257 check = project.createTask("checksum");
1258 check.setFile(file);
1259 check.setProperty(checksum);
1260 check.setVerifyproperty("check.result");
1261
1262 result = false;
1263 if(file.exists()){
1264 print("File exists, verifying checksum...")
1265 result = check.eval();
1266 if(!result){
1267 print("Checksum check failed, deleting!")
1268 file.delete();
1269 } else {
1270 print("Checksum check succeeded!")
1271 }
1272 }
1273 if(result == false){
1274 print("Downloading file...")
1275 get = project.createTask("get");
1276 get.setSrc(new URL(url));
1277 get.setDest(file)
1278 get.perform();
1279 result = check.eval();
1280 if(!result ){
1281 fail = project.createTask("fail");
1282 fail.setMessage("Download and checksum check failed for: " + path);
1283 fail.perform();
1284 }
1285 }
1286 ]]>
1287 </scriptdef>
1288
1289 <target name="getasm6" >
1290 <getAndCheckLibrary
1291 url="http://repository.ow2.org/nexus/service/local/repositories/releases/content/org/ow2/asm/asm-debug-all/6.0_ALPHA/asm-debug-all-6.0_ALPHA.jar"
1292 path="${basedir}/${jar.dir}/asm-debug-all-6.0-SNAPSHOT.jar"
1293 checksum="7df23eb7d67e31b18c2df741d1656f7b"
1294 />
1295 </target>
1296
1297 <target name="getbcel6">
1298 <!-- BCEL 6.0 RC1, svn 14039 see
1299 http://mail-archives.apache.org/mod_mbox/commons-dev/201606.mbox/%3CCAB917R%2BmcbEarP5-ZBTDUTkt-xAwQCYagtmAbMqm3ub1KB5xDw%40mail.gmail.com%3E
1300 -->
1301 <getAndCheckLibrary
1302 url="https://repository.apache.org/content/repositories/orgapachecommons-1177/org/apache/bcel/bcel/6.0/bcel-6.0.jar"
1303 path="${basedir}/${jar.dir}/bcel-6.0-SNAPSHOT.jar"
1304 checksum="c5581905c94bb3e81e09b444229bf63e"
1305 />
1306 </target>
12211307
12221308 <!-- Download, patch, and build a modified BCEL 5.2. Install resulting bcel.jar in lib. -->
12231309 <target name="patchbcel">
11 PDFS = $(TEX_SRCS:.tex=.pdf)
22
33 %.pdf : %.tex
4 pdflatex $*
45 pdflatex $*
56 pdflatex $*
67
design/architecture/attention.pdf less more
Binary diff not shown
00 Manifest-Version: 1.0
11 Main-Class: edu.umd.cs.findbugs.LaunchAppropriateUI
2 Class-Path: bcel-6.0-SNAPSHOT.jar dom4j-1.6.1.jar jaxen-1.1.6.jar asm-debug-all-5.0.2.jar jsr305.jar jFormatString.jar commons-lang-2.6.jar
2 Class-Path: bcel-6.0-SNAPSHOT.jar dom4j-1.6.1.jar jaxen-1.1.6.jar asm-debug-all-6.0-SNAPSHOT.jar jsr305.jar jFormatString.jar commons-lang-2.6.jar
0 Manifest-Version: 1.0
1 Main-Class: edu.umd.cs.findbugs.LaunchAppropriateUI
2 Class-Path: bcel-6.0-SNAPSHOT.jar dom4j-1.6.1.jar jaxen-1.1.6.jar asm-debug-all-5.0.2.jar jsr305.jar jFormatString.jar commons-lang-2.6.jar plastic.jar
0 Manifest-Version: 1.0
1 Main-Class: edu.umd.cs.findbugs.LaunchAppropriateUI
2 Class-Path: bcel-6.0-SNAPSHOT.jar dom4j-1.6.1.jar jaxen-1.1.6.jar asm-debug-all-6.0-SNAPSHOT.jar jsr305.jar jFormatString.jar commons-lang-2.6.jar plastic.jar
00 doc.html.sidebar= \n\
1 <td bgcolor="#b9b9fe" valign="top" align="left" width="20%"> \n\
2 <table width="100%" cellspacing="0" border="0"> \n\
3 <tr><td><a class="sidebar" href="index.html"><img src="umdFindbugs.png" alt="FindBugs"></a></td></tr> \n\
4 \n\
5 <tr><td>&nbsp;</td></tr>\n\
6 \n\
7 <tr><td><b>Docs and Info</b></td></tr> \n\
8 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="findbugs2.html">FindBugs 2.0</a></font></td></tr> \n\
9 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="demo.html">Demo and data</a></font></td></tr> \n\
10 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="users.html">Users and supporters</a></font></td></tr> \n\
11 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="http://findbugs.blogspot.com/">FindBugs blog</a></font></td></tr> \n\
12 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="factSheet.html">Fact sheet</a></font></td></tr> \n\
13 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="manual/index.html">Manual</a></font></td></tr> \n\
14 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="ja/manual/index.html">Manual(ja/&#26085;&#26412;&#35486;)</a></font></td></tr> \n\
15 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="FAQ.html">FAQ</a></font></td></tr> \n\
16 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="bugDescriptions.html">Bug descriptions</a></font></td></tr> \n\
17 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="bugDescriptions_ja.html">Bug descriptions(ja/&#26085;&#26412;&#35486;)</a></font></td></tr> \n\
18 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="bugDescriptions_fr.html">Bug descriptions(fr)</a></font></td></tr> \n\
19 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="mailingLists.html">Mailing lists</a></font></td></tr> \n\
20 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="publications.html">Documents and Publications</a></font></td></tr> \n\
21 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="links.html">Links</a></font></td></tr> \n\
22 \n\
23 <tr><td>&nbsp;</td></tr>\n\
24 \n\
25 <tr><td><a class="sidebar" href="downloads.html"><b>Downloads</b></a></td></tr> \n\
26 \n\
27 <tr><td>&nbsp;</td></tr>\n\
28 \n\
29 <tr><td><a class="sidebar" href="http://www.cafeshops.com/findbugs"><b>FindBugs Swag</b></a></td></tr>\n\
30 \n\
31 <tr><td>&nbsp;</td></tr>\n\
32 \n\
33 <tr><td><b>Development</b></td></tr> \n\
34 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="http://sourceforge.net/p/findbugs/bugs/">Open bugs</a></font></td></tr> \n\
35 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="reportingBugs.html">Reporting bugs</a></font></td></tr> \n\
36 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="contributing.html">Contributing</a></font></td></tr> \n\
37 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="team.html">Dev team</a></font></td></tr> \n\
38 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="api/index.html">API</a> <a class="sidebar" href="api/overview-summary.html">[no frames]</a></font></td></tr> \n\
39 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="Changes.html">Change log</a></font></td></tr> \n\
40 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="http://sourceforge.net/projects/findbugs">SF project page</a></font></td></tr> \n\
41 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="http://code.google.com/p/findbugs/source/browse/">Browse source</a></font></td></tr> \n\
42 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="http://code.google.com/p/findbugs/source/list">Latest code changes</a></font></td></tr> \n\
43 </table> \n\
44 </td>
1 <td bgcolor="#b9b9fe" valign="top" align="left" width="20%"> \n\
2 <table width="100%" cellspacing="0" border="0"> \n\
3 <tr><td><a class="sidebar" href="index.html"><img src="umdFindbugs.png" alt="FindBugs"></a></td></tr> \n\
4 \n\
5 <tr><td>&nbsp;</td></tr>\n\
6 \n\
7 <tr><td><b>Docs and Info</b></td></tr> \n\
8 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="findbugs2.html">FindBugs 2.0</a></font></td></tr> \n\
9 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="demo.html">Demo and data</a></font></td></tr> \n\
10 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="users.html">Users and supporters</a></font></td></tr> \n\
11 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="http://findbugs.blogspot.com/">FindBugs blog</a></font></td></tr> \n\
12 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="factSheet.html">Fact sheet</a></font></td></tr> \n\
13 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="manual/index.html">Manual</a></font></td></tr> \n\
14 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="ja/manual/index.html">Manual(ja/&#26085;&#26412;&#35486;)</a></font></td></tr> \n\
15 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="FAQ.html">FAQ</a></font></td></tr> \n\
16 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="bugDescriptions.html">Bug descriptions</a></font></td></tr> \n\
17 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="bugDescriptions_ja.html">Bug descriptions(ja/&#26085;&#26412;&#35486;)</a></font></td></tr> \n\
18 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="bugDescriptions_fr.html">Bug descriptions(fr)</a></font></td></tr> \n\
19 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="mailingLists.html">Mailing lists</a></font></td></tr> \n\
20 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="publications.html">Documents and Publications</a></font></td></tr> \n\
21 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="links.html">Links</a></font></td></tr> \n\
22 \n\
23 <tr><td>&nbsp;</td></tr>\n\
24 \n\
25 <tr><td><a class="sidebar" href="downloads.html"><b>Downloads</b></a></td></tr> \n\
26 \n\
27 <tr><td>&nbsp;</td></tr>\n\
28 \n\
29 <tr><td><a class="sidebar" href="http://www.cafeshops.com/findbugs"><b>FindBugs Swag</b></a></td></tr>\n\
30 \n\
31 <tr><td>&nbsp;</td></tr>\n\
32 \n\
33 <tr><td><b>Development</b></td></tr> \n\
34 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="https://github.com/findbugsproject/findbugs/issues">Open bugs</a></font></td></tr> \n\
35 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="reportingBugs.html">Reporting bugs</a></font></td></tr> \n\
36 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="contributing.html">Contributing</a></font></td></tr> \n\
37 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="team.html">Dev team</a></font></td></tr> \n\
38 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="api/index.html">API</a> <a class="sidebar" href="api/overview-summary.html">[no frames]</a></font></td></tr> \n\
39 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="Changes.html">Change log</a></font></td></tr> \n\
40 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="https://github.com/findbugsproject/findbugs">GitHub project page</a></font></td></tr> \n\
41 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="https://github.com/findbugsproject/findbugs">Browse source</a></font></td></tr> \n\
42 <tr><td><font size="-1">&nbsp;<a class="sidebar" href="https://github.com/findbugsproject/findbugs/commits/master">Latest code changes</a></font></td></tr> \n\
43 </table> \n\
44 </td>
4545 doc.html.footer= \n\
46 <hr> <p> \n\
47 <script language="JavaScript" type="text/javascript"> \n\
46 <hr> <p> \n\
47 <script language="JavaScript" type="text/javascript"> \n\
4848 <!---//hide script from old browsers \n\
4949 document.write( "Last updated "+ document.lastModified + "." ); \n\
5050 //end hiding contents ---> \n\
51 </script> \n\
52 <p> Send comments to <a class="sidebar" href="mailto:findbugs@cs.umd.edu">findbugs@cs.umd.edu</a> \n\
53 <p> \n\
54 <a href="http://sourceforge.net/projects/findbugs/"><img src="http://sourceforge.net/sflogo.php?group_id=96405&amp;type=5" width="210" height="62" border="0" alt="FindBugs on SourceForge.net" /></a>
51 </script> \n\
52 <p> Send comments to <a class="sidebar" href="mailto:findbugs@cs.umd.edu">findbugs@cs.umd.edu</a> \n\
53 <p> \n\
54 <a href="http://sourceforge.net/projects/findbugs/"><img src="http://sourceforge.net/sflogo.php?group_id=96405&amp;type=5" width="210" height="62" border="0" alt="FindBugs on SourceForge.net" /></a>
5555 doc.html.googleanalytics= \n\
5656 <script type="text/javascript"> \n\
5757 var _gaq = _gaq || []; \n\
6363 ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; \n\
6464 var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); \n\
6565 })(); \n\
66 </script>
66 </script>
6767 doc.html.gen.header=\
68 <link rel="stylesheet" type="text/css" href="findbugs.css"/>\n\
69 <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"/>
68 <link rel="stylesheet" type="text/css" href="findbugs.css"/>\n\
69 <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"/>
7070 doc.html.gen.beginBody= \n\
71 <table width="100%"><tr>\n\
72 @HTML_SIDEBAR@\n\
73 <td align="left" valign="top">
71 <table width="100%"><tr>\n\
72 @HTML_SIDEBAR@\n\
73 <td align="left" valign="top">
7474 doc.html.gen.endBody=\n\
75 @HTML_FOOTER@\n\
76 </td></tr></table>
75 @HTML_FOOTER@\n\
76 </td></tr></table>
7777 doc.html.gen.bugDescriptions.prologue=\
78 <p>This document lists the standard bug patterns reported by\n\
79 <a href="@WEBSITE@">FindBugs</a> version @VERSION@.</p>
78 <p>This document lists the standard bug patterns reported by\n\
79 <a href="@WEBSITE@">FindBugs</a> version @VERSION@.</p>
8080 doc.html.gen.allBugDescriptions.prologue=\
81 <p>This document lists all of the bug patterns reported by the\n\
82 latest development version of \n\
83 <a href="@WEBSITE@">FindBugs</a>.&nbsp; Note that this may include\n\
84 bug patterns not available in any released version of FindBugs,\n\
85 as well as bug patterns that are not enabled by default.
81 <p>This document lists all of the bug patterns reported by the\n\
82 latest development version of \n\
83 <a href="@WEBSITE@">FindBugs</a>.&nbsp; Note that this may include\n\
84 bug patterns not available in any released version of FindBugs,\n\
85 as well as bug patterns that are not enabled by default.
416416 reports="CAA_COVARIANT_ARRAY_FIELD,CAA_COVARIANT_ARRAY_RETURN,CAA_COVARIANT_ARRAY_LOCAL,CAA_COVARIANT_ARRAY_ELEMENT_STORE"/>
417417 <Detector class="edu.umd.cs.findbugs.detect.DumbMethods" speed="fast"
418418 reports="NP_IMMEDIATE_DEREFERENCE_OF_READLINE,RV_01_TO_INT,DM_INVALID_MIN_MAX,DM_RUN_FINALIZERS_ON_EXIT,DM_STRING_CTOR,DM_STRING_VOID_CTOR,DM_STRING_TOSTRING,DM_GC,DM_BOOLEAN_CTOR,DM_EXIT,DM_CONVERT_CASE,SW_SWING_METHODS_INVOKED_IN_SWING_THREAD,DM_BOXED_PRIMITIVE_TOSTRING,DM_BOXED_PRIMITIVE_FOR_PARSING,DM_BOXED_PRIMITIVE_FOR_COMPARE,DM_NEW_FOR_GETCLASS,DM_NEXTINT_VIA_NEXTDOUBLE,DM_USELESS_THREAD,DM_MONITOR_WAIT_ON_CONDITION,DMI_CALLING_NEXT_FROM_HASNEXT,RV_REM_OF_HASHCODE,RV_REM_OF_RANDOM_INT,RV_ABSOLUTE_VALUE_OF_RANDOM_INT,RV_ABSOLUTE_VALUE_OF_HASHCODE,BIT_ADD_OF_SIGNED_BYTE,BIT_IOR_OF_SIGNED_BYTE,INT_BAD_COMPARISON_WITH_NONNEGATIVE_VALUE,INT_BAD_COMPARISON_WITH_SIGNED_BYTE,INT_BAD_REM_BY_1,DMI_ANNOTATION_IS_NOT_VISIBLE_TO_REFLECTION,INT_VACUOUS_COMPARISON,BC_EQUALS_METHOD_SHOULD_WORK_FOR_ALL_OBJECTS,DMI_RANDOM_USED_ONLY_ONCE,DMI_LONG_BITS_TO_DOUBLE_INVOKED_ON_INT,DMI_THREAD_PASSED_WHERE_RUNNABLE_EXPECTED,DMI_FUTILE_ATTEMPT_TO_CHANGE_MAXPOOL_SIZE_OF_SCHEDULED_THREAD_POOL_EXECUTOR,DMI_SCHEDULED_THREAD_POOL_EXECUTOR_WITH_ZERO_CORE_THREADS,DMI_VACUOUS_CALL_TO_EASYMOCK_METHOD,DMI_BIGDECIMAL_CONSTRUCTED_FROM_DOUBLE,INT_VACUOUS_BIT_OPERATION,DMI_COLLECTION_OF_URLS,INT_BAD_COMPARISON_WITH_INT_VALUE,DMI_DOH,DMI_ARGUMENTS_WRONG_ORDER,RANGE_ARRAY_INDEX,RANGE_ARRAY_OFFSET,RANGE_ARRAY_LENGTH,RANGE_STRING_INDEX"/>
419 "/>
420419 <Detector class="edu.umd.cs.findbugs.detect.NumberConstructor" speed="fast"
421420 disabled="false" reports="DM_NUMBER_CTOR,DM_FP_NUMBER_CTOR"/>
422421 <Detector class="edu.umd.cs.findbugs.detect.FindSqlInjection" speed="moderate"
216216 <Detector class="edu.umd.cs.findbugs.detect.SynchronizationOnSharedBuiltinConstant">
217217 <Details>
218218 <![CDATA[
219 <p> This detector looks for synchronization on a shared builtin constant (such as a String).</p>
219 <p> This detector looks for synchronization on a shared built-in constant (such as a String).</p>
220220 ]]>
221221 </Details>
222222 </Detector>
604604 <p> This detector generates a random signal: warnings that are just based on
605605 hash values of the operations performed by methods.
606606 These warnings are bogus random noise, intended to be useful
607 as a control in data mining experiments, not in finding actual bugs in software
607 as a control in data mining experiments, not in finding actual bugs in software.
608608
609609 This detector is just a hook for testing new detectors.
610610 Normally, this detector does nothing.</p>
868868 <Detector class="edu.umd.cs.findbugs.detect.IteratorIdioms">
869869 <Details>
870870 <![CDATA[
871 <p> This iterator looks for problems in how Iterator classes are defined.
871 <p> This detector looks for problems in how Iterator classes are defined.
872872 </p>
873873 ]]>
874874 </Details>
12051205 <Details>
12061206 <![CDATA[
12071207 <p>
1208 This detector looks for calls to Thread.interrupted() from a non static context. If it is called from
1208 This detector looks for calls to Thread.interrupted() from a non-static context. If it is called from
12091209 Thread.currentThread().interrupted(), then it is just a useless exercise, just use Thread.interrupted().
12101210 However if it is called on an arbitrary thread object, it is most probably an error, as interrupted()
12111211 is always called on the current thread.
12931293 <Detector class="edu.umd.cs.findbugs.detect.FindCircularDependencies">
12941294 <Details>
12951295 <![CDATA[
1296 <p>This detector looks circular dependencies among classes. </p>
1296 <p>This detector looks for circular dependencies among classes. </p>
12971297 ]]>
12981298 </Details>
12991299 </Detector>
13191319 <![CDATA[
13201320 <p>This detector looks for public classes that synchronize and use wait(), notify() or notifyAll()
13211321 on <b>this</b>. This exposes a synchronization implementation as a public artifact of the class.
1322 Clients of the class may use an instance of the class as it's own synchronizing object, and cause
1322 Clients of the class may use an instance of the class as its own synchronizing object, and cause
13231323 havoc to the base implementation.
13241324 </p>
13251325 ]]>
13671367 <Details>
13681368 <![CDATA[
13691369 <p>
1370 This detector looks for uses of of non Serializable objects in contexts that require them to be serializable.
1370 This detector looks for uses of non Serializable objects in contexts that require them to be serializable.
13711371 </p>
13721372 ]]>
13731373 </Details>
13971397 <Detector class="edu.umd.cs.findbugs.detect.FindPuzzlers">
13981398 <Details>
13991399 <![CDATA[
1400 <p> This detector problems looks for miscellaneous small errors
1400 <p> This detector looks for miscellaneous small errors
14011401 mentioned by Joshua Bloch and Neal Gafter in
14021402 their work on Programming Puzzlers.
14031403 </p>
14611461 <Details>
14621462 <![CDATA[
14631463 <p>
1464 This detector for final classes that declare protected members. As this
1464 This detector looks for final classes that declare protected members. As this
14651465 class can not be derived from, the use of protected access for members is
14661466 incorrect. The access should be changed to public or private to represent
14671467 the correct intention of the field. This was probably caused by a change in
16061606 <Detector class="edu.umd.cs.findbugs.detect.AppendingToAnObjectOutputStream">
16071607 <Details>
16081608 <![CDATA[
1609 <p>Looks for an attempt to append to an object output stream</p>
1609 <p>Looks for an attempt to append to an object output stream.</p>
16101610 ]]>
16111611 </Details>
16121612 </Detector>
17571757 <LongDescription>Creation of ScheduledThreadPoolExecutor with zero core threads in {1}</LongDescription>
17581758 <Details>
17591759 <![CDATA[
1760 <p>(<a href="http://java.sun.com/javase/6/docs/api/java/util/concurrent/ScheduledThreadPoolExecutor.html#ScheduledThreadPoolExecutor(int)">Javadoc</a>)
1760 <p>(<a href="http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/ScheduledThreadPoolExecutor.html#ScheduledThreadPoolExecutor%28int%29">Javadoc</a>)
17611761 A ScheduledThreadPoolExecutor with zero core threads will never execute anything; changes to the max pool size are ignored.
17621762 </p>
17631763
17691769 <LongDescription>Futile attempt to change max pool size of ScheduledThreadPoolExecutor in {1}</LongDescription>
17701770 <Details>
17711771 <![CDATA[
1772 <p>(<a href="http://java.sun.com/javase/6/docs/api/java/util/concurrent/ScheduledThreadPoolExecutor.html">Javadoc</a>)
1772 <p>(<a href="http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/ScheduledThreadPoolExecutor.html">Javadoc</a>)
17731773 While ScheduledThreadPoolExecutor inherits from ThreadPoolExecutor, a few of the inherited tuning methods are not useful for it. In particular, because it acts as a fixed-sized pool using corePoolSize threads and an unbounded queue, adjustments to maximumPoolSize have no useful effect.
17741774 </p>
17751775
20442044 <Details>
20452045 <![CDATA[
20462046 <p>
2047 The usage of Optional return type (java.util.Optional or com.google.common.base.Optiona)
2048 always mean that explicit null returns were not desired by design.
2049 Returning a null value in such case is a contract violation and will most likely break clients code.
2047 The usage of Optional return type (java.util.Optional or com.google.common.base.Optional)
2048 always means that explicit null returns were not desired by design.
2049 Returning a null value in such case is a contract violation and will most likely break client code.
20502050 </p>
20512051 ]]>
20522052 </Details>
21332133 <LongDescription>Unknown bug pattern BUG_PATTERN in {1}</LongDescription>
21342134 <Details>
21352135 <![CDATA[
2136 <p>A warning was recorded, but findbugs can't find the description of this bug pattern
2136 <p>A warning was recorded, but FindBugs can't find the description of this bug pattern
21372137 and so can't describe it. This should occur only in cases of a bug in FindBugs or its configuration,
21382138 or perhaps if an analysis was generated using a plugin, but that plugin is not currently loaded.
21392139 .</p>
26842684 <Details>
26852685 <![CDATA[
26862686 <p>A random value from 0 to 1 is being coerced to the integer value 0. You probably
2687 want to multiple the random value by something else before coercing it to an integer, or use the <code>Random.nextInt(n)</code> method.
2687 want to multiply the random value by something else before coercing it to an integer, or use the <code>Random.nextInt(n)</code> method.
26882688 </p>
26892689 ]]>
26902690 </Details>
28882888 </pre>
28892889
28902890 <p>This is considered bad practice, as it makes it very hard to implement an equals method that
2891 is symmetric and transitive. Without those properties, very unexpected behavoirs are possible.
2891 is symmetric and transitive. Without those properties, very unexpected behaviors are possible.
28922892 </p>
28932893 ]]>
28942894 </Details>
30633063 A large String constant is duplicated across multiple class files.
30643064 This is likely because a final field is initialized to a String constant, and the Java language
30653065 mandates that all references to a final field from other classes be inlined into
3066 that classfile. See <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6447475">JDK bug 6447475</a>
3066 that classfile. See <a href="http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6447475">JDK bug 6447475</a>
30673067 for a description of an occurrence of this bug in the JDK and how resolving it reduced
30683068 the size of the JDK by 1 megabyte.
30693069 </p>
33483348 <LongDescription>{1} is a mutable servlet field</LongDescription>
33493349 <Details>
33503350 <![CDATA[
3351 <p>A web server generally only creates one instance of servlet or jsp class (i.e., treats
3351 <p>A web server generally only creates one instance of servlet or JSP class (i.e., treats
33523352 the class as a Singleton),
33533353 and will
33543354 have multiple threads invoke methods on that instance to service multiple
35083508 when evaluating the right-hand side can generate an error.
35093509 </p>
35103510
3511 <p>See <a href="http://java.sun.com/docs/books/jls/third_edition/html/expressions.html#15.22.2">the Java
3512 Language Specification</a> for details
3511 <p>See <a href="https://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.22.2">the Java
3512 Language Specification</a> for details.
35133513
35143514 </p>
35153515 ]]>
35293529 can result in errors if the left-hand side guards cases
35303530 when evaluating the right-hand side can generate an error.
35313531
3532 <p>See <a href="http://java.sun.com/docs/books/jls/third_edition/html/expressions.html#15.22.2">the Java
3533 Language Specification</a> for details
3532 <p>See <a href="https://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.22.2">the Java
3533 Language Specification</a> for details.
35343534
35353535 </p>
35363536 ]]>
35983598 <LongDescription>{2.name} isn't initialized in {1} when invoked from constructor for superclass</LongDescription>
35993599 <Details>
36003600 <![CDATA[
3601 <p> This method is invoked in the constructor of of the superclass. At this point,
3601 <p> This method is invoked in the constructor of the superclass. At this point,
36023602 the fields of the class have not yet initialized.</p>
36033603 <p>To make this more concrete, consider the following classes:</p>
36043604 <pre>abstract class A {
36213621 the constructor for the <code>A</code> class is invoked
36223622 <em>before</em> the constructor for <code>B</code> sets <code>value</code>.
36233623 Thus, when the constructor for <code>A</code> invokes <code>getValue</code>,
3624 an uninitialized value is read for <code>value</code>
3624 an uninitialized value is read for <code>value</code>.
36253625 </p>
36263626 ]]>
36273627 </Details>
36973697 synchronized(LOCK) { ...}
36983698 ...
36993699 </pre>
3700 <p>Constant Strings are interned and shared across all other classes loaded by the JVM. Thus, this could
3700 <p>Constant Strings are interned and shared across all other classes loaded by the JVM. Thus, this code
37013701 is locking on something that other code might also be locking. This could result in very strange and hard to diagnose
37023702 blocking and deadlock behavior. See <a href="http://www.javalobby.org/java/forums/t96352.html">http://www.javalobby.org/java/forums/t96352.html</a> and <a href="http://jira.codehaus.org/browse/JETTY-352">http://jira.codehaus.org/browse/JETTY-352</a>.
37033703 </p>
37103710 <LongDescription>Synchronization on Boolean in {1}</LongDescription>
37113711 <Details>
37123712 <![CDATA[
3713 <p> The code synchronizes on a boxed primitive constant, such as an Boolean.</p>
3713 <p> The code synchronizes on a boxed primitive constant, such as a Boolean.</p>
37143714 <pre>
37153715 private static Boolean inited = Boolean.FALSE;
37163716 ...
37233723 ...
37243724 </pre>
37253725 <p>Since there normally exist only two Boolean objects, this code could be synchronizing on the same object as other, unrelated code, leading to unresponsiveness
3726 and possible deadlock</p>
3726 and possible deadlock.</p>
37273727 <p>See CERT <a href="https://www.securecoding.cert.org/confluence/display/java/CON08-J.+Do+not+synchronize+on+objects+that+may+be+reused">CON08-J. Do not synchronize on objects that may be reused</a> for more information.</p>
37283728 ]]>
37293729 </Details>
37723772 </pre>
37733773 <p>Since Integer objects can be cached and shared,
37743774 this code could be synchronizing on the same object as other, unrelated code, leading to unresponsiveness
3775 and possible deadlock</p>
3775 and possible deadlock.</p>
37763776 <p>See CERT <a href="https://www.securecoding.cert.org/confluence/display/java/CON08-J.+Do+not+synchronize+on+objects+that+may+be+reused">CON08-J. Do not synchronize on objects that may be reused</a> for more information.</p>
37773777 ]]>
37783778 </Details>
40264026 An inner class is invoking a method that could be resolved to either a inherited method or a method defined in an outer class.
40274027 For example, you invoke <code>foo(17)</code>, which is defined in both a superclass and in an outer method.
40284028 By the Java semantics,
4029 it will be resolved to invoke the inherited method, but this may not be want
4029 it will be resolved to invoke the inherited method, but this may not be what
40304030 you intend.
40314031 </p>
40324032 <p>If you really intend to invoke the inherited method,
48944894 <LongDescription>Useless condition: it's known that {2} at this point</LongDescription>
48954895 <Details>
48964896 <![CDATA[
4897 <p>This condition always produces the same result as the value of the involved variable was narrowed before.
4898 Probably something else was meant or condition can be removed.</p>
4897 <p>This condition always produces the same result as the value of the involved variable that was narrowed before.
4898 Probably something else was meant or the condition can be removed.</p>
48994899 ]]>
49004900 </Details>
49014901 </BugPattern>
49054905 <Details>
49064906 <![CDATA[
49074907 <p>This condition always produces the same result due to the type range of the involved variable.
4908 Probably something else was meant or condition can be removed.</p>
4908 Probably something else was meant or the condition can be removed.</p>
49094909 ]]>
49104910 </Details>
49114911 </BugPattern>
56085608 but it is possible to create other Boolean objects using the <code>new Boolean(b)</code>
56095609 constructor. It is best to avoid such objects, but if they do exist,
56105610 then checking Boolean objects for equality using == or != will give results
5611 than are different than you would get using <code>.equals(...)</code>
5611 than are different than you would get using <code>.equals(...)</code>.
56125612 </p>
56135613 ]]>
56145614 </Details>
58585858 <Details>
58595859 <![CDATA[
58605860 <p> The Double.longBitsToDouble method is invoked, but a 32 bit int value is passed
5861 as an argument. This almostly certainly is not intended and is unlikely
5861 as an argument. This almost certainly is not intended and is unlikely
58625862 to give the intended result.
58635863 </p>
58645864 ]]>
59025902 <p> This code generates a random signed integer and then computes
59035903 the absolute value of that random integer. If the number returned by the random number
59045904 generator is <code>Integer.MIN_VALUE</code>, then the result will be negative as well (since
5905 <code>Math.abs(Integer.MIN_VALUE) == Integer.MIN_VALUE</code>). (Same problem arised for long values as well).
5905 <code>Math.abs(Integer.MIN_VALUE) == Integer.MIN_VALUE</code>). (Same problem arises for long values as well).
59065906 </p>
59075907 ]]>
59085908 </Details>
59505950 you may need to change your code.
59515951 If you know the divisor is a power of 2,
59525952 you can use a bitwise and operator instead (i.e., instead of
5953 using <code>x.hashCode()%n</code>, use <code>x.hashCode()&amp;(n-1)</code>.
5953 using <code>x.hashCode()%n</code>, use <code>x.hashCode()&amp;(n-1)</code>).
59545954 This is probably faster than computing the remainder as well.
59555955 If you don't know that the divisor is a power of 2, take the absolute
59565956 value of the result of the remainder operation (i.e., use
5957 <code>Math.abs(x.hashCode()%n)</code>
5957 <code>Math.abs(x.hashCode()%n)</code>).
59585958 </p>
59595959 ]]>
59605960 </Details>
59785978 <p> Signed bytes can only have a value in the range -128 to 127. Comparing
59795979 a signed byte with a value outside that range is vacuous and likely to be incorrect.
59805980 To convert a signed byte <code>b</code> to an unsigned value in the range 0..255,
5981 use <code>0xff &amp; b</code>
5981 use <code>0xff &amp; b</code>.
59825982 </p>
59835983 ]]>
59845984 </Details>
59905990 <![CDATA[
59915991 <p> This code compares an int value with a long constant that is outside
59925992 the range of values that can be represented as an int value.
5993 This comparison is vacuous and possibily to be incorrect.
5993 This comparison is vacuous and possibly to be incorrect.
59945994 </p>
59955995 ]]>
59965996 </Details>
60396039 <p> Loads a byte value (e.g., a value loaded from a byte array or returned by a method
60406040 with return type byte) and performs a bitwise OR with
60416041 that value. Byte values are sign extended to 32 bits
6042 before any any bitwise operations are performed on the value.
6042 before any bitwise operations are performed on the value.
60436043 Thus, if <code>b[0]</code> contains the value <code>0xff</code>, and
60446044 <code>x</code> is initially 0, then the code
60456045 <code>((x &lt;&lt; 8) | b[0])</code> will sign extend <code>0xff</code>
60716071 <![CDATA[
60726072 <p> Adds a byte value and a value which is known to have the 8 lower bits clear.
60736073 Values loaded from a byte array are sign extended to 32 bits
6074 before any any bitwise operations are performed on the value.
6074 before any bitwise operations are performed on the value.
60756075 Thus, if <code>b[0]</code> contains the value <code>0xff</code>, and
60766076 <code>x</code> is initially 0, then the code
60776077 <code>((x &lt;&lt; 8) + b[0])</code> will sign extend <code>0xff</code>
61136113 <LongDescription>Check for sign of bitwise operation in {1}</LongDescription>
61146114 <Details>
61156115 <![CDATA[
6116 <p> This method compares an expression such as</p>
6117 <pre>((event.detail &amp; SWT.SELECTED) &gt; 0)</pre>.
6118 <p>Using bit arithmetic and then comparing with the greater than operator can
6116 <p> This method compares an expression such as
6117 <code>((event.detail &amp; SWT.SELECTED) &gt; 0)</code>.
6118 Using bit arithmetic and then comparing with the greater than operator can
61196119 lead to unexpected results (of course depending on the value of
61206120 SWT.SELECTED). If SWT.SELECTED is a negative number, this is a candidate
61216121 for a bug. Even when SWT.SELECTED is not negative, it seems good practice
61226122 to use '!= 0' instead of '&gt; 0'.
61236123 </p>
6124 <p>
6125 <em>Boris Bokowski</em>
6126 </p>
61276124 ]]>
61286125 </Details>
61296126 </BugPattern>
61306127 <BugPattern type="BIT_SIGNED_CHECK_HIGH_BIT">
6131 <ShortDescription>Check for sign of bitwise operation</ShortDescription>
6132 <LongDescription>Check for sign of bitwise operation in {1}</LongDescription>
6133 <Details>
6134 <![CDATA[
6135 <p> This method compares an expression such as</p>
6136 <pre>((event.detail &amp; SWT.SELECTED) &gt; 0)</pre>.
6137 <p>Using bit arithmetic and then comparing with the greater than operator can
6138 lead to unexpected results (of course depending on the value of
6139 SWT.SELECTED). If SWT.SELECTED is a negative number, this is a candidate
6140 for a bug. Even when SWT.SELECTED is not negative, it seems good practice
6128 <ShortDescription>Check for sign of bitwise operation involving negative number</ShortDescription>
6129 <LongDescription>Check for sign of bitwise operation involving {2} in {1}</LongDescription>
6130 <Details>
6131 <![CDATA[
6132 <p> This method compares a bitwise expression such as
6133 <code>((val &amp; CONSTANT) &gt; 0)</code> where CONSTANT is the negative number.
6134 Using bit arithmetic and then comparing with the greater than operator can
6135 lead to unexpected results. This comparison is unlikely to work as expected. The good practice is
61416136 to use '!= 0' instead of '&gt; 0'.
6142 </p>
6143 <p>
6144 <em>Boris Bokowski</em>
61456137 </p>
61466138 ]]>
61476139 </Details>
61516143 <LongDescription>Check to see if ((...) &amp; 0) == 0 in {1}</LongDescription>
61526144 <Details>
61536145 <![CDATA[
6154 <p> This method compares an expression of the form (e &amp; 0) to 0,
6146 <p> This method compares an expression of the form <code>(e &amp; 0)</code> to 0,
61556147 which will always compare equal.
61566148 This may indicate a logic error or typo.</p>
61576149 ]]>
61626154 <LongDescription>Incompatible bit masks in (e | {2} == {3}) yields constant result in {1}</LongDescription>
61636155 <Details>
61646156 <![CDATA[
6165 <p> This method compares an expression of the form (e | C) to D.
6157 <p> This method compares an expression of the form <code>(e | C)</code> to D.
61666158 which will always compare unequal
61676159 due to the specific values of constants C and D.
61686160 This may indicate a logic error or typo.</p>
61706162 <p> Typically, this bug occurs because the code wants to perform
61716163 a membership test in a bit set, but uses the bitwise OR
61726164 operator ("|") instead of bitwise AND ("&amp;").</p>
6165
6166 <p>Also such bug may appear in expressions like <code>(e &amp; A | B) == C</code>
6167 which is parsed like <code>((e &amp; A) | B) == C</code> while <code>(e &amp; (A | B)) == C</code> was intended.</p>
61736168 ]]>
61746169 </Details>
61756170 </BugPattern>
62146209 <p> This method contains an unsynchronized lazy initialization of a static field.
62156210 After the field is set, the object stored into that location is further updated or accessed.
62166211 The setting of the field is visible to other threads as soon as it is set. If the
6217 futher accesses in the method that set the field serve to initialize the object, then
6212 further accesses in the method that set the field serve to initialize the object, then
62186213 you have a <em>very serious</em> multithreading bug, unless something else prevents
62196214 any other thread from accessing the stored object until it is fully initialized.
62206215 </p>
65086503 <LongDescription>TestCase {0} has no tests</LongDescription>
65096504 <Details>
65106505 <![CDATA[
6511 <p> Class is a JUnit TestCase but has not implemented any test methods</p>
6506 <p> Class is a JUnit TestCase but has not implemented any test methods.</p>
65126507 ]]>
65136508 </Details>
65146509 </BugPattern>
67316726 <![CDATA[
67326727 <p>
67336728 This instruction assigns a class literal to a variable and then never uses it.
6734 <a href="//java.sun.com/j2se/1.5.0/compatibility.html#literal">The behavior of this differs in Java 1.4 and in Java 5.</a>
6729 <a href="http://www.oracle.com/technetwork/java/javase/compatibility-137462.html#literal">The behavior of this differs in Java 1.4 and in Java 5.</a>
67356730 In Java 1.4 and earlier, a reference to <code>Foo.class</code> would force the static initializer
67366731 for <code>Foo</code> to be executed, if it has not been executed already.
67376732 In Java 5 and later, it does not.
67386733 </p>
6739 <p>See Sun's <a href="//java.sun.com/j2se/1.5.0/compatibility.html#literal">article on Java SE compatibility</a>
6734 <p>See Sun's <a href="http://www.oracle.com/technetwork/java/javase/compatibility-137462.html#literal">article on Java SE compatibility</a>
67406735 for more details and examples, and suggestions on how to force class initialization in Java 5.
67416736 </p>
67426737 ]]>
71937188 <Details>
71947189 <![CDATA[
71957190 <p>
7196 This format string include a newline character (\n). In format strings, it is generally
7197 preferable better to use %n, which will produce the platform-specific line separator.
7191 This format string includes a newline character (\n). In format strings, it is generally
7192 preferable to use %n, which will produce the platform-specific line separator.
71987193 </p>
71997194 ]]>
72007195 </Details>
72057200 <Details>
72067201 <![CDATA[
72077202 <p>
7208 One of the arguments is uncompatible with the corresponding format string specifier.
7203 One of the arguments is incompatible with the corresponding format string specifier.
72097204 As a result, this will generate a runtime exception when executed.
72107205 For example, <code>String.format("%d", "1")</code> will generate an exception, since
72117206 the String "1" is incompatible with the format specifier %d.
74327427 <p>The correct way to do get an array of a specific type from a collection is to use
74337428 <code>c.toArray(new String[]);</code>
74347429 or <code>c.toArray(new String[c.size()]);</code> (the latter is slightly more efficient).
7435 <p>There is one common/known exception exception to this. The <code>toArray()</code>
7430 <p>There is one common/known exception to this. The <code>toArray()</code>
74367431 method of lists returned by <code>Arrays.asList(...)</code> will return a covariantly
74377432 typed array. For example, <code>Arrays.asArray(new String[] { "a" }).toArray()</code>
74387433 will return a <code>String []</code>. FindBugs attempts to detect and suppress
75777572 The code here uses <code>File.separator</code>
75787573 where a regular expression is required. This will fail on Windows
75797574 platforms, where the <code>File.separator</code> is a backslash, which is interpreted in a
7580 regular expression as an escape character. Amoung other options, you can just use
7575 regular expression as an escape character. Among other options, you can just use
75817576 <code>File.separatorChar=='\\' ? "\\\\" : File.separator</code> instead of
75827577 <code>File.separator</code>
75837578
76617656 <![CDATA[
76627657 <p>
76637658 The code invokes hashCode on an array. Calling hashCode on
7664 an array returns the same value as System.identityHashCode, and ingores
7659 an array returns the same value as System.identityHashCode, and ignores
76657660 the contents and length of the array. If you need a hashCode that
76667661 depends on the contents of an array <code>a</code>,
76677662 use <code>java.util.Arrays.hashCode(a)</code>.
77097704 use <code>(low+high) &gt;&gt;&gt; 1</code>
77107705 </p>
77117706 <p>This bug exists in many earlier implementations of binary search and merge sort.
7712 Martin Buchholz <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6412541">found and fixed it</a>
7707 Martin Buchholz <a href="http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6412541">found and fixed it</a>
77137708 in the JDK libraries, and Joshua Bloch
77147709 <a href="http://googleresearch.blogspot.com/2006/06/extra-extra-read-all-about-it-nearly.html">widely
77157710 publicized the bug pattern</a>.
80368031 <LongDescription>{1} is static field of type java.util.Calendar, which isn't thread safe</LongDescription>
80378032 <Details>
80388033 <![CDATA[
8039 <p>Even though the JavaDoc does not contain a hint about it, Calendars are inherently unsafe for multihtreaded use.
8034 <p>Even though the JavaDoc does not contain a hint about it, Calendars are inherently unsafe for multithreaded use.
80408035 Sharing a single instance across thread boundaries without proper synchronization will result in erratic behavior of the
80418036 application. Under 1.4 problems seem to surface less often than under Java 5 where you will probably see
80428037 random ArrayIndexOutOfBoundsExceptions or IndexOutOfBoundsExceptions in sun.util.calendar.BaseCalendar.getCalendarDateFromFixedDate().</p>
80438038 <p>You may also experience serialization problems.</p>
80448039 <p>Using an instance field is recommended.</p>
8045 <p>For more information on this see <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6231579">Sun Bug #6231579</a>
8046 and <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6178997">Sun Bug #6178997</a>.</p>
8040 <p>For more information on this see <a href="http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6231579">JDK Bug #6231579</a>
8041 and <a href="http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6178997">JDK Bug #6178997</a>.</p>
80478042 ]]>
80488043 </Details>
80498044 </BugPattern>
80528047 <LongDescription>Call to method of static java.util.Calendar in {1}</LongDescription>
80538048 <Details>
80548049 <![CDATA[
8055 <p>Even though the JavaDoc does not contain a hint about it, Calendars are inherently unsafe for multihtreaded use.
8050 <p>Even though the JavaDoc does not contain a hint about it, Calendars are inherently unsafe for multithreaded use.
80568051 The detector has found a call to an instance of Calendar that has been obtained via a static
8057 field. This looks suspicous.</p>
8058 <p>For more information on this see <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6231579">Sun Bug #6231579</a>
8059 and <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6178997">Sun Bug #6178997</a>.</p>
8052 field. This looks suspicious.</p>
8053 <p>For more information on this see <a href="http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6231579">JDK Bug #6231579</a>
8054 and <a href="http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6178997">JDK Bug #6178997</a>.</p>
80608055 ]]>
80618056 </Details>
80628057 </BugPattern>
80708065 application.</p>
80718066 <p>You may also experience serialization problems.</p>
80728067 <p>Using an instance field is recommended.</p>
8073 <p>For more information on this see <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6231579">Sun Bug #6231579</a>
8074 and <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6178997">Sun Bug #6178997</a>.</p>
8068 <p>For more information on this see <a href="http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6231579">JDK Bug #6231579</a>
8069 and <a href="http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6178997">JDK Bug #6178997</a>.</p>
80758070 ]]>
80768071 </Details>
80778072 </BugPattern>
80828077 <![CDATA[
80838078 <p>As the JavaDoc states, DateFormats are inherently unsafe for multithreaded use.
80848079 The detector has found a call to an instance of DateFormat that has been obtained via a static
8085 field. This looks suspicous.</p>
8086 <p>For more information on this see <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6231579">Sun Bug #6231579</a>
8087 and <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6178997">Sun Bug #6178997</a>.</p>
8080 field. This looks suspicious.</p>
8081 <p>For more information on this see <a href="http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6231579">JDK Bug #6231579</a>
8082 and <a href="http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6178997">JDK Bug #6178997</a>.</p>
80888083 ]]>
80898084 </Details>
80908085 </BugPattern>
84268421 <Details>
84278422 <![CDATA[
84288423 <p>FindBugs generated a warning that, according to a @NoWarning annotated,
8429 is unexpected or undesired</p>
8424 is unexpected or undesired.</p>
84308425 ]]>
84318426 </Details>
84328427 </BugPattern>
84368431 <Details>
84378432 <![CDATA[
84388433 <p>FindBugs didn't generate generated a warning that, according to a @ExpectedWarning annotated,
8439 is expected or desired</p>
8434 is expected or desired.</p>
84408435 ]]>
84418436 </Details>
84428437 </BugPattern>
33073307 </Details>
33083308 </BugPattern>
33093309 <BugPattern type="DB_DUPLICATE_BRANCHES">
3310 <ShortDescription>Méthode utilsant le même code pour deux branches</ShortDescription>
3310 <ShortDescription>Méthode utilisant le même code pour deux branches</ShortDescription>
33113311 <LongDescription>La méthode {1} utilise le même code pour deux branches</LongDescription>
33123312 <Details>
33133313 <![CDATA[
19971997 -->
19981998
19991999 <BugPattern type="CNT_ROUGH_CONSTANT_VALUE">
2000 <ShortDescription>既知の定数の雑な値を見つける</ShortDescription>
2001 <LongDescription>{3} の雑な値を見つけました: {2}</LongDescription>
2000 <ShortDescription>既知の定数の大雑把な値を見つけた</ShortDescription>
2001 <LongDescription>{3} の大雑把な値を見つけました: {2}</LongDescription>
20022002 <Details>
20032003 <![CDATA[
20042004 <p>
20742074 <Details>
20752075 <![CDATA[
20762076 <p>
2077 このコードは、10進数の数にうまく変換されない double 値から BigDecimal を作成しています。
2077 このコードは10進数の数にうまく変換されない double 値から BigDecimal を作成しています。
20782078 たとえば、Java で <code>new BigDecimal(0.1)</code> と書くと、0.1と正確に等しい BigDecimal (スケールが1でスケールなしの値が1) が作成されると思うかもしれませんが、
20792079 実際には0.1000000000000000055511151231257827021181583404541015625と等しくなります。
20802080 </p>
21562156 <Details>
21572157 <![CDATA[
21582158 <p>
2159 このコードは、空白または空のパスワードを使用してデータベース接続を作成しています。
2159 このコードは空白または空のパスワードを使用してデータベース接続を作成しています。
21602160 これはデータベースがパスワードによって保護されていないことを示しています。
21612161 </p>
21622162 ]]>
21682168 <Details>
21692169 <![CDATA[
21702170 <p>
2171 このコードは、ハードコードされた定数パスワードを使用してデータベース接続を作成しています。
2171 このコードはハードコードされた定数パスワードを使用してデータベース接続を作成しています。
21722172 ソースコードかコンパイルされたコードへアクセスできる人なら誰でも簡単にパスワードを知ることができてしまいます。
21732173 </p>
21742174 ]]>
21872187 </p>
21882188 <p>
21892189 FindBugs は、HRS の最も露骨で自明なケースだけを探します。
2190 FindBugs が何かを発見したならほぼ間違いなく FindBugs が報告しないより多くの脆弱性があるでしょう。
2190 FindBugs が何かを派遣したならほぼ間違いなく FindBugs が報告しないより多くの脆弱性があるでしょう。
21912191 HRS を心配するなら、商用の静的解析ツールかペネトレーションテストツールの使用を真剣に検討するべきです。
21922192 </p>
21932193 ]]>
22002200 <Details>
22012201 <![CDATA[
22022202 <p>
2203 このコードは、HTTP ヘッダに HTTP パラメータを直接書き込んでいます。これは HRS(HTTP レスポンススプリッティング) 脆弱性を可能にします。<br>
2203 このコードはHTTP ヘッダに HTTP パラメータを直接書き込んでいます。これは HRS(HTTP レスポンススプリッティング) 脆弱性を可能にします。<br>
22042204 詳細は、<a href="http://en.wikipedia.org/wiki/HTTP_response_splitting">http://en.wikipedia.org/wiki/HTTP_response_splitting</a> を参照してください。
22052205 </p>
22062206 <p>
22072207 FindBugs は、HRS の最も露骨で自明なケースだけを探します。
2208 FindBugs が何かを発見したならほぼ間違いなく FindBugs が報告しないより多くの脆弱性があるでしょう。
2208 FindBugs が何かを見つけたならほぼ間違いなく FindBugs が報告しないより多くの脆弱性があるでしょう。
22092209 HRS を心配するなら、商用の静的解析ツールかペネトレーションテストツールの使用を真剣に検討するべきです。
22102210 </p>
22112211 ]]>
22222222 </p>
22232223 <p>
22242224 FindBugs は、相対パストラバーサルの最も露骨で自明なケースだけを探します。
2225 FindBugs が何かを発見したならほぼ間違いなく FindBugs が報告しないより多くの脆弱性があるでしょう。
2225 FindBugs が何かを見つけたならほぼ間違いなく FindBugs が報告しないより多くの脆弱性があるでしょう。
22262226 相対パストラバーサルを心配するなら、商用の静的解析ツールかペネトレーションテストツールの使用を真剣に検討するべきです。
22272227 </p>
22282228 ]]>
22392239 </p>
22402240 <p>
22412241 FindBugs は、相対パストラバーサルの最も露骨で自明なケースだけを探します。
2242 FindBugs が何かを発見したならほぼ間違いなく FindBugs が報告しないより多くの脆弱性があるでしょう。
2242 FindBugs が何かを見つけたならほぼ間違いなく FindBugs が報告しないより多くの脆弱性があるでしょう。
22432243 相対パストラバーサルを心配するなら、商用の静的解析ツールかペネトレーションテストツールの使用を真剣に検討するべきです。
22442244 </p>
22452245 ]]>
22512251 <Details>
22522252 <![CDATA[
22532253 <p>
2254 このコードは、サーブレットの出力に HTTP パラメータを直接書き込んでいます。これは反射型 XSS(クロスサイトスクリプティング) 脆弱性を可能にします。<br>
2254 このコードはサーブレットの出力に HTTP パラメータを直接書き込んでいます。これは反射型 XSS(クロスサイトスクリプティング) 脆弱性を可能にします。<br>
22552255 詳細は、<a href="http://en.wikipedia.org/wiki/Cross-site_scripting">http://en.wikipedia.org/wiki/Cross-site_scripting</a> を参照してください。
22562256 </p>
22572257 <p>
22582258 FindBugs は、XSS の最も露骨で自明なケースだけを探します。
2259 FindBugs が何かを発見したならほぼ間違いなく FindBugs が報告しないより多くの脆弱性があるでしょう。
2259 FindBugs が何かを見つけたならほぼ間違いなく FindBugs が報告しないより多くの脆弱性があるでしょう。
22602260 XSS を心配するなら、商用の静的解析ツールかペネトレーションテストツールの使用を真剣に検討するべきです。
22612261 </p>
22622262 ]]>
22692269 <Details>
22702270 <![CDATA[
22712271 <p>
2272 このコードは、サーブレットのエラーページに <code>HttpServletResponse.sendError</code> を使用して HTTP パラメータを直接書き込んでいます。
2272 このコードはサーブレットのエラーページに <code>HttpServletResponse.sendError</code> を使用して HTTP パラメータを直接書き込んでいます。
22732273 信頼できない入力を返すことは反射型 XSS(クロスサイトスクリプティング) 脆弱性を可能にします。<br>
22742274 詳細は、<a href="http://en.wikipedia.org/wiki/Cross-site_scripting">http://en.wikipedia.org/wiki/Cross-site_scripting</a> を参照してください。
22752275 </p>
22762276 <p>
22772277 FindBugs は、XSS の最も露骨で自明なケースだけを探します。
2278 FindBugs が何かを発見したならほぼ間違いなく FindBugs が報告しないより多くの脆弱性があるでしょう。
2278 FindBugs が何かを見つけたならほぼ間違いなく FindBugs が報告しないより多くの脆弱性があるでしょう。
22792279 XSS を心配するなら、商用の静的解析ツールかペネトレーションテストツールの使用を真剣に検討するべきです。
22802280 </p>
22812281 ]]>
22882288 <Details>
22892289 <![CDATA[
22902290 <p>
2291 このコードは、JSP の出力に HTTP パラメータを直接書き込んでいます。これは XSS(クロスサイトスクリプティング) 脆弱性を可能にします。<br>
2291 このコードはJSP の出力に HTTP パラメータを直接書き込んでいます。これは XSS(クロスサイトスクリプティング) 脆弱性を可能にします。<br>
22922292 詳細は、<a href="http://en.wikipedia.org/wiki/Cross-site_scripting">http://en.wikipedia.org/wiki/Cross-site_scripting</a> を参照してください。
22932293 </p>
22942294 <p>
22952295 FindBugs は、XSS の最も露骨で自明なケースだけを探します。
2296 FindBugs が何かを発見したならほぼ間違いなく FindBugs が報告しないより多くの脆弱性があるでしょう。
2296 FindBugs が何かを見つけたならほぼ間違いなく FindBugs が報告しないより多くの脆弱性があるでしょう。
22972297 XSS に関して心配しているなら商用の静的解析ツールかペネトレーションテストツールの使用を真剣に検討するべきです。
22982298 </p>
22992299 ]]>
23732373 <Details>
23742374 <![CDATA[
23752375 <p>
2376 このコードは、volatile フィールドをインクリメントしています。
2376 このコードはvolatile フィールドをインクリメントしています。
23772377 volatile フィールドのインクリメントはアトミックではありません。
23782378 複数のスレッドが同時にフィールドをインクリメントすると、インクリメントが失われる可能性があります。
23792379 </p>
24092409 </BugPattern>
24102410
24112411 <BugPattern type="NP_OPTIONAL_RETURN_NULL">
2412 <ShortDescription>Optional の戻り型を持つメソッドが明示的に null を返す</ShortDescription>
2412 <ShortDescription>Optional の戻り型 ((java.util.Optional または com.google.common.base.Optional)) を持つメソッドが明示的に null を返す</ShortDescription>
24132413 <LongDescription>{1} は、Optional の戻り型を持っていて、 明示的に null を返しています。</LongDescription>
24142414 <Details>
24152415 <![CDATA[
24162416 <p>
2417 Optional の戻り型の使い方は、常に明示的に null を返すのは設計が望ましくないことを意味します。
2417 Optional の戻り型 ((java.util.Optional または com.google.common.base.Optional)) の使い方で明示的に null を返すのは設計が望ましくないことを意味します。
24182418 null 値をこのようなケースで返すことは契約違反で、多分クライアントコードを破壊するでしょう。
24192419 </p>
24202420 ]]>
25302530 <Details>
25312531 <![CDATA[
25322532 <p>
2533 このコードは、<code>putNextEntry</code> メソッドを呼び出して、<code>closeEntry</code> メソッドをすぐにを呼び出しています。
2533 このコードは <code>putNextEntry</code> メソッドを呼び出して、<code>closeEntry</code> メソッドをすぐにを呼び出しています。
25342534 これは空の ZIP ファイルエントリになります。
25352535 エントリデータは <code>putNextEntry</code> メソッドと <code>closeEntry</code> メソッドの呼び出しの間で ZIP ファイルに書き込むべきです。
25362536 </p>
25442544 <Details>
25452545 <![CDATA[
25462546 <p>
2547 このコードは、<code>putNextEntry</code> メソッドを呼び出して、 <code>closeEntry</code> メソッドをすぐに呼び出しています。
2547 このコードは <code>putNextEntry</code> メソッドを呼び出して、 <code>closeEntry</code> メソッドをすぐに呼び出しています。
25482548 これは空の JAR ファイルエントリになります。
25492549 エントリデータは <code>putNextEntry</code> メソッドと <code>closeEntry</code> メソッドの呼び出しの間で JAR ファイルに書き込むべきです。
25502550 </p>
27492749 <Details>
27502750 <![CDATA[
27512751 <p>
2752 このコードは、セキュリティ許可チェックが必要なメソッドを呼び出しています。
2752 このコードはセキュリティ許可チェックが必要なメソッドを呼び出しています。
27532753 このコードにセキュリティ許可が与えられるとしても、セキュリティ許可を持たないコードによって呼び出されるなら doPrivileged ブロックの中で呼び出す必要があります。
27542754 </p>
27552755 ]]>
31493149 <Details>
31503150 <![CDATA[
31513151 <p>
3152 このコードは、<code>Math.min(0, Math.max(100, value))</code> のような構文を使用して境界値を制限しようとしています。
3152 このコードは <code>Math.min(0, Math.max(100, value))</code> のような構文を使用して境界値を制限しようとしています。
31533153 しかしながら、定数の順序が間違っています。 <code>Math.min(100, Math.max(0, value))</code> とすべきです。
31543154 結果としてこのコードは常に同じ結果 (もし値が NaN なら NaN) を作り出します。
31553155 </p>
32043204 <Details>
32053205 <![CDATA[
32063206 <p>
3207 このコードは、定数でない文字列から SQL の <code>PreparedStatement</code> を作成しています。
3207 このコードは定数でない文字列から SQL の <code>PreparedStatement</code> を作成しています。
32083208 ユーザからのチェックされていない汚染されたデータがこの文字列を作る際に使われるなら、<code>PreparedStatement</code> で予想外で望ましくない何かをするために SQL インジェクションが使われる可能性があります。
32093209 </p>
32103210 ]]>
34733473
34743474 <BugPattern type="EQ_OVERRIDING_EQUALS_NOT_SYMMETRIC">
34753475 <ShortDescription>equals メソッドはスーパークラスの equals メソッドをオーバーライドしているが、対称的ではないかもしれない</ShortDescription>
3476 <LongDescription>{1.class} は、{2.class.givenClass} で equals メソッドをオーバーラドしていますが、対称的ではないかもしれません。</LongDescription>
3476 <LongDescription>{1.class} は、{2.class.givenClass} で equals メソッドをオーバーライドしていますが、対称的ではないかもしれません。</LongDescription>
34773477 <Details>
34783478 <![CDATA[
34793479 <p>
36143614 <Details>
36153615 <![CDATA[
36163616 <p>
3617 このコードは、<code>compareTo</code> または <code>compare</code> メソッドの戻り値を無効にしています。
3617 このコードは <code>compareTo</code> または <code>compare</code> メソッドの戻り値を無効にしています。
36183618 これは疑わしいかバッドプログラミングプラクティスです。戻り値が Integer.MIN_VALUE なので、戻り値を無効にすることは結果の符号を無効にしません。
36193619 結果を無効にするのではなくオペランドの順序を逆にすることによって、同じ意図した結果を得ることができます。
36203620 </p>
38193819 <Details>
38203820 <![CDATA[
38213821 <p>
3822 このコードは、参照等価性のために == や != を使用して <code>java.lang.String</code> オブジェクトを比較しています。
3822 このコードは参照等価性のために == や != を使用して <code>java.lang.String</code> オブジェクトを比較しています。
38233823 両方の文字列がソースファイルの定数か、<code>String.intern()</code> を使用して正準化されていないかぎり、同じ文字列は2つの異なる String オブジェクトによって表されるかもしれません。
38243824 その代わりに <code>equals(Object)</code> メソッドを使用することを検討してください。
38253825 </p>
38333833 <Details>
38343834 <![CDATA[
38353835 <p>
3836 このコードは、参照等価性のために == や != を使用して <code>java.lang.String</code> パラメータを比較しています。
3836 このコードは参照等価性のために == や != を使用して <code>java.lang.String</code> パラメータを比較しています。
38373837 文字列定数または正準化された文字列だけをメソッドに渡すことを呼び出し元に要求することは必要以上に脆弱で測定可能な性能の向上をもたらしません。
38383838 その代わりに <code>equals(Object)</code> メソッドを使用することを検討してください。
38393839 </p>
38963896 <li>少なくとも1つのロックされたアクセスがクラス自身のメソッドの1つによって実行され、</li>
38973897 <li>読み出しの2倍の重み付けをした書き込みで、非同期フィールドのアクセス (読み出しと書き込み) 数がすべてのアクセスのわずか1/3</li>
38983898 </ul>
3899 <p
3899 <p>
39003900 このバグパターンに合致する典型的なバグは、スレッドセーフを意図したクラスでメソッドを同期化させることを忘れていることです。
39013901 </p>
39023902 <p>
39623962 <Details>
39633963 <![CDATA[
39643964 <p>
3965 このコードは、オブジェクトの内部表現に外部の可変オブジェクトの参照を格納しています。
3965 このコードはオブジェクトの内部表現に外部の可変オブジェクトの参照を格納しています。
39663966 インスタンスが信頼できないコードによってアクセスされるなら、可変オブジェクトのチェックされていない変更がセキュリティや他の重要なプロパティを危うくするでしょう。
39673967 何か違うことをする必要があります。オブジェクトの新しいコピーを返すことは、多くの状況でより良いアプローチです。
39683968 </p>
39753975 <Details>
39763976 <![CDATA[
39773977 <p>
3978 このコードは、static フィールドに外部の可変オブジェクトを格納しています。
3978 このコードはstatic フィールドに外部の可変オブジェクトを格納しています。
39793979 可変オブジェクトのチェックされていない変更がセキュリティや他の重要なプロパティを危うくするでしょう。
39803980 何か違うことをする必要があります。オブジェクトのコピーを保存することは、多くの状況でより良いアプローチです。
39813981 </p>
40164016 <Details>
40174017 <![CDATA[
40184018 <p>
4019 このコードは、短絡論理 (&amp;&amp; や ||) ではなく非短絡論理 (&amp; や |) を使用していると思われます。
4019 このコードは短絡論理 (&amp;&amp; や ||) ではなく非短絡論理 (&amp; や |) を使用していると思われます。
40204020 さらに、左辺値によって右辺を評価したくない (例外のスローや演算が高くつく副作用があるため) と思っているのかもしれません。
40214021 非短絡論理は、左辺を知ることによって結果を推論できたとしても両側の式が評価されます。
40224022 これは効率が悪く、右辺の評価でエラーが発生するケースを左辺でガードしているなら、結果としてエラーになる可能性があります。
40334033 <Details>
40344034 <![CDATA[
40354035 <p>
4036 このコードは、短絡論理 (&amp;&amp; や ||) ではなく非短絡論理 (&amp; や |) を使用していると思われます。
4036 このコードは短絡論理 (&amp;&amp; や ||) ではなく非短絡論理 (&amp; や |) を使用していると思われます。
40374037 非短絡論理は、左辺を知ることによって結果を推論できたとしても両側の式が評価されます。
40384038 これは効率が悪く、右辺の評価でエラーが発生するケースを左辺でガードしているなら、結果としてエラーになる可能性があります。
40394039 </p>
40824082 <![CDATA[
40834083 <p>
40844084 このメソッドには条件制御フローによってガードされない <code>java.lang.Object.wait()</code> の呼び出しがあります。
4085 このコードは、<code>wait</code> メソッドを呼び出す前に待機するつもりだった条件が既に満たされていないことを確かめるべきです。
4085 このコードは <code>wait</code> メソッドを呼び出す前に待機するつもりだった条件が既に満たされていないことを確かめるべきです。
40864086 どんな前の通知も無視されます。
40874087 </p>
40884088 ]]>
42134213 <Details>
42144214 <![CDATA[
42154215 <p>
4216 このコードは、正準化した文字列で同期化しています。
4216 このコードは正準化した文字列で同期化しています。
42174217 </p>
42184218 <blockquote><pre>
42194219 private static String LOCK = "LOCK";
42644264 <Details>
42654265 <![CDATA[
42664266 <p>
4267 このコードは、明らかに共有されていない <code>Integer</code> のようなボクシングされたプリミティブ型で同期化しています。
4267 このコードは明らかに共有されていない <code>Integer</code> のようなボクシングされたプリミティブ型で同期化しています。
42684268 </p>
42694269 <blockquote><pre>
42704270 private static final Integer fileLock = new Integer(1);
42744274 }
42754275 </pre></blockquote>
42764276 <p>
4277 このコードは、 fileLock を以下のように宣言するとより良くなります。
4277 このコードは fileLock を以下のように宣言するとより良くなります。
42784278 </p>
42794279 <blockquote><pre>
42804280 private static final Object fileLock = new Object();
42934293 <Details>
42944294 <![CDATA[
42954295 <p>
4296 このコードは、Integer のようなボクシングされたプリミティブ型の定数で同期化しています。
4296 このコードはInteger のようなボクシングされたプリミティブ型の定数で同期化しています。
42974297 </p>
42984298 <blockquote><pre>
42994299 private static Integer count = 0;
44724472 <![CDATA[
44734473 <p>
44744474 この final static フィールドは Hashtable を参照しているので、悪意のあるコードや偶然別のパッケージによってアクセスできます。
4475 このコードは、Hashtable のコンテンツを自由に変更できます。
4475 このコードはHashtable のコンテンツを自由に変更できます。
44764476 </p>
44774477 ]]>
44784478 </Details>
45144514 <![CDATA[
45154515 <p>
45164516 この final static フィールドは配列を参照しているので、悪意のあるコードや偶然別のパッケージによってアクセスできます。
4517 このコードは、配列のコンテンツを自由に変更できます。
4517 このコードは配列のコンテンツを自由に変更できます。
45184518 </p>
45194519 ]]>
45204520 </Details>
45494549 </BugPattern>
45504550
45514551 <BugPattern type="ME_ENUM_FIELD_SETTER">
4552 <ShortDescription>public 列挙型メソッドが無条件にフィールドを設定するPublic enum method unconditionally sets its field</ShortDescription>
4552 <ShortDescription>public 列挙型メソッドが無条件にフィールドを設定する</ShortDescription>
45534553 <LongDescription>{1} は無条件にフィールド {2.name} を設定しています。</LongDescription>
45544554 <Details>
45554555 <![CDATA[
46274627 </BugPattern>
46284628
46294629 <BugPattern type="NM_METHOD_NAMING_CONVENTION">
4630 <ShortDescription>メソッド名は小文字から始めるべきです</ShortDescription>
4630 <ShortDescription>メソッド名は小文字から始めるべき</ShortDescription>
46314631 <LongDescription>メソッド名 {1} は、小文字から始まっていません。</LongDescription>
46324632 <Details>
46334633 <![CDATA[
49884988 </BugPattern>
49894989
49904990 <BugPattern type="SF_SWITCH_FALLTHROUGH">
4991 <ShortDescription>1つの case が次の case へと通り抜ける switch 文を発見した</ShortDescription>
4992 <LongDescription>1つの case が次の case へと通り抜ける switch 文を発見しました。{1}</LongDescription>
4991 <ShortDescription>1つの case が次の case へと通り抜ける switch 文を見つけた</ShortDescription>
4992 <LongDescription>1つの case が次の case へと通り抜ける switch 文を見つけました。{1}</LongDescription>
49934993 <Details>
49944994 <![CDATA[
49954995 <p>
50015001 </BugPattern>
50025002
50035003 <BugPattern type="SF_SWITCH_NO_DEFAULT">
5004 <ShortDescription>default がない switch 文を発見した</ShortDescription>
5005 <LongDescription>default がない switch 文を発見しました。{1}</LongDescription>
5004 <ShortDescription>default がない switch 文を見つけた</ShortDescription>
5005 <LongDescription>default がない switch 文を見つけました。{1}</LongDescription>
50065006 <Details>
50075007 <![CDATA[
50085008 <p>
55185518 <Details>
55195519 <![CDATA[
55205520 <p>
5521 この条件は常に関係している変数の値が前に絞られたのと同じ結果を作り出します。
5521 この条件は前に絞られた関係している変数の値と同じ結果を常に作り出します。
55225522 おそらく何かほかのことを意味していたのか、あるいは条件を除去できます。
55235523 </p>
55245524 ]]>
55315531 <Details>
55325532 <![CDATA[
55335533 <p>
5534 この条件は関係している変数の型範囲のために常に同じ結果を作り出します。
5534 この条件は関係している変数の型範囲のために同じ結果を常に作り出します。
55355535 おそらく何かほかのことを意味していたのか、あるいは条件を除去できます。
55365536 </p>
55375537 ]]>
56555655 <Details>
56565656 <![CDATA[
56575657 <p>
5658 このコードは、メソッドを呼び出して戻り値を無視しています。
5658 このコードはメソッドを呼び出して戻り値を無視しています。
56595659 しかしながら、解析はメソッド (もしあればサブクラスの実装も含む) が戻り値以外の効果をもたらさないことを示しています。
56605660 この呼び出しは除去できます。
56615661 </p>
56805680 </BugPattern>
56815681
56825682 <BugPattern type="RV_RETURN_VALUE_IGNORED_INFERRED">
5683 <ShortDescription>メソッドは戻り値を無視しています、これは間違いではないですか?</ShortDescription>
5683 <ShortDescription>メソッドは戻り値を無視しています。これは間違いではないですか?</ShortDescription>
56845684 <LongDescription>{2.givenClass} の戻り値を無視しています、これは間違いではないですか? {1}</LongDescription>
56855685 <Details>
56865686 <![CDATA[
56875687 <p>
5688 このコードは、メソッドを呼び出して、戻り値を無視しています。
5688 このコードはメソッドを呼び出して、戻り値を無視しています。
56895689 戻り値は、メソッドが呼び出される型と同じ型です。そして、我々の解析から戻り値が重要であるかもしれないように見えます (たとえば、<code>String.toLowerCase()</code> の戻り値を無視するような)。
56905690 </p>
56915691 <p>
57165716 <p>
57175717 プログラマは、<code>trim</code> メソッドが <code>dateString</code> によって参照される String オブジェクトが更新されると思っています。
57185718 しかし、String オブジェクトは不変で、<code>trim</code> メソッドが新しい String オブジェクトを返すのに無視しています。
5719 このコードは、以下のように修正するべきです。
5719 このコードは以下のように修正するべきです。
57205720 </p>
57215721 <blockquote><pre>
57225722 String dateString = getHeaderField(name);
57475747 <Details>
57485748 <![CDATA[
57495749 <p>
5750 このコードは、compareTo または compare メソッドを呼び出して、戻り値が特定の値(たとえば1または-1) なのか確かめています。
5750 このコードはcompareTo または compare メソッドを呼び出して、戻り値が特定の値(たとえば1または-1) なのか確かめています。
57515751 これらのメソッドを呼び出すときは特定のゼロ以外の値ではなく、結果の符号だけをチェックするべきです。
57525752 多数または大部分の compareTo と比較メソッドは-1、0または1を返しますが、いくつかは他の値を返します。
57535753 </p>
57615761 <Details>
57625762 <![CDATA[
57635763 <p>
5764 このコードは、例外 (またはエラー) オブジェクトを作成していますが、何もしていません。<br>
5764 このコードは例外 (またはエラー) オブジェクトを作成していますが、何もしていません。<br>
57655765 たとえば以下のようなコードです。
57665766 </p>
57675767 <blockquote><pre>
65856585 <Details>
65866586 <![CDATA[
65876587 <p>
6588 このコードは、<code>java.util.Random</code> オブジェクトを作成して1つの乱数を生成するために使用して捨てています。
6588 このコードは <code>java.util.Random</code> オブジェクトを作成して1つの乱数を生成するために使用して捨てています。
65896589 これはあまり良くない品質の乱数を作り出し、効率が悪いです。
65906590 できれば、<code>Random</code> オブジェクトを1つだけ作成して保存されるようにコードを書き直してください。
65916591 そして、毎回新しい乱数は既存の <code>Random</code> オブジェクトを呼び出して取得することが必要です。
66046604 <Details>
66056605 <![CDATA[
66066606 <p>
6607 このコードは、符号付き整数の乱数を生成して絶対値を計算しています。
6607 このコードは符号付き整数の乱数を生成して絶対値を計算しています。
66086608 乱数ジェネレータで返される数が <code>Integer.MIN_VALUE</code> なら結果は同様に負です (<code>Math.abs(Integer.MIN_VALUE) == Integer.MIN_VALUE</code> なので)。
66096609 (同じ問題は long 値でも同様に起きます)。
66106610 </p>
66186618 <Details>
66196619 <![CDATA[
66206620 <p>
6621 このコードは、ハッシュコードを生成して絶対値を計算しています。
6621 このコードはハッシュコードを生成して絶対値を計算しています。
66226622 ハッシュコードが <code>Integer.MIN_VALUE</code> なら結果は同様に負です (<code>Math.abs(Integer.MIN_VALUE) == Integer.MIN_VALUE</code> なので)。
66236623 </p>
66246624 <p>
66486648 <Details>
66496649 <![CDATA[
66506650 <p>
6651 このコードは、ハッシュコードを計算して別の値を法とする剰余を計算しています。
6651 このコードはハッシュコードを計算して別の値を法とする剰余を計算しています。
66526652 ハッシュコードは負になり、剰余演算の結果も負なります。
66536653 </p>
66546654 <p>
66676667 <Details>
66686668 <![CDATA[
66696669 <p>
6670 このコードは、負でないことが保証されている値と負の定数またはゼロとを比較しています。
6670 このコードは負でないことが保証されている値と負の定数またはゼロとを比較しています。
66716671 </p>
66726672 ]]>
66736673 </Details>
66926692 <Details>
66936693 <![CDATA[
66946694 <p>
6695 このコードは、int 値と int 値として表される値の範囲外の long 定数を比較しています。
6695 このコードはint 値と int 値として表される値の範囲外の long 定数を比較しています。
66966696 この比較は無意味で、おそらく間違っています。
66976697 </p>
66986698 ]]>
68196819 <Details>
68206820 <![CDATA[
68216821 <p>
6822 このメソッドは、<code>((event.detail &amp; SWT.SELECTED) &gt; 0)</code> のような式を比較しています。
6823 ビット演算をより大きい演算子で比較することは、予想外の結果 (もちろん、<code>SWT.SELECTED</code> の値による) の原因になる可能性があります。
6824 <code>SWT.SELECTED</code> が負数であるなら、これはバグの候補です。
6825 <code>SWT.SELECTED</code> が負ではないとしても、'&gt; 0' の代わりに '!= 0' を使用することは良いプラクティスと思われます。
6826 </p>
6827 <p>
6828 Boris Bokowski
6822 このメソッドは、<code>((event.detail &amp; SWT.SELECTED) &gt; 0)</code> のような式で比較しています。
6823 ビット演算をより大きい演算子で比較することは、予想外の結果 (もちろん、SWT.SELECTED の値による) の原因になる可能性があります。
6824 SWT.SELECTED が負数であるなら、これはバグの候補です。
6825 SWT.SELECTED が負ではないとしても、'&gt; 0' の代わりに '!= 0' を使用することが良いプラクティスであると思われます。
68296826 </p>
68306827 ]]>
68316828 </Details>
68326829 </BugPattern>
68336830
68346831 <BugPattern type="BIT_SIGNED_CHECK_HIGH_BIT">
6835 <ShortDescription>ビット演算の符号をチェックする</ShortDescription>
6836 <LongDescription>ビット演算の符号をチェックしてください。{1}</LongDescription>
6837 <Details>
6838 <![CDATA[
6839 <p>
6840 このメソッドは、<code>((event.detail &amp; SWT.SELECTED) &gt; 0)</code> のような式を比較しています。
6841 ビット演算をより大きい演算子で比較することは、予想外の結果 (もちろん、<code>SWT.SELECTED</code> の値による) の原因になる可能性があります。
6842 <code>SWT.SELECTED</code> が負数であるなら、これはバグの候補です。
6843 <code>SWT.SELECTED</code> が負ではないとしても、'&gt; 0' の代わりに '!= 0' を使用することは良いプラクティスと思われます。
6844 </p>
6845 <p>
6846 Boris Bokowski
6832 <ShortDescription>負数を含むビット演算の符号をチェックする</ShortDescription>
6833 <LongDescription>{2} を含むビット演算の符号をチェックしてください。{1}</LongDescription>
6834 <Details>
6835 <![CDATA[
6836 <p>
6837 このメソッドは、CONSTANT が負数のときに <code>((val &amp; CONSTANT) &gt; 0)</code> のようなビット演算式で比較しています。
6838 ビット演算をより大きい演算子で比較することは、予想外の結果の原因になる可能性があります。比較は期待したようになりません。
6839 '&gt; 0' の代わりに '!= 0' を使用することが良いプラクティスです。
68476840 </p>
68486841 ]]>
68496842 </Details>
68556848 <Details>
68566849 <![CDATA[
68576850 <p>
6858 このメソッドは、<i>(e &amp; 0)</i> 形式の式を0と比較しています。それは、常に等価であることを比較します。論理エラーかタイプミスかもしれません。
6851 このメソッドは、<code>(e &amp; 0)</code> 形式の式を0と比較しています。それは、常に等価であることを比較します。論理エラーかタイプミスかもしれません。
68596852 </p>
68606853 ]]>
68616854 </Details>
68676860 <Details>
68686861 <![CDATA[
68696862 <p>
6870 このメソッドは、<code>(e | C)</code> 形式の式を <code>D</code> と比較しています。
6871 定数 <i>C</i> の特定の値と <i>D</i> のために常に等しくないことを比較します。論理エラーかタイプミスかもしれません。
6863 このメソッドは、<code>(e | C)</code> 形式の式を D と比較しています。
6864 定数 C と D の特定の値のために常に等しくないことを比較します。論理エラーかタイプミスかもしれません。
68726865 </p>
68736866 <p>
68746867 典型的に、このバグは、ビットセットで帰属関係のテストを実行したいコードで発生します。
68756868 しかし、ビット論理積演算子 ("&amp;") の代わりにビット論理和演算子 ("|") を使用しています。
6869 </p>
6870 <p>
6871 こうしたバグは <code>(e &amp; (A | B)) == C</code> が意図されている間に <code>((e &amp; A) | B) == C</code> のように解析される <code>(e &amp; A | B) == C</code> のような式で現れるかもしれません。
68766872 </p>
68776873 ]]>
68786874 </Details>
71277123 <Details>
71287124 <![CDATA[
71297125 <p>
7130 このコードは、String.indexOf() に長さ1の文字列定数を渡しています。String.indexOf() の整数実装を使うほうが効率的です。
7126 このコードはString.indexOf() に長さ1の文字列定数を渡しています。String.indexOf() の整数実装を使うほうが効率的です。
71317127 たとえば、<code>myString.indexOf(".")</code> の代わりに <code>myString.indexOf('.')</code> を呼び出します。
71327128 </p>
71337129 ]]>
71407136 <Details>
71417137 <![CDATA[
71427138 <p>
7143 このコードは、String.lastIndexOf() に長さ1の文字列定数を渡しています。String.lastIndexOf() の整数実装を使うほうが効率的です。
7139 このコードはString.lastIndexOf() に長さ1の文字列定数を渡しています。String.lastIndexOf() の整数実装を使うほうが効率的です。
71447140 たとえば、<code>myString.lastIndexOf(".")</code> の代わりに <code>myString.lastIndexOf('.')</code> を呼び出します。
71457141 </p>
71467142 ]]>
75807576 <Details>
75817577 <![CDATA[
75827578 <p>
7583 このコードは、浮動小数点が特別な非数値と等価であるか確かめています (たとえば <code>if (x == Double.NaN)</code>)。
7579 このコードは浮動小数点が特別な非数値と等価であるか確かめています (たとえば <code>if (x == Double.NaN)</code>)。
75847580 しかしながら、<code>NaN</code> の特別な意味のため、値は <code>NaN</code> と等価ではありません。
75857581 したがって、<code>x == Double.NaN</code> は常に false と評価します。
75867582 <code>x</code> という値が特別な非数値であるかどうか確かめるためには <code>Double.isNaN(x)</code> を使用します (または <code>x</code> が浮動小数点精度であるなら <code>Float.isNaN(x)</code>)。
77737769 <Details>
77747770 <![CDATA[
77757771 <p>
7776 このコードは、以下のように整数の乗算を実行してから結果を long に変換しています。
7772 このコードは以下のように整数の乗算を実行してから結果を long に変換しています。
77777773 </p>
77787774 <blockquote><pre>
77797775 long convertDaysToMilliseconds(int days) { return 1000*3600*24*days; }
78027798 <Details>
78037799 <![CDATA[
78047800 <p>
7805 このコードは、32ビット int 値を64ビット long 値に変換して、絶対時間値を必要とするメソッドパラメータに渡しています。
7801 このコードは32ビット int 値を64ビット long 値に変換して、絶対時間値を必要とするメソッドパラメータに渡しています。
78067802 絶対時間値は、「エポック」(すなわち、1970年1月1日、00:00:00 GMT)としてわかっている標準的な基準時間からのミリ秒数です。<br>
78077803 たとえば、次のメソッド (エポックからの秒を Date へ変換することを意図した) はひどく壊れています。
78087804 </p>
78337829 <Details>
78347830 <![CDATA[
78357831 <p>
7836 このコードは、整数値を float 精度浮動小数点に変換してから、その結果を <code>Math.round()</code> に渡して引数に最も近い int/long を返します。
7832 このコードは整数値を float 精度浮動小数点に変換してから、その結果を <code>Math.round()</code> に渡して引数に最も近い int/long を返します。
78377833 整数を float に変換すると小数部がない数値が得られるので、この演算は常にノーオペレーションになります。
78387834 <code>Math.round()</code>に渡される値を生成した演算が浮動小数点演算を使用して実行することを意図した可能性が高いです。
78397835 </p>
78477843 <Details>
78487844 <![CDATA[
78497845 <p>
7850 このコードは、整数値 (たとえば、int や long) を倍精度浮動小数点に変換してから、その結果を <code>Math.ceil()</code> に渡しています。
7846 このコードは整数値 (たとえば、int や long) を倍精度浮動小数点に変換してから、その結果を <code>Math.ceil()</code> に渡しています。
78517847 整数を double に変換すると小数部がない数値が得られるので、この演算は常にノーオペレーションになります。
78527848 <code>Math.ceil()</code>に渡される値を生成した演算が倍精度浮動小数点演算を使用して実行することを意図した可能性が高いです。
78537849 </p>
78617857 <Details>
78627858 <![CDATA[
78637859 <p>
7864 このコードは 整数の除算の結果を double または float にキャストしています。
7860 このコードは整数の除算の結果を double または float にキャストしています。
78657861 整数で除算をすることは、ゼロに最も近い整数値まで結果を切り捨てます。
78667862 結果が double にキャストされたという事実は、この精度が維持されるべきだったことを示唆しています。
78677863 おそらく意味されたことは、除算を実行する前にオペランドの1つまたは両方を double にキャストすることでした。<br>
78867882 <Details>
78877883 <![CDATA[
78887884 <p>
7889 このコードは、HttpSession に非直列化可能オブジェクトを格納していると思われます。
7885 このコードは HttpSession に非直列化可能オブジェクトを格納していると思われます。
78907886 このセッションが不活性化されるか移行したなら、エラーを招きます。
78917887 </p>
78927888 ]]>
78997895 <Details>
79007896 <![CDATA[
79017897 <p>
7902 このコードは、<code>ObjectOutput.writeObject</code> に非直列化可能オブジェクトを渡していると思われます。
7898 このコードは <code>ObjectOutput.writeObject</code> に非直列化可能オブジェクトを渡していると思われます。
79037899 このオブジェクトが本当に非直列化可能なら、エラーを招きます。
79047900 </p>
79057901 ]]>
79127908 <Details>
79137909 <![CDATA[
79147910 <p>
7915 この書式文字列は、前の書式指示子の引数が再利用されるようにするために「相対インデックス ("&lt;")」を指定しています。
7911 この書式文字列は前の書式指示子の引数が再利用されるようにするために「相対インデックス ("&lt;")」を指定しています。
79167912 しかしながら、前の引数がありません。
79177913 たとえば、<code>formatter.format("%&lt;s %s", "a", "b")</code> が実行されると MissingFormatArgumentException をスローします。
79187914 </p>
79267922 <Details>
79277923 <![CDATA[
79287924 <p>
7929 この書式文字列には改行文字 (\n) が含まれています。
7925 この書式文字列は改行文字 (\n) が含まれています。
79307926 一般的に書式文字列には %n を使用することがより望ましいです。%n は、プラットホーム特有の行セパレータを作り出します。
79317927 </p>
79327928 ]]>
79347930 </BugPattern>
79357931
79367932 <BugPattern type="VA_FORMAT_STRING_BAD_CONVERSION">
7937 <ShortDescription>与えられた引数の型は書式指示子に合致しません</ShortDescription>
7933 <ShortDescription>与えられた引数の型は書式指示子に合致しない</ShortDescription>
79387934 <LongDescription>引数の型 {3} は、書式指示子 {4} によって扱えません。{1}</LongDescription>
79397935 <Details>
79407936 <![CDATA[
79417937 <p>
7942 引数の1つは、対応する書式指示子と互換性がありません。その結果、実行されるときに実行時例外を生成します。
7938 引数の1つは対応する書式指示子と互換性がありません。その結果、実行されるときに実行時例外を生成します。
79437939 たとえば、<code>String.format("%d", "1")</code> は、文字列 "1" が書式指示子 "%d" と互換性がないので例外を生成します。
79447940 </p>
79457941 ]]>
80848080 <Details>
80858081 <![CDATA[
80868082 <p>
8087 このコードは、Collection を抽象コレクションにキャストしています (たとえば <code>List</code>、<code>Set</code>、<code>Map</code>)。
8083 このコードはCollection を抽象コレクションにキャストしています (たとえば <code>List</code>、<code>Set</code>、<code>Map</code>)。
80888084 オブジェクトがキャストする型であるということが保証されていることを確認してください。
80898085 必要とするコレクションの反復処理ができるなら Set または List にキャストする必要はありません。
80908086 </p>
81398135 <Details>
81408136 <![CDATA[
81418137 <p>
8142 このコードは、以下のように、<code>Object[]</code> より特定の型のコレクションで <code>toArray</code> メソッドを呼び出す結果をキャストしています。
8138 このコードは以下のように、<code>Object[]</code> より特定の型のコレクションで <code>toArray</code> メソッドを呼び出す結果をキャストしています。
81438139 </p>
81448140 <blockquote><pre>
81458141 String[] getAsArray(Collection&lt;String&gt; c) {
82328228 <Details>
82338229 <![CDATA[
82348230 <p>
8235 このコードは、メソッドの戻り値の未確認のキャストを実行しています。
8231 このコードはメソッドの戻り値の未確認のキャストを実行しています。
82368232 コードは、キャストが安全であることが保証されるようにメソッドを呼び出しているかもしれませんが、FindBugs はキャストが安全であることを検証できません。
82378233 プログラムのロジックがこのキャストが失敗しないことを確実に確認してください。
82388234 </p>
82808276 <Details>
82818277 <![CDATA[
82828278 <p>
8283 このコードは、正規表現の構文によると無効である正規表現を使用しています。
8279 このコードは正規表現の構文によると無効である正規表現を使用しています。
82848280 この文が実行されるとき PatternSyntaxException をスローします。
82858281 </p>
82868282 ]]>
82938289 <Details>
82948290 <![CDATA[
82958291 <p>
8296 このコードは、正規表現が必要な場所で、<code>File.separator</code> を使用しています。
8292 このコードは正規表現が必要な場所で、<code>File.separator</code> を使用しています。
82978293 これは <code>File.separator</code> がバックスラッシュである Windows プラットホームでは失敗します。
82988294 バックスラッシュは正規表現ではエスケープ文字として解釈されます。
82998295 その他の選択肢としては、<code>File.separator</code> の代わりに <code>File.separatorChar=='\\' ? "\\\\" : File.separator</code> を使用できます。
83088304 <Details>
83098305 <![CDATA[
83108306 <p>
8311 このコードは、インクリメント演算 (たとえば、<code>i++</code>) を実行してすぐに上書きしています。
8307 このコードはインクリメント演算 (たとえば、<code>i++</code>) を実行してすぐに上書きしています。
83128308 たとえば、<code>i = i++</code> は元の値をインクリメントした値で上書きします。
83138309 </p>
83148310 ]]>
83218317 <Details>
83228318 <![CDATA[
83238319 <p>
8324 このコードは、符号なしキャストの実行結果を short または byte にキャストしています。結果の上位ビットは捨てられます。
8320 このコードは符号なしキャストの実行結果を short または byte にキャストしています。結果の上位ビットは捨てられます。
83258321 上位ビットが捨てられるので、符号付きと符号なし右シフト (シフトのサイズによって) との違いがないかもしれません。
83268322 </p>
83278323 ]]>
83488344 <Details>
83498345 <![CDATA[
83508346 <p>
8351 このコードは、32ビット int の-31から31の範囲を超えた量でシフトを実行しています。
8347 このコードは32ビット int の-31から31の範囲を超えた量でシフトを実行しています。
83528348 これの効果は、どのくらいシフトするのかを決めるために整数値の下位5ビット (32で割った余り) を使用することです (たとえば、40ビットでシフトすることは8ビットでシフトすることと同じで、32ビットでシフトすることは0ビットでシフトすることと同じです)。
83538349 これはおそらく期待されたことではなく、少なくとも紛らわしいです。
83548350 </p>
83628358 <Details>
83638359 <![CDATA[
83648360 <p>
8365 このコードは、整数剰余の結果に整数定数を乗算しています。
8361 このコードは整数剰余の結果に整数定数を乗算しています。
83668362 紛らわしい演算子の優先順位がないことを確実にしてください。
83678363 たとえば、i % 60 * 1000 は、i % (60 * 1000) ではなく (i % 60) * 1000 となります。
83688364 </p>
83768372 <Details>
83778373 <![CDATA[
83788374 <p>
8379 このコードは、配列で <code>hashCode</code> メソッドを呼び出しています。
8375 このコードは配列で <code>hashCode</code> メソッドを呼び出しています。
83808376 配列で <code>hashCode</code> メソッドを呼び出すことは、System.identityHashCode と同じ値を返すので、コンテンツと配列の長さを無視します。
83818377 配列 <code>a</code> のコンテンツによるハッシュコードを必要とするなら、<code>java.util.Arrays.hashCode(a)</code> を使用してください。
83828378 </p>
83908386 <Details>
83918387 <![CDATA[
83928388 <p>
8393 このコードは、配列で <code>toString</code> メソッドを呼び出しています。「[C@16f0472」のようなかなり役に立たない結果を生成します。
8389 このコードは配列で <code>toString</code> メソッドを呼び出しています。「[C@16f0472」のようなかなり役に立たない結果を生成します。
83948390 配列のコンテンツを与え、読める文字列に変換するために <code>Arrays.toString()</code> を使用することを検討してください。<br>
83958391 『Programming Puzzlers』の第3章、パズル12を参照してください。
83968392 </p>
84048400 <Details>
84058401 <![CDATA[
84068402 <p>
8407 このコードは、無名の配列で <code>toString</code> メソッドを呼び出しています。「[C@16f0472」のようなかなり役に立たない結果を生成します。
8403 このコードは無名の配列で <code>toString</code> メソッドを呼び出しています。「[C@16f0472」のようなかなり役に立たない結果を生成します。
84088404 配列のコンテンツを与え、読める文字列に変換するために <code>Arrays.toString()</code> を使用することを検討してください。<br>
84098405 『Programming Puzzlers』の第3章、パズル12を参照してください。
84108406 </p>
84188414 <Details>
84198415 <![CDATA[
84208416 <p>
8421 このコードは、除算か符号付き右シフトを使用して2つの整数の平均を計算して、結果を配列の添字として使用しています。
8417 このコードは除算か符号付き右シフトを使用して2つの整数の平均を計算して、結果を配列の添字として使用しています。
84228418 平均値が非常に大きいならオーバーフローする可能性があります (結果として負の平均の計算になる)。
84238419 結果が負でないことを意図していたなら、その代わりに符号なし右シフトを使用できます。
84248420 つまり、<code>(low+high)/2</code> ではなく <code>(low+high) &gt;&gt;&gt; 1</code> を使用してください。
84388434 <Details>
84398435 <![CDATA[
84408436 <p>
8441 このコードは、<code>x % 2 == 1</code> を使用して値が負数なのか確かめていますが、負数 (たとえば、<code>(-5) % 2 == -1</code>) なので機能しません。
8437 このコードは <code>x % 2 == 1</code> を使用して値が負数なのか確かめていますが、負数 (たとえば、<code>(-5) % 2 == -1</code>) なので機能しません。
84428438 奇数チェックを意図しているなら、<code>x &amp; 1 == 1</code> または <code>x % 2 != 0</code> を使用することを検討してください。
84438439 </p>
84448440 ]]>
84518447 <Details>
84528448 <![CDATA[
84538449 <p>
8454 このコードは、ハードコードされた絶対パス名を使用して File オブジェクトを構築しています (たとえば <code>new File("/home/dannyc/workspace/j2ee/src/share/com/sun/enterprise/deployment");</code>)。
8450 このコードはハードコードされた絶対パス名を使用して File オブジェクトを構築しています (たとえば <code>new File("/home/dannyc/workspace/j2ee/src/share/com/sun/enterprise/deployment");</code>)。
84558451 </p>
84568452 ]]>
84578453 </Details>
84638459 <Details>
84648460 <![CDATA[
84658461 <p>
8466 このコードは、メソッドに0から11の範囲外の月定数値を渡しています。
8462 このコードはメソッドに0から11の範囲外の月定数値を渡しています。
84678463 </p>
84688464 ]]>
84698465 </Details>
84758471 <Details>
84768472 <![CDATA[
84778473 <p>
8478 このコードは、文字列で <code>substring(0)</code> を呼び出していますが、元の値を返します。
8474 このコードは文字列で <code>substring(0)</code> を呼び出していますが、元の値を返します。
84798475 </p>
84808476 ]]>
84818477 </Details>
87728768 </BugPattern>
87738769
87748770 <BugPattern type="STCAL_STATIC_SIMPLE_DATE_FORMAT_INSTANCE">
8775 <ShortDescription>static DateFormat</ShortDescription>
8771 <ShortDescription>static DateFormat フィールド</ShortDescription>
87768772 <LongDescription>{1} は、java.text.DateFormat 型の static フィールドです。それはスレッドセーフではありません。</LongDescription>
87778773 <Details>
87788774 <![CDATA[
89418937 <Details>
89428938 <![CDATA[
89438939 <p>
8944 このコードは、ファイルを追加モードで開いて、オブジェクト出力ストリームの中で結果をラップしています。
8940 このコードはファイルを追加モードで開いて、オブジェクト出力ストリームの中で結果をラップしています。
89458941 これはファイルに格納された既存のオブジェクト出力ストリームに追加できないでしょう。
89468942 オブジェクト出力ストリームに追加したいなら、オブジェクト出力ストリームを開いておく必要があります。
89478943 </p>
89758971 </pre></blockquote>
89768972 <p>
89778973 <code>Label</code> のサブクラスは同じサブクラスで同期化しません。データレースを生じさせます。
8978 代わりに、このコードは、<code>Label.class</code> で同期化するべきです。
8974 代わりに、このコードは <code>Label.class</code> で同期化するべきです。
89798975 </p>
89808976 <blockquote><pre>
89818977 private static final String base = "label";
0
1 AppleJavaExtensions
2 v 1.2
3
4 http://developer.apple.com/samplecode/AppleJavaExtensions/AppleJavaExtensions.html
5
6 This is a pluggable jar of stub classes representing the new Apple
7 eAWT and eIO APIs for Java 1.4 on Mac OS X. The purpose of these
8 stubs is to allow for compilation of eAWT- or eIO-referencing code on
9 platforms other than Mac OS X. These stubs are not intended for the
10 runtime classpath on non-Mac platforms. Please see the OSXAdapter
11 sample for how to write cross-platform code that uses eAWT.
12
13 There is no license file provided for AppleJavaExtensions.jar. Below
14 is a response from Apple to a question about the license.
15
16 On 13 Aug 2004, at 12:33 AM, mdrance@apple.com wrote:
17
18 > Thank you for bringing this up. AppleJavaExtensions is subject to all
19 > the same terms as the other sample code projects from Apple. We will
20 > update the readme to contain the boilerplate legal info. Of course you
21 > can use them on other platforms -- the readme explicitly says this is
22 > their purpose. But I appreciate your caution and attention to detail.
23
24 Below is a copy of the standard Apple sample code disclaimer from another
25 piece of sample code on the same site:
26
27 -------------------------------------------------------------------------
28 Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
29 Computer, Inc. ("Apple") in consideration of your agreement to the
30 following terms, and your use, installation, modification or
31 redistribution of this Apple software constitutes acceptance of these
32 terms. If you do not agree with these terms, please do not use,
33 install, modify or redistribute this Apple software.
34
35 In consideration of your agreement to abide by the following terms, and
36 subject to these terms, Apple grants you a personal, non-exclusive
37 license, under Apple's copyrights in this original Apple software (the
38 "Apple Software"), to use, reproduce, modify and redistribute the Apple
39 Software, with or without modifications, in source and/or binary forms;
40 provided that if you redistribute the Apple Software in its entirety and
41 without modifications, you must retain this notice and the following
42 text and disclaimers in all such redistributions of the Apple Software.
43 Neither the name, trademarks, service marks or logos of Apple Computer,
44 Inc. may be used to endorse or promote products derived from the Apple
45 Software without specific prior written permission from Apple. Except
46 as expressly stated in this notice, no other rights or licenses, express
47 or implied, are granted by Apple herein, including but not limited to
48 any patent rights that may be infringed by your derivative works or by
49 other works in which the Apple Software may be incorporated.
50
51 The Apple Software is provided by Apple on an "AS IS" basis. APPLE
52 MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
53 THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
54 FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
55 OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
56
57 IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
58 OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
59 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
60 INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
61 MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
62 AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
63 STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
64 POSSIBILITY OF SUCH DAMAGE.
65
66 Copyright © 2004 Apple Computer, Inc., All Rights Reserved
0 <project>
0 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
11 <modelVersion>4.0.0</modelVersion>
22 <parent>
33 <groupId>org.sonatype.oss</groupId>
44 <artifactId>oss-parent</artifactId>
55 <version>7</version>
6 <relativePath></relativePath>
6 <relativePath />
77 </parent>
88
99 <groupId>com.google.code.findbugs</groupId>
1010 <artifactId>findbugs</artifactId>
11 <version>3.0.1-SNAPSHOT</version>
11 <version>3.1.0-SNAPSHOT</version>
1212 <packaging>jar</packaging>
1313
1414 <url>http://findbugs.sourceforge.net/</url>
5959 <developer>
6060 <id>bp</id>
6161 <name>Keith Lea</name>
62 <email></email>
62 <email />
6363 <url>http://keithlea.com/</url>
6464 <roles>
6565 <role>web cloud</role>
8888 </contributor>
8989 <contributor>
9090 <name>Nay Ayewah</name>
91 <email></email>
92 <url></url>
93 <roles>
94 <role></role>
91 <email />
92 <url />
93 <roles>
94 <role />
9595 </roles>
9696 <timezone>-5</timezone>
9797 </contributor>
9898 <contributor>
9999 <name>Ben Langmead</name>
100 <email></email>
101 <url></url>
102 <roles>
103 <role></role>
100 <email />
101 <url />
102 <roles>
103 <role />
104104 </roles>
105105 <timezone>-5</timezone>
106106 </contributor>
107107 <contributor>
108108 <name>Tomas Pollak</name>
109 <email></email>
110 <url></url>
109 <email />
110 <url />
111111 <roles>
112112 <role>Eclipse plugin tests</role>
113113 </roles>
115115 </contributor>
116116 <contributor>
117117 <name>Phil Crosby</name>
118 <email></email>
119 <url></url>
120 <roles>
121 <role></role>
118 <email />
119 <url />
120 <roles>
121 <role />
122122 </roles>
123123 <timezone>-5</timezone>
124124 </contributor>
125125 <contributor>
126126 <name>Peter Friese</name>
127 <email></email>
128 <url></url>
127 <email />
128 <url />
129129 <roles>
130130 <role>Eclipse plugin</role>
131131 </roles>
133133 </contributor>
134134 <contributor>
135135 <name>Dave Brosius</name>
136 <email></email>
137 <url></url>
138 <roles>
139 <role></role>
136 <email />
137 <url />
138 <roles>
139 <role />
140140 </roles>
141141 <timezone>-5</timezone>
142142 </contributor>
143143 <contributor>
144144 <name>Brian Goetz</name>
145 <email></email>
146 <url></url>
147 <roles>
148 <role></role>
145 <email />
146 <url />
147 <roles>
148 <role />
149149 </roles>
150150 <timezone>-5</timezone>
151151 </contributor>
152152 <contributor>
153153 <name>Rohan Lloyd</name>
154 <email></email>
155 <url></url>
156 <roles>
157 <role></role>
154 <email />
155 <url />
156 <roles>
157 <role />
158158 </roles>
159159 <timezone>-5</timezone>
160160 </contributor>
161161 <contributor>
162162 <name>Tagir Valeev</name>
163 <email></email>
164 <url></url>
165 <roles>
166 <role></role>
163 <email>lany@ngs.ru</email>
164 <url />
165 <roles>
166 <role />
167167 </roles>
168168 <timezone>+6</timezone>
169169 </contributor>
245245 </dependency>
246246 </dependencies>
247247 <build>
248 <sourceDirectory>${basedir}/src</sourceDirectory>
248 <sourceDirectory>${basedir}/src/java</sourceDirectory>
249249 <testSourceDirectory>${basedir}/src/junit</testSourceDirectory>
250250 <resources>
251251 <resource>
274274 </includes>
275275 </resource>
276276 <resource>
277 <directory>${basedir}/src/antTask</directory>
277 <directory>${basedir}/src/gui</directory>
278278 <includes>
279279 <include>**/*.xsl</include>
280280 <include>**/*.properties</include>
284284 </includes>
285285 </resource>
286286 <resource>
287 <directory>${basedir}/src/gui</directory>
287 <directory>${basedir}/src/java</directory>
288288 <includes>
289289 <include>**/*.xsl</include>
290290 <include>**/*.properties</include>
293293 <include>**/*.html</include>
294294 </includes>
295295 </resource>
296 <resource>
297 <directory>${basedir}/src/java</directory>
298 <includes>
299 <include>**/*.xsl</include>
300 <include>**/*.properties</include>
301 <include>**/*.db</include>
302 <include>**/*.png</include>
303 <include>**/*.html</include>
304 </includes>
305 </resource>
306296 </resources>
307297 <plugins>
298 <plugin>
299 <groupId>org.codehaus.mojo</groupId>
300 <artifactId>build-helper-maven-plugin</artifactId>
301 <version>1.9.1</version>
302 <executions>
303 <execution>
304 <phase>generate-sources</phase>
305 <goals><goal>add-source</goal></goals>
306 <configuration>
307 <sources>
308 <source>src/antTask</source>
309 <source>src/tools</source>
310 <source>src/gui</source>
311 </sources>
312 </configuration>
313 </execution>
314 </executions>
315 </plugin>
308316 <plugin>
309317 <groupId>org.apache.maven.plugins</groupId>
310318 <artifactId>maven-javadoc-plugin</artifactId>
311319 <version>2.9.1</version>
312 <configuration>
313 <sourcepath>src/java</sourcepath>
314 </configuration>
315320 </plugin>
316321 <plugin>
317322 <groupId>org.apache.maven.plugins</groupId>
328333 <testExcludes>
329334 <exclude>**/architecture/**</exclude>
330335 <exclude>**/cloud/**</exclude>
331 <!-- -->
332336 <exclude>**/DetectorsTest.java</exclude>
333337 </testExcludes>
334338 </configuration>
00 #! /bin/sh
11 mvn install:install-file -Dfile=lib/bcel-6.0-SNAPSHOT.jar -DgroupId=com.google.code.findbugs -DartifactId=bcel -Dversion=6.0-SNAPSHOT -Dpackaging=jar
2 mvn install:install-file -Dfile=lib/asm-debug-all-5.0.2.jar -DgroupId=org.ow2.asm -DartifactId=asm-debug-all -Dversion=5.0.2 -Dpackaging=jar
2 mvn install:install-file -Dfile=lib/asm-debug-all-6.0-SNAPSHOT.jar -DgroupId=org.ow2.asm -DartifactId=asm-debug-all -Dversion=6.0-SNAPSHOT -Dpackaging=jar
33 mvn clean
44 mvn package
159159 getProject().setProperty(errorProperty, "true");
160160 }
161161 if ((rc & ExitCodes.ERROR_FLAG) != 0) {
162 String message = "At least one error occured!";
162 String message = "At least one error occurred!";
163163 if (failIfBugFound) {
164164 throw new BuildException(message);
165165 } else {
5050 * <li>debug (boolean default false)
5151 * <li>effort (enum min|default|max)</li>
5252 * <li>excludeFilter (filter filename)
53 * <li>excludePath (classpath or classpathRef to filters)
5354 * <li>failOnError (boolean - default false)
5455 * <li>home (findbugs install dir)
5556 * <li>includeFilter (filter filename)
57 * <li>includePath (classpath or classpathRef to filters)
5658 * <li>maxRank (maximum rank issue to be reported)
5759 * <li>jvm (Set the command used to start the VM)
5860 * <li>jvmargs (any additional jvm arguments)
59 * <li>omitVisitors (collection - comma seperated)
61 * <li>omitVisitors (collection - comma separated)
6062 * <li>onlyAnalyze (restrict analysis to find bugs to given comma-separated list
6163 * of classes and packages - See the textui argument description for details)
6264 * <li>output (enum text|xml|xml:withMessages|html - default xml)
7577 * "default.xsl")
7678 * <li>systemProperty (a system property to set)
7779 * <li>timestampNow (boolean - default false)
78 * <li>visitors (collection - comma seperated)
80 * <li>visitors (collection - comma separated)
7981 * <li>chooseVisitors (selectively enable/disable visitors)
8082 * <li>workHard (boolean default false)
8183 * <li>setSetExitCode (boolean default true)
135137
136138 private File excludeFile;
137139
140 private Path excludePath;
141
138142 private File includeFile;
143
144 private Path includePath;
139145
140146 private Path auxClasspath;
141147
531537 */
532538 public void setSourcePathRef(Reference r) {
533539 createSourcePath().setRefid(r);
540 }
541
542 /**
543 * the sourcepath to use.
544 */
545 public void setExcludePath(Path src) {
546 if (excludePath == null) {
547 excludePath = src;
548 } else {
549 excludePath.append(src);
550 }
551 }
552
553 /**
554 * Path to use for sourcepath.
555 */
556 public Path createExcludePath() {
557 if (excludePath == null) {
558 excludePath = new Path(getProject());
559 }
560 return excludePath.createPath();
561 }
562
563 /**
564 * Adds a reference to a source path defined elsewhere.
565 */
566 public void setExcludePathRef(Reference r) {
567 createExcludePath().setRefid(r);
568 }
569
570 /**
571 * the sourcepath to use.
572 */
573 public void setIncludePath(Path src) {
574 if (includePath == null) {
575 includePath = src;
576 } else {
577 includePath.append(src);
578 }
579 }
580
581 /**
582 * Path to use for sourcepath.
583 */
584 public Path createIncludePath() {
585 if (includePath == null) {
586 includePath = new Path(getProject());
587 }
588 return includePath.createPath();
589 }
590
591 /**
592 * Adds a reference to a source path defined elsewhere.
593 */
594 public void setIncludePathRef(Reference r) {
595 createIncludePath().setRefid(r);
534596 }
535597
536598 /**
727789 addArg("-exclude");
728790 addArg(excludeFile.getPath());
729791 }
792 if (excludePath != null) {
793 String[] result = excludePath.toString().split(java.io.File.pathSeparator);
794 for (int x = 0; x < result.length; x++) {
795 addArg("-exclude");
796 addArg(result[x]);
797 }
798 }
730799 if (includeFile != null) {
731800 addArg("-include");
732801 addArg(includeFile.getPath());
802 }
803 if (includePath != null) {
804 String[] result = includePath.toString().split(java.io.File.pathSeparator);
805 for (int x = 0; x < result.length; x++) {
806 addArg("-include");
807 addArg(result[x]);
808 }
733809 }
734810 if (visitors != null) {
735811 addArg("-visitors");
3131 /**
3232 * FindBugsViewerTask.java -- Ant Task to launch the FindBugsFrame
3333 *
34 * To use, create a new task that refrences the ant task (such as
34 * To use, create a new task that references the ant task (such as
3535 * "findbugs-viewer"). Then call this task while passing in parameters to modify
3636 * it's behaviour. It supports several options that are the same as the findbugs
3737 * task:
705705 <p>Changes since version 1.3.5</p>
706706 <ul>
707707 <li>Added fairly exhaustive static analysis of uses of format
708 strings, checking for missing or extra arguements, invalid format
708 strings, checking for missing or extra arguments, invalid format
709709 specifiers, or mismatched format specifiers and arguments (e.g,
710710 passing a String value for a %d format specifier). The logic for
711711 doing so is derived from Sun's java.util.Formatter class, and
13031303 extends <code>beta.Foo</code>). This can be exceptionally
13041304 confusing, create lots of situations in which you have to look
13051305 at import statements to resolve references and creates many
1306 opportunities to accidently define methods that do not
1306 opportunities to accidentally define methods that do not
13071307 override methods in their superclasses.
13081308 </li>
13091309 <li>NM_SAME_SIMPLE_NAME_AS_INTERFACE: This class/interface
13121312 in a different package (e.g., <code>alpha.Foo</code> extends <code>beta.Foo</code>).
13131313 This can be exceptionally confusing, create lots of situations
13141314 in which you have to look at import statements to resolve
1315 references and creates many opportunities to accidently define
1315 references and creates many opportunities to accidentally define
13161316 methods that do not override methods in their superclasses.
13171317 </li>
13181318 </ul>
21292129 </li>
21302130 <li>Updated detectors
21312131 <ul>
2132 <li>SwitchFallthrough.java: surpress some false positives</li>
2133 <li>DuplicateBranches.java: surpress some false positives</li>
2134 <li>IteratorIdioms.java: surpress some false positives</li>
2135 <li>FindHEmismatch.java: surpress some false positives</li>
2132 <li>SwitchFallthrough.java: suppress some false positives</li>
2133 <li>DuplicateBranches.java: suppress some false positives</li>
2134 <li>IteratorIdioms.java: suppress some false positives</li>
2135 <li>FindHEmismatch.java: suppress some false positives</li>
21362136 <li>QuestionableBooleanAssignment.java: finds more cases of
21372137 <tt>if (b=true)</tt> ilk
21382138 </li>
24432443 <li>New detector to find calls to equals() methods that use
24442444 Object's version. (Dave Brosius)</li>
24452445 <li>New detector to find Applets that call methods in the
2446 constructor refering to the AppletStub (Dave Brosius)</li>
2446 constructor referring to the AppletStub (Dave Brosius)</li>
24472447 <li>New detector to find some cases of infinite recursion
24482448 (Bill Pugh)</li>
24492449 <li>New detector to find dead stores to local variables (David
24972497 <li>Allow Swing GUI to show source code in jar files on
24982498 Windows systems (Dave Brosius) <!-- Bug fixes -->
24992499 </li>
2500 <li>Fix the Switch Fall Thru detector (Dave Brosius, David
2500 <li>Fix the Switch Fall Through detector (Dave Brosius, David
25012501 Hovemeyer, Bill Pugh)</li>
25022502 <li>MacOS GUI fixes (Rohan Lloyd)</li>
25032503 <li>Fix false positive in BOA in case where method is
2020
2121 <p>The preferred way to get the FindBugs source code and create the patch is to use Eclipse + Git.
2222 You can easily import FindBugs code into Eclipse by following the steps described
23 here: <a href="https://code.google.com/p/findbugs/source/browse/eclipsePlugin/doc/building_findbugsplugin.txt">Import Eclipse projects</a>
23 here: <a href="https://github.com/findbugsproject/findbugs/blob/master/eclipsePlugin/doc/building_findbugsplugin.txt">Import Eclipse projects</a>
2424 .
2525 </p>
2626
2727 <h2>Preparing a patch</h2>
2828
29 <p> The best way to create a patch is to clone FindBugs Git repository here:
30 <a href="http://code.google.com/p/findbugs/source/clones">http://code.google.com/p/findbugs/source/clones</a>,
29 <p> The best way to create a patch is to fork FindBugs Git repository here:
30 <a href="https://github.com/findbugsproject/findbugs">https://github.com/findbugsproject/findbugs</a>,
3131 commit changes with descriptive commit messages (small commits are better) and
32 create a new <a href="https://sourceforge.net/p/findbugs/bugs/">bug</a>
33 or <a href="https://sourceforge.net/p/findbugs/feature-requests/">feature request</a>
34 with the "[patch]" prefix in the title and link to your repository in the description.
32 create a new <a href="https://github.com/findbugsproject/findbugs/pulls">pull request</a>
33 with the appropriate title and description.
3534 </p>
3635
3736 <p> Please follow these guidelines when preparing your patch:</p>
4746 <li> If you are submitting a new bug detector, please submit a small
4847 standalone source file that contains an instance of the
4948 kind of bug the detector looks for. The file should be placed at
50 <a href="https://code.google.com/p/findbugs/source/browse/#git%2FfindbugsTestCases%2Fsrc%2Fjava%2FsfBugsNew">findbugsTestCases/src/java/sfBugsNew</a>
49 <a href="https://github.com/findbugsproject/findbugs/tree/master/findbugsTestCases/src/java/ghBugsNew">findbugsTestCases/src/java/ghBugsNew</a>
5150 package and named after the bug or feature you are addressing.
5251 </ul>
5352
5756 <h2>Where to submit a patch</h2>
5857
5958 <p> Patches may be submitted through the
60 <a href="https://sourceforge.net/p/findbugs/bugs/">bug</a>
61 or <a href="https://sourceforge.net/p/findbugs/feature-requests/">feature request</a> trackers on the
62 <a href="http://sourceforge.net/projects/findbugs/">sourceforge project page</a>.
59 <a href="https://github.com/findbugsproject/findbugs/pulls">pull requests</a> on the
60 <a href="https://github.com/findbugsproject/findbugs">GitHub project page</a>.
6361
6462 @HTML_FOOTER@
6563
3434
3535
3636 <p>
37 Also check out <a href="http://code.google.com/p/findbugs/w/list">http://code.google.com/p/findbugs/w/list</a>
37 Also check out <a href="https://github.com/findbugsproject/findbugs/commits/master">https://github.com/findbugsproject/findbugs/commits/master</a>
3838 for more information about some recent features/changes in FindBugs.
3939 </p>
4040
5454 href="#sponsors">Sponsors</a> | <a href="#support">Support</a>
5555 </p>
5656
57 <h1>FindBugs 3.0.1 Release</h1>
58 <ul>
59 <li>A number of changes described in the <a href="Changes.html">changes document</a>, including new bug patterns:
57 <h1>FindBugs 3.0.1 Release</h1>
58 <ul>
59 <li>A number of changes described in the <a href="Changes.html">changes document</a>, including new bug patterns:
6060 <ul>
6161 <li>
6262 <a
183183 for more details.</p>
184184
185185 <p>
186 Also check out <a href="http://code.google.com/p/findbugs/w/list">http://code.google.com/p/findbugs/w/list</a>
186 Also check out <a href="https://github.com/findbugsproject/findbugs/commits/master">https://github.com/findbugsproject/findbugs/commits/master</a>
187187 for more information about some recent features/changes in FindBugs.
188188 </p>
189189
13341334 <para>
13351335 An optional attribute. It specifies
13361336 the confidence/priority threshold for reporting issues. If set to "low", confidence is not used to filter bugs.
1337 If set to "medium" (the default), low confidence issues are supressed.
1337 If set to "medium" (the default), low confidence issues are suppressed.
13381338 If set to "high", only high confidence bugs are reported.
13391339 </para>
13401340 </listitem>
14731473 </varlistentry>
14741474
14751475 <varlistentry>
1476 <term><literal>excludePath</literal></term>
1477 <listitem>
1478 <para>
1479 Since Findbugs 3.0.2.
1480 </para>
1481 <para>
1482 An optional nested element which specifies a path
1483 containing filters specifying bugs
1484 to exclude from being reported. See <xref linkend="filter" />.
1485 </para>
1486 <para>
1487 Example:
1488
1489 <screen>
1490 &lt;findbugs home="${findbugs.home}">
1491 &lt;excludePath&gt;
1492 &lt;path&gt;
1493 &lt;fileset dir="${findbugs-exclusion-filters.dir}" includes="findbugs-*-exclude-filter.xml" /&gt;
1494 &lt;/path&gt;
1495 &lt;/excludePath&gt;
1496 &lt;/findbugs&gt;
1497 </screen>
1498
1499 See <ulink url="https://ant.apache.org/manual/using.html#path">Apache Ant's Path-like Structures documentation</ulink> for details.
1500 </para>
1501 </listitem>
1502 </varlistentry>
1503
1504 <varlistentry>
14761505 <term><literal>includeFilter</literal></term>
14771506 <listitem>
14781507 <para>
14791508 Optional attribute. It specifies the filename of a filter specifying
14801509 which bugs are reported. See <xref linkend="filter" />.
14811510 </para>
1511 </listitem>
1512 </varlistentry>
1513
1514 <varlistentry>
1515 <term><literal>includePath</literal></term>
1516 <listitem>
1517 <para>
1518 Since Findbugs 3.0.2.
1519 </para>
1520 <para>
1521 An optional nested element which specifies a path
1522 containing filters specifying which bugs
1523 are reported. See <xref linkend="filter" />.
1524 </para>
1525 <para>
1526 Example:
1527
1528 <screen>
1529 &lt;findbugs home="${findbugs.home}">
1530 &lt;includePath&gt;
1531 &lt;path&gt;
1532 &lt;fileset dir="${findbugs-inclusion-filters.dir}" includes="findbugs-*-include-filter.xml" /&gt;
1533 &lt;/path&gt;
1534 &lt;/includePath&gt;
1535 &lt;/findbugs&gt;
1536 </screen>
1537
1538 See <ulink url="https://ant.apache.org/manual/using.html#path">Apache Ant's Path-like Structures documentation</ulink> for details.
1539 </para>
14821540 </listitem>
14831541 </varlistentry>
14841542
16001658 </listitem>
16011659 </varlistentry>
16021660
1661 <varlistentry>
1662 <term><literal>pluginList</literal></term>
1663 <listitem>
1664 <para>
1665 A optional String attribute or optional nested element specifying which BugDetector Jar files to add.. The <literal>pluginList</literal>
1666 element must specify a <literal>location</literal> attribute which names the
1667 archive file (jar, zip, etc.), directory, or class file to be analyzed. Multiple <literal>pluginList</literal>
1668 elements may be specified as children of a single <literal>findbugs</literal> element.
1669 </para>
1670 </listitem>
1671 </varlistentry>
1672
16031673 </variablelist>
16041674
16051675
17551825 <title>Extending the Eclipse Plugin (since 2.0.0)</title>
17561826 <para>
17571827 Eclipse plugin supports contribution of custom &FindBugs; detectors (see also
1758 <ulink url="http://code.google.com/p/findbugs/source/browse/findbugs/src/doc/AddingDetectors.txt">AddingDetectors.txt</ulink>
1828 <ulink url="https://github.com/findbugsproject/findbugs/blob/master/findbugs/src/doc/AddingDetectors.txt">AddingDetectors.txt</ulink>
17591829 for more information). There are two ways to contribute custom plugins to the Eclipse:
17601830 </para>
17611831 <itemizedlist>
17881858
17891859 <para>
17901860 Please check the documentation of the
1791 <ulink url="http://code.google.com/p/findbugs/source/browse/eclipsePlugin/schema/detectorPlugins.exsd">
1861 <ulink url="https://github.com/findbugsproject/findbugs/blob/master//eclipsePlugin/schema/detectorPlugins.exsd">
17921862 findBugsEclipsePlugin/schema/detectorPlugins.exsd</ulink>
17931863 extension point how to update the plugin.xml. Existing &FindBugs; detector plugins can
17941864 be easily "extended" to be full featured &FindBugs; AND Eclipse detector plugins.
18041874 Eclipse plugin. You can do this even for third-party detector packages.
18051875 Another major differentiator is the ability to extend the default FindBugs
18061876 classpath at runtime with required third party libraries (see
1807 <ulink url="http://code.google.com/p/findbugs/source/browse/findbugs/src/doc/AddingDetectors.txt">AddingDetectors.txt</ulink>
1877 <ulink url="https://github.com/findbugsproject/findbugs/blob/master/findbugs/src/doc/AddingDetectors.txt">AddingDetectors.txt</ulink>
18081878 for more information).
18091879 </para>
18101880 </listitem>
19992069 If the <literal>Match</literal> element contains neither a <literal>Class</literal> element,
20002070 nor a <literal>class</literal> / <literal>classregex</literal> attribute, the predicate will apply
20012071 to all classes. Such predicate is likely to match more bug instances than you want, unless it is
2002 refined further down with apropriate method or field predicates.
2072 refined further down with appropriate method or field predicates.
20032073 </para>
20042074 </listitem>
20052075 </varlistentry>
20372107
20382108 <listitem><para>This element specifies a field. The <literal>name</literal> attribute is is used to specify
20392109 the exact or regex match pattern for the field name. You can also filter fields according to their signature -
2040 use <literal>type</literal> attribute to specify fully qualified type of the field. You can specify eiter or both
2110 use <literal>type</literal> attribute to specify fully qualified type of the field. You can specify either or both
20412111 of these attributes in order to perform name / signature based matches. The <literal>role</literal> attribute is
20422112 the field role.
20432113 </para></listitem>
21322202 By explicitly matching both classes, you ensure that the IC bug instance will be
21332203 matched regardless of which class involved in the circularity happens to be
21342204 listed first in the bug instance. (Of course, this approach might accidentally
2135 supress circularities involving "com.foobar.A" or "com.foobar.B" and a third
2205 suppress circularities involving "com.foobar.A" or "com.foobar.B" and a third
21362206 class.)
21372207 </para>
21382208
25732643 </listitem>
25742644 <listitem>
25752645 <para>
2576 <command>explanation:</command>A textual explaination of why the return value should be checked. Default value:"".
2646 <command>explanation:</command>A textual explanation of why the return value should be checked. Default value:"".
25772647 </para>
25782648 </listitem>
25792649 </varlistentry>
27402810 <para>
27412811 The annotated element could be null under some circumstances. In general, this means
27422812 developers will have to read the documentation to determine when a null value is
2743 acceptable and whether it is neccessary to check for a null value. FindBugs will
2813 acceptable and whether it is necessary to check for a null value. FindBugs will
27442814 treat the annotated items as though they had no annotation.
27452815 </para>
27462816 <para>
31483218 <tbody>
31493219 <row><entry>-output &lt;file&gt;</entry> <entry>output="&lt;file&gt;"</entry> <entry>save output in the named file (may also be an input file)</entry></row>
31503220 <row><entry>-overrideRevisionNames[:truth]</entry> <entry>overrideRevisionNames="[true|false]"</entry><entry>override revision names for each version with names computed from the filenames</entry></row>
3151 <row><entry>-noPackageMoves[:truth]</entry> <entry>noPackageMoves="[true|false]"</entry><entry>if a class has moved to another package, treat warnings in that class as seperate</entry></row>
3221 <row><entry>-noPackageMoves[:truth]</entry> <entry>noPackageMoves="[true|false]"</entry><entry>if a class has moved to another package, treat warnings in that class as separate</entry></row>
31523222 <row><entry>-preciseMatch[:truth]</entry> <entry>preciseMatch="[true|false]"</entry><entry>require bug patterns to match precisely</entry></row>
31533223 <row><entry>-precisePriorityMatch[:truth]</entry> <entry>precisePriorityMatch="[true|false]"</entry><entry>consider two warnings as the same only if priorities match exactly</entry></row>
31543224 <row><entry>-quiet[:truth]</entry> <entry>quiet="[true|false]"</entry><entry>don't generate any output to standard out unless there is an error</entry></row>
33243394 <row><entry>fixed</entry><entry>Count of warnings removed from a class that remains in the current version</entry></row>
33253395 <row><entry>removed</entry><entry>Count of warnings in the previous version for a class that is not present in the current version</entry></row>
33263396 <row><entry>retained</entry><entry>Count of warnings that were in both the previous and current version</entry></row>
3327 <row><entry>dead</entry><entry>Warnings that were present in earlier versions but in neither the current version or the immediately preceeding version</entry></row>
3397 <row><entry>dead</entry><entry>Warnings that were present in earlier versions but in neither the current version or the immediately preceding version</entry></row>
33283398 <row><entry>active</entry><entry>Total warnings present in the current version</entry></row>
33293399 </tbody>
33303400 </tgroup>
39614031 <para>Kevin Lubick contributed fixes and tests for multi-quick-fixes and customizable
39624032 annotation colors for Eclipse plugin.</para>
39634033
4034 <para>Boris Bokowski contributed several new bug patterns: BIT_SIGNED_CHECK and BIT_SIGNED_CHECK_HIGH_BIT.</para>
4035
39644036 <para>Tagir Valeev contributed several new bug detectors and improved existing ones.</para>
39654037
39664038 <para>If you have contributed to &FindBugs;, but aren't mentioned above,
655655 <varlistentry>
656656 <term><command>-userPrefs</command> <replaceable>edu.umd.cs.findbugs.core.prefs</replaceable></term>
657657 <listitem>
658 <para>ユーザー設定ファイルのパスを設定します。ユーザー設定ファイルの内容で、他のオプションの一部を上書きすることができます。
658 <para>ユーザー設定ファイルのパスを設定します。ユーザー設定ファイルの内容で、他のオプションの一部を上書きすることができます。
659659 <literal>userPrefs</literal> を一番目の引数に指定した場合は、後続のオプションの方がユーザー設定ファイルの内容に優先します。
660660 <literal>userPrefs</literal> を最後の引数に指定した場合は、ユーザー設定ファイルの内容の方が前に指定したオプションに優先します。
661661 このオプションを設けた背景・理由は、 Eclipse プロジェクトの FindBugs の設定をコマンドライン実行で再利用するためです。</para>
10401040 <listitem>
10411041 <para>
10421042 任意指定の属性です。
1043 ユーザー設定ファイルのパスを設定します。ユーザー設定ファイルの内容で、他のオプションの一部を上書きすることができます。
1043 ユーザー設定ファイルのパスを設定します。ユーザー設定ファイルの内容で、他のオプションの一部を上書きすることができます。
10441044 <literal>userPreferencesFile</literal> を一番目の引数に指定した場合は、後続のオプションの方がユーザー設定ファイルの内容に優先します。
10451045 <literal>userPreferencesFile</literal> を最後の引数に指定した場合は、ユーザー設定ファイルの内容の方が前に指定したオプションに優先します。
10461046 このオプションを設けた背景・理由は、 Eclipse プロジェクトの FindBugs の設定をコマンドライン実行で再利用するためです。
11541154 <para>
11551155 Eclipse プラグインでは、 独自の &FindBugs; ディテクタを追加することができます。
11561156 (詳しく知りたい方は、
1157 <ulink url="http://code.google.com/p/findbugs/source/browse/findbugs/src/doc/AddingDetectors.txt">AddingDetectors.txt</ulink>
1158 もご覧ください)。
1157 <ulink url="https://github.com/findbugsproject/findbugs/blob/master/findbugs/src/doc/AddingDetectors.txt">AddingDetectors.txt</ulink>
1158 もご覧ください)。
11591159 独自のプラグインを Eclipse に追加するには以下の2通りの方法があります。
11601160 </para>
11611161 <itemizedlist>
11621162 <listitem>
11631163 <para>
1164 既存の標準 &FindBugs; ディテクタパッケージは以下で設定できます。
1164 既存の標準 &FindBugs; ディテクタパッケージは以下で設定できます。
11651165 <menuchoice>
11661166 <guimenu>Window</guimenu>
11671167 <guimenuitem>Preferences</guimenuitem>
11851185 </para>
11861186
11871187 <para>
1188 <ulink url="http://code.google.com/p/findbugs/source/browse/eclipsePlugin/schema/detectorPlugins.exsd">
1188 <ulink url="https://github.com/findbugsproject/findbugs/blob/master/eclipsePlugin/schema/detectorPlugins.exsd">
11891189 findBugsEclipsePlugin/schema/detectorPlugins.exsd</ulink> の documentation で plugin.xml の更新方法を確認してください。
11901190 既存の &FindBugs; ディテクタプラグイン を簡単に「拡張」して強力な &FindBugs; Eclipse ディテクタプラグイン にすることができます。
11911191 通常必要なのは、 META-INF/MANIFEST.MF および plugin.xml を jar に追加してかつ、 MANIFEST.MF がビルド時に上書きされないようにビルドスクリプトを更新するだけです。
11961196 前提条件は現在使用しているディテクタパッケージを Eclipse プラグインに変換しておくことです。
11971197 これはサードパーティのディテクタパッケージも同様です。
11981198 もうひとつの主な差別化要因は、 FindBugs のデフォルト実行時クラスパス に当該サードパーティライブラリーを追加することが必要なことです(くわしくは
1199 <ulink url="http://code.google.com/p/findbugs/source/browse/findbugs/src/doc/AddingDetectors.txt">AddingDetectors.txt</ulink>
1199 <ulink url="https://github.com/findbugsproject/findbugs/blob/master/findbugs/src/doc/AddingDetectors.txt">AddingDetectors.txt</ulink>
12001200 をご覧ください)。
12011201 </para>
12021202 </listitem>
13671367 <varlistentry>
13681368 <term><literal>&lt;And&gt;</literal></term>
13691369 <listitem><para>
1370 この要素は、論理積として <literal>Match</literal> 条項を結合します。
1370 この要素は、論理積として <literal>Match</literal> 条項を結合します。
13711371 すなわち、 <literal>Bug</literal> および <literal>Confidence</literal> 要素を <literal>And</literal> 条項内に指定することで
13721372 特定の信頼度の特定のバグのみ照合することができます。
13731373 </para></listitem>
18071807 <para>
18081808 クラスまたはパッケージのすべてのメンバーが指定されたアノテーションクラスのデフォルト値でアノテートされることを指定することができます。
18091809 この指定は @NonNull 、 @CheckForNull 、または @CheckReturnValueなどに使用する想定です。
1810 具体的には、 クラスまたはパッケージに @DefaultAnnotation(NonNull.class) を指定した上で、
1810 具体的には、 クラスまたはパッケージに @DefaultAnnotation(NonNull.class) を指定した上で、
18111811 null を許容したいパラメーター、メソッドまたはフィールドにのみ @Nullable を指定するという使用方法があります。
18121812 </para>
18131813 </listitem>
2222
2323 <p>
2424 Please report bugs using the
25 <a href="http://sourceforge.net/p/findbugs/_list/tickets?source=navbar">Sourceforge
26 bugs tracker</a>.&nbsp; Note that you need to be logged in to sourceforge to
25 <a href="https://github.com/findbugsproject/findbugs/issues">GitHub
26 bugs tracker</a>.&nbsp; Note that you need to be logged in to GitHub to
2727 use the bug tracker.
2828 </p>
2929
3030 <p>
31 If you cannot use the Sourceforge tracker, you can try sending
31 If you cannot use the GitHub tracker, you can try sending
3232 email to the <a href="http://www.cs.umd.edu/mailman/listinfo/findbugs-discuss"
3333 >findbugs-discuss mailing list</a>.&nbsp; You must be subscribed
3434 to the list to post a message.
6767 </tr>
6868 <tr>
6969 <td>findbugs.sf.comment</td>
70 <td>Ignore switch fall thru bugs if a comment is found with 'fall' or 'nobreak'
70 <td>Ignore switch fall through bugs if a comment is found with 'fall' or 'nobreak'
7171 </tr>
7272 <tr>
7373 <td>ba.checkAssertions</td>
5959 <li>You can also redirect all update checks to a local server. This allows you to collect information about who is using
6060 what versions of FindBugs in your organization, and keep all of that information private.
6161 <li>All of the plugins from the FindBugs project use <pre>http://update.findbugs.org/update-check</pre> as the
62 host we use for update checks. If you wish to ensure that no one from your organization accidently reports any usage
62 host we use for update checks. If you wish to ensure that no one from your organization accidentally reports any usage
6363 information to the FindBugs project, you can blacklist that URL in your firewall
6464 <ul>
6565 <li>You can also block <pre>http://findbugs-cloud.appspot.com</pre>, the host we use for our publicly hosted
6666 repository of bug evaluations (e.g., evaluations in open source projects such as the JDK, Eclipse and GlassFish).
6767 While people have to explicitly request that their evaluations be stored into the FindBugs cloud, you
68 can block it to ensure that no one accidently shares evaluations of your own code to the FindBugs cloud. You can also
68 can block it to ensure that no one accidentally shares evaluations of your own code to the FindBugs cloud. You can also
6969 remove the WebCloudClient
7070
7171 </ul>
5353 <p>
5454 The following companies, projects and organizations have given us
5555 permission to identify them as FindBugs users and/or have
56 publically stated that they use FindBugs. Send email to
56 publicly stated that they use FindBugs. Send email to
5757 <a href="mailto:findbugs@cs.umd.edu">findbugs@cs.umd.edu</a> if
5858 you'd like to be listed here.
5959 </p>
5353 saveBugs(UTF8.fileWriter(out), data, p);
5454 lastPlaceSaved = out.getAbsolutePath();
5555 } catch (IOException e) {
56 JOptionPane.showMessageDialog(null, "An error has occured in saving your file");
56 JOptionPane.showMessageDialog(null, "An error has occurred in saving your file");
5757 }
5858 }
5959
4444 * Our TreeModel. Once upon a time it was a simple model, that queried data, its BugSet, for what to show under each branch
4545 * Then it got more and more complicated, no one knows why it still seems to work... or why it doesn't if it in fact doesn't.
4646 *
47 * Here's a tip, Dont even attempt to deal with suppressions or filtering and their related tree model events without the API
47 * Here's a tip, Don't even attempt to deal with suppressions or filtering and their related tree model events without the API
4848 * for TreeModelEvents open. And read it three times first. Ignore the fact that its inconsistent for sending events about the root, just pick one of the things it says and go with it
4949 *
5050 * Heres the order things MUST be done when dealing with suppressions, filtering, unsuppressions... unfiltering... all that fun stuff
353353
354354 // If this thread is not interrupting a previous thread, set the paths
355355 // to be opened when the new tree is complete
356 // If the thread is interrupting another thread, dont do this, because
357 // you dont have the tree with the correct paths selected
356 // If the thread is interrupting another thread, don't do this, because
357 // you don't have the tree with the correct paths selected
358358
359359 // As of now, it should be impossible to interrupt a rebuilding thread,
360360 // in another version this may change, so this if statement check is
753753 void sendEvent(TreeModelEvent event, TreeModification whatToDo) {
754754 Debug.println("Sending An Event!");
755755 if (event == null) {
756 throw new IllegalStateException("Dont throw null events.");
756 throw new IllegalStateException("Don't throw null events.");
757757 }
758758 resetData();
759759 for (TreeModelListener l : listeners) {
5252 *
5353 */
5454 /*
55 * GUISaveState uses the Preferences API, dont look for a file anywhere, there
55 * GUISaveState uses the Preferences API, don't look for a file anywhere, there
5656 * isn't one, well... there might be, but its all system dependent where it is
5757 * and how its stored
5858 */
6666 private static final String FRAME_BOUNDS = "Frame Bounds";
6767 private static final String EXTENDED_WINDOW_STATE = "ExtendedWindowState";
6868
69 private static final int MAXNUMRECENTPROJECTS = 5;
69 static final int MAXNUMRECENTPROJECTS = 10;
7070
7171 private static final Sortables[] DEFAULT_COLUMN_HEADERS = new Sortables[] { Sortables.CATEGORY, Sortables.BUGCODE,
7272 Sortables.TYPE, Sortables.DIVIDER, Sortables.BUG_RANK, Sortables.FIRST_SEEN, Sortables.DESIGNATION };
543543 if (bugCollection != null) {
544544 displayer.clearCache();
545545 BugSet bs = new BugSet(bugCollection);
546 // Dont clear data, the data's correct, just get the tree off the
546 // Don't clear data, the data's correct, just get the tree off the
547547 // listener lists.
548548 BugTreeModel model = (BugTreeModel) mainFrameTree.getTree().getModel();
549549 model.getOffListenerList();
117117 final File f = saveOpenFileChooser.getSelectedFile();
118118
119119 if (!fileType.isValid(f)) {
120 JOptionPane.showMessageDialog(saveOpenFileChooser, "That file is not compatible with the choosen file type",
120 JOptionPane.showMessageDialog(saveOpenFileChooser, "That file is not compatible with the chosen file type",
121121 "Invalid File", JOptionPane.WARNING_MESSAGE);
122122 loading = true;
123123 continue;
632632 if (!(path.getParentPath() == null)) {
633633 // path is null, the
634634 // root was selected,
635 // dont allow them to
635 // don't allow them to
636636 // filter out the root.
637637 branchPopupMenu.show(tree, e.getX(), e.getY());
638638 }
186186
187187 wizardComponents[1] = createFilePanel(
188188 edu.umd.cs.findbugs.L10N.getLocalString("dlg.aux_class_lbl", "Auxiliary class locations:"), auxList, auxModel,
189 JFileChooser.FILES_AND_DIRECTORIES, directoryOrArchive, "Choose Auxilliary Class Archives and Directories", false,
189 JFileChooser.FILES_AND_DIRECTORIES, directoryOrArchive, "Choose Auxiliary Class Archives and Directories", false,
190190 "http://findbugs.sourceforge.net/FAQ.html#q4");
191191
192192 wizardComponents[2] = createFilePanel(
2929 public class RecentMenu {
3030
3131 private static class LimitedArrayList<T> extends ArrayList<T> {
32 public static final int MAX_ENTRIES = 5;
32 public static final int MAX_ENTRIES = GUISaveState.MAXNUMRECENTPROJECTS;
3333
3434 public LimitedArrayList() {
3535 super(MAX_ENTRIES);
286286 public int getColumnIndex(Object columnIdentifier) {
287287
288288 if (columnIdentifier == null) {
289 throw new IllegalArgumentException("Dont send null to getColumnIndex, null shouldn't be in the sorting table.");
289 throw new IllegalArgumentException("Don't send null to getColumnIndex, null shouldn't be in the sorting table.");
290290 }
291291
292292 for (int x = 0; x < columnList.size(); x++) {
133133 (MainFrame.getInstance().getBugTreeModel()).sendEvent(event, whatToDo);
134134 } catch (BranchOperationException e) {
135135 // Another filter already filters out the branch this filter
136 // would filter out, set active, but dont send any tree model
136 // would filter out, set active, but don't send any tree model
137137 // events.
138138 this.active = active;
139139 }
461461 }
462462
463463 /**
464 * Get the primary method annotation, which indicates where the bug occurs.
464 * Get the primary field annotation, which indicates where the bug occurs.
465465 */
466466 @CheckForNull
467467 public FieldAnnotation getPrimaryField() {
5050 *
5151 * A bug ranker is comprised of a list of bug patterns, bug kinds and bug
5252 * categories. For each, either an absolute or relative bug rank is provided. A
53 * relative rank is one preceeded by a + or -.
53 * relative rank is one preceded by a + or -.
5454 *
5555 * For core bug detectors, the bug ranker search order is:
5656 * <ul>
7777 * name of the BCEL class
7878 */
7979 private static void error(String cname) {
80 System.err.println("BCEL class compatability error.");
80 System.err.println("BCEL class compatibility error.");
8181 System.err.println("The version of class " + cname + " found was not compatible with\n"
8282 + "FindBugs. Please remove any BCEL libraries that may be interfering. This may happen\n"
8383 + "if you have an old version of BCEL or a library that includes an old version of BCEL\n"
4343 public static final String SUBCLASS_ROLE = "CLASS_SUBCLASS";
4444
4545 public static final String SUPERCLASS_ROLE = "CLASS_SUPERCLASS";
46
47 public static final String ANONYMOUS_ROLE = "CLASS_ANONYMOUS";
4648
4749 public static final String RECOMMENDED_SUPERCLASS_ROLE = "CLASS_RECOMMENDED_SUPERCLASS";
4850
1111
1212 @Override
1313 public String toString() {
14 return String.format("Supress %s in %s.%s", bugPattern, clazz, field);
14 return String.format("Suppress %s in %s.%s", bugPattern, clazz, field);
1515 }
1616 @Override
1717 public boolean match(BugInstance bugInstance) {
22 CLASS_REFTYPE =Reference type {0}
33 CLASS_SUBCLASS =has subclass {0}
44 CLASS_SUPERCLASS =superclass is {0}
5 CLASS_ANONYMOUS =Anonymous class {0}
56 CLASS_RECOMMENDED_SUPERCLASS =Perhaps class should be refactored to extend {0}
67 CLASS_IMPLEMENTED_INTERFACE =implements interface {0}
78 CLASS_ANNOTATION =annotated with {0.simpleName}
276276 }
277277
278278 /**
279 * For now, just look at the 2 preceeding and succeeding opcodes for fuzzy
279 * For now, just look at the 2 preceding and succeeding opcodes for fuzzy
280280 * source line matching.
281281 */
282282 // private static final int NUM_CONTEXT_OPCODES = 2;
1818
1919 package edu.umd.cs.findbugs;
2020
21 import java.util.regex.Matcher;
22 import java.util.regex.Pattern;
23
2421 /**
2522 * Support for finding out what version of Java we're running on.
2623 */
2724 public class JavaVersion {
28 private static final Pattern PATTERN = Pattern.compile("^(\\d+)\\.(\\d+)(\\..*)?$");
2925
3026 private final int major;
3127
4238 try {
4339 runtimeVersion = new JavaVersion(SystemProperties.getProperty("java.version"));
4440 } catch (JavaVersionException e) {
45 System.err.println("Warning: Unknown version of Java");
46 // Assume Java 1.0.
47 runtimeVersion = new JavaVersion(1, 0);
41 // Assume Java 1.8.
42 runtimeVersion = new JavaVersion(1, 8);
4843 e.printStackTrace();
4944 }
5045 }
6257 * <code>java.version</code> system property: e.g., "1.4.2_04"
6358 */
6459 public JavaVersion(String versionString) throws JavaVersionException {
65 Matcher matcher = PATTERN.matcher(versionString);
66 if (!matcher.matches()) {
67 throw new JavaVersionException("Could not parse Java version string: " + versionString);
68 }
60 // See https://bugs.openjdk.java.net/browse/JDK-8061493 for http://openjdk.java.net/jeps/223
61 // The only common between pre-9 and 9+ are the dots as separators...
62 String[] strings = versionString.split("\\.", 3);
6963 try {
70 major = Integer.parseInt(matcher.group(1));
71 minor = Integer.parseInt(matcher.group(2));
72 if (matcher.group(3) != null) {
73 rest = matcher.group(3);
64 // We need only care about 9+ early access in first segment
65 int earlyAccess = strings[0].indexOf('-');
66 if(earlyAccess > 0){
67 // 9+ early access versions do not follow common scheme above (it would be too easy)
68 // they look like 9-ea+73 and have only one meaningful (major) part for us.
69 major = Integer.parseInt(strings[0].substring(0, earlyAccess));
70 minor = 0;
71 rest = strings[0].substring(earlyAccess);
7472 } else {
75 rest = "";
73 major = Integer.parseInt(strings[0]);
74 if(strings.length > 1){
75 minor = Integer.parseInt(strings[1]);
76 if (strings.length > 2) {
77 rest = strings[2];
78 } else {
79 rest = "";
80 }
81 } else {
82 minor = 0;
83 rest = "";
84 }
7685 }
7786 } catch (NumberFormatException e) {
7887 throw new JavaVersionException("Could not parse Java Version string: " + versionString, e);
26332633 i.setSpecialKind(Item.NON_NEGATIVE);
26342634 }
26352635 push(i);
2636 } else if("java/lang/String".equals(clsName) && numberArguments == 0 && topItem.getConstant() instanceof String) {
2636 } else if("java/lang/String".equals(clsName) && numberArguments == 0 && topItem != null &&
2637 topItem.getConstant() instanceof String) {
26372638 String input = (String) topItem.getConstant();
26382639 Object result;
26392640 switch(methodName) {
212212 classLoader = new URLClassLoader(loaderURLs, parent);
213213 } else {
214214 if (parent != PluginLoader.class.getClassLoader()) {
215 throw new IllegalArgumentException("Can't specify parentid " + parentId + " and provide a seperate class loader");
215 throw new IllegalArgumentException("Can't specify parentid " + parentId + " and provide a separate class loader");
216216 }
217217 Plugin parentPlugin = Plugin.getByPluginId(parentId);
218218 if (parentPlugin != null) {
2929
3030 import javax.annotation.CheckForNull;
3131
32 import org.apache.bcel.Constants;
32 import org.apache.bcel.Const;
3333 import org.apache.bcel.classfile.Attribute;
3434 import org.apache.bcel.classfile.ClassFormatException;
3535 import org.apache.bcel.classfile.Code;
3636 import org.apache.bcel.classfile.ConstantClass;
3737 import org.apache.bcel.classfile.Method;
38 import org.apache.bcel.classfile.StackMapTable;
39 import org.apache.bcel.classfile.StackMapTableEntry;
38 import org.apache.bcel.classfile.StackMap;
39 import org.apache.bcel.classfile.StackMapEntry;
4040 import org.apache.bcel.classfile.StackMapType;
4141 import org.apache.bcel.generic.Type;
4242
8383 SAME_FRAME, SAME_LOCALS_1_STACK_ITEM_FRAME, CHOP_FRAME, APPEND_FRAME, FULL_FRAME;
8484
8585 static StackFrameType get(int frame_type) {
86 if (frame_type >= Constants.SAME_FRAME && frame_type <= Constants.SAME_FRAME_MAX) {
86 if (frame_type >= Const.SAME_FRAME && frame_type <= Const.SAME_FRAME_MAX) {
8787 return SAME_FRAME;
88 } else if (frame_type >= Constants.SAME_LOCALS_1_STACK_ITEM_FRAME
89 && frame_type <= Constants.SAME_LOCALS_1_STACK_ITEM_FRAME_MAX) {
88 } else if (frame_type >= Const.SAME_LOCALS_1_STACK_ITEM_FRAME
89 && frame_type <= Const.SAME_LOCALS_1_STACK_ITEM_FRAME_MAX) {
9090 return SAME_LOCALS_1_STACK_ITEM_FRAME;
91 } else if (frame_type == Constants.SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED) {
91 } else if (frame_type == Const.SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED) {
9292 return SAME_LOCALS_1_STACK_ITEM_FRAME;
93 } else if (frame_type >= Constants.CHOP_FRAME && frame_type <= Constants.CHOP_FRAME_MAX) {
93 } else if (frame_type >= Const.CHOP_FRAME && frame_type <= Const.CHOP_FRAME_MAX) {
9494 return CHOP_FRAME;
95 } else if (frame_type == Constants.SAME_FRAME_EXTENDED) {
95 } else if (frame_type == Const.SAME_FRAME_EXTENDED) {
9696 return SAME_FRAME;
97 } else if (frame_type >= Constants.APPEND_FRAME && frame_type <= Constants.APPEND_FRAME_MAX) {
97 } else if (frame_type >= Const.APPEND_FRAME && frame_type <= Const.APPEND_FRAME_MAX) {
9898 return APPEND_FRAME;
99 } else if (frame_type == Constants.FULL_FRAME) {
99 } else if (frame_type == Const.FULL_FRAME) {
100100 return FULL_FRAME;
101101 } else {
102102 /* Can't happen */
105105 }
106106 }
107107
108 static @CheckForNull StackMapTable getStackMapTable(Code code) {
108 static @CheckForNull StackMap getStackMapTable(Code code) {
109109 for(Attribute a : code.getAttributes()) {
110 if (a instanceof StackMapTable) {
111 return (StackMapTable) a;
110 if (a instanceof StackMap) {
111 return (StackMap) a;
112112 }
113113 }
114114 return null;
142142
143143 @Override
144144 public Field run() {
145 Class<StackMapTableEntry> c = StackMapTableEntry.class;
145 Class<StackMapEntry> c = StackMapEntry.class;
146146 Field result;
147147 try {
148148 result = c.getDeclaredField("frame_type");
167167 frame_type_field = f;
168168 }
169169
170 static int getFrameType(StackMapTableEntry e) {
170 static int getFrameType(StackMapEntry e) {
171171 if (frame_type_field == null) {
172172 return -1;
173173 }
196196 if (code == null) {
197197 return null;
198198 }
199 StackMapTable stackMapTable = getStackMapTable(code);
199 StackMap stackMapTable = getStackMapTable(code);
200200 if (stackMapTable == null) {
201201 return null;
202202 }
212212 System.out.println(locals);
213213 }
214214 int pc = 0;
215 for(StackMapTableEntry e : stackMapTable.getStackMapTable()) {
216 pc += e.getByteCodeOffsetDelta();
215 for(StackMapEntry e : stackMapTable.getStackMap()) {
216 pc += e.getByteCodeOffset();
217217 int rawFrameType = getFrameType(e);
218218 StackFrameType stackFrameType = StackFrameType.get(rawFrameType);
219219 switch (stackFrameType) {
226226 break;
227227 case CHOP_FRAME :
228228 stack.clear();
229 int n = Constants.CHOP_FRAME_MAX+1-rawFrameType;
229 int n = Const.CHOP_FRAME_MAX+1-rawFrameType;
230230 for(int i = 0; i < n; i++) {
231231 Item it = locals.remove(locals.size()-1);
232232 if (it == null) {
276276
277277 switch (t.getType()) {
278278
279 case Constants.ITEM_Double:
279 case Const.ITEM_Double:
280280 return Item.typeOnly("D");
281 case Constants.ITEM_Float:
281 case Const.ITEM_Float:
282282 return Item.typeOnly("F");
283 case Constants.ITEM_Integer:
283 case Const.ITEM_Integer:
284284 return Item.typeOnly("I");
285 case Constants.ITEM_Long:
285 case Const.ITEM_Long:
286286 return Item.typeOnly("J");
287 case Constants.ITEM_Bogus:
288 case Constants.ITEM_NewObject:
287 case Const.ITEM_Bogus:
288 case Const.ITEM_NewObject:
289289 return Item.typeOnly("Ljava/lang/Object;");
290 case Constants.ITEM_Null:
290 case Const.ITEM_Null:
291291 Item it = new Item();
292292 it.setSpecialKind(Item.TYPE_ONLY);
293293 return it;
294 case Constants.ITEM_InitObject:
294 case Const.ITEM_InitObject:
295295 return Item.typeOnly("Ljava/lang/Object;");
296 case Constants.ITEM_Object:
296 case Const.ITEM_Object:
297297 int index = t.getIndex();
298298 ConstantClass c = (ConstantClass) t.getConstantPool().getConstant(index);
299299 String name = c.getBytes(t.getConstantPool());
2727
2828 import edu.umd.cs.findbugs.ba.XClass;
2929 import edu.umd.cs.findbugs.ba.XField;
30 import edu.umd.cs.findbugs.util.ClassName;
3130 import edu.umd.cs.findbugs.visitclass.DismantleBytecode;
3231
3332 public class SwitchHandler {
4544 return -1;
4645 }
4746 int total = 0;
48 String enumSignature = ClassName.toSignature(c.getClassDescriptor().getClassName());
4947 for(XField f : c.getXFields()) {
50 if (f.getSignature().equals(enumSignature)
51 && f.isPublic() && f.isFinal()) {
48 if (f.isEnum()) {
5249 total++;
5350 }
5451 }
4848 /**
4949 * Minor version number.
5050 */
51 public static final int MINOR = 0;
51 public static final int MINOR = 1;
5252
5353 /**
5454 * Patch level.
5555 */
56 public static final int PATCHLEVEL = 1;
56 public static final int PATCHLEVEL = 0;
5757
5858 /**
5959 * Development version or release candidate?
2020
2121 import javax.annotation.Nonnull;
2222
23 import edu.umd.cs.findbugs.Priorities;
24
2523 /**
2624 * Describes the confidence with which FindBugs reports a bug instance.
2725 */
2826 public enum Confidence {
29 HIGH(Priorities.HIGH_PRIORITY), MEDIUM(Priorities.NORMAL_PRIORITY), LOW(Priorities.LOW_PRIORITY), IGNORE(
30 Priorities.IGNORE_PRIORITY);
27 HIGH(1 /* Priorities.HIGH_PRIORITY */),
28 MEDIUM(2 /* Priorities.NORMAL_PRIORITY */ ),
29 LOW(3 /* Priorities.LOW_PRIORITY */),
30 IGNORE(5 /*Priorities.IGNORE_PRIORITY */);
3131
3232 private final int confidenceValue;
3333
66
77 import java.lang.annotation.Retention;
88 import java.lang.annotation.RetentionPolicy;
9
10 import edu.umd.cs.findbugs.BugRanker;
119
1210 /**
1311 * Annotation indicating that a FindBugs warning is desired.
2826 public Confidence confidence() default Confidence.LOW;
2927
3028 /** Desire a warning at least this scary */
31 public int rank() default BugRanker.VISIBLE_RANK_MAX;
29 public int rank() default 20; // BugRanker.VISIBLE_RANK_MAX
3230
3331 /** Desire at least this many warnings */
3432 public int num() default 1;
66
77 import java.lang.annotation.Retention;
88 import java.lang.annotation.RetentionPolicy;
9
10 import edu.umd.cs.findbugs.BugRanker;
119
1210 /**
1311 * Annotation indicating that a FindBugs warning is expected.
2826 public Confidence confidence() default Confidence.LOW;
2927
3028 /** Expect a warning at least this scary */
31 public int rank() default BugRanker.VISIBLE_RANK_MAX;
29 public int rank() default 20; // BugRanker.VISIBLE_RANK_MAX
3230
3331 /** Expect at least this many warnings */
3432 public int num() default 1;
66
77 import java.lang.annotation.Retention;
88 import java.lang.annotation.RetentionPolicy;
9
10 import edu.umd.cs.findbugs.BugRanker;
119
1210 /**
1311 * Annotation indicating that <em>no</em> FindBugs warning is expected.
2826 public Confidence confidence() default Confidence.LOW;
2927
3028 /** Want no warning at this rank or scarier */
31 public int rank() default BugRanker.VISIBLE_RANK_MAX;
29 public int rank() default 20; // BugRanker.VISIBLE_RANK_MAX
3230
3331 /** Tolerate up to this many warnings */
3432 public int num() default 0;
1818
1919 package edu.umd.cs.findbugs.annotations;
2020
21 import edu.umd.cs.findbugs.Priorities;
2221
2322 /**
2423 * @author pugh
2625 */
2726 @Deprecated
2827 public enum Priority {
29 HIGH(Priorities.HIGH_PRIORITY), MEDIUM(Priorities.NORMAL_PRIORITY), LOW(Priorities.LOW_PRIORITY), IGNORE(
30 Priorities.IGNORE_PRIORITY);
28 HIGH(1 /* Priorities.HIGH_PRIORITY */),
29 MEDIUM(2 /* Priorities.NORMAL_PRIORITY */ ),
30 LOW(3 /* Priorities.LOW_PRIORITY */),
31 IGNORE(5 /*Priorities.IGNORE_PRIORITY */);
3132
3233 private final int priorityValue;
3334
4040 return (getAccessFlags() & Constants.ACC_SYNTHETIC) != 0;
4141 }
4242
43 @Override
44 public boolean isEnum() {
45 return (getAccessFlags() & Constants.ACC_ENUM) != 0;
46 }
47
4348 /*
4449 * (non-Javadoc)
4550 *
4949 * @see Frame
5050 * @see DataflowAnalysis
5151 */
52 public abstract class AbstractFrameModelingVisitor<Value, FrameType extends Frame<Value>> implements VisitorSupportsInvokeDynamic {
52 public abstract class AbstractFrameModelingVisitor<Value, FrameType extends Frame<Value>> implements Visitor {
5353 private FrameType frame;
5454
5555 private Location location;
3232
3333 import javax.annotation.CheckForNull;
3434 import javax.annotation.Nonnull;
35
36 import net.jcip.annotations.NotThreadSafe;
3735
3836 import org.apache.bcel.Repository;
3937 import org.apache.bcel.classfile.JavaClass;
6967 import edu.umd.cs.findbugs.detect.UnreadFieldsData;
7068 import edu.umd.cs.findbugs.internalAnnotations.DottedClassName;
7169 import edu.umd.cs.findbugs.util.ClassName;
70 import net.jcip.annotations.NotThreadSafe;
7271
7372 /**
7473 * A context for analysis of a complete project. This serves as the repository
541540 }
542541
543542 JavaClass clazz = originalRepository.findClass(className);
544 return (clazz == null ? originalRepository.loadClass(className) : clazz);
543 if(clazz != null){
544 return clazz;
545 }
546 // XXX workaround for system classes missing on Java 9
547 // Not sure if we BCEL update, but this seem to work in simple cases
548 return AnalysisContext.currentAnalysisContext().lookupClass(className);
545549 }
546550
547551 /**
806806 if (newLine == lineNum || newLine == -1) {
807807 continue;
808808 }
809
809810 if (prevStartPc >= 0) {
810811 int nextPcInFinallyBlock = pcInFinallyBlock.nextSetBit(prevStartPc);
811 if (nextPcInFinallyBlock < line.getStartPC()) {
812 if ( prevStartPc < nextPcInFinallyBlock && nextPcInFinallyBlock < line.getStartPC()) {
812813 lineMentionedMultipleTimes.set(lineNum);
813814 }
814815 }
816
815817 if (line.getStartPC() >= firstHandler) {
816818 afterHandler.set(lineNum);
819 afterHandler.set(newLine);
817820 }
818
819821 lineNum = newLine;
820 prevStartPc = line.getStartPC();
822
821823 if (foundOnce.get(lineNum)) {
822824 lineMentionedMultipleTimes.set(lineNum);
823825 } else {
824826 foundOnce.set(lineNum);
825827 }
828 prevStartPc = line.getStartPC();
826829 }
827830 }
828831 lineMentionedMultipleTimes.and(afterHandler);
189189 database.addMethodParameterAnnotation("java.util.concurrent.ConcurrentHashMap", "setEntryAt",
190190 "([Ljava/util/concurrent/ConcurrentHashMap$HashEntry;ILjava/util/concurrent/ConcurrentHashMap$HashEntry;)V", false, 1, NullnessAnnotation.NULLABLE);
191191 database.addMethodParameterAnnotation("java.util.concurrent.ForkJoinPool", "<init>",
192 "(ILjava/util/concurrent/ForkJoinPool$ForkJoinWorkerThreadFactory;Ljava/lang/Thread$UncaughtExceptionHandler;Z)V", false, 1, NullnessAnnotation.NULLABLE);
192 "(ILjava/util/concurrent/ForkJoinPool$ForkJoinWorkerThreadFactory;Ljava/lang/Thread$UncaughtExceptionHandler;Z)V", false, 1, NullnessAnnotation.NONNULL);
193 database.addMethodParameterAnnotation("java.util.concurrent.ForkJoinPool", "<init>",
194 "(ILjava/util/concurrent/ForkJoinPool$ForkJoinWorkerThreadFactory;Ljava/lang/Thread$UncaughtExceptionHandler;Z)V", false, 2, NullnessAnnotation.NULLABLE);
193195 database.addMethodParameterAnnotation("java.util.concurrent.PriorityBlockingQueue", "<init>",
194196 "(ILjava/util/Comparator;)V", false, 1, NullnessAnnotation.NULLABLE);
195197
311311 return Collections.<XMethod> emptySet();
312312 }
313313
314 // XXX handle INVOKEDYNAMIC
315 if (opcode == Constants.INVOKEDYNAMIC) {
316 return Collections.<XMethod> emptySet();
317 }
318
314319 Type receiverType;
315320 boolean receiverTypeIsExact;
316321
4747 return CHECK_FOR_NULL;
4848 }
4949 // Unfortunately there are mixed case Nonnull and NonNull annotations (JSR305, FB and JDT)
50 if (className.endsWith("Nonnull")) {
50 if (className.endsWith("Nonnull") || className.equals("org.jetbrains.annotations.NotNull")) {
5151 return NONNULL;
5252 }
5353 for (NullnessAnnotation v : myValues) {
6060 }
6161
6262 /**
63 * A momento to remind us of how we classified a particular exception edge.
63 * A memento to remind us of how we classified a particular exception edge.
6464 * If pruning and classifying succeeds, then these momentos can be applied
6565 * to actually change the state of the edges. The issue is that the entire
6666 * pruning/classifying operation must either fail or succeed as a whole.
6868 }
6969
7070 /**
71 * Parse the class file into a JavaClass object. If succesful, the new
71 * Parse the class file into a JavaClass object. If successful, the new
7272 * JavaClass is entered into the Repository.
7373 *
7474 * @return the parsed JavaClass
5151 public boolean isVolatile();
5252
5353 /**
54 * @return true if this is a enum constant
55 */
56 public boolean isEnum();
57
58 /**
5459 * @return FieldDescriptor referring to this field
5560 */
5661 public FieldDescriptor getFieldDescriptor();
1919 package edu.umd.cs.findbugs.ba.bcp;
2020
2121 /**
22 * A set of Bindings, which are definitions of variables occuring in a
22 * A set of Bindings, which are definitions of variables occurring in a
2323 * ByteCodePattern. BindingSets are immutable; to add a binding, a new cell is
2424 * allocated. (Are we CONSING yet?)
2525 *
6464 * @param bindingSet
6565 * previous definitions
6666 * @return a MatchResult containing an updated BindingSet if successful, or
67 * null if unsucessful
67 * null if unsuccessful
6868 */
6969 protected MatchResult checkConsistent(Variable field, Variable value, BindingSet bindingSet) {
7070 // Ensure that the field and value variables are consistent with
2626 import javax.annotation.meta.When;
2727
2828 import org.apache.bcel.generic.ConstantPoolGen;
29 import org.apache.bcel.generic.INVOKEDYNAMIC;
2930 import org.apache.bcel.generic.Instruction;
3031 import org.apache.bcel.generic.InvokeInstruction;
3132
104105 Location location = i.next();
105106 Instruction ins = location.getHandle().getInstruction();
106107 if (ins instanceof InvokeInstruction) {
107 XMethod called = XFactory.createXMethod((InvokeInstruction) ins, cpg);
108 addEffectiveRelevantQualifiers(result, called);
108 if (ins instanceof INVOKEDYNAMIC) {
109 // TODO handle INVOKEDYNAMIC
110 } else {
111 XMethod called = XFactory.createXMethod((InvokeInstruction) ins, cpg);
112 addEffectiveRelevantQualifiers(result, called);
113 }
109114 }
110115
111116 if (DEBUG_FIND_EFFECTIVE_RELEVANT_QUALIFIERS) {
5454
5555 static final ClassDescriptor intellijNullable = DescriptorFactory.createClassDescriptor("org/jetbrains/annotations/Nullable");
5656
57 static final ClassDescriptor intellijNotNull = DescriptorFactory.createClassDescriptor("org/jetbrains/annotations/NotNull");
58
5759 static final ClassDescriptor eclipseNullable = DescriptorFactory.createClassDescriptor("org/eclipse/jdt/annotation/Nullable");
5860
5961 static final ClassDescriptor eclipseNonNull = DescriptorFactory.createClassDescriptor("org/eclipse/jdt/annotation/NonNull");
127129 resolveTypeQualifierNicknames(new AnnotationValue(JSR305NullnessAnnotations.CHECK_FOR_NULL), result, onStack);
128130 return;
129131 }
130 if (annotationClass.equals(eclipseNonNull) || annotationClass.equals(eclipseNonNullByDefault)) {
132 if (annotationClass.equals(eclipseNonNull) || annotationClass.equals(eclipseNonNullByDefault)
133 || annotationClass.equals(intellijNotNull)) {
131134 resolveTypeQualifierNicknames(new AnnotationValue(JSR305NullnessAnnotations.NONNULL), result, onStack);
132135 return;
133136 }
6868
6969 /**
7070 * A user-friendly front end for finding null pointer dereferences and redundant
71 * null comparisions.
71 * null comparisons.
7272 *
7373 * @see IsNullValueAnalysis
7474 * @author David Hovemeyer
43814381 javax.xml.soap.SOAPMessage,createAttachmentPart,(Ljavax/activation/DataHandler;)Ljavax/xml/soap/AttachmentPart;,1|true
43824382 javax.xml.soap.SOAPMessage,getProperty,(Ljava/lang/String;)Ljava/lang/Object;,1|true
43834383 javax.xml.soap.SOAPMessage,getSOAPBody,()Ljavax/xml/soap/SOAPBody;,1|true
4384 javax.xml.soap.SOAPMessage,getSOAPHeader,()Ljavax/xml/soap/SOAPHeader;,1|true
43854384 javax.xml.stream.XMLEventFactory,newFactory,()Ljavax/xml/stream/XMLEventFactory;,9|true
43864385 javax.xml.stream.XMLEventFactory,newFactory,(Ljava/lang/String;Ljava/lang/ClassLoader;)Ljavax/xml/stream/XMLEventFactory;,9|true
43874386 javax.xml.stream.XMLEventFactory,newInstance,()Ljavax/xml/stream/XMLEventFactory;,9|true
210210 * possiblyLeakedObligation)
211211 */) {
212212 if (DEBUG_NULL_CHECK) {
213 System.out.println("Deleting " + comparedObligation.toString() + " on edge from comparision "
213 System.out.println("Deleting " + comparedObligation.toString() + " on edge from comparison "
214214 + edge.getSource().getLastInstruction());
215215 }
216216 fact.deleteObligation(comparedObligation, edge.getTarget().getLabel());
1919 package edu.umd.cs.findbugs.ba.type;
2020
2121 import java.util.Collection;
22
23 import javax.annotation.CheckForNull;
2224
2325 import edu.umd.cs.findbugs.ba.CFG;
2426 import edu.umd.cs.findbugs.ba.Dataflow;
4648 return getAnalysis().getEdgeExceptionSet(edge);
4749 }
4850
51 @CheckForNull
4952 public LocationAndFactPair getLocationAndFactForInstruction(int pc) {
5053 Collection<Location> locations = getCFG().getLocationsContainingInstructionWithOffset(pc);
5154
168168 if (p == param) {
169169 return getEntryValue(slotOffset);
170170 }
171 param++;
171 p++;
172172 slotOffset += SignatureParser.getNumSlotsForType(paramSig);
173173 }
174174
1717 */
1818
1919 package edu.umd.cs.findbugs.bcel;
20
21 import javax.annotation.OverridingMethodsMustInvokeSuper;
2022
2123 import org.apache.bcel.classfile.Code;
2224
6466 }
6567
6668 @Override
69 @OverridingMethodsMustInvokeSuper
6770 public boolean beforeOpcode(int seen) {
6871 stack.precomputation(this);
6972 return !stack.isTop();
7477 * @see #sawOpcode(int)
7578 */
7679 @Override
80 @OverridingMethodsMustInvokeSuper
7781 public void afterOpcode(int seen) {
7882 stack.sawOpcode(this, seen);
7983 }
188188 return checkFlag(Constants.ACC_PRIVATE);
189189 }
190190
191 @Override
192 public boolean isEnum() {
193 return checkFlag(Constants.ACC_ENUM);
194 }
195
191196 /*
192197 * (non-Javadoc)
193198 *
2424
2525 import javax.annotation.CheckForNull;
2626
27 import org.apache.bcel.Constants;
27 import org.apache.bcel.Const;
2828 import org.objectweb.asm.Attribute;
2929 import org.objectweb.asm.ClassReader;
3030 import org.objectweb.asm.ClassVisitor;
5959
6060 private static final BitSet RETURN_OPCODE_SET = new BitSet();
6161 static {
62 RETURN_OPCODE_SET.set(Constants.ARETURN);
63 RETURN_OPCODE_SET.set(Constants.IRETURN);
64 RETURN_OPCODE_SET.set(Constants.LRETURN);
65 RETURN_OPCODE_SET.set(Constants.DRETURN);
66 RETURN_OPCODE_SET.set(Constants.FRETURN);
67 RETURN_OPCODE_SET.set(Constants.RETURN);
62 RETURN_OPCODE_SET.set(Const.ARETURN);
63 RETURN_OPCODE_SET.set(Const.IRETURN);
64 RETURN_OPCODE_SET.set(Const.LRETURN);
65 RETURN_OPCODE_SET.set(Const.DRETURN);
66 RETURN_OPCODE_SET.set(Const.FRETURN);
67 RETURN_OPCODE_SET.set(Const.RETURN);
6868 }
6969
7070 private final ClassReader classReader;
206206 @Override
207207 public void visitInsn(int opcode) {
208208 switch (opcode) {
209 case Constants.MONITORENTER:
209 case Const.MONITORENTER:
210210 mBuilder.setUsesConcurrency();
211211 break;
212 case Constants.ARETURN:
213 case Constants.IRETURN:
214 case Constants.LRETURN:
215 case Constants.DRETURN:
216 case Constants.FRETURN:
212 case Const.ARETURN:
213 case Const.IRETURN:
214 case Const.LRETURN:
215 case Const.DRETURN:
216 case Const.FRETURN:
217217 if (identityState == IdentityMethodState.LOADED_PARAMETER) {
218218 mBuilder.setIsIdentity();
219219 }
220220 sawReturn = true;
221221 break;
222 case Constants.RETURN:
222 case Const.RETURN:
223223 sawReturn = true;
224224 break;
225 case Constants.ATHROW:
225 case Const.ATHROW:
226226 if (stubState == StubState.INITIALIZE_RUNTIME) {
227227 sawStubThrow = true;
228228 } else if (justSawInitializationOfUnsupportedOperationException) {
456456 mBuilder.setUnsupported();
457457 }
458458 if (sawStubThrow) {
459 mBuilder.addAccessFlags(Constants.ACC_SYNTHETIC);
459 mBuilder.addAccessFlags(Const.ACC_SYNTHETIC);
460460 mBuilder.setIsStub();
461461
462462 }
646646
647647 int size;
648648 switch (tag) {
649 case Constants.CONSTANT_Methodref:
650 case Constants.CONSTANT_InterfaceMethodref:
651 case Constants.CONSTANT_Fieldref:
652 case Constants.CONSTANT_Integer:
653 case Constants.CONSTANT_Float:
654 case Constants.CONSTANT_NameAndType:
655 case Constants.CONSTANT_InvokeDynamic:
649 case Const.CONSTANT_Methodref:
650 case Const.CONSTANT_InterfaceMethodref:
651 case Const.CONSTANT_Fieldref:
652 case Const.CONSTANT_Integer:
653 case Const.CONSTANT_Float:
654 case Const.CONSTANT_NameAndType:
655 case Const.CONSTANT_InvokeDynamic:
656656 size = 5;
657657 break;
658 case Constants.CONSTANT_Long:
659 case Constants.CONSTANT_Double:
658 case Const.CONSTANT_Long:
659 case Const.CONSTANT_Double:
660660 size = 9;
661661 count++;
662662 break;
663 case Constants.CONSTANT_Utf8:
663 case Const.CONSTANT_Utf8:
664664 size = 3 + classReader.readUnsignedShort(offset + 1);
665665 break;
666 case Constants.CONSTANT_Class:
666 case Const.CONSTANT_Class:
667667 @SlashedClassName
668668 String className = classReader.readUTF8(offset + 1, buf);
669669 if (className.indexOf('[') >= 0) {
674674 }
675675 size = 3;
676676 break;
677 case Constants.CONSTANT_String:
678 case Constants.CONSTANT_MethodType:
677 case Const.CONSTANT_String:
678 case Const.CONSTANT_MethodType:
679679 size = 3;
680680 break;
681 case Constants.CONSTANT_MethodHandle:
681 case Const.CONSTANT_MethodHandle:
682682 size = 4;
683683 break;
684684 default:
2525 */
2626 public class FindBugsASM {
2727
28 public static final int ASM_VERSION = Opcodes.ASM5;
28 public static final int ASM_VERSION = Opcodes.ASM6;
2929
3030 }
2020
2121 import static org.apache.bcel.Constants.*;
2222
23 import java.util.ArrayDeque;
2324 import java.util.ArrayList;
2425 import java.util.BitSet;
2526 import java.util.Collections;
2627 import java.util.Comparator;
28 import java.util.Deque;
2729 import java.util.HashMap;
2830 import java.util.HashSet;
2931 import java.util.IdentityHashMap;
726728 for (VariableData data : analyzedArguments.values()) {
727729 for (LongRangeSet subRange : data.splitSet) {
728730 BitSet reachedBlocks = new BitSet();
729 walkCFG(cfg, cfg.getEntry(), subRange, data.edges, reachedBlocks, new HashSet<Long>());
731 walkCFG(cfg, subRange, data.edges, reachedBlocks);
730732 data.reachableBlocks.or(reachedBlocks);
731733 }
732734 }
892894 return result;
893895 }
894896
895 private static void walkCFG(CFG cfg, BasicBlock basicBlock, LongRangeSet subRange, Map<Edge, Branch> edges, BitSet reachedBlocks, Set<Long> numbers) {
896 reachedBlocks.set(basicBlock.getLabel());
897 for (Iterator<Edge> iterator = cfg.outgoingEdgeIterator(basicBlock); iterator.hasNext();) {
898 Edge edge = iterator.next();
899 Branch branch = edges.get(edge);
900 if (branch != null) {
901 branch.numbers.addAll(numbers);
902 numbers = new HashSet<>(numbers);
903 numbers.add(branch.number.longValue());
904 if (branch.trueSet.intersects(subRange)) {
905 branch.trueReachedSet.add(subRange);
906 } else {
907 branch.falseReachedSet.add(subRange);
908 continue;
909 }
910 }
911 BasicBlock target = edge.getTarget();
912 if (!reachedBlocks.get(target.getLabel())) {
913 walkCFG(cfg, target, subRange, edges, reachedBlocks, numbers);
914 }
915 if (branch != null) {
916 break;
897 private static void walkCFG(final CFG cfg, LongRangeSet subRange, Map<Edge, Branch> edges, final BitSet reachedBlocks) {
898 class WalkState {
899 Set<Long> numbers;
900 BasicBlock target;
901
902 WalkState(Set<Long> numbers, BasicBlock target) {
903 reachedBlocks.set(target.getLabel());
904 this.target = target;
905 this.numbers = numbers;
906 }
907 }
908
909 Deque<WalkState> walkStates = new ArrayDeque<>();
910 walkStates.push(new WalkState(new HashSet<Long>(), cfg.getEntry()));
911
912 while(!walkStates.isEmpty()) {
913 WalkState walkState = walkStates.removeLast();
914 Set<Long> numbers = walkState.numbers;
915 for(Iterator<Edge> iterator = cfg.outgoingEdgeIterator(walkState.target); iterator.hasNext(); ) {
916 Edge edge = iterator.next();
917 Branch branch = edges.get(edge);
918 if (branch != null) {
919 branch.numbers.addAll(numbers);
920 numbers = new HashSet<>(numbers);
921 numbers.add(branch.number.longValue());
922 if (branch.trueSet.intersects(subRange)) {
923 branch.trueReachedSet.add(subRange);
924 } else {
925 branch.falseReachedSet.add(subRange);
926 continue;
927 }
928 }
929 BasicBlock target = edge.getTarget();
930 if (!reachedBlocks.get(target.getLabel())) {
931 walkStates.push(new WalkState(numbers, target));
932 }
933 if (branch != null) {
934 break;
935 }
917936 }
918937 }
919938 }
116116 throw new IOException("File " + file.getAbsolutePath() + " is not a normal file");
117117 } else if (fileName.endsWith(".class")) {
118118 return new SingleFileCodeBase(codeBaseLocator, fileName);
119 } else if (fileName.endsWith(File.separator + "jrt-fs.jar")) {
120 return new JrtfsCodeBase(codeBaseLocator, fileName);
119121 } else {
120122 return ZipCodeBaseFactory.makeZipCodeBase(codeBaseLocator, file);
121123 }
2424 import java.io.FileNotFoundException;
2525 import java.io.IOException;
2626 import java.io.InputStream;
27 import java.nio.file.Files;
28 import java.nio.file.Path;
29 import java.nio.file.Paths;
2730 import java.util.HashMap;
2831 import java.util.HashSet;
2932 import java.util.Iterator;
3740 import java.util.jar.Manifest;
3841
3942 import edu.umd.cs.findbugs.FindBugs;
43 import edu.umd.cs.findbugs.JavaVersion;
4044 import edu.umd.cs.findbugs.SystemProperties;
4145 import edu.umd.cs.findbugs.classfile.CheckedAnalysisException;
4246 import edu.umd.cs.findbugs.classfile.ClassDescriptor;
272276 dumpCodeBaseList(classPath.appCodeBaseIterator(), "Application codebases");
273277 dumpCodeBaseList(classPath.auxCodeBaseIterator(), "Auxiliary codebases");
274278 }
279
280 // Make sure we always know if we can't find system classes
281 ICodeBaseEntry resource = classPath.lookupResource("java/lang/Object.class");
282 if(resource == null){
283 throw new ResourceNotFoundException("java/lang/Object.class");
284 }
275285 }
276286
277287 /**
389399 }
390400 }
391401
402 if(isJava9orLater()){
403 Path jrtFsJar = Paths.get(System.getProperty("java.home", ""), "jrt-fs.jar");
404 if(Files.isRegularFile(jrtFsJar)){
405 addWorkListItemsForClasspath(workList, jrtFsJar.toString());
406 }
407 }
392408 return workList;
409 }
410
411 private static boolean isJava9orLater() {
412 JavaVersion javaVersion = JavaVersion.getRuntimeVersion();
413 return javaVersion.getMajor() >= 9;
393414 }
394415
395416 /**
627648 } catch (IOException e) {
628649 if (item.isAppCodeBase() || item.getHowDiscovered() == ICodeBase.Discovered.SPECIFIED) {
629650 if (e instanceof FileNotFoundException) {
630 errorLogger.logError("File not found: " + item.getCodeBaseLocator());
651 if(item.isAppCodeBase()){
652 errorLogger.logError("File from project not found: " + item.getCodeBaseLocator(), e);
653 } else {
654 errorLogger.logError("File from auxiliary classpath not found: " + item.getCodeBaseLocator(), e);
655 }
631656 } else {
632657 errorLogger.logError("Cannot open codebase " + item.getCodeBaseLocator(), e);
633658 }
0 /*
1 * FindBugs - Find Bugs in Java programs
2 * Copyright (C) 2003-2008 University of Maryland
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19 package edu.umd.cs.findbugs.classfile.impl;
20
21 import java.io.BufferedInputStream;
22 import java.io.IOException;
23 import java.io.InputStream;
24 import java.net.URI;
25 import java.net.URL;
26 import java.net.URLClassLoader;
27 import java.nio.file.FileSystem;
28 import java.nio.file.FileSystems;
29 import java.nio.file.Files;
30 import java.nio.file.Path;
31 import java.nio.file.Paths;
32 import java.nio.file.StandardOpenOption;
33 import java.util.Collections;
34 import java.util.HashMap;
35 import java.util.Iterator;
36 import java.util.LinkedHashMap;
37 import java.util.LinkedHashSet;
38 import java.util.Map;
39 import java.util.Objects;
40 import java.util.Set;
41
42 import javax.annotation.CheckForNull;
43 import javax.annotation.Nonnull;
44
45 import edu.umd.cs.findbugs.classfile.ClassDescriptor;
46 import edu.umd.cs.findbugs.classfile.DescriptorFactory;
47 import edu.umd.cs.findbugs.classfile.ICodeBaseEntry;
48 import edu.umd.cs.findbugs.classfile.ICodeBaseIterator;
49 import edu.umd.cs.findbugs.classfile.ICodeBaseLocator;
50 import edu.umd.cs.findbugs.classfile.InvalidClassFileFormatException;
51 import edu.umd.cs.findbugs.classfile.ResourceNotFoundException;
52
53 /**
54 *
55 * Code base supporting Java 9 new jimage packed modules
56 *
57 * @author andrey
58 */
59 public class JrtfsCodeBase extends AbstractScannableCodeBase {
60
61 private FileSystem fs;
62 private final String fileName;
63 private Path root;
64
65 /**
66 * Key is package name in bytecode notation (e.g. 'java/lang').
67 * <p>
68 * Values are either plain Strings for single-module packages, or sets of
69 * Strings for packages spread over multiple modules
70 */
71 private Map<String, Object> packageToModuleMap;
72
73 public JrtfsCodeBase(ICodeBaseLocator codeBaseLocator, @Nonnull String fileName) {
74 super(codeBaseLocator);
75 this.fileName = fileName;
76 URL url;
77 try {
78 url = Paths.get(fileName).toUri().toURL();
79 URLClassLoader loader = new URLClassLoader(new URL[] { url });
80 fs = FileSystems.newFileSystem(URI.create("jrt:/"), Collections.emptyMap(), loader);
81 root = fs.getPath("modules");
82 packageToModuleMap = createPackageToModuleMap(fs);
83 } catch (IOException e) {
84 e.printStackTrace();
85 }
86 }
87
88 public Map<String, Object> createPackageToModuleMap(FileSystem fs) throws IOException{
89 HashMap<String, Object> packageToModule = new LinkedHashMap<>();
90 Path path = fs.getPath("packages");
91 Files.list(path).forEach(p -> {
92 try {
93 Iterator<Path> modIter = Files.list(p).iterator();
94 while (modIter.hasNext()) {
95 Path module = modIter.next();
96 String packageKey = fileName(p).replace('.', '/');
97 String modulePath = fileName(module);
98 if(!modIter.hasNext() && !packageToModule.containsKey(packageKey)){
99 packageToModule.put(packageKey, modulePath);
100 } else {
101 @SuppressWarnings("unchecked")
102 Set<Object> modules = (Set<Object>) packageToModule.get(packageKey);
103 if(modules == null){
104 modules = new LinkedHashSet<>();
105 packageToModule.put(packageKey, modules);
106 }
107 modules.add(modulePath);
108 }
109 }
110 } catch (IOException e) {
111 e.printStackTrace();
112 }
113 });
114 return packageToModule;
115 }
116
117 @Override
118 @CheckForNull
119 public ICodeBaseEntry lookupResource(String resourceName) {
120 resourceName = translateResourceName(resourceName);
121 String packageName = getPackage(resourceName);
122 Object moduleNameOrSet = packageToModuleMap.get(packageName);
123 if(moduleNameOrSet == null){
124 return null;
125 }
126 if(moduleNameOrSet instanceof String){
127 return createEntry(resourceName, (String) moduleNameOrSet);
128 } else {
129 @SuppressWarnings("unchecked")
130 Set<String> modules = (Set<String>) moduleNameOrSet;
131 for (String moduleName : modules) {
132 ICodeBaseEntry entry = createEntry(resourceName, moduleName);
133 if(entry != null){
134 return entry;
135 }
136 }
137 }
138 return null;
139 }
140
141 @CheckForNull
142 private ICodeBaseEntry createEntry(String resourceName, String moduleName) {
143 Path resolved = root.resolve(moduleName + "/" + resourceName);
144 if(Files.exists(resolved)){
145 return new JrtfsCodebaseEntry(resolved, root, this);
146 }
147 return null;
148 }
149
150 private static String getPackage(String resourceName) {
151 int lastSlash = resourceName.lastIndexOf('/');
152 if(lastSlash > 0){
153 return resourceName.substring(0, lastSlash);
154 }
155 return resourceName;
156 }
157
158 @Override
159 public String getPathName() {
160 return fileName;
161 }
162
163 @Override
164 public int hashCode() {
165 return 31 + fileName.hashCode();
166 }
167
168 @Override
169 public boolean equals(Object obj) {
170 if (this == obj) {
171 return true;
172 }
173 if (!(obj instanceof JrtfsCodeBase)) {
174 return false;
175 }
176 return fileName.equals(((JrtfsCodeBase) obj).fileName);
177 }
178
179
180 @Override
181 public String toString() {
182 StringBuilder builder = new StringBuilder();
183 builder.append("JrtfsCodeBase [");
184 if (fileName != null) {
185 builder.append("file=");
186 builder.append(fileName);
187 }
188 builder.append("]");
189 return builder.toString();
190 }
191
192 @Override
193 public void close() {
194 if(fs != null){
195 try {
196 fs.close();
197 } catch (IOException e) {
198 e.printStackTrace();
199 }
200 }
201 }
202
203 @Override
204 public ICodeBaseIterator iterator() throws InterruptedException {
205 return new JrtfsCodeBaseIterator();
206 }
207
208 @Nonnull
209 static String fileName(Path p){
210 Path name = p.getFileName();
211 return name != null? name.toString() : "";
212 }
213
214 static boolean isClassFile(Path p) {
215 return p.endsWith(".class") && !p.endsWith("module-info.class") && Files.isRegularFile(p);
216 }
217
218 public class JrtfsCodeBaseIterator implements ICodeBaseIterator {
219
220 private Iterator<Path> iterator;
221
222 public JrtfsCodeBaseIterator() {
223 try {
224 iterator = Files.walk(root).filter(p -> isClassFile(p)).iterator();
225 } catch (IOException e) {
226 e.printStackTrace();
227 }
228 }
229
230 @Override
231 public boolean hasNext() throws InterruptedException {
232 return iterator.hasNext();
233 }
234
235 @Override
236 public ICodeBaseEntry next() throws InterruptedException {
237 if (Thread.interrupted()) {
238 throw new InterruptedException();
239 }
240 Path next = iterator.next();
241 return new JrtfsCodebaseEntry(next, root, JrtfsCodeBase.this);
242 }
243
244 }
245
246 public static class JrtfsCodebaseEntry extends AbstractScannableCodeBaseEntry {
247
248 private final Path path;
249 private final Path root;
250 private final JrtfsCodeBase codebase;
251
252 public JrtfsCodebaseEntry(Path next, Path root, JrtfsCodeBase codebase) {
253 this.path = next;
254 this.root = root;
255 this.codebase = codebase;
256 }
257
258 @Override
259 public int getNumBytes() {
260 try {
261 return (int) Files.size(path);
262 } catch (IOException e) {
263 e.printStackTrace();
264 return -1;
265 }
266 }
267
268 @Override
269 public InputStream openResource() throws IOException {
270 return new BufferedInputStream(Files.newInputStream(path, StandardOpenOption.READ));
271 }
272
273 @Override
274 public JrtfsCodeBase getCodeBase() {
275 return codebase;
276 }
277
278 @Override
279 public ClassDescriptor getClassDescriptor() throws ResourceNotFoundException, InvalidClassFileFormatException {
280 return DescriptorFactory.createClassDescriptorFromResourceName(getResourceName());
281 }
282
283 @Override
284 public String getRealResourceName() {
285 return root.relativize(path).toString();
286 }
287
288 @Override
289 public int hashCode() {
290 final int prime = 31;
291 int result = prime + codebase.hashCode();
292 result = prime * result + path.hashCode();
293 return result;
294 }
295
296 @Override
297 public boolean equals(Object obj) {
298 if (this == obj) {
299 return true;
300 }
301 if (!(obj instanceof JrtfsCodebaseEntry)) {
302 return false;
303 }
304 JrtfsCodebaseEntry other = (JrtfsCodebaseEntry) obj;
305 if(!Objects.equals(codebase, other.codebase)){
306 return false;
307 }
308 return Objects.equals(path, other.path);
309 }
310
311 @Override
312 public String toString() {
313 StringBuilder builder = new StringBuilder();
314 builder.append("JrtfsCodebaseEntry [");
315 if (path != null) {
316 builder.append("path=");
317 builder.append(path);
318 builder.append(", ");
319 }
320 if (codebase != null) {
321 builder.append("codebase=");
322 builder.append(codebase);
323 }
324 builder.append("]");
325 return builder.toString();
326 }
327
328 }
329
330
331 }
317317 if (!option.startsWith("-")) {
318318 break;
319319 }
320
320 if (dryRun && option.startsWith("@")) {
321 ++arg;
322 continue;
323 }
321324 String optionExtraPart = "";
322325 int colon = option.indexOf(':');
323326 if (colon >= 0) {
3131 *
3232 * @param keySet
3333 * non null set instance to sort
34 * @return non null list wich contains all given keys, sorted
34 * @return non null list which contains all given keys, sorted
3535 * lexicographically. The list may be empty if given set was empty
3636 */
3737 static public Enumeration<?> sortKeys(Set<String> keySet) {
197197 if (props.size() == 0) {
198198 return;
199199 }
200
201 Properties prefixlessProperties = new Properties();
202 for (Map.Entry<?, ?> e : props.entrySet()) {
203 if(e.getKey() instanceof String) {
204 String key = e.getKey().toString();
205 String value = e.getValue().toString();
206 prefixlessProperties.setProperty(key.replace("/instance/edu.umd.cs.findbugs.plugin.eclipse/", ""), value);
207 } else {
208 prefixlessProperties.put(e.getKey(), e.getValue());
209 }
210 }
211 props = prefixlessProperties;
212
200213 for (int i = 0; i < MAX_RECENT_FILES; i++) {
201214 String key = "recent" + i;
202215 String projectName = (String) props.get(key);
204217 recentProjectsList.add(projectName);
205218 }
206219 }
220
207221
208222 for (Map.Entry<?, ?> e : props.entrySet()) {
209223
2020 package edu.umd.cs.findbugs.detect;
2121
2222 import java.util.regex.Pattern;
23 import java.util.regex.PatternSyntaxException;
2423
2524 import edu.umd.cs.findbugs.BugInstance;
2625 import edu.umd.cs.findbugs.BugReporter;
8584 OpcodeStack.Item it = stack.getStackItem(stackDepth);
8685 if (it.getSpecialKind() == OpcodeStack.Item.FILE_SEPARATOR_STRING && (flags & Pattern.LITERAL) == 0) {
8786 bugReporter.reportBug(new BugInstance(this, "RE_CANT_USE_FILE_SEPARATOR_AS_REGULAR_EXPRESSION", HIGH_PRIORITY)
88 .addClassAndMethod(this).addCalledMethod(this).addSourceLine(this));
87 .addClassAndMethod(this).addCalledMethod(this).addSourceLine(this));
8988 return;
9089 }
9190 Object value = it.getConstant();
9594 String regex = (String) value;
9695 try {
9796 Pattern.compile(regex, flags);
98 } catch (PatternSyntaxException e) {
97 } catch (IllegalArgumentException e) {
9998 String message = e.getMessage();
10099 int eol = message.indexOf('\n');
101100 if (eol > 0) {
102101 message = message.substring(0, eol);
103102 }
104103 BugInstance bug = new BugInstance(this, "RE_BAD_SYNTAX_FOR_REGULAR_EXPRESSION", HIGH_PRIORITY)
105 .addClassAndMethod(this).addCalledMethod(this).addString(message).describe(StringAnnotation.ERROR_MSG_ROLE)
106 .addString(regex).describe(StringAnnotation.REGEX_ROLE);
104 .addClassAndMethod(this).addCalledMethod(this).addString(message).describe(StringAnnotation.ERROR_MSG_ROLE)
105 .addString(regex).describe(StringAnnotation.REGEX_ROLE);
107106 String options = getOptions(flags);
108107 if (options.length() > 0) {
109108 bug.addString("Regex flags: " + options).describe(StringAnnotation.STRING_MESSAGE);
7171 */
7272 public class BuildObligationPolicyDatabase implements Detector2, NonReportingDetector {
7373
74 static class AuxilaryObligationPropertyDatabase extends MethodPropertyDatabase<String> {
74 static class AuxiliaryObligationPropertyDatabase extends MethodPropertyDatabase<String> {
7575
7676 /*
7777 * (non-Javadoc)
142142 URL u = DetectorFactoryCollection.getCoreResource("obligationPolicy.db");
143143 try {
144144 if (u != null) {
145 AuxilaryObligationPropertyDatabase db = new AuxilaryObligationPropertyDatabase();
145 AuxiliaryObligationPropertyDatabase db = new AuxiliaryObligationPropertyDatabase();
146146 db.read(u.openStream());
147147 for (Map.Entry<MethodDescriptor, String> e : db.entrySet()) {
148148 String[] v = e.getValue().split(",");
3030
3131 import org.apache.bcel.classfile.Code;
3232 import org.apache.bcel.classfile.Method;
33 import org.apache.bcel.generic.Type;
3334
3435 import edu.umd.cs.findbugs.BugReporter;
3536 import edu.umd.cs.findbugs.NonReportingDetector;
204205
205206 private int nArgs;
206207
207 private int shift;
208
209 private boolean[] argEnabled;
208 private int[] argNums;
210209
211210 private List<MethodParameter>[] passedParameters;
212211
217216 @SuppressWarnings("unchecked")
218217 @Override
219218 public void visitMethod(Method obj) {
220 argEnabled = null;
221 org.apache.bcel.generic.Type[] argumentTypes = obj.getArgumentTypes();
219 argNums = null;
220 Type[] argumentTypes = obj.getArgumentTypes();
222221 if(argumentTypes.length == 0) {
223222 return;
224223 }
224 int lvNum = obj.isStatic() ? 0 : 1;
225225 nArgs = argumentTypes.length;
226 int argCount = lvNum;
227 for(Type type : argumentTypes) {
228 argCount+=type.getSize();
229 }
226230 for(int i=0; i<nArgs; i++) {
227231 if(argumentTypes[i].getSignature().equals("Ljava/lang/String;")) {
228 if(argEnabled == null) {
229 argEnabled = new boolean[nArgs];
230 }
231 argEnabled[i] = true;
232 }
233 }
234 if(argEnabled != null) {
235 shift = obj.isStatic() ? 0 : -1;
232 if(argNums == null) {
233 argNums = new int[argCount];
234 Arrays.fill(argNums, -1);
235 }
236 argNums[lvNum] = i;
237 }
238 lvNum+=argumentTypes[i].getSize();
239 }
240 if(argNums != null) {
236241 passedParameters = new List[nArgs];
237242 }
238243 super.visitMethod(obj);
240245
241246 @Override
242247 public boolean shouldVisitCode(Code obj) {
243 return argEnabled != null;
248 return argNums != null;
244249 }
245250
246251 @Override
260265 @Override
261266 public void sawOpcode(int seen) {
262267 if (isRegisterStore()) {
263 int param = getRegisterOperand() + shift;
264 if (param >= 0 && param < nArgs) {
265 argEnabled[param] = false;
266 passedParameters[param] = null;
268 int param = getRegisterOperand();
269 if (param < argNums.length) {
270 int argNum = argNums[param];
271 argNums[param] = -1;
272 if(argNum >= 0) {
273 passedParameters[argNum] = null;
274 }
267275 }
268276 }
269277 switch (seen) {
275283 int callArgs = getNumberArguments(md.getSignature());
276284 for (int i = 0; i < callArgs; i++) {
277285 Item item = getStack().getStackItem(callArgs - 1 - i);
278 int param = item.getRegisterNumber() + shift;
279 if (param >= 0 && param < nArgs && argEnabled[param]) {
280 List<MethodParameter> list = passedParameters[param];
286 int param = item.getRegisterNumber();
287 if (param >= 0 && param < argNums.length && argNums[param] != -1) {
288 List<MethodParameter> list = passedParameters[argNums[param]];
281289 if (list == null) {
282 passedParameters[param] = list = new ArrayList<>();
290 passedParameters[argNums[param]] = list = new ArrayList<>();
283291 }
284292 list.add(new MethodParameter(md, i));
285293 }
4646 @Override
4747 public void visit(JavaClass obj) {
4848
49 if (Subtypes2.instanceOf(obj, "java.util.Comparator") && !ClassName.isAnonymous(getClassName())
49 if (Subtypes2.instanceOf(obj, "java.util.Comparator") && !ClassName.isLocalOrAnonymous(getClassName())
5050 && !Subtypes2.instanceOf(obj, "java.io.Serializable")) {
5151 int priority = NORMAL_PRIORITY;
5252 if (obj.isInterface() || obj.isAbstract()) {
2121 import edu.umd.cs.findbugs.ba.DataflowAnalysisException;
2222 import edu.umd.cs.findbugs.ba.Location;
2323 import edu.umd.cs.findbugs.ba.MethodUnprofitableException;
24 import edu.umd.cs.findbugs.ba.SignatureParser;
2425 import edu.umd.cs.findbugs.ba.constant.Constant;
2526 import edu.umd.cs.findbugs.ba.constant.ConstantDataflow;
2627 import edu.umd.cs.findbugs.ba.constant.ConstantFrame;
9495 }
9596 InvokeInstruction iins = (InvokeInstruction) ins;
9697
98 SignatureParser parser = new SignatureParser(iins.getSignature(cpg));
99
97100 ConstantFrame frame = constantDataflow.getFactAtLocation(location);
98101 if (!frame.isValid()) {
99102 // This basic block is probably dead
103106 MethodDescriptor md = new MethodDescriptor(iins, cpg);
104107 if (allDatabasePasswordMethods.containsKey(md)) {
105108 for(int paramNumber : allDatabasePasswordMethods.get(md)) {
106 Constant operandValue = frame.getStackValue(iins.getArgumentTypes(cpg).length-1-paramNumber);
109 Constant operandValue = frame.getArgument(iins, cpg, paramNumber, parser);
107110 if (operandValue.isConstantString()) {
108111 String password = operandValue.getConstantString();
109112 if (password.length() == 0) {
133136 } else if (allFileNameStringMethods.containsKey(md)) {
134137
135138 for(int paramNumber : allFileNameStringMethods.get(md)) {
136 Constant operandValue = frame.getStackValue(iins.getArgumentTypes(cpg).length-1-paramNumber);
139 Constant operandValue = frame.getArgument(iins, cpg, paramNumber, parser);
137140 if (!operandValue.isConstantString()) {
138141 continue;
139142 }
2121 import java.math.BigDecimal;
2222 import java.util.Iterator;
2323
24 import org.apache.bcel.Const;
2425 import org.apache.bcel.classfile.Attribute;
2526 import org.apache.bcel.classfile.Code;
2627 import org.apache.bcel.classfile.CodeException;
201202 && "setMaximumPoolSize".equals(getNameConstantOperand())) {
202203 accumulator.accumulateBug(new BugInstance(DumbMethods.this,
203204 "DMI_FUTILE_ATTEMPT_TO_CHANGE_MAXPOOL_SIZE_OF_SCHEDULED_THREAD_POOL_EXECUTOR", HIGH_PRIORITY)
204 .addClassAndMethod(DumbMethods.this), DumbMethods.this);
205 .addClassAndMethod(DumbMethods.this), DumbMethods.this);
205206 }
206207 }
207208 }
383384 OpcodeStack.Item top = stack.getStackItem(0);
384385 if ("Ljava/net/URL;".equals(top.getSignature())) {
385386 accumulator.accumulateBug(new BugInstance(DumbMethods.this, "DMI_COLLECTION_OF_URLS", HIGH_PRIORITY)
386 .addClassAndMethod(DumbMethods.this), DumbMethods.this);
387 .addClassAndMethod(DumbMethods.this), DumbMethods.this);
387388 }
388389 }
389390 }
492493 if (seen == INVOKEVIRTUAL && "java/util/Random".equals(getClassConstantOperand())
493494 && (freshRandomOnTos || freshRandomOneBelowTos)) {
494495 accumulator.accumulateBug(new BugInstance(DumbMethods.this, "DMI_RANDOM_USED_ONLY_ONCE", HIGH_PRIORITY)
495 .addClassAndMethod(DumbMethods.this).addCalledMethod(DumbMethods.this), DumbMethods.this);
496 .addClassAndMethod(DumbMethods.this).addCalledMethod(DumbMethods.this), DumbMethods.this);
496497
497498 }
498499 freshRandomOneBelowTos = freshRandomOnTos && isRegisterLoad();
702703 }
703704 if (primitiveType != null
704705 && (previousMethodCall.equals(rvo) || signature.equals(primitiveType))
705 && (getThisClass().getMajor() >= MAJOR_1_7 || getThisClass().getMajor() >= MAJOR_1_4
706 && (getThisClass().getMajor() >= Const.MAJOR_1_7 || getThisClass().getMajor() >= MAJOR_1_4
706707 && (primitiveType.equals("D") || primitiveType.equals("F")))) {
707708 MethodDescriptor shouldCall = new MethodDescriptor(called.getClassDescriptor().getClassName(), "compare",
708709 "(" + primitiveType + primitiveType + ")I", true);
709710 BugInstance bug = new BugInstance(this, "DM_BOXED_PRIMITIVE_FOR_COMPARE",
710711 primitiveType.equals("Z") ? LOW_PRIORITY : primitiveType.equals("B") ? NORMAL_PRIORITY
711712 : HIGH_PRIORITY).addClassAndMethod(this).addCalledMethod(this).addMethod(shouldCall)
712 .describe(MethodAnnotation.SHOULD_CALL);
713 .describe(MethodAnnotation.SHOULD_CALL);
713714 accumulator.accumulateBug(bug, this);
714715 }
715716 }
819820 && "org/easymock/EasyMock".equals(getClassConstantOperand())
820821 && ("replay".equals(getNameConstantOperand()) || "verify".equals(getNameConstantOperand()) || getNameConstantOperand()
821822 .startsWith("reset")) && "([Ljava/lang/Object;)V".equals(getSigConstantOperand())
822 && getPrevOpcode(1) == ANEWARRAY && getPrevOpcode(2) == ICONST_0) {
823 && getPrevOpcode(1) == ANEWARRAY && getPrevOpcode(2) == ICONST_0) {
823824 accumulator.accumulateBug(new BugInstance(this, "DMI_VACUOUS_CALL_TO_EASYMOCK_METHOD", NORMAL_PRIORITY)
824 .addClassAndMethod(this).addCalledMethod(this), this);
825 .addClassAndMethod(this).addCalledMethod(this), this);
825826 }
826827
827828 if ((seen == INVOKESTATIC || seen == INVOKEVIRTUAL || seen == INVOKESPECIAL || seen == INVOKEINTERFACE)
845846 if (prevOpcode == I2L && seen == INVOKESTATIC && "java/lang/Double".equals(getClassConstantOperand())
846847 && "longBitsToDouble".equals(getNameConstantOperand())) {
847848 accumulator.accumulateBug(new BugInstance(this, "DMI_LONG_BITS_TO_DOUBLE_INVOKED_ON_INT", HIGH_PRIORITY)
848 .addClassAndMethod(this).addCalledMethod(this), this);
849 .addClassAndMethod(this).addCalledMethod(this), this);
849850 }
850851
851852 /**
876877 int special = item0.getSpecialKind();
877878 if (special == OpcodeStack.Item.RANDOM_INT) {
878879 pendingAbsoluteValueBug = new BugInstance(this, "RV_ABSOLUTE_VALUE_OF_RANDOM_INT", HIGH_PRIORITY)
879 .addClassAndMethod(this);
880 .addClassAndMethod(this);
880881 pendingAbsoluteValueBugSourceLine = SourceLineAnnotation.fromVisitedInstruction(this);
881882 opcodesSincePendingAbsoluteValueBug = 0;
882883 }
883884
884885 else if (special == OpcodeStack.Item.HASHCODE_INT) {
885886 pendingAbsoluteValueBug = new BugInstance(this, "RV_ABSOLUTE_VALUE_OF_HASHCODE", HIGH_PRIORITY)
886 .addClassAndMethod(this);
887 .addClassAndMethod(this);
887888 pendingAbsoluteValueBugSourceLine = SourceLineAnnotation.fromVisitedInstruction(this);
888889 opcodesSincePendingAbsoluteValueBug = 0;
889890 }
929930 int v = switchLabels[i];
930931 if (v <= -129 || v >= 128) {
931932 accumulator.accumulateBug(new BugInstance(this, "INT_BAD_COMPARISON_WITH_SIGNED_BYTE", HIGH_PRIORITY)
932 .addClassAndMethod(this).addInt(v).describe(IntAnnotation.INT_VALUE),
933 SourceLineAnnotation.fromVisitedInstruction(this, getPC() + switchOffsets[i]));
933 .addClassAndMethod(this).addInt(v).describe(IntAnnotation.INT_VALUE),
934 SourceLineAnnotation.fromVisitedInstruction(this, getPC() + switchOffsets[i]));
934935 }
935936
936937 }
10161017 }
10171018
10181019 accumulator.accumulateBug(new BugInstance(this, "INT_BAD_COMPARISON_WITH_SIGNED_BYTE", priority)
1019 .addClassAndMethod(this).addInt(v1).describe(IntAnnotation.INT_VALUE).addValueSource(item0, this), this);
1020 .addClassAndMethod(this).addInt(v1).describe(IntAnnotation.INT_VALUE).addValueSource(item0, this), this);
10201021
10211022 }
10221023 } else if (item0.getSpecialKind() == OpcodeStack.Item.NON_NEGATIVE && constant1 instanceof Number) {
115115 Type cType = Type.getType(c.getSignature());
116116 IncompatibleTypes check = IncompatibleTypes.getPriorityForAssumingCompatible(thisType, cType, false);
117117 int priority = check.getPriority();
118 if ("java/lang/Object".equals(getSuperclassName()) && ClassName.isAnonymous(getClassName())) {
118 if ("java/lang/Object".equals(getSuperclassName()) && ClassName.isLocalOrAnonymous(getClassName())) {
119119 priority++;
120120 }
121121 bugAccumulator.accumulateBug(new BugInstance(this, "EQ_CHECK_FOR_OPERAND_NOT_COMPATIBLE_WITH_THIS", priority)
841841 * @return true if given method is known to change its object only
842842 */
843843 private static boolean isObjectOnlyMethod(MethodDescriptor m) {
844 if (m.isStatic() || m.getName().equals("<init>")) {
844 if (m.isStatic() || m.getName().equals("<init>") || m.getName().equals("forEach")) {
845845 return false;
846846 }
847847 String className = m.getSlashedClassName();
577577 }
578578 boolean result = ifNullTests > 2;
579579
580 // System.out.println("Preceeding null tests " + ifNullTests + " " +
580 // System.out.println("Preceding null tests " + ifNullTests + " " +
581581 // ifNonnullTests + " " + result);
582582 return result;
583583 } catch (CFGBuilderException e) {
6060 * resources that aren't closed.
6161 *
6262 * @author David Hovemeyer
63 * @author Agustin Toribio atomo@arrakis.es
6364 */
6465 public final class FindOpenStream extends ResourceTrackingDetector<Stream, StreamResourceTracker> implements StatelessDetector {
6566 static final boolean DEBUG = SystemProperties.getBoolean("fos.debug");
104105 streamFactoryCollection.add(new MethodReturnValueStreamFactory("java.lang.Class", "getResourceAsStream",
105106 "(Ljava/lang/String;)Ljava/io/InputStream;", "OS_OPEN_STREAM"));
106107
108 // Added support for java.nio.file.Files (since 1.7)
109 streamFactoryCollection.add(new MethodReturnValueStreamFactory("java.nio.file.Files", "newInputStream",
110 "(Ljava/nio/file/Path;[Ljava/nio/file/OpenOption;)Ljava/io/InputStream;", "OS_OPEN_STREAM"));
111 streamFactoryCollection.add(new MethodReturnValueStreamFactory("java.nio.file.Files", "newOutputStream",
112 "(Ljava/nio/file/Path;[Ljava/nio/file/OpenOption;)Ljava/io/OutputStream;", "OS_OPEN_STREAM"));
113 streamFactoryCollection.add(new MethodReturnValueStreamFactory("java.nio.file.Files", "newByteChannel",
114 "(Ljava/nio/file/Path;[Ljava/nio/file/OpenOption;)Ljava/nio/channels/SeekableByteChannel;", "OS_OPEN_STREAM"));
115 streamFactoryCollection.add(new MethodReturnValueStreamFactory("java.nio.file.Files", "newByteChannel",
116 "(Ljava/nio/file/Path;Ljava/util/Set;[Ljava/nio/file/attribute/FileAttribute;)Ljava/nio/channels/SeekableByteChannel;", "OS_OPEN_STREAM"));
117 streamFactoryCollection.add(new MethodReturnValueStreamFactory("java.nio.file.Files", "newDirectoryStream",
118 "(Ljava/nio/file/Path;)Ljava/nio/file/DirectoryStream;", "OS_OPEN_STREAM"));
119 streamFactoryCollection.add(new MethodReturnValueStreamFactory("java.nio.file.Files", "newDirectoryStream",
120 "(Ljava/nio/file/Path;Ljava/nio/file/DirectoryStream$Filter;)Ljava/nio/file/DirectoryStream;", "OS_OPEN_STREAM"));
121 streamFactoryCollection.add(new MethodReturnValueStreamFactory("java.nio.file.Files", "newDirectoryStream",
122 "(Ljava/nio/file/Path;Ljava/lang/String;)Ljava/nio/file/DirectoryStream;", "OS_OPEN_STREAM"));
123 streamFactoryCollection.add(new MethodReturnValueStreamFactory("java.nio.file.Files", "newBufferedReader",
124 "(Ljava/nio/file/Path;Ljava/nio/charset/Charset;)Ljava/io/BufferedReader;", "OS_OPEN_STREAM"));
125 streamFactoryCollection.add(new MethodReturnValueStreamFactory("java.nio.file.Files", "newBufferedWriter",
126 "(Ljava/nio/file/Path;Ljava/nio/charset/Charset;[Ljava/nio/file/OpenOption;)Ljava/io/BufferedWriter;", "OS_OPEN_STREAM"));
127
128 // java 8
129 streamFactoryCollection.add(new MethodReturnValueStreamFactory("java.nio.file.Files", "newBufferedReader",
130 "(Ljava/nio/file/Path;)Ljava/io/BufferedReader;", "OS_OPEN_STREAM"));
131 streamFactoryCollection.add(new MethodReturnValueStreamFactory("java.nio.file.Files", "newBufferedWriter",
132 "(Ljava/nio/file/Path;[Ljava/nio/file/OpenOption;)Ljava/io/BufferedWriter;", "OS_OPEN_STREAM"));
133
107134 // Ignore socket input and output streams
108135 streamFactoryCollection.add(new MethodReturnValueStreamFactory("java.net.Socket", "getInputStream",
109136 "()Ljava/io/InputStream;"));
253280 // class containing one of these words, then we don't run the
254281 // detector on the class.
255282 private static final String[] PRESCREEN_CLASS_LIST = { "Stream", "Reader", "Writer", "ZipFile", "JarFile", "DriverManager",
256 "Connection", "Statement" };
283 "Connection", "Statement", "Files" };
257284
258285 /*
259286 * (non-Javadoc)
568568 if (field != null) {
569569 // If the field is final, we'll assume that the String value
570570 // is static.
571 if (field.isFinal() && field.isFinal()) {
571 if (field.isFinal()) {
572572 pushValue(staticStringTypeInstance);
573573 } else {
574574 pushValue(type);
2828 import edu.umd.cs.findbugs.LocalVariableAnnotation;
2929 import edu.umd.cs.findbugs.OpcodeStack;
3030 import edu.umd.cs.findbugs.ba.AnalysisContext;
31 import edu.umd.cs.findbugs.ba.XField;
3132 import edu.umd.cs.findbugs.bcel.OpcodeStackDetector;
3233
3334 public class FindReturnRef extends OpcodeStackDetector {
105106 return;
106107 }
107108
108 if (staticMethod && seen == PUTSTATIC && MutableStaticFields.mutableSignature(getSigConstantOperand())) {
109 if (staticMethod && seen == PUTSTATIC && nonPublicFieldOperand()
110 && MutableStaticFields.mutableSignature(getSigConstantOperand())) {
109111 OpcodeStack.Item top = stack.getStackItem(0);
110112 if (isPotentialCapture(top)) {
111113 bugAccumulator.accumulateBug(
116118 getPC(), getPC() - 1)), this);
117119 }
118120 }
119 if (!staticMethod && seen == PUTFIELD && MutableStaticFields.mutableSignature(getSigConstantOperand())) {
121 if (!staticMethod && seen == PUTFIELD && nonPublicFieldOperand()
122 && MutableStaticFields.mutableSignature(getSigConstantOperand())) {
120123 OpcodeStack.Item top = stack.getStackItem(0);
121124 OpcodeStack.Item target = stack.getStackItem(1);
122125 if (isPotentialCapture(top) && target.getRegisterNumber() == 0) {
135138 return;
136139 }
137140
138 if (thisOnTOS && seen == GETFIELD && getClassConstantOperand().equals(getClassName())
141 if (thisOnTOS && seen == GETFIELD && getClassConstantOperand().equals(getClassName()) && nonPublicFieldOperand()
139142 && !AnalysisContext.currentXFactory().isEmptyArrayField(getXFieldOperand())) {
140143 fieldOnTOS = true;
141144 thisOnTOS = false;
145148 fieldIsStatic = false;
146149 return;
147150 }
148 if (seen == GETSTATIC && getClassConstantOperand().equals(getClassName())
151 if (seen == GETSTATIC && getClassConstantOperand().equals(getClassName()) && nonPublicFieldOperand()
149152 && !AnalysisContext.currentXFactory().isEmptyArrayField(getXFieldOperand())) {
150153 fieldOnTOS = true;
151154 thisOnTOS = false;
171174 thisOnTOS = false;
172175 }
173176
177 private boolean nonPublicFieldOperand() {
178 XField xField = getXFieldOperand();
179 return xField == null || !xField.isPublic();
180 }
181
174182 private boolean isPotentialCapture(OpcodeStack.Item top) {
175183 if (!top.isInitialParameter()) {
176184 return false;
4646 import edu.umd.cs.findbugs.BugReporter;
4747 import edu.umd.cs.findbugs.Detector;
4848 import edu.umd.cs.findbugs.SourceLineAnnotation;
49 import edu.umd.cs.findbugs.SystemProperties;
49 import edu.umd.cs.findbugs.ba.AnalysisContext;
5050 import edu.umd.cs.findbugs.ba.BasicBlock;
5151 import edu.umd.cs.findbugs.ba.CFG;
5252 import edu.umd.cs.findbugs.ba.CFGBuilderException;
5454 import edu.umd.cs.findbugs.ba.DataflowAnalysisException;
5555 import edu.umd.cs.findbugs.ba.EdgeTypes;
5656 import edu.umd.cs.findbugs.ba.Location;
57 import edu.umd.cs.findbugs.ba.SignatureParser;
58 import edu.umd.cs.findbugs.ba.XFactory;
59 import edu.umd.cs.findbugs.ba.XMethod;
5760 import edu.umd.cs.findbugs.ba.constant.Constant;
5861 import edu.umd.cs.findbugs.ba.constant.ConstantDataflow;
5962 import edu.umd.cs.findbugs.ba.constant.ConstantFrame;
6063 import edu.umd.cs.findbugs.ba.type.TopType;
6164 import edu.umd.cs.findbugs.ba.type.TypeDataflow;
6265 import edu.umd.cs.findbugs.ba.type.TypeFrame;
66 import edu.umd.cs.findbugs.ba.vna.ValueNumber;
67 import edu.umd.cs.findbugs.ba.vna.ValueNumberDataflow;
68 import edu.umd.cs.findbugs.ba.vna.ValueNumberFrame;
6369 import edu.umd.cs.findbugs.classfile.CheckedAnalysisException;
6470 import edu.umd.cs.findbugs.classfile.Global;
6571 import edu.umd.cs.findbugs.classfile.MethodDescriptor;
188194 final Map<MethodDescriptor, int[]> executeMethods;
189195 final Set<MethodDescriptor> allMethods = new HashSet<>();
190196
191 private final boolean testingEnabled;
192
193197 public FindSqlInjection(BugReporter bugReporter) {
194198 this.bugReporter = bugReporter;
195199 this.bugAccumulator = new BugAccumulator(bugReporter);
196 testingEnabled = SystemProperties.getBoolean("report_TESTING_pattern_in_standard_detectors");
197200 Set<MethodParameter> baseExecuteMethods = new HashSet<>();
198201 for(MethodDescriptor executeMethod : EXECUTE_METHODS) {
199202 baseExecuteMethods.add(new MethodParameter(executeMethod, 0));
464467 }
465468 }
466469
467 String description = "TESTING";
470 String description;
468471 if (isExecute) {
469472 description = "SQL_NONCONSTANT_STRING_PASSED_TO_EXECUTE";
470473 } else {
473476
474477 BugInstance bug = new BugInstance(this, description, priority);
475478 bug.addClassAndMethod(methodGen, javaClass.getSourceFileName());
476 if ("TESTING".equals(description)) {
477 bug.addString("Incomplete report invoking non-constant SQL string");
478 }
479479 if (sawSeriousTaint) {
480480 bug.addString("non-constant SQL string involving HTTP taint");
481481 }
489489
490490 private void analyzeMethod(ClassContext classContext, Method method) throws DataflowAnalysisException, CFGBuilderException {
491491 JavaClass javaClass = classContext.getJavaClass();
492 ValueNumberDataflow vnd = classContext.getValueNumberDataflow(method);
493
494 Set<ValueNumber> passthruParams = getPassthruParams(vnd, method, javaClass);
495
492496 this.method = method;
493497 this.classContext = classContext;
494498 MethodGen methodGen = classContext.getMethodGen(method);
528532 }
529533 }
530534 ConstantFrame frame = dataflow.getFactAtLocation(location);
531 int numArguments = frame.getNumArguments(invoke, cpg);
532 Constant value = frame.getStackValue(numArguments - 1 - paramNumber);
533
534 if (!value.isConstantString()) {
535 SignatureParser parser = new SignatureParser(invoke.getSignature(cpg));
536 Constant value = frame.getArgument(invoke, cpg, paramNumber, parser);
537 ValueNumber vn = vnd.getFactAtLocation(location).getArgument(invoke, cpg, paramNumber, parser);
538
539 if (!value.isConstantString() && !passthruParams.contains(vn)) {
535540 // TODO: verify it's the same string represented by
536541 // stringAppendState
537542 // FIXME: will false positive on const/static strings
538543 // returns by methods
539 Location prev = getPreviousLocation(cfg, location, true);
544 Location prev = getValueNumberCreationLocation(vnd, vn);
540545 if (prev == null || !isSafeValue(prev, cpg)) {
541 BugInstance bug = generateBugInstance(javaClass, methodGen, location.getHandle(), stringAppendState, executeMethod);
542 if(!testingEnabled && "TESTING".equals(bug.getType())){
543 continue;
544 }
546 BugInstance bug = generateBugInstance(javaClass, methodGen, location.getHandle(), stringAppendState,
547 executeMethod);
545548 bugAccumulator.accumulateBug(
546549 bug,
547550 SourceLineAnnotation.fromVisitedInstruction(classContext, methodGen,
552555 bugAccumulator.reportAccumulatedBugs();
553556 }
554557
558 private Location getValueNumberCreationLocation(ValueNumberDataflow vnd, ValueNumber vn) {
559 ConstantPoolGen cpg = vnd.getCFG().getMethodGen().getConstantPool();
560 for(Iterator<Location> it = vnd.getCFG().locationIterator(); it.hasNext(); ) {
561 Location loc = it.next();
562 if(loc.getHandle().getInstruction().produceStack(cpg) != 1) {
563 continue;
564 }
565 try {
566 ValueNumberFrame vnf = vnd.getFactAfterLocation(loc);
567 if(vnf.getTopValue().equals(vn)) {
568 return loc;
569 }
570 } catch (DataflowAnalysisException e) {
571 AnalysisContext.logError("While analyzing "+vnd.getCFG().getMethodGen()+" at "+loc, e);
572 }
573 }
574 return null;
575 }
576
577 private Set<ValueNumber> getPassthruParams(ValueNumberDataflow vnd, Method method, JavaClass javaClass) {
578 XMethod xMethod = XFactory.createXMethod(javaClass, method);
579 Set<ValueNumber> passthruParams = new HashSet<>();
580
581 int[] p = preparedStatementMethods.get(xMethod);
582 if(p != null) {
583 for(int pNum : p) {
584 passthruParams.add(vnd.getAnalysis().getEntryValueForParameter(pNum));
585 }
586 }
587 p = executeMethods.get(xMethod);
588 if(p != null) {
589 for(int pNum : p) {
590 passthruParams.add(vnd.getAnalysis().getEntryValueForParameter(pNum));
591 }
592 }
593 return passthruParams;
594 }
595
555596 @Override
556597 public void report() {
557598 }
5050 import edu.umd.cs.findbugs.BugReporter;
5151 import edu.umd.cs.findbugs.Detector;
5252 import edu.umd.cs.findbugs.StringAnnotation;
53 import edu.umd.cs.findbugs.ba.AnalysisContext;
5354 import edu.umd.cs.findbugs.ba.BasicBlock;
5455 import edu.umd.cs.findbugs.ba.CFG;
5556 import edu.umd.cs.findbugs.ba.ClassContext;
7475 * @author Tagir Valeev
7576 */
7677 public class FindUselessObjects implements Detector {
78 private static final int MAX_ITERATIONS = 50;
7779 private final BugReporter reporter;
7880 private final NoSideEffectMethodsDatabase noSideEffectMethods;
7981
470472 }
471473 context.enhanceViaMergeTree();
472474 boolean changed;
475 int iteration = 0;
473476 do {
474477 changed = false;
478 if(++iteration > MAX_ITERATIONS) {
479 AnalysisContext.logError("FindUselessObjects: " + classContext.getClassDescriptor().getDottedClassName() + "."
480 + method.getName() + method.getSignature() + ": cannot converge after " + MAX_ITERATIONS
481 + " iterations; method is skipped");
482 return;
483 }
475484 for(Iterator<GenLocation> iterator = context.genIterator(); iterator.hasNext() && !context.isEmpty(); ) {
476485 GenLocation location = iterator.next();
477486 Instruction inst = location.getHandle().getInstruction();
1818
1919 package edu.umd.cs.findbugs.detect;
2020
21 import org.apache.bcel.classfile.Method;
21 import org.apache.bcel.classfile.Code;
2222
2323 import edu.umd.cs.findbugs.BugInstance;
2424 import edu.umd.cs.findbugs.BugReporter;
25 import edu.umd.cs.findbugs.BytecodeScanningDetector;
26 import edu.umd.cs.findbugs.StatelessDetector;
25 import edu.umd.cs.findbugs.OpcodeStack.Item;
26 import edu.umd.cs.findbugs.bcel.OpcodeStackDetector;
2727
2828 /**
2929 * Find comparisons involving values computed with bitwise operations whose
3030 * outcomes are fixed at compile time.
3131 *
3232 * @author Tom Truscott <trt@unx.sas.com>
33 * @author Tagir Valeev
3334 */
34 public class IncompatMask extends BytecodeScanningDetector implements StatelessDetector {
35 int state;
36
37 long arg0, arg1;
38
39 int bitop;
40
41 boolean isLong;
42
35 public class IncompatMask extends OpcodeStackDetector {
4336 private final BugReporter bugReporter;
4437
38 private int bitop = -1;
39
40 private boolean equality;
41
42 private Number arg1, arg2;
43
44 private Item bitresultItem;
45
4546 public IncompatMask(BugReporter bugReporter) {
46 this.state = 0;
4747 this.bugReporter = bugReporter;
4848 }
4949
50 static int populationCount(long i) {
51 return Long.bitCount(i);
52 }
53
5054 @Override
51 public void visit(Method obj) {
55 public void visit(Code obj) {
56 arg1 = arg2 = null;
5257 super.visit(obj);
53 this.state = 0;
54 }
55
56 private void checkState(int expectedState) {
57 if (state == expectedState) {
58 state++;
59 } else {
60 state = 0;
61 }
62 }
63
64 private void noteVal(long val) {
65 if (state == 0) {
66 arg0 = val;
67 } else if (state == 2) {
68 arg1 = val;
69 } else {
70 state = -1;
71 }
72 state++;
73 }
74
75 @Override
76 public void sawInt(int val) {
77 noteVal(val);
78 }
79
80 @Override
81 public void sawLong(long val) {
82 noteVal(val);
83 }
84
85 static int populationCount(long i) {
86 int result = 0;
87 while (i != 0) {
88 if ((i & 1) == 1) {
89 result++;
90 }
91 i >>>= 1;
92 }
93 return result;
58 }
59
60 private Number getArg() {
61 Object constValue = stack.getStackItem(0).getConstant();
62 if (!(constValue instanceof Number)) {
63 constValue = stack.getStackItem(1).getConstant();
64 }
65 if (!(constValue instanceof Long) && !(constValue instanceof Integer)) {
66 return null;
67 }
68 return (Number) constValue;
9469 }
9570
9671 @Override
9772 public void sawOpcode(int seen) {
98 // System.out.println("BIT: " + state + ": " + OPCODE_NAMES[seen]);
99
10073 switch (seen) {
101 case ICONST_M1:
102 noteVal(-1);
103 return;
104 case ICONST_0:
105 noteVal(0);
106 return;
107 case ICONST_1:
108 noteVal(1);
109 return;
110 case ICONST_2:
111 noteVal(2);
112 return;
113 case ICONST_3:
114 noteVal(3);
115 return;
116 case ICONST_4:
117 noteVal(4);
118 return;
119 case ICONST_5:
120 noteVal(5);
121 return;
122 case LCONST_0:
123 noteVal(0);
124 return;
125 case LCONST_1:
126 noteVal(1);
127 return;
128
129 case BIPUSH:
130 return; /* will pick up value via sawInt */
131 case LDC2_W:
132 return; /* will pick up value via sawLong */
133
134 case SIPUSH:
135 return; /* will pick up value via sawInt */
136 case LDC:
137 case LDC_W:
138 return; /* will pick up value via sawInt */
139
14074 case IAND:
14175 case LAND:
76 arg1 = getArg();
14277 bitop = IAND;
143 isLong = seen == LAND;
144 checkState(1);
14578 return;
14679 case IOR:
14780 case LOR:
81 arg1 = getArg();
14882 bitop = IOR;
149 isLong = seen == LOR;
150 checkState(1);
151 return;
152
83 return;
15384 case LCMP:
154 if (state == 3) {
155 isLong = true;
156 return; /* Ignore. An 'if' opcode will follow */
157 }
158 state = 0;
159 return;
160
85 if (checkItem(2)) {
86 arg2 = getArg();
87 }
88 return;
89 case IF_ICMPEQ:
90 case IF_ICMPNE:
91 if (checkItem(2)) {
92 arg2 = getArg();
93 equality = true;
94 }
95 break;
96 case IFEQ:
97 case IFNE:
98 if (arg1 instanceof Integer && checkItem(1)) {
99 arg2 = 0;
100 }
101 equality = true;
102 break;
161103 case IFLE:
162104 case IFLT:
163105 case IFGT:
164106 case IFGE:
165 if (state == 3 && isLong || state == 2 && !isLong) {
166 long bits = getFlagBits(isLong, arg0);
167 boolean highbit = !isLong && (bits & 0x80000000) != 0 || isLong && bits < 0 && bits << 1 == 0;
168 boolean onlyLowBits = bits >>> 12 == 0;
169 BugInstance bug;
170 if (highbit) {
171 bug = new BugInstance(this, "BIT_SIGNED_CHECK_HIGH_BIT", (seen == IFLE || seen == IFGT) ? HIGH_PRIORITY
172 : NORMAL_PRIORITY);
173 } else {
174 bug = new BugInstance(this, "BIT_SIGNED_CHECK", onlyLowBits ? LOW_PRIORITY : NORMAL_PRIORITY);
107 if (arg1 instanceof Integer && checkItem(1)) {
108 arg2 = 0;
109 }
110 equality = false;
111 break;
112 default:
113 return;
114 }
115 if (arg1 == null || arg2 == null) {
116 return;
117 }
118 boolean isLong = arg1 instanceof Long;
119 if (!equality && arg2.longValue() == 0) {
120 long bits = getFlagBits(isLong, arg1.longValue());
121 boolean highbit = !isLong && (bits & 0x80000000) != 0 || isLong && bits < 0 && bits << 1 == 0;
122 boolean onlyLowBits = bits >>> 12 == 0;
123 BugInstance bug;
124 if (highbit) {
125 bug = new BugInstance(this, "BIT_SIGNED_CHECK_HIGH_BIT", (seen == IFLE || seen == IFGT) ? HIGH_PRIORITY
126 : NORMAL_PRIORITY);
127 } else {
128 bug = new BugInstance(this, "BIT_SIGNED_CHECK", onlyLowBits ? LOW_PRIORITY : NORMAL_PRIORITY);
129 }
130 bug.addClassAndMethod(this).addString(toHex(arg1)+" ("+arg1+")").addSourceLine(this);
131 bugReporter.reportBug(bug);
132 }
133 if (equality) {
134 long dif;
135 String t;
136
137 long val1 = arg1.longValue();
138 long val2 = arg2.longValue();
139
140 if (bitop == IOR) {
141 dif = val1 & ~val2;
142 t = "BIT_IOR";
143 } else if (val1 != 0 || val2 != 0) {
144 dif = val2 & ~val1;
145 t = "BIT_AND";
146 } else {
147 dif = 1;
148 t = "BIT_AND_ZZ";
149 }
150 if (dif != 0) {
151 BugInstance bug = new BugInstance(this, t, HIGH_PRIORITY).addClassAndMethod(this);
152 if (!"BIT_AND_ZZ".equals(t)) {
153 bug.addString(toHex(arg1)).addString(toHex(arg2));
175154 }
176 bugReporter.reportBug(bug.addClassAndMethod(this).addSourceLine(this));
177 }
178 state = 0;
179 return;
180
181 case IFEQ:
182 case IFNE:
183 /* special case: if arg1 is 0 it will not be pushed */
184 if (state == 2) {
185 arg1 = 0;
186 state = 3;
187 }
188
189 //$FALL-THROUGH$
190 case IF_ICMPEQ:
191 case IF_ICMPNE:
192 checkState(3);
193 if (state != 4) {
194 return;
195 }
196 break; /* the only break in this switch! gross */
197
198 case GOTO:
199 state = -1;
200 return;
201
155 bug.addSourceLine(this);
156 bugReporter.reportBug(bug);
157 }
158 }
159 arg1 = arg2 = null;
160 bitresultItem = null;
161 }
162
163 private static String toHex(Number n) {
164 return "0x"+(n instanceof Long ? Long.toHexString(n.longValue()) : Integer.toHexString(n.intValue()));
165 }
166
167 private boolean checkItem(int n) {
168 if(bitresultItem != null) {
169 for (int i = 0; i < n; i++) {
170 if (stack.getStackItem(i) == bitresultItem) {
171 return true;
172 }
173 }
174 }
175 arg1 = arg2 = null;
176 bitresultItem = null;
177 return false;
178 }
179
180 @Override
181 public void afterOpcode(int seen) {
182 super.afterOpcode(seen);
183 switch (seen) {
184 case IAND:
185 case LAND:
186 case IOR:
187 case LOR:
188 if(stack.getStackDepth() > 0) {
189 bitresultItem = stack.getStackItem(0);
190 }
191 break;
202192 default:
203 state = 0;
204 return;
205 }
206
207 /* We have matched the instruction pattern, so check the args */
208 long dif;
209 String t;
210
211 if (bitop == IOR) {
212 dif = arg0 & ~arg1;
213 t = "BIT_IOR";
214 } else if (arg0 != 0 || arg1 != 0) {
215 dif = arg1 & ~arg0;
216 t = "BIT_AND";
217 } else {
218 dif = 1;
219 t = "BIT_AND_ZZ";
220 }
221
222 if (dif != 0) {
223 // System.out.println("Match at offset " + getPC());
224 BugInstance bug = new BugInstance(this, t, HIGH_PRIORITY).addClassAndMethod(this);
225 if (!"BIT_AND_ZZ".equals(t)) {
226 bug.addString("0x" + Long.toHexString(arg0)).addString("0x" + Long.toHexString(arg1));
227 }
228
229 bug.addSourceLine(this);
230 bugReporter.reportBug(bug);
231 }
232 state = 0;
193 break;
194 }
233195 }
234196
235197 static long getFlagBits(boolean isLong, long arg0) {
244206 return bits;
245207 }
246208 }
247
121121
122122 /**
123123 * Eclipse uses reflection to initialize NLS message bundles. Classes which
124 * using this mechanism are usualy extending org.eclipse.osgi.util.NLS class
124 * using this mechanism are usually extending org.eclipse.osgi.util.NLS class
125125 * and contains lots of public static String fields which are used as
126126 * message constants. Unfortunately these fields cannot be final, so FB
127127 * reports tons of warnings for such Eclipse classes.
377377
378378 /**
379379 * Eclipse uses reflection to initialize NLS message bundles. Classes which
380 * using this mechanism are usualy extending org.eclipse.osgi.util.NLS class
380 * using this mechanism are usually extending org.eclipse.osgi.util.NLS class
381381 * and contains lots of public static String fields which are used as
382382 * message constants. Unfortunately these fields often has bad names which
383383 * does not follow Java code convention, so FB reports tons of warnings for
5757 SortedSet<String> redundantInfNames = new TreeSet<String>();
5858
5959 for (String interfaceName : interfaceNames) {
60 if (!"java/io/Serializable".equals(interfaceName)) {
61 JavaClass inf = Repository.lookupClass(interfaceName.replace('/', '.'));
60 if (!"java.io.Serializable".equals(interfaceName)) {
61 JavaClass inf = Repository.lookupClass(interfaceName);
6262 if (superObj.instanceOf(inf)) {
6363 redundantInfNames.add(inf.getClassName());
6464 }
6565
6666 String superclassName2 = getSuperclassName();
6767 boolean weird = "java.lang.Object".equals(superclassName2) && obj.getInterfaceIndices().length == 0;
68 boolean hasAnonymousName = ClassName.isAnonymous(obj.getClassName());
68 boolean hasAnonymousName = ClassName.isLocalOrAnonymous(obj.getClassName());
6969 boolean isAnonymousInnerClass = hasAnonymousName && !weird;
7070 if (isAnonymousInnerClass) {
7171 super.visitJavaClass(obj);
1818
1919 package edu.umd.cs.findbugs.detect;
2020
21 import java.util.ArrayList;
2122 import java.util.Collection;
2223 import java.util.Collections;
2324 import java.util.HashMap;
2425 import java.util.HashSet;
2526 import java.util.Iterator;
2627 import java.util.LinkedList;
28 import java.util.List;
2729 import java.util.Map;
2830 import java.util.Set;
2931 import java.util.TreeSet;
4345 import org.apache.bcel.generic.Type;
4446
4547 import edu.umd.cs.findbugs.BugAccumulator;
48 import edu.umd.cs.findbugs.BugAnnotation;
4649 import edu.umd.cs.findbugs.BugInstance;
4750 import edu.umd.cs.findbugs.BugReporter;
51 import edu.umd.cs.findbugs.ClassAnnotation;
4852 import edu.umd.cs.findbugs.DeepSubtypeAnalysis;
53 import edu.umd.cs.findbugs.FieldAnnotation;
54 import edu.umd.cs.findbugs.LocalVariableAnnotation;
55 import edu.umd.cs.findbugs.MethodAnnotation;
4956 import edu.umd.cs.findbugs.OpcodeStack;
57 import edu.umd.cs.findbugs.OpcodeStack.Item;
5058 import edu.umd.cs.findbugs.Priorities;
5159 import edu.umd.cs.findbugs.ProgramPoint;
5260 import edu.umd.cs.findbugs.SourceLineAnnotation;
5563 import edu.umd.cs.findbugs.ba.XClass;
5664 import edu.umd.cs.findbugs.ba.XFactory;
5765 import edu.umd.cs.findbugs.ba.XField;
66 import edu.umd.cs.findbugs.ba.XMethod;
5867 import edu.umd.cs.findbugs.ba.ch.Subtypes2;
5968 import edu.umd.cs.findbugs.ba.generic.GenericObjectType;
6069 import edu.umd.cs.findbugs.ba.generic.GenericUtilities;
102111 private final BugAccumulator bugAccumulator;
103112
104113 boolean publicOrProtectedConstructor;
114
115 private final Map<String, List<BugAnnotation>> anonymousClassAnnotation = new HashMap<>();
105116
106117 /**
107118 * @deprecated Use {@link edu.umd.cs.findbugs.detect.UnreadFieldsData#getReadFields()} instead
567578 bugAccumulator.accumulateBug(new BugInstance(this, "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD", priority)
568579 .addClassAndMethod(this).addField(f), this);
569580
581 }
582 }
583
584 // Store annotation for the anonymous class creation
585 if (seen == INVOKESPECIAL && getMethodDescriptorOperand().getName().equals("<init>") && ClassName.isAnonymous(getClassConstantOperand())) {
586 List<BugAnnotation> annotation = new ArrayList<>();
587 annotation.add(ClassAnnotation.fromClassDescriptor(getClassDescriptor()));
588 annotation.add(MethodAnnotation.fromVisitedMethod(this));
589 annotation.add(SourceLineAnnotation.fromVisitedInstruction(this));
590 anonymousClassAnnotation.put(getClassDescriptorOperand().getDottedClassName(), annotation);
591 }
592
593 if (seen == PUTFIELD || seen == ASTORE || seen == ASTORE_0 || seen == ASTORE_1 || seen == ASTORE_2 || seen == ASTORE_3) {
594 Item item = stack.getStackItem(0);
595 XMethod xMethod = item.getReturnValueOf();
596 if(xMethod != null && xMethod.getName().equals("<init>") && ClassName.isAnonymous(xMethod.getClassName())) {
597 List<BugAnnotation> annotations = anonymousClassAnnotation.get(xMethod.getClassName());
598 if(annotations == null) {
599 annotations = new ArrayList<>();
600 }
601 if(seen == PUTFIELD) {
602 annotations.add(FieldAnnotation.fromReferencedField(this));
603 } else {
604 annotations.add(LocalVariableAnnotation.getLocalVariableAnnotation(getMethod(), getRegisterOperand(), getPC(), getNextPC()));
605 }
606 anonymousClassAnnotation.put(xMethod.getClassName(), annotations);
570607 }
571608 }
572609
743780 boolean isConstructor = "<init>".equals(getMethodName()) || "<clinit>".equals(getMethodName());
744781 if (getMethod().isStatic() == f.isStatic()
745782 && (isConstructor || data.calledFromConstructors.contains(getMethodName() + ":" + getMethodSig())
746 || "init".equals(getMethodName()) || "init".equals(getMethodName())
747 || "initialize".equals(getMethodName()) || getMethod().isPrivate())) {
783 || "init".equals(getMethodName()) || "initialize".equals(getMethodName())
784 || getMethod().isPrivate())) {
748785
749786 if (isConstructor) {
750787 data.writtenInConstructorFields.add(f);
11341171 priority = NORMAL_PRIORITY;
11351172 }
11361173
1137 String bug = "SIC_INNER_SHOULD_BE_STATIC";
1174 BugInstance bugInstance;
11381175 if (isAnonymousInnerClass) {
1139 bug = "SIC_INNER_SHOULD_BE_STATIC_ANON";
1176 bugInstance = new BugInstance(this, "SIC_INNER_SHOULD_BE_STATIC_ANON", priority);
1177 List<BugAnnotation> annotations = anonymousClassAnnotation.remove(f.getClassDescriptor().getDottedClassName());
1178 if(annotations != null) {
1179 bugInstance.addClass(className).describe(ClassAnnotation.ANONYMOUS_ROLE);
1180 bugInstance.addAnnotations(annotations);
1181 } else {
1182 bugInstance.addClass(className);
1183 }
11401184 } else if (!easyChange) {
1141 bug = "SIC_INNER_SHOULD_BE_STATIC_NEEDS_THIS";
1185 bugInstance = new BugInstance(this, "SIC_INNER_SHOULD_BE_STATIC_NEEDS_THIS", priority).addClass(className);
1186 } else {
1187 bugInstance = new BugInstance(this, "SIC_INNER_SHOULD_BE_STATIC", priority).addClass(className);
11421188 }
11431189
1144 bugReporter.reportBug(new BugInstance(this, bug, priority).addClass(className));
1190 bugReporter.reportBug(bugInstance);
11451191
11461192 }
11471193 }
3131 import edu.umd.cs.findbugs.BytecodeScanningDetector;
3232 import edu.umd.cs.findbugs.MethodAnnotation;
3333 import edu.umd.cs.findbugs.StatelessDetector;
34 import edu.umd.cs.findbugs.ba.CFGBuilderException;
3435 import edu.umd.cs.findbugs.ba.ClassContext;
36 import edu.umd.cs.findbugs.ba.DataflowAnalysisException;
3537 import edu.umd.cs.findbugs.ba.XClass;
38 import edu.umd.cs.findbugs.ba.type.TypeDataflow.LocationAndFactPair;
3639 import edu.umd.cs.findbugs.classfile.CheckedAnalysisException;
3740 import edu.umd.cs.findbugs.classfile.ClassDescriptor;
3841 import edu.umd.cs.findbugs.classfile.FieldDescriptor;
165168 private static boolean implementsMap(ClassDescriptor d) {
166169 while (d != null) {
167170 try {
171 // Do not report this warning for EnumMap: EnumMap.keySet()/get() iteration is as fast as entrySet() iteration
172 if ("java.util.EnumMap".equals(d.getDottedClassName())) {
173 return false;
174 }
168175 // True if variable is itself declared as a Map
169176 if ("java.util.Map".equals(d.getDottedClassName())) {
170177 return true;
225232 "keySet".equals(getNameConstantOperand()) && "()Ljava/util/Set;".equals(getSigConstantOperand())
226233 // Following check solves sourceforge bug 1830576
227234 && implementsMap(getClassDescriptorOperand())) {
235 try {
236 LocationAndFactPair lfp = getClassContext().getTypeDataflow(getMethod()).getLocationAndFactForInstruction(
237 getPC());
238 // Skip EnumMap if TypeAnalysis knows that the type is EnumMap
239 if (lfp != null && lfp.frame.getTopValue().getSignature().equals("Ljava/util/EnumMap;")) {
240 break;
241 }
242 } catch (DataflowAnalysisException | CFGBuilderException e) {
243 // ignore
244 }
228245 mapVariable = loadedVariable;
229246 removedFromStack(true);
230247 keySetRegister = IN_STACK;
4747
4848 if (name == null) {
4949 if (signature == null) {
50 throw new FilterException(this.getClass().getName() + " must have eiter name or signature attributes");
50 throw new FilterException(this.getClass().getName() + " must have either name or signature attributes");
5151 }
5252 else {
5353 name = "~.*"; // any name
3333 * String and null)
3434 *
3535 * If matchSpec starts with ~ character it will be treated as
36 * java.util.regex.Pattern, with the ~ character omited. The pattern will be
36 * java.util.regex.Pattern, with the ~ character omitted. The pattern will be
3737 * matched against whole value (ie Matcher.match(), not Matcher.find())
3838 *
3939 * If matchSpec is a non-null String with any other initial charcter, exact
7070 if (type.endsWith("[]")) {
7171 return "[" + typeToSignature(type.substring(0, type.length() - 2));
7272 } else {
73 return scalarTypeToSiganture(type);
73 return scalarTypeToSignature(type);
7474 }
7575 }
7676
77 private static String scalarTypeToSiganture(String type) {
77 private static String scalarTypeToSignature(String type) {
7878 if ("boolean".equals(type)) {
7979 return "Z";
8080 } else if ("byte".equals(type)) {
4646 menu.viewbugs_item=Fehler ansehen
4747
4848 menu.filterwarnings_menu=Filterwarnungen
49 menu.exppriority_item=Experimental Priorität
49 menu.exppriority_item=Experimentelle Priorität
5050 menu.lowpriority_item=&Niedrige Priorität
5151 menu.mediumpriority_item=&Mittlere Priorität
5252 menu.highpriority_item=&Hohe Priorität
7676
7777 dlg.cloud.add_review=Klicken um Review zu erstellen...
7878 dlg.cloud.add_review_multi=Klicken um Review zu {0} Fehlern zu erstellen...
79 dlg.cloud.ovwrt_review_multi=Klicken um {0} Reviews zu ¸berschreiben...
79 dlg.cloud.ovwrt_review_multi=Klicken um {0} Reviews zu überschreiben...
8080
8181 dlg.byclass_tab=Nach Klasse
8282 dlg.bypackage_tab=Nach Paket
152152 menu.sortConfiguration=Konfiguration sortieren...
153153 menu.gotoLine=Gehe zu Zeile...
154154 menu.changeDesignation=Bewertung ändern
155 menu.filterBugsLikeThis=ähnliche Fehler filtern
155 menu.filterBugsLikeThis=Ähnliche Fehler filtern
156156 menu.filterTheseBugs=Diese Fehler filtern
157157 menu.mergeAnalysis=Analyse zusammenführen
158158 menu.suppress=Fehler unterdrücken
166166 menu.normaleffort_item=Normal
167167 menu.maxeffort_item=Maximal
168168 menu.rerunAnalysis=Analyse wiederholen
169 dlg.new_item=Neues Project
169 dlg.new_item=Neues Projekt
170170 dlg.reconfig=Rekonfigurieren
171171 dlg.rerunAnalysis=Analyse wiederholen
172172 msg.addRemoveFiles=Dateien hinzufügen/entfernen
173173 msg.nosource_txt=Quelltext nicht verfügbar
174174 msg.loading_bugs_over_network_txt=Fehler laden (Netzwerk)...
175175 msg.you_are_loading_without_saving_txt=Sie laden ohne zu speichern. Sind Sie sicher?
176 msg.you_are_closing_without_saving_txt=Sie schliessen ohne zu speichern. Sind Sie sicher?
176 msg.you_are_closing_without_saving_txt=Sie schlieflen ohne zu speichern. Sind Sie sicher?
177177 msg.confirm_save_txt=Wollen Sie speichern?
178178 dlg.create_new_filter_ttl=Neuen Filter erstellen
179 dlg.changing_text_lbl=Wenn Sie diesen Text ändern, überschreiben Sie die Anmerkungungen zu allen Fehlern in diesem Verzeichnis und seinen Unterverzeichnissen. Sind Sie sicher?
179 dlg.changing_text_lbl=Wenn Sie diesen Text ändern, überschreiben Sie die Anmerkungen zu allen Fehlern in diesem Verzeichnis und seinen Unterverzeichnissen. Sind Sie sicher?
180180 dlg.annotation_change_ttl=Anmerkung ändern
181181 dlg.yes_btn=Ja
182182 dlg.no_btn=Nein
194194 dlg.analysis_exists_lbl=Diese Analyse existiert schon.\nÜberschreiben?
195195 dlg.file_does_not_exist_lbl=Diese Datei existiert nicht
196196 dlg.not_dir_warning_lbl=Warnung! Diese Datei ist kein Verzeichnis!
197 dlg.proj_not_dir_warning_lbl=Warnung! Dieses Project ist kein Verzeichnis!
197 dlg.proj_not_dir_warning_lbl=Warnung! Dieses Projekt ist kein Verzeichnis!
198198 summary.lines=Zeilen
199199 summary.line=Zeile
200200 statusbar.bugs_hidden=Fehler ausgeblendet
201201 statusbar.bug_hidden=Fehler ausgeblendet
202 err.missing_code=Fehler: kein Fehler-Code für diesen Eintrag
203 err.missing_pattern=Fehler: Fehlendes Bug-Pattern für diesen Schlüssel
202 err.missing_code=Fehler: Kein Fehler-Code für diesen Eintrag
203 err.missing_pattern=Fehler: Fehlendes Fehler-Muster für diesen Schlüssel
204204 progress.scanning_archives=Lese Archive...
205205 progress.analyzing_classes=Analysiere Klassen...
206206 progress.finishing_analysis=Analyse beendet...
246246 tooltip.longer_description=Längere Beschreibung für das Fehler-Muster
247247 tooltip.reorder_message=Ziehen, um den Verzeichnisbaum neu zu ordnen
248248 menu.recent_projects_menu=Letzte Projekte
249 menu.about_fb=Über Findbugs...
249 menu.about_fb=Über FindBugs...
250250 menu.go_to_line=Gehe zu Zeile...
251251 menu.change_designation=Fehler-Bewertung ändern
252252 menu.filter_these_bugs=Fehler filtern
277277 dlg.error_ttl=Datei nicht gefunden
278278 dlg.project_settings_changed_lbl=Projekt-Einstellungen geändert. Neue Analyse durchführen?
279279 dlg.invalid_txt=nicht gefunden. OK zum Weitermachen?
280 dlg.source_dirs_lbl=Source-Verzeichnisse
281 dlg.aux_class_lbl=Hilfs-Klassen
282 dlg.class_jars_dirs_lbl=Klassen-Archive und Verzeichnisse zum Analysieren
280 dlg.source_dirs_lbl=Quelltext-Verzeichnisse:
281 dlg.aux_class_lbl=Verzeichnisse für Hilfs-Klassen:
282 dlg.class_jars_dirs_lbl=Klassen-Archive und Verzeichnisse zum Analysieren:
283283 dlg.finish_btn=Übernehmen
284284 dlg.warning_ttl=Warnung!
285285 dlg.saving_error_lbl=Fehler beim Speichern
286 dlg.filter_settings_not_found_lbl=Filter-Einstellungen nicht gefunden, verwende defaults
287 dlg.not_xml_data_lbl=Dies ist keine gespeicherte XML Fehler-Datei.
288 dlg.no_xml_data_lbl=Dieses Verzeichnis enthält keine gespeicherten XML Fehler-Dateien, bitte wählen Sie ein anderes.
286 dlg.filter_settings_not_found_lbl=Filter-Einstellungen nicht gefunden, verwende Standardeinstellungen.
287 dlg.not_xml_data_lbl=Dies ist keine gespeicherte XML-Fehler-Datei.
288 dlg.no_xml_data_lbl=Dieses Verzeichnis enthält keine gespeicherten XML-Fehler-Dateien, bitte wählen Sie ein anderes.
289289 menu.designation=Bewertung
193193 dlg.warning_ttl=Warning!
194194 dlg.analyze_btn=Analyze
195195 dlg.class_jars_dirs_lbl=Classpath for analysis (jar, ear, war, zip, or directory)
196 dlg.aux_class_lbl=Auxillary classpath (optional; classes referenced by analysis classpath)
196 dlg.aux_class_lbl=Auxiliary classpath (optional; classes referenced by analysis classpath)
197197 dlg.source_dirs_lbl=Source directories (optional; used when browsing found bugs)
198198 dlg.invalid_txt= can't be found. OK to continue?
199199 dlg.error_ttl=Can't locate file
2929 * Denotes a class name or package name where the . character is used to
3030 * separate package/class name components.
3131 *
32 * e.g. {@code java.util.Collection}, {@code foo.Bar$Baz}
33 *
3234 * @author pugh
35 * @see edu.umd.cs.findbugs.util.ClassName An utility class provides utility methods to handle this format
36 * @see SlashedClassName Another format of class name
3337 */
3438 @Documented
3539 @SlashedClassName(when = When.NEVER)
2929 import javax.annotation.meta.When;
3030
3131 /**
32 * * Denotes a class name or package name where the / character is used to
32 * Denotes a class name or package name where the / character is used to
3333 * separate package/class name components.
3434 *
35 * e.g. {@code java/util/Collection}, {@code foo/Bar$Baz}
36 *
3537 * @author pugh
38 * @see edu.umd.cs.findbugs.util.ClassName An utility class provides utility methods to handle this format
39 * @see DottedClassName Another format of class name
3640 */
3741 @Documented
3842 @TypeQualifier(applicableTo = CharSequence.class)
5454 }
5555
5656 // See http://java.sun.com/docs/books/jls/third_edition/html/lexical.html
57 // Hexidecimal floating-point literals are not implemented.
57 // Hexadecimal floating-point literals are not implemented.
5858 // Unicode escapes are not implemented (but could be implemented in the
5959 // fillLineBuf() method).
6060
5656
5757 /**
5858 * Determine whether or not this ConstraintEdge resulted from an ordering
59 * constraint having a single detector as its source (ealier detector). Such
59 * constraint having a single detector as its source (earlier detector). Such
6060 * constraints automatically enable the source (earlier) detector if the
6161 * target (later) detector is enabled.
6262 *
4040
4141 /**
4242 * Set whether or not this ordering constraint resulted from an ordering
43 * constraint having a single detector as its source (ealier detector). Such
43 * constraint having a single detector as its source (earlier detector). Such
4444 * constraints automatically enable the source (earlier) detector if the
4545 * target (later) detector is enabled.
4646 */
5050
5151 /**
5252 * Determine whether or not this ordering constraint resulted from an
53 * ordering constraint having a single detector as its source (ealier
53 * ordering constraint having a single detector as its source (earlier
5454 * detector). Such constraints automatically enable the source (earlier)
5555 * detector if the target (later) detector is enabled.
5656 *
185185 }
186186
187187 /**
188 * Does a class name appear to designate an anonymous class? Only the name
189 * is analyzed. No classes are loaded or looked up.
188 * Does a class name appear to designate an anonymous or local (defined
189 * inside method) class? Only the name is analyzed. No classes are loaded or
190 * looked up.
190191 *
191192 * @param className
192193 * class name, slashed or dotted, fully qualified or unqualified
193 * @return true if className is the name of an anonymous class
194 */
195 public static boolean isAnonymous(String className) {
194 * @return true if className is the name of an anonymous or local class
195 */
196 public static boolean isLocalOrAnonymous(String className) {
196197 int i = className.lastIndexOf('$');
197198 if (i >= 0 && i + 1 < className.length()) {
198199 return Character.isDigit(className.charAt(i + 1));
200 }
201 return false;
202 }
203
204 /**
205 * Does a class name appear to designate an anonymous class? Only
206 * the name is analyzed. No classes are loaded or looked up.
207 *
208 * @param className
209 * class name, slashed or dotted, fully qualified or unqualified
210 * @return true if className is the name of an anonymous class
211 */
212 public static boolean isAnonymous(String className) {
213 int i = className.lastIndexOf('$');
214 if (i >= 0 && ++i < className.length()) {
215 while(i < className.length()) {
216 if(!Character.isDigit(className.charAt(i))) {
217 return false;
218 }
219 i++;
220 }
221 return true;
199222 }
200223 return false;
201224 }
221221 if (retvel == JFileChooser.APPROVE_OPTION) {
222222 File file = fc.getSelectedFile();
223223 try {
224 writer.println("File choosen:");
224 writer.println("File chosen:");
225225 writer.println("File path: " + file.getAbsolutePath());
226226 writer.println("File canonical path: " + file.getCanonicalPath());
227227
709709 int s = ((ConstantString) constantRefOperand).getStringIndex();
710710
711711 stringConstantOperand = getStringFromIndex(s);
712 } else if (constantRefOperand instanceof ConstantInvokeDynamic) {
713 ConstantInvokeDynamic id = (ConstantInvokeDynamic) constantRefOperand;
714 ConstantNameAndType sig = (ConstantNameAndType) getConstantPool().getConstant(
715 id.getNameAndTypeIndex());
716 nameConstantOperand = getStringFromIndex(sig.getNameIndex());
717 sigConstantOperand = getStringFromIndex(sig.getSignatureIndex());
712718 } else if (constantRefOperand instanceof ConstantCP) {
713719 ConstantCP cp = (ConstantCP) constantRefOperand;
714720 ConstantClass clazz = (ConstantClass) getConstantPool().getConstant(cp.getClassIndex());
720726 nameConstantOperand = getStringFromIndex(sig.getNameIndex());
721727 sigConstantOperand = getStringFromIndex(sig.getSignatureIndex());
722728 refConstantOperand = null;
723 } else if (constantRefOperand instanceof ConstantInvokeDynamic) {
724 ConstantInvokeDynamic id = (ConstantInvokeDynamic) constantRefOperand;
725 ConstantNameAndType sig = (ConstantNameAndType) getConstantPool().getConstant(
726 id.getNameAndTypeIndex());
727 nameConstantOperand = getStringFromIndex(sig.getNameIndex());
728 sigConstantOperand = getStringFromIndex(sig.getSignatureIndex());
729
730
731729 }
732730 break;
733731 case M_R:
2828 import org.apache.bcel.classfile.AnnotationEntry;
2929 import org.apache.bcel.classfile.Annotations;
3030 import org.apache.bcel.classfile.Attribute;
31 import org.apache.bcel.classfile.BootstrapMethods;
3132 import org.apache.bcel.classfile.Code;
3233 import org.apache.bcel.classfile.CodeException;
3334 import org.apache.bcel.classfile.Constant;
3435 import org.apache.bcel.classfile.ConstantCP;
3536 import org.apache.bcel.classfile.ConstantClass;
3637 import org.apache.bcel.classfile.ConstantInterfaceMethodref;
38 import org.apache.bcel.classfile.ConstantInvokeDynamic;
39 import org.apache.bcel.classfile.ConstantMethodHandle;
40 import org.apache.bcel.classfile.ConstantMethodType;
3741 import org.apache.bcel.classfile.ConstantMethodref;
3842 import org.apache.bcel.classfile.ConstantNameAndType;
3943 import org.apache.bcel.classfile.ConstantPool;
4852 import org.apache.bcel.classfile.LocalVariable;
4953 import org.apache.bcel.classfile.LocalVariableTable;
5054 import org.apache.bcel.classfile.Method;
55 import org.apache.bcel.classfile.MethodParameters;
56 import org.apache.bcel.classfile.ParameterAnnotationEntry;
5157 import org.apache.bcel.classfile.ParameterAnnotations;
58 import org.apache.bcel.classfile.StackMap;
59 import org.apache.bcel.classfile.StackMapEntry;
5260 import org.apache.bcel.classfile.StackMapTable;
5361 import org.apache.bcel.classfile.StackMapTableEntry;
5462
820828 public void visitParameterAnnotation(ParameterAnnotations arg0) {
821829 }
822830
831 @Deprecated
832 public void visitStackMapTable(StackMapTable arg0) {
833 // TODO Auto-generated method stub
834
835 }
836
837 /*
838 * (non-Javadoc)
839 *
840 * @see
841 * org.apache.bcel.classfile.Visitor#visitStackMapTableEntry(org.apache.
842 * bcel.classfile.StackMapTableEntry)
843 */
844 @Deprecated
845 public void visitStackMapTableEntry(StackMapTableEntry arg0) {
846 // TODO Auto-generated method stub
847
848 }
849
823850 /*
824851 * (non-Javadoc)
825852 *
828855 * classfile.StackMapTable)
829856 */
830857 @Override
831 public void visitStackMapTable(StackMapTable arg0) {
858 public void visitStackMap(StackMap arg0) {
832859 // TODO Auto-generated method stub
833860
834861 }
841868 * bcel.classfile.StackMapTableEntry)
842869 */
843870 @Override
844 public void visitStackMapTableEntry(StackMapTableEntry arg0) {
871 public void visitStackMapEntry(StackMapEntry arg0) {
872 // TODO Auto-generated method stub
873
874 }
875
876 @Override
877 public void visitConstantInvokeDynamic(ConstantInvokeDynamic obj) {
878 // TODO Auto-generated method stub
879
880 }
881
882 @Override
883 public void visitBootstrapMethods(BootstrapMethods obj) {
884 // TODO Auto-generated method stub
885
886 }
887
888 @Override
889 public void visitMethodParameters(MethodParameters obj) {
890 // TODO Auto-generated method stub
891
892 }
893
894 @Override
895 public void visitConstantMethodType(ConstantMethodType obj) {
896 // TODO Auto-generated method stub
897
898 }
899
900 @Override
901 public void visitConstantMethodHandle(ConstantMethodHandle obj) {
902 // TODO Auto-generated method stub
903
904 }
905
906 @Override
907 public void visitParameterAnnotationEntry(ParameterAnnotationEntry obj) {
845908 // TODO Auto-generated method stub
846909
847910 }
403403 }
404404
405405 /**
406 * Get key used to classify the presence and/or abscence of a BugInstance in
406 * Get key used to classify the presence and/or absence of a BugInstance in
407407 * successive versions in the history.
408408 *
409409 * @param activePrevious
146146 addOption("-prefix", "class name prefix",
147147 "comma separated list of class name prefixes that should be analyzed (e.g., edu.umd.cs.)");
148148 addOption("-exclude", "class name prefix",
149 "comma separated list of class name prefixes that should be excluded from both analyze and auxilary jar files (e.g., java.)");
149 "comma separated list of class name prefixes that should be excluded from both analyze and auxiliary jar files (e.g., java.)");
150150 addOption("-excludePattern", "class name pattern(s)",
151151 "comma separated list of regular expressions; all classes matching them are excluded");
152152
255255
256256 int analysisCount = 1;
257257
258 int auxilaryCount = 1;
259
260 String getNextAuxilaryFileOutput() {
258 int auxiliaryCount = 1;
259
260 String getNextAuxiliaryFileOutput() {
261261 String result;
262 if (auxilaryCount == 1) {
263 result = "auxilary.jar";
262 if (auxiliaryCount == 1) {
263 result = "auxiliary.jar";
264264 } else {
265 result = "auxilary" + (auxilaryCount) + ".jar";
266 }
267 auxilaryCount++;
265 result = "auxiliary" + (auxiliaryCount) + ".jar";
266 }
267 auxiliaryCount++;
268268 System.out.println("Starting " + result);
269269 return result;
270270 }
301301 doit.execute();
302302 }
303303
304 int auxilaryClassCount = 0;
305
306 ZipOutputStream auxilaryOut;
304 int auxiliaryClassCount = 0;
305
306 ZipOutputStream auxiliaryOut;
307307
308308 final byte buffer[] = new byte[8192];
309309
456456 }
457457
458458 if (numFilesToAnalyze < copied.size() || numFilesToAnalyze > commandLine.maxClasses) {
459 auxilaryOut = createZipFile(getNextAuxilaryFileOutput());
459 auxiliaryOut = createZipFile(getNextAuxiliaryFileOutput());
460460 }
461461
462462 int count = Integer.MAX_VALUE;
515515 }
516516
517517 boolean writeToAnalyzeOut = false;
518 boolean writeToAuxilaryOut = false;
518 boolean writeToAuxiliaryOut = false;
519519 if (commandLine.prefix.matches(dottedName)) {
520520 writeToAnalyzeOut = true;
521521 if (numFilesToAnalyze > commandLine.maxClasses) {
522 writeToAuxilaryOut = true;
522 writeToAuxiliaryOut = true;
523523 }
524524 } else {
525 writeToAuxilaryOut = auxilaryOut != null;
525 writeToAuxiliaryOut = auxiliaryOut != null;
526526 }
527527 ZipOutputStream out = null;
528528 if (writeToAnalyzeOut) {
530530 out.putNextEntry(newZipEntry(ze));
531531 }
532532
533 if (writeToAuxilaryOut) {
534 auxilaryClassCount++;
535 if (auxilaryClassCount > 29999) {
536 auxilaryClassCount = 0;
537 advanceAuxilaryOut();
533 if (writeToAuxiliaryOut) {
534 auxiliaryClassCount++;
535 if (auxiliaryClassCount > 29999) {
536 auxiliaryClassCount = 0;
537 advanceAuxiliaryOut();
538538 }
539 auxilaryOut.putNextEntry(newZipEntry(ze));
540 }
541
542 copyEntry(zipInputFile, ze, writeToAnalyzeOut, out, writeToAuxilaryOut, auxilaryOut);
539 auxiliaryOut.putNextEntry(newZipEntry(ze));
540 }
541
542 copyEntry(zipInputFile, ze, writeToAnalyzeOut, out, writeToAuxiliaryOut, auxiliaryOut);
543543 }
544544
545545 });
566566 return;
567567 }
568568
569 auxilaryClassCount++;
570 if (auxilaryClassCount > 29999) {
571 auxilaryClassCount = 0;
572 advanceAuxilaryOut();
573 }
574 auxilaryOut.putNextEntry(newZipEntry(ze));
575
576 copyEntry(zipInputFile, ze, false, null, true, auxilaryOut);
569 auxiliaryClassCount++;
570 if (auxiliaryClassCount > 29999) {
571 auxiliaryClassCount = 0;
572 advanceAuxiliaryOut();
573 }
574 auxiliaryOut.putNextEntry(newZipEntry(ze));
575
576 copyEntry(zipInputFile, ze, false, null, true, auxiliaryOut);
577577 }
578578
579579 });
580580 }
581581
582 if (auxilaryOut != null) {
583 auxilaryOut.close();
582 if (auxiliaryOut != null) {
583 auxiliaryOut.close();
584584 }
585585 for (ZipOutputStream out : analysisOutputFiles.values()) {
586586 out.close();
614614 }
615615
616616 private void copyEntry(ZipFile zipInputFile, ZipEntry ze, boolean writeToAnalyzeOut, ZipOutputStream analyzeOut1,
617 boolean writeToAuxilaryOut, ZipOutputStream auxilaryOut1) throws IOException {
617 boolean writeToAuxiliaryOut, ZipOutputStream auxiliaryOut1) throws IOException {
618618 InputStream zipIn = zipInputFile.getInputStream(ze);
619619
620620 while (true) {
625625 if (writeToAnalyzeOut) {
626626 analyzeOut1.write(buffer, 0, bytesRead);
627627 }
628 if (writeToAuxilaryOut) {
629 auxilaryOut1.write(buffer, 0, bytesRead);
628 if (writeToAuxiliaryOut) {
629 auxiliaryOut1.write(buffer, 0, bytesRead);
630630 }
631631 }
632632 if (writeToAnalyzeOut) {
633633 analyzeOut1.closeEntry();
634634 }
635 if (writeToAuxilaryOut) {
636 auxilaryOut1.closeEntry();
635 if (writeToAuxiliaryOut) {
636 auxiliaryOut1.closeEntry();
637637 }
638638 zipIn.close();
639639 }
640640
641 private void advanceAuxilaryOut() throws IOException, FileNotFoundException {
642 auxilaryOut.close();
643 auxilaryOut = createZipFile(getNextAuxilaryFileOutput());
641 private void advanceAuxiliaryOut() throws IOException, FileNotFoundException {
642 auxiliaryOut.close();
643 auxiliaryOut = createZipFile(getNextAuxiliaryFileOutput());
644644 }
645645
646646 boolean processZipEntries(File f, ZipElementHandler handler) {
9090 addOption("-projectName", "name", "set name for project");
9191 addOption("-timestamp", "when", "set timestamp for (last) revision");
9292 addSwitch("-resetSource", "remove all source search paths");
93 addSwitch("-resetProject", "remove all source search paths, analysis and auxilary classpath entries");
93 addSwitch("-resetProject", "remove all source search paths, analysis and auxiliary classpath entries");
9494 addOption("-source", "directory", "Add this directory to the source search path");
9595 addSwitch("-purgeStats", "purge/delete information about sizes of analyzed class files");
9696 addSwitch("-uploadDesignations", "upload all designations to cloud");
9292 UpdateCommandLine() {
9393 addSwitch("-overrideRevisionNames", "override revision names for each version with names computed filenames");
9494 addSwitch("-noPackageMoves",
95 "if a class seems to have moved from one package to another, treat warnings in that class as two seperate warnings");
95 "if a class seems to have moved from one package to another, treat warnings in that class as two separate warnings");
9696 addSwitch("-noResurrections",
9797 "if an issue had been detected in two versions but not in an intermediate version, record as two separate issues");
9898 addSwitch("-preciseMatch", "require bug patterns to match precisely");
0 /*
1 * Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements. See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 */
17 package org.apache.bcel.classfile;
18
19 import java.io.DataInput;
20 import java.io.DataOutputStream;
21 import java.io.IOException;
22
23 import org.apache.bcel.Const;
24
25 /**
26 * This class represents a stack map attribute used for
27 * preverification of Java classes for the <a
28 * href="http://java.sun.com/j2me/"> Java 2 Micro Edition</a>
29 * (J2ME). This attribute is used by the <a
30 * href="http://java.sun.com/products/cldc/">KVM</a> and contained
31 * within the Code attribute of a method. See CLDC specification
32 * �5.3.1.2
33 *
34 * @version $Id$
35 * @see Code
36 * @see StackMapTableEntry
37 * @see StackMapType
38 * @deprecated added here only to keep compatibility with BCEL 5.2 snapshot, see https://issues.apache.org/jira/browse/BCEL-248
39 */
40 public final class StackMapTable extends Attribute {
41
42 private StackMapTableEntry[] map; // Table of stack map entries
43
44
45 /*
46 * @param name_index Index of name
47 * @param length Content length in bytes
48 * @param map Table of stack map entries
49 * @param constant_pool Array of constants
50 */
51 public StackMapTable(final int name_index, final int length, final StackMapTableEntry[] map, final ConstantPool constant_pool) {
52 super(Const.ATTR_STACK_MAP, name_index, length, constant_pool);
53 this.map = map;
54 }
55
56
57 /**
58 * Construct object from input stream.
59 *
60 * @param name_index Index of name
61 * @param length Content length in bytes
62 * @param input Input stream
63 * @param constant_pool Array of constants
64 * @throws IOException
65 */
66 StackMapTable(final int name_index, final int length, final DataInput input, final ConstantPool constant_pool) throws IOException {
67 this(name_index, length, (StackMapTableEntry[]) null, constant_pool);
68 int map_length = input.readUnsignedShort();
69 map = new StackMapTableEntry[map_length];
70 for (int i = 0; i < map_length; i++) {
71 map[i] = new StackMapTableEntry(input, constant_pool);
72 }
73 }
74
75
76 /**
77 * Dump line number table attribute to file stream in binary format.
78 *
79 * @param file Output file stream
80 * @throws IOException
81 */
82 @Override
83 public final void dump( final DataOutputStream file ) throws IOException {
84 super.dump(file);
85 file.writeShort(map.length);
86 for (StackMapTableEntry entry : map) {
87 entry.dump(file);
88 }
89 }
90
91
92 /**
93 * @return Array of stack map entries
94 */
95 public final StackMapTableEntry[] getStackMapTable() {
96 return map;
97 }
98
99
100 /**
101 * @param map Array of stack map entries
102 */
103 public final void setStackMapTable( final StackMapTableEntry[] map ) {
104 this.map = map;
105 int len = 2; // Length of 'number_of_entries' field prior to the array of stack maps
106 for (StackMapTableEntry element : map) {
107 len += element.getMapEntrySize();
108 }
109 setLength(len);
110 }
111
112
113 /**
114 * @return String representation.
115 */
116 @Override
117 public final String toString() {
118 StringBuilder buf = new StringBuilder("StackMapTable(");
119 for (int i = 0; i < map.length; i++) {
120 buf.append(map[i]);
121 if (i < map.length - 1) {
122 buf.append(", ");
123 }
124 }
125 buf.append(')');
126 return buf.toString();
127 }
128
129
130 /**
131 * @return deep copy of this attribute
132 */
133 @Override
134 public Attribute copy( final ConstantPool _constant_pool ) {
135 StackMapTable c = (StackMapTable) clone();
136 c.map = new StackMapTableEntry[map.length];
137 for (int i = 0; i < map.length; i++) {
138 c.map[i] = map[i].copy();
139 }
140 c.setConstantPool(_constant_pool);
141 return c;
142 }
143
144
145 /**
146 * Called by objects that are traversing the nodes of the tree implicitely
147 * defined by the contents of a Java class. I.e., the hierarchy of methods,
148 * fields, attributes, etc. spawns a tree of objects.
149 *
150 * @param v Visitor object
151 */
152 @Override
153 public void accept( final Visitor v ) {
154 // v.visitStackMapTable(this);
155 throw new UnsupportedOperationException();
156 }
157
158
159 public final int getMapLength() {
160 return map == null ? 0 : map.length;
161 }
162 }
0 /*
1 * Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements. See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package org.apache.bcel.classfile;
18
19 import java.io.DataInput;
20 import java.io.DataOutputStream;
21 import java.io.IOException;
22 import org.apache.bcel.Const;
23
24 /**
25 * This class represents a stack map entry recording the types of
26 * local variables and the the of stack items at a given byte code offset.
27 * See CLDC specification �5.3.1.2
28 *
29 * @version $Id$
30 * @see StackMapTable
31 * @see StackMapType
32 * @deprecated added here only to keep compatibility with BCEL 5.2 snapshot, see https://issues.apache.org/jira/browse/BCEL-248
33 */
34 public final class StackMapTableEntry implements Node, Cloneable
35 {
36
37 private int frame_type;
38 private int byte_code_offset;
39 private StackMapType[] types_of_locals;
40 private StackMapType[] types_of_stack_items;
41 private ConstantPool constant_pool;
42
43
44 /**
45 * Construct object from input stream.
46 *
47 * @param input Input stream
48 * @throws IOException
49 */
50 StackMapTableEntry(final DataInput input, final ConstantPool constant_pool) throws IOException {
51 this(input.readByte() & 0xFF, -1, null, null, constant_pool);
52
53 if (frame_type >= Const.SAME_FRAME && frame_type <= Const.SAME_FRAME_MAX) {
54 byte_code_offset = frame_type - Const.SAME_FRAME;
55 } else if (frame_type >= Const.SAME_LOCALS_1_STACK_ITEM_FRAME &&
56 frame_type <= Const.SAME_LOCALS_1_STACK_ITEM_FRAME_MAX) {
57 byte_code_offset = frame_type - Const.SAME_LOCALS_1_STACK_ITEM_FRAME;
58 types_of_stack_items = new StackMapType[1];
59 types_of_stack_items[0] = new StackMapType(input, constant_pool);
60 } else if (frame_type == Const.SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED) {
61 byte_code_offset = input.readShort();
62 types_of_stack_items = new StackMapType[1];
63 types_of_stack_items[0] = new StackMapType(input, constant_pool);
64 } else if (frame_type >= Const.CHOP_FRAME && frame_type <= Const.CHOP_FRAME_MAX) {
65 byte_code_offset = input.readShort();
66 } else if (frame_type == Const.SAME_FRAME_EXTENDED) {
67 byte_code_offset = input.readShort();
68 } else if (frame_type >= Const.APPEND_FRAME && frame_type <= Const.APPEND_FRAME_MAX) {
69 byte_code_offset = input.readShort();
70 int number_of_locals = frame_type - 251;
71 types_of_locals = new StackMapType[number_of_locals];
72 for (int i = 0; i < number_of_locals; i++) {
73 types_of_locals[i] = new StackMapType(input, constant_pool);
74 }
75 } else if (frame_type == Const.FULL_FRAME) {
76 byte_code_offset = input.readShort();
77 int number_of_locals = input.readShort();
78 types_of_locals = new StackMapType[number_of_locals];
79 for (int i = 0; i < number_of_locals; i++) {
80 types_of_locals[i] = new StackMapType(input, constant_pool);
81 }
82 int number_of_stack_items = input.readShort();
83 types_of_stack_items = new StackMapType[number_of_stack_items];
84 for (int i = 0; i < number_of_stack_items; i++) {
85 types_of_stack_items[i] = new StackMapType(input, constant_pool);
86 }
87 } else {
88 /* Can't happen */
89 throw new ClassFormatException ("Invalid frame type found while parsing stack map table: " + frame_type);
90 }
91 }
92
93 /**
94 * DO NOT USE
95 *
96 * @param byte_code_offset
97 * @param number_of_locals NOT USED
98 * @param types_of_locals array of {@link StackMapType}s of locals
99 * @param number_of_stack_items NOT USED
100 * @param types_of_stack_items array ot {@link StackMapType}s of stack items
101 * @param constant_pool the constant pool
102 * @deprecated Since 6.0, use {@link #StackMapTableEntry(int, int, StackMapType[], StackMapType[], ConstantPool)}
103 * instead
104 */
105 public StackMapTableEntry(final int byte_code_offset, final int number_of_locals,
106 final StackMapType[] types_of_locals, final int number_of_stack_items,
107 final StackMapType[] types_of_stack_items, final ConstantPool constant_pool) {
108 this.byte_code_offset = byte_code_offset;
109 this.types_of_locals = types_of_locals != null ? types_of_locals : new StackMapType[0];
110 this.types_of_stack_items = types_of_stack_items != null ? types_of_stack_items : new StackMapType[0];
111 this.constant_pool = constant_pool;
112 }
113
114 /**
115 * Create an instance
116 *
117 * @param tag the frame_type to use
118 * @param byte_code_offset
119 * @param types_of_locals array of {@link StackMapType}s of locals
120 * @param types_of_stack_items array ot {@link StackMapType}s of stack items
121 * @param constant_pool the constant pool
122 */
123 public StackMapTableEntry(final int tag, final int byte_code_offset,
124 final StackMapType[] types_of_locals,
125 final StackMapType[] types_of_stack_items, final ConstantPool constant_pool) {
126 this.frame_type = tag;
127 this.byte_code_offset = byte_code_offset;
128 this.types_of_locals = types_of_locals != null ? types_of_locals : new StackMapType[0];
129 this.types_of_stack_items = types_of_stack_items != null ? types_of_stack_items : new StackMapType[0];
130 this.constant_pool = constant_pool;
131 }
132
133
134 /**
135 * Dump stack map entry
136 *
137 * @param file Output file stream
138 * @throws IOException
139 */
140 public final void dump( final DataOutputStream file ) throws IOException {
141 file.write(frame_type);
142 if (frame_type >= Const.SAME_FRAME && frame_type <= Const.SAME_FRAME_MAX) {
143 // nothing to be done
144 } else if (frame_type >= Const.SAME_LOCALS_1_STACK_ITEM_FRAME &&
145 frame_type <= Const.SAME_LOCALS_1_STACK_ITEM_FRAME_MAX) {
146 types_of_stack_items[0].dump(file);
147 } else if (frame_type == Const.SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED) {
148 file.writeShort(byte_code_offset);
149 types_of_stack_items[0].dump(file);
150 } else if (frame_type >= Const.CHOP_FRAME && frame_type <= Const.CHOP_FRAME_MAX) {
151 file.writeShort(byte_code_offset);
152 } else if (frame_type == Const.SAME_FRAME_EXTENDED) {
153 file.writeShort(byte_code_offset);
154 } else if (frame_type >= Const.APPEND_FRAME && frame_type <= Const.APPEND_FRAME_MAX) {
155 file.writeShort(byte_code_offset);
156 for (StackMapType type : types_of_locals) {
157 type.dump(file);
158 }
159 } else if (frame_type == Const.FULL_FRAME) {
160 file.writeShort(byte_code_offset);
161 file.writeShort(types_of_locals.length);
162 for (StackMapType type : types_of_locals) {
163 type.dump(file);
164 }
165 file.writeShort(types_of_stack_items.length);
166 for (StackMapType type : types_of_stack_items) {
167 type.dump(file);
168 }
169 } else {
170 /* Can't happen */
171 throw new ClassFormatException ("Invalid Stack map table tag: " + frame_type);
172 }
173 }
174
175
176 /**
177 * @return String representation.
178 */
179 @Override
180 public final String toString() {
181 StringBuilder buf = new StringBuilder(64);
182 buf.append("(");
183 if (frame_type >= Const.SAME_FRAME && frame_type <= Const.SAME_FRAME_MAX) {
184 buf.append("SAME");
185 } else if (frame_type >= Const.SAME_LOCALS_1_STACK_ITEM_FRAME &&
186 frame_type <= Const.SAME_LOCALS_1_STACK_ITEM_FRAME_MAX) {
187 buf.append("SAME_LOCALS_1_STACK");
188 } else if (frame_type == Const.SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED) {
189 buf.append("SAME_LOCALS_1_STACK_EXTENDED");
190 } else if (frame_type >= Const.CHOP_FRAME && frame_type <= Const.CHOP_FRAME_MAX) {
191 buf.append("CHOP ").append(String.valueOf(251-frame_type));
192 } else if (frame_type == Const.SAME_FRAME_EXTENDED) {
193 buf.append("SAME_EXTENDED");
194 } else if (frame_type >= Const.APPEND_FRAME && frame_type <= Const.APPEND_FRAME_MAX) {
195 buf.append("APPEND ").append(String.valueOf(frame_type-251));
196 } else if (frame_type == Const.FULL_FRAME) {
197 buf.append("FULL");
198 } else {
199 buf.append("UNKNOWN (").append(frame_type).append(")");
200 }
201 buf.append(", offset delta=").append(byte_code_offset);
202 if (types_of_locals.length > 0) {
203 buf.append(", locals={");
204 for (int i = 0; i < types_of_locals.length; i++) {
205 buf.append(types_of_locals[i]);
206 if (i < types_of_locals.length - 1) {
207 buf.append(", ");
208 }
209 }
210 buf.append("}");
211 }
212 if (types_of_stack_items.length > 0) {
213 buf.append(", stack items={");
214 for (int i = 0; i < types_of_stack_items.length; i++) {
215 buf.append(types_of_stack_items[i]);
216 if (i < types_of_stack_items.length - 1) {
217 buf.append(", ");
218 }
219 }
220 buf.append("}");
221 }
222 buf.append(")");
223 return buf.toString();
224 }
225
226
227 /**
228 * Calculate stack map entry size
229 *
230 */
231 int getMapEntrySize() {
232 if (frame_type >= Const.SAME_FRAME && frame_type <= Const.SAME_FRAME_MAX) {
233 return 1;
234 } else if (frame_type >= Const.SAME_LOCALS_1_STACK_ITEM_FRAME &&
235 frame_type <= Const.SAME_LOCALS_1_STACK_ITEM_FRAME_MAX) {
236 return 1 + (types_of_stack_items[0].hasIndex() ? 3 : 1);
237 } else if (frame_type == Const.SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED) {
238 return 3 + (types_of_stack_items[0].hasIndex() ? 3 : 1);
239 } else if (frame_type >= Const.CHOP_FRAME && frame_type <= Const.CHOP_FRAME_MAX) {
240 return 3;
241 } else if (frame_type == Const.SAME_FRAME_EXTENDED) {
242 return 3;
243 } else if (frame_type >= Const.APPEND_FRAME && frame_type <= Const.APPEND_FRAME_MAX) {
244 int len = 3;
245 for (StackMapType types_of_local : types_of_locals) {
246 len += types_of_local.hasIndex() ? 3 : 1;
247 }
248 return len;
249 } else if (frame_type == Const.FULL_FRAME) {
250 int len = 7;
251 for (StackMapType types_of_local : types_of_locals) {
252 len += types_of_local.hasIndex() ? 3 : 1;
253 }
254 for (StackMapType types_of_stack_item : types_of_stack_items) {
255 len += types_of_stack_item.hasIndex() ? 3 : 1;
256 }
257 return len;
258 } else {
259 throw new RuntimeException("Invalid StackMapTable frame_type: " + frame_type);
260 }
261 }
262
263
264 public void setFrameType( final int f ) {
265 if (f >= Const.SAME_FRAME && f <= Const.SAME_FRAME_MAX) {
266 byte_code_offset = f - Const.SAME_FRAME;
267 } else if (f >= Const.SAME_LOCALS_1_STACK_ITEM_FRAME &&
268 f <= Const.SAME_LOCALS_1_STACK_ITEM_FRAME_MAX) {
269 byte_code_offset = f - Const.SAME_LOCALS_1_STACK_ITEM_FRAME;
270 } else if (f == Const.SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED) { // CHECKSTYLE IGNORE EmptyBlock
271 } else if (f >= Const.CHOP_FRAME && f <= Const.CHOP_FRAME_MAX) { // CHECKSTYLE IGNORE EmptyBlock
272 } else if (f == Const.SAME_FRAME_EXTENDED) { // CHECKSTYLE IGNORE EmptyBlock
273 } else if (f >= Const.APPEND_FRAME && f <= Const.APPEND_FRAME_MAX) { // CHECKSTYLE IGNORE EmptyBlock
274 } else if (f == Const.FULL_FRAME) { // CHECKSTYLE IGNORE EmptyBlock
275 } else {
276 throw new RuntimeException("Invalid StackMapTable frame_type");
277 }
278 frame_type = f;
279 }
280
281
282 public int getFrameType() {
283 return frame_type;
284 }
285
286
287 public void setByteCodeOffset( final int new_offset ) {
288 if (new_offset < 0 || new_offset > 32767) {
289 throw new RuntimeException("Invalid StackMapTable offset: " + new_offset);
290 }
291
292 if (frame_type >= Const.SAME_FRAME &&
293 frame_type <= Const.SAME_FRAME_MAX) {
294 if (new_offset > Const.SAME_FRAME_MAX) {
295 frame_type = Const.SAME_FRAME_EXTENDED;
296 } else {
297 frame_type = new_offset;
298 }
299 } else if (frame_type >= Const.SAME_LOCALS_1_STACK_ITEM_FRAME &&
300 frame_type <= Const.SAME_LOCALS_1_STACK_ITEM_FRAME_MAX) {
301 if (new_offset > Const.SAME_FRAME_MAX) {
302 frame_type = Const.SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED;
303 } else {
304 frame_type = Const.SAME_LOCALS_1_STACK_ITEM_FRAME + new_offset;
305 }
306 } else if (frame_type == Const.SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED) { // CHECKSTYLE IGNORE EmptyBlock
307 } else if (frame_type >= Const.CHOP_FRAME &&
308 frame_type <= Const.CHOP_FRAME_MAX) { // CHECKSTYLE IGNORE EmptyBlock
309 } else if (frame_type == Const.SAME_FRAME_EXTENDED) { // CHECKSTYLE IGNORE EmptyBlock
310 } else if (frame_type >= Const.APPEND_FRAME &&
311 frame_type <= Const.APPEND_FRAME_MAX) { // CHECKSTYLE IGNORE EmptyBlock
312 } else if (frame_type == Const.FULL_FRAME) { // CHECKSTYLE IGNORE EmptyBlock
313 } else {
314 throw new RuntimeException("Invalid StackMapTable frame_type: " + frame_type);
315 }
316 byte_code_offset = new_offset;
317 }
318
319
320 /**
321 * Update the distance (as an offset delta) from this StackMapTable
322 * entry to the next. Note that this might cause the the
323 * frame type to change. Note also that delta may be negative.
324 *
325 * @param int offset delta
326 */
327 public void updateByteCodeOffset(final int delta) {
328 setByteCodeOffset(byte_code_offset + delta);
329 }
330
331
332 public int getByteCodeOffset() {
333 return byte_code_offset;
334 }
335
336
337 @java.lang.Deprecated
338 public void setNumberOfLocals( final int n ) { // TODO unused
339 }
340
341
342 public int getNumberOfLocals() {
343 return types_of_locals.length;
344 }
345
346
347 public void setTypesOfLocals( final StackMapType[] types ) {
348 types_of_locals = types != null ? types : new StackMapType[0];
349 }
350
351
352 public StackMapType[] getTypesOfLocals() {
353 return types_of_locals;
354 }
355
356
357 @java.lang.Deprecated
358 public void setNumberOfStackItems( final int n ) { // TODO unused
359 }
360
361
362 public int getNumberOfStackItems() {
363 return types_of_stack_items.length;
364 }
365
366
367 public void setTypesOfStackItems( final StackMapType[] types ) {
368 types_of_stack_items = types != null ? types : new StackMapType[0];
369 }
370
371
372 public StackMapType[] getTypesOfStackItems() {
373 return types_of_stack_items;
374 }
375
376
377 /**
378 * @return deep copy of this object
379 */
380 public StackMapTableEntry copy() {
381 StackMapTableEntry e;
382 try {
383 e = (StackMapTableEntry) clone();
384 } catch (CloneNotSupportedException ex) {
385 throw new Error("Clone Not Supported");
386 }
387
388 e.types_of_locals = new StackMapType[types_of_locals.length];
389 for (int i = 0; i < types_of_locals.length; i++) {
390 e.types_of_locals[i] = types_of_locals[i].copy();
391 }
392 e.types_of_stack_items = new StackMapType[types_of_stack_items.length];
393 for (int i = 0; i < types_of_stack_items.length; i++) {
394 e.types_of_stack_items[i] = types_of_stack_items[i].copy();
395 }
396 return e;
397 }
398
399
400 /**
401 * Called by objects that are traversing the nodes of the tree implicitely
402 * defined by the contents of a Java class. I.e., the hierarchy of methods,
403 * fields, attributes, etc. spawns a tree of objects.
404 *
405 * @param v Visitor object
406 */
407 @Override
408 public void accept( final Visitor v ) {
409 throw new UnsupportedOperationException();
410 // v.visitStackMapTableEntry(this);
411 }
412
413
414 /**
415 * @return Constant pool used by this object.
416 */
417 public final ConstantPool getConstantPool() {
418 return constant_pool;
419 }
420
421
422 /**
423 * @param constant_pool Constant pool to be used for this object.
424 */
425 public final void setConstantPool( final ConstantPool constant_pool ) {
426 this.constant_pool = constant_pool;
427 }
428 }
0 /*
1 * FindBugs - Find Bugs in Java programs
2 * Copyright (C) 2003-2008 University of Maryland
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19 package edu.umd.cs.findbugs;
20
21 import junit.framework.TestCase;
22
23 public class JavaVersionTest extends TestCase {
24
25 private static void testJavaVersionString(String version, int maj, int min, String rest)
26 throws JavaVersionException {
27 JavaVersion jv = new JavaVersion(version);
28 assertEquals(maj, jv.getMajor());
29 assertEquals(min, jv.getMinor());
30 assertEquals(rest, jv.getRest());
31 }
32
33 /**
34 * Test method for {@link edu.umd.cs.findbugs.JavaVersion#JavaVersion(java.lang.String)}.
35 * @throws JavaVersionException if version string cannot be parsed
36 */
37 public void testJavaVersionString() throws JavaVersionException {
38 // Historical versions (up to Java 8)
39 testJavaVersionString("1.7", 1, 7, "");
40 testJavaVersionString("1.7.0", 1, 7, "0");
41 testJavaVersionString("1.7.0_80", 1, 7, "0_80");
42 testJavaVersionString("1.8.0_66", 1, 8, "0_66");
43 // New scheme for Java 9 and later (JEP 223)
44 // See http://openjdk.java.net/jeps/223
45 testJavaVersionString("9-ea", 9, 0, "-ea");
46 testJavaVersionString("9", 9, 0, "");
47 testJavaVersionString("9.1.2", 9, 1, "2");
48 testJavaVersionString("9.0.1", 9, 0, "1");
49 // Long versions
50 testJavaVersionString("1.7.0_65-b20", 1, 7, "0_65-b20");
51 testJavaVersionString("7.6.15+20", 7, 6, "15+20");
52 testJavaVersionString("1.9.0-ea-b19", 1, 9, "0-ea-b19");
53 testJavaVersionString("9-ea+19", 9, 0, "-ea+19");
54 }
55 }
16461646 <ClassStats class="edu.umd.cs.findbugs.detect.BuildNonNullAnnotationDatabase" sourceFile="BuildNonNullAnnotationDatabase.java" interface="false" size="71" bugs="0"/>
16471647 <ClassStats class="edu.umd.cs.findbugs.detect.BuildNonnullReturnDatabase" sourceFile="BuildNonnullReturnDatabase.java" interface="false" size="58" bugs="0"/>
16481648 <ClassStats class="edu.umd.cs.findbugs.detect.BuildObligationPolicyDatabase" sourceFile="BuildObligationPolicyDatabase.java" interface="false" size="158" bugs="0"/>
1649 <ClassStats class="edu.umd.cs.findbugs.detect.BuildObligationPolicyDatabase$AuxilaryObligationPropertyDatabase" sourceFile="BuildObligationPolicyDatabase.java" interface="false" size="9" bugs="0"/>
1649 <ClassStats class="edu.umd.cs.findbugs.detect.BuildObligationPolicyDatabase$AuxiliaryObligationPropertyDatabase" sourceFile="BuildObligationPolicyDatabase.java" interface="false" size="9" bugs="0"/>
16501650 <ClassStats class="edu.umd.cs.findbugs.detect.BuildUnconditionalParamDerefDatabase" sourceFile="BuildUnconditionalParamDerefDatabase.java" interface="false" size="113" bugs="0"/>
16511651 <ClassStats class="edu.umd.cs.findbugs.detect.CallToUnconditionalThrower" sourceFile="CallToUnconditionalThrower.java" interface="false" size="75" bugs="0"/>
16521652 <ClassStats class="edu.umd.cs.findbugs.detect.CallToUnsupportedMethod" sourceFile="CallToUnsupportedMethod.java" interface="false" size="72" bugs="0"/>