Imported Upstream version 3.1.0~preview2
Emmanuel Bourg
7 years ago
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 | <?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 | <?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 | <?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 | 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 | #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 | 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 | 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 |
8 | 8 | lib/bcel-6.0-SNAPSHOT.jar, |
9 | 9 | lib/dom4j-1.6.1.jar, |
10 | 10 | lib/junit.jar, |
11 | lib/asm-debug-all-5.0.2.jar, | |
11 | lib/asm-debug-all-6.0-SNAPSHOT.jar, | |
12 | 12 | lib/jaxen-1.1.6.jar, |
13 | 13 | lib/jFormatString.jar, |
14 | 14 | lib/commons-lang-2.6.jar, |
95 | 95 | org.objectweb.asm.tree.analysis, |
96 | 96 | org.objectweb.asm.util, |
97 | 97 | 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!⏎ |
46 | 46 | <property name="engine.jar" value="${jar.dir}/findbugs.jar"/> |
47 | 47 | <property name="oneFourCompatibility.jar" value="${build.dir}/oneFourCompatibility.jar"/> |
48 | 48 | <property name="annotations.jar" value="${jar.dir}/annotations.jar"/> |
49 | <property name="findbugs-annotations.jar" value="${jar.dir}/findbugs-annotations.jar"/> | |
49 | 50 | <property name="test.jar" value="${test.dir}/dumb.jar"/> |
50 | 51 | <property name="sampleoutput.dir" value="build/sampleoutput"/> |
51 | 52 | <property name="junittests.jar" value="build/junittests.jar"/> |
106 | 107 | <target name="errorprone" depends="clean,init"> |
107 | 108 | <javac |
108 | 109 | destdir="${classes.dir}" |
109 | source="1.7" | |
110 | target="1.7" | |
110 | source="1.8" | |
111 | target="1.8" | |
111 | 112 | includeantruntime="false" |
112 | 113 | encoding="ISO-8859-1" |
113 | 114 | deprecation="off" |
121 | 122 | </javac> |
122 | 123 | </target> |
123 | 124 | <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}"> | |
126 | 127 | <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> | |
128 | 132 | </condition> |
129 | 133 | </fail> |
130 | 134 | |
132 | 136 | <echo level="info" message="compiling findbugs"/> |
133 | 137 | <javac |
134 | 138 | destdir="${classes.dir}" |
135 | source="1.7" | |
136 | target="1.7" | |
139 | source="1.8" | |
140 | target="1.8" | |
137 | 141 | includeantruntime="false" |
138 | 142 | encoding="ISO-8859-1" |
139 | 143 | deprecation="off" |
165 | 169 | <echo level="info" message="compiling junit test cases"/> |
166 | 170 | <javac srcdir="${junitsrc.dir}" |
167 | 171 | destdir="${junitclasses.dir}" |
168 | source="1.7" | |
169 | target="1.7" | |
172 | source="1.8" | |
173 | target="1.8" | |
170 | 174 | includeantruntime="false" |
171 | 175 | encoding="ISO-8859-1" |
172 | 176 | deprecation="off" |
177 | 181 | <echo level="info" message="compiling tools"/> |
178 | 182 | <javac srcdir="${toolsrc.dir}" |
179 | 183 | destdir="${classes.dir}" |
180 | source="1.7" | |
181 | target="1.7" | |
184 | source="1.8" | |
185 | target="1.8" | |
182 | 186 | includeantruntime="false" |
183 | 187 | encoding="ISO-8859-1" |
184 | 188 | debug="on" |
191 | 195 | <echo level="info" message="compiling ant task"/> |
192 | 196 | <javac srcdir="${anttasksrc.dir}" |
193 | 197 | destdir="${classes.dir}" |
194 | source="1.7" | |
195 | target="1.7" | |
198 | source="1.8" | |
199 | target="1.8" | |
196 | 200 | includeantruntime="false" |
197 | 201 | encoding="ISO-8859-1" |
198 | 202 | deprecation="off" |
299 | 303 | </fileset> |
300 | 304 | <zipfileset src="${jar.dir}/jcip-annotations.jar" excludes="META-INF/**,**/*.html"/> |
301 | 305 | <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> | |
302 | 316 | </jar> |
303 | 317 | </target> |
304 | 318 | |
1165 | 1179 | </delete> |
1166 | 1180 | </target> |
1167 | 1181 | |
1168 | <target name="init" depends="properties"> | |
1182 | <target name="init" depends="properties,getasm6,getbcel6"> | |
1169 | 1183 | <mkdir dir="${scripts.dir}"/> |
1170 | 1184 | <mkdir dir="${build.dir}"/> |
1171 | 1185 | <mkdir dir="${doc.dir}"/> |
1202 | 1216 | doctitle="FindBugs API Documentation" |
1203 | 1217 | Header="<b>FindBugs&trade; ${release.number}</b>" |
1204 | 1218 | Windowtitle="FindBugs ${release.number} API" |
1205 | bottom="<font size='-1'><a href='http://findbugs.sourceforge.net/' target='_parent'>FindBugs</a>&trade; is licenced under the LGPL. Copyright &copy; 2006 University of Maryland.</font>" | |
1219 | bottom="<font size='-1'><a href='http://findbugs.sourceforge.net/' target='_parent'>FindBugs</a>&trade; is licensed under the LGPL. Copyright &copy; 2006 University of Maryland.</font>" | |
1206 | 1220 | nodeprecated="false" nodeprecatedlist="false" noindex="false" nonavbar= "false" notree="false" |
1207 | 1221 | sourcepath="src/java:src/gui:src/antTask" splitindex="true" use="true" version="true"> |
1208 | 1222 | <classpath refid="findbugs.classpath"/> |
1218 | 1232 | nodeprecated="false" nodeprecatedlist="false" noindex="false" nonavbar= "false" notree="false" |
1219 | 1233 | sourcepath="src/java:src/gui:src/antTask" splitindex="true" use="true" version="true"/> |
1220 | 1234 | </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> | |
1221 | 1307 | |
1222 | 1308 | <!-- Download, patch, and build a modified BCEL 5.2. Install resulting bcel.jar in lib. --> |
1223 | 1309 | <target name="patchbcel"> |
0 | 0 | Manifest-Version: 1.0 |
1 | 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 | |
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 |
0 | 0 | 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> </td></tr>\n\ | |
6 | \n\ | |
7 | <tr><td><b>Docs and Info</b></td></tr> \n\ | |
8 | <tr><td><font size="-1"> <a class="sidebar" href="findbugs2.html">FindBugs 2.0</a></font></td></tr> \n\ | |
9 | <tr><td><font size="-1"> <a class="sidebar" href="demo.html">Demo and data</a></font></td></tr> \n\ | |
10 | <tr><td><font size="-1"> <a class="sidebar" href="users.html">Users and supporters</a></font></td></tr> \n\ | |
11 | <tr><td><font size="-1"> <a class="sidebar" href="http://findbugs.blogspot.com/">FindBugs blog</a></font></td></tr> \n\ | |
12 | <tr><td><font size="-1"> <a class="sidebar" href="factSheet.html">Fact sheet</a></font></td></tr> \n\ | |
13 | <tr><td><font size="-1"> <a class="sidebar" href="manual/index.html">Manual</a></font></td></tr> \n\ | |
14 | <tr><td><font size="-1"> <a class="sidebar" href="ja/manual/index.html">Manual(ja/日本語)</a></font></td></tr> \n\ | |
15 | <tr><td><font size="-1"> <a class="sidebar" href="FAQ.html">FAQ</a></font></td></tr> \n\ | |
16 | <tr><td><font size="-1"> <a class="sidebar" href="bugDescriptions.html">Bug descriptions</a></font></td></tr> \n\ | |
17 | <tr><td><font size="-1"> <a class="sidebar" href="bugDescriptions_ja.html">Bug descriptions(ja/日本語)</a></font></td></tr> \n\ | |
18 | <tr><td><font size="-1"> <a class="sidebar" href="bugDescriptions_fr.html">Bug descriptions(fr)</a></font></td></tr> \n\ | |
19 | <tr><td><font size="-1"> <a class="sidebar" href="mailingLists.html">Mailing lists</a></font></td></tr> \n\ | |
20 | <tr><td><font size="-1"> <a class="sidebar" href="publications.html">Documents and Publications</a></font></td></tr> \n\ | |
21 | <tr><td><font size="-1"> <a class="sidebar" href="links.html">Links</a></font></td></tr> \n\ | |
22 | \n\ | |
23 | <tr><td> </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> </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> </td></tr>\n\ | |
32 | \n\ | |
33 | <tr><td><b>Development</b></td></tr> \n\ | |
34 | <tr><td><font size="-1"> <a class="sidebar" href="http://sourceforge.net/p/findbugs/bugs/">Open bugs</a></font></td></tr> \n\ | |
35 | <tr><td><font size="-1"> <a class="sidebar" href="reportingBugs.html">Reporting bugs</a></font></td></tr> \n\ | |
36 | <tr><td><font size="-1"> <a class="sidebar" href="contributing.html">Contributing</a></font></td></tr> \n\ | |
37 | <tr><td><font size="-1"> <a class="sidebar" href="team.html">Dev team</a></font></td></tr> \n\ | |
38 | <tr><td><font size="-1"> <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"> <a class="sidebar" href="Changes.html">Change log</a></font></td></tr> \n\ | |
40 | <tr><td><font size="-1"> <a class="sidebar" href="http://sourceforge.net/projects/findbugs">SF project page</a></font></td></tr> \n\ | |
41 | <tr><td><font size="-1"> <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"> <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> </td></tr>\n\ | |
6 | \n\ | |
7 | <tr><td><b>Docs and Info</b></td></tr> \n\ | |
8 | <tr><td><font size="-1"> <a class="sidebar" href="findbugs2.html">FindBugs 2.0</a></font></td></tr> \n\ | |
9 | <tr><td><font size="-1"> <a class="sidebar" href="demo.html">Demo and data</a></font></td></tr> \n\ | |
10 | <tr><td><font size="-1"> <a class="sidebar" href="users.html">Users and supporters</a></font></td></tr> \n\ | |
11 | <tr><td><font size="-1"> <a class="sidebar" href="http://findbugs.blogspot.com/">FindBugs blog</a></font></td></tr> \n\ | |
12 | <tr><td><font size="-1"> <a class="sidebar" href="factSheet.html">Fact sheet</a></font></td></tr> \n\ | |
13 | <tr><td><font size="-1"> <a class="sidebar" href="manual/index.html">Manual</a></font></td></tr> \n\ | |
14 | <tr><td><font size="-1"> <a class="sidebar" href="ja/manual/index.html">Manual(ja/日本語)</a></font></td></tr> \n\ | |
15 | <tr><td><font size="-1"> <a class="sidebar" href="FAQ.html">FAQ</a></font></td></tr> \n\ | |
16 | <tr><td><font size="-1"> <a class="sidebar" href="bugDescriptions.html">Bug descriptions</a></font></td></tr> \n\ | |
17 | <tr><td><font size="-1"> <a class="sidebar" href="bugDescriptions_ja.html">Bug descriptions(ja/日本語)</a></font></td></tr> \n\ | |
18 | <tr><td><font size="-1"> <a class="sidebar" href="bugDescriptions_fr.html">Bug descriptions(fr)</a></font></td></tr> \n\ | |
19 | <tr><td><font size="-1"> <a class="sidebar" href="mailingLists.html">Mailing lists</a></font></td></tr> \n\ | |
20 | <tr><td><font size="-1"> <a class="sidebar" href="publications.html">Documents and Publications</a></font></td></tr> \n\ | |
21 | <tr><td><font size="-1"> <a class="sidebar" href="links.html">Links</a></font></td></tr> \n\ | |
22 | \n\ | |
23 | <tr><td> </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> </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> </td></tr>\n\ | |
32 | \n\ | |
33 | <tr><td><b>Development</b></td></tr> \n\ | |
34 | <tr><td><font size="-1"> <a class="sidebar" href="https://github.com/findbugsproject/findbugs/issues">Open bugs</a></font></td></tr> \n\ | |
35 | <tr><td><font size="-1"> <a class="sidebar" href="reportingBugs.html">Reporting bugs</a></font></td></tr> \n\ | |
36 | <tr><td><font size="-1"> <a class="sidebar" href="contributing.html">Contributing</a></font></td></tr> \n\ | |
37 | <tr><td><font size="-1"> <a class="sidebar" href="team.html">Dev team</a></font></td></tr> \n\ | |
38 | <tr><td><font size="-1"> <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"> <a class="sidebar" href="Changes.html">Change log</a></font></td></tr> \n\ | |
40 | <tr><td><font size="-1"> <a class="sidebar" href="https://github.com/findbugsproject/findbugs">GitHub project page</a></font></td></tr> \n\ | |
41 | <tr><td><font size="-1"> <a class="sidebar" href="https://github.com/findbugsproject/findbugs">Browse source</a></font></td></tr> \n\ | |
42 | <tr><td><font size="-1"> <a class="sidebar" href="https://github.com/findbugsproject/findbugs/commits/master">Latest code changes</a></font></td></tr> \n\ | |
43 | </table> \n\ | |
44 | </td> | |
45 | 45 | 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\ | |
48 | 48 | <!---//hide script from old browsers \n\ |
49 | 49 | document.write( "Last updated "+ document.lastModified + "." ); \n\ |
50 | 50 | //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&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&type=5" width="210" height="62" border="0" alt="FindBugs on SourceForge.net" /></a> | |
55 | 55 | doc.html.googleanalytics= \n\ |
56 | 56 | <script type="text/javascript"> \n\ |
57 | 57 | var _gaq = _gaq || []; \n\ |
63 | 63 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; \n\ |
64 | 64 | var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); \n\ |
65 | 65 | })(); \n\ |
66 | </script> | |
66 | </script> | |
67 | 67 | 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"/> | |
70 | 70 | 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"> | |
74 | 74 | doc.html.gen.endBody=\n\ |
75 | @HTML_FOOTER@\n\ | |
76 | </td></tr></table> | |
75 | @HTML_FOOTER@\n\ | |
76 | </td></tr></table> | |
77 | 77 | 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> | |
80 | 80 | 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>. 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>. 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. |
416 | 416 | reports="CAA_COVARIANT_ARRAY_FIELD,CAA_COVARIANT_ARRAY_RETURN,CAA_COVARIANT_ARRAY_LOCAL,CAA_COVARIANT_ARRAY_ELEMENT_STORE"/> |
417 | 417 | <Detector class="edu.umd.cs.findbugs.detect.DumbMethods" speed="fast" |
418 | 418 | 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 | "/> | |
420 | 419 | <Detector class="edu.umd.cs.findbugs.detect.NumberConstructor" speed="fast" |
421 | 420 | disabled="false" reports="DM_NUMBER_CTOR,DM_FP_NUMBER_CTOR"/> |
422 | 421 | <Detector class="edu.umd.cs.findbugs.detect.FindSqlInjection" speed="moderate" |
216 | 216 | <Detector class="edu.umd.cs.findbugs.detect.SynchronizationOnSharedBuiltinConstant"> |
217 | 217 | <Details> |
218 | 218 | <![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> | |
220 | 220 | ]]> |
221 | 221 | </Details> |
222 | 222 | </Detector> |
604 | 604 | <p> This detector generates a random signal: warnings that are just based on |
605 | 605 | hash values of the operations performed by methods. |
606 | 606 | 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. | |
608 | 608 | |
609 | 609 | This detector is just a hook for testing new detectors. |
610 | 610 | Normally, this detector does nothing.</p> |
868 | 868 | <Detector class="edu.umd.cs.findbugs.detect.IteratorIdioms"> |
869 | 869 | <Details> |
870 | 870 | <![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. | |
872 | 872 | </p> |
873 | 873 | ]]> |
874 | 874 | </Details> |
1205 | 1205 | <Details> |
1206 | 1206 | <![CDATA[ |
1207 | 1207 | <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 | |
1209 | 1209 | Thread.currentThread().interrupted(), then it is just a useless exercise, just use Thread.interrupted(). |
1210 | 1210 | However if it is called on an arbitrary thread object, it is most probably an error, as interrupted() |
1211 | 1211 | is always called on the current thread. |
1293 | 1293 | <Detector class="edu.umd.cs.findbugs.detect.FindCircularDependencies"> |
1294 | 1294 | <Details> |
1295 | 1295 | <![CDATA[ |
1296 | <p>This detector looks circular dependencies among classes. </p> | |
1296 | <p>This detector looks for circular dependencies among classes. </p> | |
1297 | 1297 | ]]> |
1298 | 1298 | </Details> |
1299 | 1299 | </Detector> |
1319 | 1319 | <![CDATA[ |
1320 | 1320 | <p>This detector looks for public classes that synchronize and use wait(), notify() or notifyAll() |
1321 | 1321 | 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 | |
1323 | 1323 | havoc to the base implementation. |
1324 | 1324 | </p> |
1325 | 1325 | ]]> |
1367 | 1367 | <Details> |
1368 | 1368 | <![CDATA[ |
1369 | 1369 | <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. | |
1371 | 1371 | </p> |
1372 | 1372 | ]]> |
1373 | 1373 | </Details> |
1397 | 1397 | <Detector class="edu.umd.cs.findbugs.detect.FindPuzzlers"> |
1398 | 1398 | <Details> |
1399 | 1399 | <![CDATA[ |
1400 | <p> This detector problems looks for miscellaneous small errors | |
1400 | <p> This detector looks for miscellaneous small errors | |
1401 | 1401 | mentioned by Joshua Bloch and Neal Gafter in |
1402 | 1402 | their work on Programming Puzzlers. |
1403 | 1403 | </p> |
1461 | 1461 | <Details> |
1462 | 1462 | <![CDATA[ |
1463 | 1463 | <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 | |
1465 | 1465 | class can not be derived from, the use of protected access for members is |
1466 | 1466 | incorrect. The access should be changed to public or private to represent |
1467 | 1467 | the correct intention of the field. This was probably caused by a change in |
1606 | 1606 | <Detector class="edu.umd.cs.findbugs.detect.AppendingToAnObjectOutputStream"> |
1607 | 1607 | <Details> |
1608 | 1608 | <![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> | |
1610 | 1610 | ]]> |
1611 | 1611 | </Details> |
1612 | 1612 | </Detector> |
1757 | 1757 | <LongDescription>Creation of ScheduledThreadPoolExecutor with zero core threads in {1}</LongDescription> |
1758 | 1758 | <Details> |
1759 | 1759 | <![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>) | |
1761 | 1761 | A ScheduledThreadPoolExecutor with zero core threads will never execute anything; changes to the max pool size are ignored. |
1762 | 1762 | </p> |
1763 | 1763 | |
1769 | 1769 | <LongDescription>Futile attempt to change max pool size of ScheduledThreadPoolExecutor in {1}</LongDescription> |
1770 | 1770 | <Details> |
1771 | 1771 | <![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>) | |
1773 | 1773 | 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. |
1774 | 1774 | </p> |
1775 | 1775 | |
2044 | 2044 | <Details> |
2045 | 2045 | <![CDATA[ |
2046 | 2046 | <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. | |
2050 | 2050 | </p> |
2051 | 2051 | ]]> |
2052 | 2052 | </Details> |
2133 | 2133 | <LongDescription>Unknown bug pattern BUG_PATTERN in {1}</LongDescription> |
2134 | 2134 | <Details> |
2135 | 2135 | <![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 | |
2137 | 2137 | and so can't describe it. This should occur only in cases of a bug in FindBugs or its configuration, |
2138 | 2138 | or perhaps if an analysis was generated using a plugin, but that plugin is not currently loaded. |
2139 | 2139 | .</p> |
2684 | 2684 | <Details> |
2685 | 2685 | <![CDATA[ |
2686 | 2686 | <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. | |
2688 | 2688 | </p> |
2689 | 2689 | ]]> |
2690 | 2690 | </Details> |
2888 | 2888 | </pre> |
2889 | 2889 | |
2890 | 2890 | <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. | |
2892 | 2892 | </p> |
2893 | 2893 | ]]> |
2894 | 2894 | </Details> |
3063 | 3063 | A large String constant is duplicated across multiple class files. |
3064 | 3064 | This is likely because a final field is initialized to a String constant, and the Java language |
3065 | 3065 | 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> | |
3067 | 3067 | for a description of an occurrence of this bug in the JDK and how resolving it reduced |
3068 | 3068 | the size of the JDK by 1 megabyte. |
3069 | 3069 | </p> |
3348 | 3348 | <LongDescription>{1} is a mutable servlet field</LongDescription> |
3349 | 3349 | <Details> |
3350 | 3350 | <![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 | |
3352 | 3352 | the class as a Singleton), |
3353 | 3353 | and will |
3354 | 3354 | have multiple threads invoke methods on that instance to service multiple |
3508 | 3508 | when evaluating the right-hand side can generate an error. |
3509 | 3509 | </p> |
3510 | 3510 | |
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. | |
3513 | 3513 | |
3514 | 3514 | </p> |
3515 | 3515 | ]]> |
3529 | 3529 | can result in errors if the left-hand side guards cases |
3530 | 3530 | when evaluating the right-hand side can generate an error. |
3531 | 3531 | |
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. | |
3534 | 3534 | |
3535 | 3535 | </p> |
3536 | 3536 | ]]> |
3598 | 3598 | <LongDescription>{2.name} isn't initialized in {1} when invoked from constructor for superclass</LongDescription> |
3599 | 3599 | <Details> |
3600 | 3600 | <![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, | |
3602 | 3602 | the fields of the class have not yet initialized.</p> |
3603 | 3603 | <p>To make this more concrete, consider the following classes:</p> |
3604 | 3604 | <pre>abstract class A { |
3621 | 3621 | the constructor for the <code>A</code> class is invoked |
3622 | 3622 | <em>before</em> the constructor for <code>B</code> sets <code>value</code>. |
3623 | 3623 | 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>. | |
3625 | 3625 | </p> |
3626 | 3626 | ]]> |
3627 | 3627 | </Details> |
3697 | 3697 | synchronized(LOCK) { ...} |
3698 | 3698 | ... |
3699 | 3699 | </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 | |
3701 | 3701 | is locking on something that other code might also be locking. This could result in very strange and hard to diagnose |
3702 | 3702 | 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>. |
3703 | 3703 | </p> |
3710 | 3710 | <LongDescription>Synchronization on Boolean in {1}</LongDescription> |
3711 | 3711 | <Details> |
3712 | 3712 | <![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> | |
3714 | 3714 | <pre> |
3715 | 3715 | private static Boolean inited = Boolean.FALSE; |
3716 | 3716 | ... |
3723 | 3723 | ... |
3724 | 3724 | </pre> |
3725 | 3725 | <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> | |
3727 | 3727 | <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> |
3728 | 3728 | ]]> |
3729 | 3729 | </Details> |
3772 | 3772 | </pre> |
3773 | 3773 | <p>Since Integer objects can be cached and shared, |
3774 | 3774 | 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> | |
3776 | 3776 | <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> |
3777 | 3777 | ]]> |
3778 | 3778 | </Details> |
4026 | 4026 | An inner class is invoking a method that could be resolved to either a inherited method or a method defined in an outer class. |
4027 | 4027 | For example, you invoke <code>foo(17)</code>, which is defined in both a superclass and in an outer method. |
4028 | 4028 | 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 | |
4030 | 4030 | you intend. |
4031 | 4031 | </p> |
4032 | 4032 | <p>If you really intend to invoke the inherited method, |
4894 | 4894 | <LongDescription>Useless condition: it's known that {2} at this point</LongDescription> |
4895 | 4895 | <Details> |
4896 | 4896 | <![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> | |
4899 | 4899 | ]]> |
4900 | 4900 | </Details> |
4901 | 4901 | </BugPattern> |
4905 | 4905 | <Details> |
4906 | 4906 | <![CDATA[ |
4907 | 4907 | <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> | |
4909 | 4909 | ]]> |
4910 | 4910 | </Details> |
4911 | 4911 | </BugPattern> |
5608 | 5608 | but it is possible to create other Boolean objects using the <code>new Boolean(b)</code> |
5609 | 5609 | constructor. It is best to avoid such objects, but if they do exist, |
5610 | 5610 | 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>. | |
5612 | 5612 | </p> |
5613 | 5613 | ]]> |
5614 | 5614 | </Details> |
5858 | 5858 | <Details> |
5859 | 5859 | <![CDATA[ |
5860 | 5860 | <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 | |
5862 | 5862 | to give the intended result. |
5863 | 5863 | </p> |
5864 | 5864 | ]]> |
5902 | 5902 | <p> This code generates a random signed integer and then computes |
5903 | 5903 | the absolute value of that random integer. If the number returned by the random number |
5904 | 5904 | 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). | |
5906 | 5906 | </p> |
5907 | 5907 | ]]> |
5908 | 5908 | </Details> |
5950 | 5950 | you may need to change your code. |
5951 | 5951 | If you know the divisor is a power of 2, |
5952 | 5952 | you can use a bitwise and operator instead (i.e., instead of |
5953 | using <code>x.hashCode()%n</code>, use <code>x.hashCode()&(n-1)</code>. | |
5953 | using <code>x.hashCode()%n</code>, use <code>x.hashCode()&(n-1)</code>). | |
5954 | 5954 | This is probably faster than computing the remainder as well. |
5955 | 5955 | If you don't know that the divisor is a power of 2, take the absolute |
5956 | 5956 | 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>). | |
5958 | 5958 | </p> |
5959 | 5959 | ]]> |
5960 | 5960 | </Details> |
5978 | 5978 | <p> Signed bytes can only have a value in the range -128 to 127. Comparing |
5979 | 5979 | a signed byte with a value outside that range is vacuous and likely to be incorrect. |
5980 | 5980 | To convert a signed byte <code>b</code> to an unsigned value in the range 0..255, |
5981 | use <code>0xff & b</code> | |
5981 | use <code>0xff & b</code>. | |
5982 | 5982 | </p> |
5983 | 5983 | ]]> |
5984 | 5984 | </Details> |
5990 | 5990 | <![CDATA[ |
5991 | 5991 | <p> This code compares an int value with a long constant that is outside |
5992 | 5992 | 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. | |
5994 | 5994 | </p> |
5995 | 5995 | ]]> |
5996 | 5996 | </Details> |
6039 | 6039 | <p> Loads a byte value (e.g., a value loaded from a byte array or returned by a method |
6040 | 6040 | with return type byte) and performs a bitwise OR with |
6041 | 6041 | 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. | |
6043 | 6043 | Thus, if <code>b[0]</code> contains the value <code>0xff</code>, and |
6044 | 6044 | <code>x</code> is initially 0, then the code |
6045 | 6045 | <code>((x << 8) | b[0])</code> will sign extend <code>0xff</code> |
6071 | 6071 | <![CDATA[ |
6072 | 6072 | <p> Adds a byte value and a value which is known to have the 8 lower bits clear. |
6073 | 6073 | 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. | |
6075 | 6075 | Thus, if <code>b[0]</code> contains the value <code>0xff</code>, and |
6076 | 6076 | <code>x</code> is initially 0, then the code |
6077 | 6077 | <code>((x << 8) + b[0])</code> will sign extend <code>0xff</code> |
6113 | 6113 | <LongDescription>Check for sign of bitwise operation in {1}</LongDescription> |
6114 | 6114 | <Details> |
6115 | 6115 | <![CDATA[ |
6116 | <p> This method compares an expression such as</p> | |
6117 | <pre>((event.detail & SWT.SELECTED) > 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 & SWT.SELECTED) > 0)</code>. | |
6118 | Using bit arithmetic and then comparing with the greater than operator can | |
6119 | 6119 | lead to unexpected results (of course depending on the value of |
6120 | 6120 | SWT.SELECTED). If SWT.SELECTED is a negative number, this is a candidate |
6121 | 6121 | for a bug. Even when SWT.SELECTED is not negative, it seems good practice |
6122 | 6122 | to use '!= 0' instead of '> 0'. |
6123 | 6123 | </p> |
6124 | <p> | |
6125 | <em>Boris Bokowski</em> | |
6126 | </p> | |
6127 | 6124 | ]]> |
6128 | 6125 | </Details> |
6129 | 6126 | </BugPattern> |
6130 | 6127 | <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 & SWT.SELECTED) > 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 & CONSTANT) > 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 | |
6141 | 6136 | to use '!= 0' instead of '> 0'. |
6142 | </p> | |
6143 | <p> | |
6144 | <em>Boris Bokowski</em> | |
6145 | 6137 | </p> |
6146 | 6138 | ]]> |
6147 | 6139 | </Details> |
6151 | 6143 | <LongDescription>Check to see if ((...) & 0) == 0 in {1}</LongDescription> |
6152 | 6144 | <Details> |
6153 | 6145 | <![CDATA[ |
6154 | <p> This method compares an expression of the form (e & 0) to 0, | |
6146 | <p> This method compares an expression of the form <code>(e & 0)</code> to 0, | |
6155 | 6147 | which will always compare equal. |
6156 | 6148 | This may indicate a logic error or typo.</p> |
6157 | 6149 | ]]> |
6162 | 6154 | <LongDescription>Incompatible bit masks in (e | {2} == {3}) yields constant result in {1}</LongDescription> |
6163 | 6155 | <Details> |
6164 | 6156 | <![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. | |
6166 | 6158 | which will always compare unequal |
6167 | 6159 | due to the specific values of constants C and D. |
6168 | 6160 | This may indicate a logic error or typo.</p> |
6170 | 6162 | <p> Typically, this bug occurs because the code wants to perform |
6171 | 6163 | a membership test in a bit set, but uses the bitwise OR |
6172 | 6164 | operator ("|") instead of bitwise AND ("&").</p> |
6165 | ||
6166 | <p>Also such bug may appear in expressions like <code>(e & A | B) == C</code> | |
6167 | which is parsed like <code>((e & A) | B) == C</code> while <code>(e & (A | B)) == C</code> was intended.</p> | |
6173 | 6168 | ]]> |
6174 | 6169 | </Details> |
6175 | 6170 | </BugPattern> |
6214 | 6209 | <p> This method contains an unsynchronized lazy initialization of a static field. |
6215 | 6210 | After the field is set, the object stored into that location is further updated or accessed. |
6216 | 6211 | 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 | |
6218 | 6213 | you have a <em>very serious</em> multithreading bug, unless something else prevents |
6219 | 6214 | any other thread from accessing the stored object until it is fully initialized. |
6220 | 6215 | </p> |
6508 | 6503 | <LongDescription>TestCase {0} has no tests</LongDescription> |
6509 | 6504 | <Details> |
6510 | 6505 | <![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> | |
6512 | 6507 | ]]> |
6513 | 6508 | </Details> |
6514 | 6509 | </BugPattern> |
6731 | 6726 | <![CDATA[ |
6732 | 6727 | <p> |
6733 | 6728 | 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> | |
6735 | 6730 | In Java 1.4 and earlier, a reference to <code>Foo.class</code> would force the static initializer |
6736 | 6731 | for <code>Foo</code> to be executed, if it has not been executed already. |
6737 | 6732 | In Java 5 and later, it does not. |
6738 | 6733 | </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> | |
6740 | 6735 | for more details and examples, and suggestions on how to force class initialization in Java 5. |
6741 | 6736 | </p> |
6742 | 6737 | ]]> |
7193 | 7188 | <Details> |
7194 | 7189 | <![CDATA[ |
7195 | 7190 | <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. | |
7198 | 7193 | </p> |
7199 | 7194 | ]]> |
7200 | 7195 | </Details> |
7205 | 7200 | <Details> |
7206 | 7201 | <![CDATA[ |
7207 | 7202 | <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. | |
7209 | 7204 | As a result, this will generate a runtime exception when executed. |
7210 | 7205 | For example, <code>String.format("%d", "1")</code> will generate an exception, since |
7211 | 7206 | the String "1" is incompatible with the format specifier %d. |
7432 | 7427 | <p>The correct way to do get an array of a specific type from a collection is to use |
7433 | 7428 | <code>c.toArray(new String[]);</code> |
7434 | 7429 | 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> | |
7436 | 7431 | method of lists returned by <code>Arrays.asList(...)</code> will return a covariantly |
7437 | 7432 | typed array. For example, <code>Arrays.asArray(new String[] { "a" }).toArray()</code> |
7438 | 7433 | will return a <code>String []</code>. FindBugs attempts to detect and suppress |
7577 | 7572 | The code here uses <code>File.separator</code> |
7578 | 7573 | where a regular expression is required. This will fail on Windows |
7579 | 7574 | 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 | |
7581 | 7576 | <code>File.separatorChar=='\\' ? "\\\\" : File.separator</code> instead of |
7582 | 7577 | <code>File.separator</code> |
7583 | 7578 | |
7661 | 7656 | <![CDATA[ |
7662 | 7657 | <p> |
7663 | 7658 | 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 | |
7665 | 7660 | the contents and length of the array. If you need a hashCode that |
7666 | 7661 | depends on the contents of an array <code>a</code>, |
7667 | 7662 | use <code>java.util.Arrays.hashCode(a)</code>. |
7709 | 7704 | use <code>(low+high) >>> 1</code> |
7710 | 7705 | </p> |
7711 | 7706 | <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> | |
7713 | 7708 | in the JDK libraries, and Joshua Bloch |
7714 | 7709 | <a href="http://googleresearch.blogspot.com/2006/06/extra-extra-read-all-about-it-nearly.html">widely |
7715 | 7710 | publicized the bug pattern</a>. |
8036 | 8031 | <LongDescription>{1} is static field of type java.util.Calendar, which isn't thread safe</LongDescription> |
8037 | 8032 | <Details> |
8038 | 8033 | <![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. | |
8040 | 8035 | Sharing a single instance across thread boundaries without proper synchronization will result in erratic behavior of the |
8041 | 8036 | application. Under 1.4 problems seem to surface less often than under Java 5 where you will probably see |
8042 | 8037 | random ArrayIndexOutOfBoundsExceptions or IndexOutOfBoundsExceptions in sun.util.calendar.BaseCalendar.getCalendarDateFromFixedDate().</p> |
8043 | 8038 | <p>You may also experience serialization problems.</p> |
8044 | 8039 | <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> | |
8047 | 8042 | ]]> |
8048 | 8043 | </Details> |
8049 | 8044 | </BugPattern> |
8052 | 8047 | <LongDescription>Call to method of static java.util.Calendar in {1}</LongDescription> |
8053 | 8048 | <Details> |
8054 | 8049 | <![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. | |
8056 | 8051 | 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> | |
8060 | 8055 | ]]> |
8061 | 8056 | </Details> |
8062 | 8057 | </BugPattern> |
8070 | 8065 | application.</p> |
8071 | 8066 | <p>You may also experience serialization problems.</p> |
8072 | 8067 | <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> | |
8075 | 8070 | ]]> |
8076 | 8071 | </Details> |
8077 | 8072 | </BugPattern> |
8082 | 8077 | <![CDATA[ |
8083 | 8078 | <p>As the JavaDoc states, DateFormats are inherently unsafe for multithreaded use. |
8084 | 8079 | 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> | |
8088 | 8083 | ]]> |
8089 | 8084 | </Details> |
8090 | 8085 | </BugPattern> |
8426 | 8421 | <Details> |
8427 | 8422 | <![CDATA[ |
8428 | 8423 | <p>FindBugs generated a warning that, according to a @NoWarning annotated, |
8429 | is unexpected or undesired</p> | |
8424 | is unexpected or undesired.</p> | |
8430 | 8425 | ]]> |
8431 | 8426 | </Details> |
8432 | 8427 | </BugPattern> |
8436 | 8431 | <Details> |
8437 | 8432 | <![CDATA[ |
8438 | 8433 | <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> | |
8440 | 8435 | ]]> |
8441 | 8436 | </Details> |
8442 | 8437 | </BugPattern> |
3307 | 3307 | </Details> |
3308 | 3308 | </BugPattern> |
3309 | 3309 | <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> | |
3311 | 3311 | <LongDescription>La méthode {1} utilise le même code pour deux branches</LongDescription> |
3312 | 3312 | <Details> |
3313 | 3313 | <![CDATA[ |
1997 | 1997 | --> |
1998 | 1998 | |
1999 | 1999 | <BugPattern type="CNT_ROUGH_CONSTANT_VALUE"> |
2000 | <ShortDescription>既知の定数の雑な値を見つける</ShortDescription> | |
2001 | <LongDescription>{3} の雑な値を見つけました: {2}</LongDescription> | |
2000 | <ShortDescription>既知の定数の大雑把な値を見つけた</ShortDescription> | |
2001 | <LongDescription>{3} の大雑把な値を見つけました: {2}</LongDescription> | |
2002 | 2002 | <Details> |
2003 | 2003 | <![CDATA[ |
2004 | 2004 | <p> |
2074 | 2074 | <Details> |
2075 | 2075 | <![CDATA[ |
2076 | 2076 | <p> |
2077 | このコードは、10進数の数にうまく変換されない double 値から BigDecimal を作成しています。 | |
2077 | このコードは10進数の数にうまく変換されない double 値から BigDecimal を作成しています。 | |
2078 | 2078 | たとえば、Java で <code>new BigDecimal(0.1)</code> と書くと、0.1と正確に等しい BigDecimal (スケールが1でスケールなしの値が1) が作成されると思うかもしれませんが、 |
2079 | 2079 | 実際には0.1000000000000000055511151231257827021181583404541015625と等しくなります。 |
2080 | 2080 | </p> |
2156 | 2156 | <Details> |
2157 | 2157 | <![CDATA[ |
2158 | 2158 | <p> |
2159 | このコードは、空白または空のパスワードを使用してデータベース接続を作成しています。 | |
2159 | このコードは空白または空のパスワードを使用してデータベース接続を作成しています。 | |
2160 | 2160 | これはデータベースがパスワードによって保護されていないことを示しています。 |
2161 | 2161 | </p> |
2162 | 2162 | ]]> |
2168 | 2168 | <Details> |
2169 | 2169 | <![CDATA[ |
2170 | 2170 | <p> |
2171 | このコードは、ハードコードされた定数パスワードを使用してデータベース接続を作成しています。 | |
2171 | このコードはハードコードされた定数パスワードを使用してデータベース接続を作成しています。 | |
2172 | 2172 | ソースコードかコンパイルされたコードへアクセスできる人なら誰でも簡単にパスワードを知ることができてしまいます。 |
2173 | 2173 | </p> |
2174 | 2174 | ]]> |
2187 | 2187 | </p> |
2188 | 2188 | <p> |
2189 | 2189 | FindBugs は、HRS の最も露骨で自明なケースだけを探します。 |
2190 | FindBugs が何かを発見したならほぼ間違いなく FindBugs が報告しないより多くの脆弱性があるでしょう。 | |
2190 | FindBugs が何かを派遣したならほぼ間違いなく FindBugs が報告しないより多くの脆弱性があるでしょう。 | |
2191 | 2191 | HRS を心配するなら、商用の静的解析ツールかペネトレーションテストツールの使用を真剣に検討するべきです。 |
2192 | 2192 | </p> |
2193 | 2193 | ]]> |
2200 | 2200 | <Details> |
2201 | 2201 | <![CDATA[ |
2202 | 2202 | <p> |
2203 | このコードは、HTTP ヘッダに HTTP パラメータを直接書き込んでいます。これは HRS(HTTP レスポンススプリッティング) 脆弱性を可能にします。<br> | |
2203 | このコードはHTTP ヘッダに HTTP パラメータを直接書き込んでいます。これは HRS(HTTP レスポンススプリッティング) 脆弱性を可能にします。<br> | |
2204 | 2204 | 詳細は、<a href="http://en.wikipedia.org/wiki/HTTP_response_splitting">http://en.wikipedia.org/wiki/HTTP_response_splitting</a> を参照してください。 |
2205 | 2205 | </p> |
2206 | 2206 | <p> |
2207 | 2207 | FindBugs は、HRS の最も露骨で自明なケースだけを探します。 |
2208 | FindBugs が何かを発見したならほぼ間違いなく FindBugs が報告しないより多くの脆弱性があるでしょう。 | |
2208 | FindBugs が何かを見つけたならほぼ間違いなく FindBugs が報告しないより多くの脆弱性があるでしょう。 | |
2209 | 2209 | HRS を心配するなら、商用の静的解析ツールかペネトレーションテストツールの使用を真剣に検討するべきです。 |
2210 | 2210 | </p> |
2211 | 2211 | ]]> |
2222 | 2222 | </p> |
2223 | 2223 | <p> |
2224 | 2224 | FindBugs は、相対パストラバーサルの最も露骨で自明なケースだけを探します。 |
2225 | FindBugs が何かを発見したならほぼ間違いなく FindBugs が報告しないより多くの脆弱性があるでしょう。 | |
2225 | FindBugs が何かを見つけたならほぼ間違いなく FindBugs が報告しないより多くの脆弱性があるでしょう。 | |
2226 | 2226 | 相対パストラバーサルを心配するなら、商用の静的解析ツールかペネトレーションテストツールの使用を真剣に検討するべきです。 |
2227 | 2227 | </p> |
2228 | 2228 | ]]> |
2239 | 2239 | </p> |
2240 | 2240 | <p> |
2241 | 2241 | FindBugs は、相対パストラバーサルの最も露骨で自明なケースだけを探します。 |
2242 | FindBugs が何かを発見したならほぼ間違いなく FindBugs が報告しないより多くの脆弱性があるでしょう。 | |
2242 | FindBugs が何かを見つけたならほぼ間違いなく FindBugs が報告しないより多くの脆弱性があるでしょう。 | |
2243 | 2243 | 相対パストラバーサルを心配するなら、商用の静的解析ツールかペネトレーションテストツールの使用を真剣に検討するべきです。 |
2244 | 2244 | </p> |
2245 | 2245 | ]]> |
2251 | 2251 | <Details> |
2252 | 2252 | <![CDATA[ |
2253 | 2253 | <p> |
2254 | このコードは、サーブレットの出力に HTTP パラメータを直接書き込んでいます。これは反射型 XSS(クロスサイトスクリプティング) 脆弱性を可能にします。<br> | |
2254 | このコードはサーブレットの出力に HTTP パラメータを直接書き込んでいます。これは反射型 XSS(クロスサイトスクリプティング) 脆弱性を可能にします。<br> | |
2255 | 2255 | 詳細は、<a href="http://en.wikipedia.org/wiki/Cross-site_scripting">http://en.wikipedia.org/wiki/Cross-site_scripting</a> を参照してください。 |
2256 | 2256 | </p> |
2257 | 2257 | <p> |
2258 | 2258 | FindBugs は、XSS の最も露骨で自明なケースだけを探します。 |
2259 | FindBugs が何かを発見したならほぼ間違いなく FindBugs が報告しないより多くの脆弱性があるでしょう。 | |
2259 | FindBugs が何かを見つけたならほぼ間違いなく FindBugs が報告しないより多くの脆弱性があるでしょう。 | |
2260 | 2260 | XSS を心配するなら、商用の静的解析ツールかペネトレーションテストツールの使用を真剣に検討するべきです。 |
2261 | 2261 | </p> |
2262 | 2262 | ]]> |
2269 | 2269 | <Details> |
2270 | 2270 | <![CDATA[ |
2271 | 2271 | <p> |
2272 | このコードは、サーブレットのエラーページに <code>HttpServletResponse.sendError</code> を使用して HTTP パラメータを直接書き込んでいます。 | |
2272 | このコードはサーブレットのエラーページに <code>HttpServletResponse.sendError</code> を使用して HTTP パラメータを直接書き込んでいます。 | |
2273 | 2273 | 信頼できない入力を返すことは反射型 XSS(クロスサイトスクリプティング) 脆弱性を可能にします。<br> |
2274 | 2274 | 詳細は、<a href="http://en.wikipedia.org/wiki/Cross-site_scripting">http://en.wikipedia.org/wiki/Cross-site_scripting</a> を参照してください。 |
2275 | 2275 | </p> |
2276 | 2276 | <p> |
2277 | 2277 | FindBugs は、XSS の最も露骨で自明なケースだけを探します。 |
2278 | FindBugs が何かを発見したならほぼ間違いなく FindBugs が報告しないより多くの脆弱性があるでしょう。 | |
2278 | FindBugs が何かを見つけたならほぼ間違いなく FindBugs が報告しないより多くの脆弱性があるでしょう。 | |
2279 | 2279 | XSS を心配するなら、商用の静的解析ツールかペネトレーションテストツールの使用を真剣に検討するべきです。 |
2280 | 2280 | </p> |
2281 | 2281 | ]]> |
2288 | 2288 | <Details> |
2289 | 2289 | <![CDATA[ |
2290 | 2290 | <p> |
2291 | このコードは、JSP の出力に HTTP パラメータを直接書き込んでいます。これは XSS(クロスサイトスクリプティング) 脆弱性を可能にします。<br> | |
2291 | このコードはJSP の出力に HTTP パラメータを直接書き込んでいます。これは XSS(クロスサイトスクリプティング) 脆弱性を可能にします。<br> | |
2292 | 2292 | 詳細は、<a href="http://en.wikipedia.org/wiki/Cross-site_scripting">http://en.wikipedia.org/wiki/Cross-site_scripting</a> を参照してください。 |
2293 | 2293 | </p> |
2294 | 2294 | <p> |
2295 | 2295 | FindBugs は、XSS の最も露骨で自明なケースだけを探します。 |
2296 | FindBugs が何かを発見したならほぼ間違いなく FindBugs が報告しないより多くの脆弱性があるでしょう。 | |
2296 | FindBugs が何かを見つけたならほぼ間違いなく FindBugs が報告しないより多くの脆弱性があるでしょう。 | |
2297 | 2297 | XSS に関して心配しているなら商用の静的解析ツールかペネトレーションテストツールの使用を真剣に検討するべきです。 |
2298 | 2298 | </p> |
2299 | 2299 | ]]> |
2373 | 2373 | <Details> |
2374 | 2374 | <![CDATA[ |
2375 | 2375 | <p> |
2376 | このコードは、volatile フィールドをインクリメントしています。 | |
2376 | このコードはvolatile フィールドをインクリメントしています。 | |
2377 | 2377 | volatile フィールドのインクリメントはアトミックではありません。 |
2378 | 2378 | 複数のスレッドが同時にフィールドをインクリメントすると、インクリメントが失われる可能性があります。 |
2379 | 2379 | </p> |
2409 | 2409 | </BugPattern> |
2410 | 2410 | |
2411 | 2411 | <BugPattern type="NP_OPTIONAL_RETURN_NULL"> |
2412 | <ShortDescription>Optional の戻り型を持つメソッドが明示的に null を返す</ShortDescription> | |
2412 | <ShortDescription>Optional の戻り型 ((java.util.Optional または com.google.common.base.Optional)) を持つメソッドが明示的に null を返す</ShortDescription> | |
2413 | 2413 | <LongDescription>{1} は、Optional の戻り型を持っていて、 明示的に null を返しています。</LongDescription> |
2414 | 2414 | <Details> |
2415 | 2415 | <![CDATA[ |
2416 | 2416 | <p> |
2417 | Optional の戻り型の使い方は、常に明示的に null を返すのは設計が望ましくないことを意味します。 | |
2417 | Optional の戻り型 ((java.util.Optional または com.google.common.base.Optional)) の使い方で明示的に null を返すのは設計が望ましくないことを意味します。 | |
2418 | 2418 | null 値をこのようなケースで返すことは契約違反で、多分クライアントコードを破壊するでしょう。 |
2419 | 2419 | </p> |
2420 | 2420 | ]]> |
2530 | 2530 | <Details> |
2531 | 2531 | <![CDATA[ |
2532 | 2532 | <p> |
2533 | このコードは、<code>putNextEntry</code> メソッドを呼び出して、<code>closeEntry</code> メソッドをすぐにを呼び出しています。 | |
2533 | このコードは <code>putNextEntry</code> メソッドを呼び出して、<code>closeEntry</code> メソッドをすぐにを呼び出しています。 | |
2534 | 2534 | これは空の ZIP ファイルエントリになります。 |
2535 | 2535 | エントリデータは <code>putNextEntry</code> メソッドと <code>closeEntry</code> メソッドの呼び出しの間で ZIP ファイルに書き込むべきです。 |
2536 | 2536 | </p> |
2544 | 2544 | <Details> |
2545 | 2545 | <![CDATA[ |
2546 | 2546 | <p> |
2547 | このコードは、<code>putNextEntry</code> メソッドを呼び出して、 <code>closeEntry</code> メソッドをすぐに呼び出しています。 | |
2547 | このコードは <code>putNextEntry</code> メソッドを呼び出して、 <code>closeEntry</code> メソッドをすぐに呼び出しています。 | |
2548 | 2548 | これは空の JAR ファイルエントリになります。 |
2549 | 2549 | エントリデータは <code>putNextEntry</code> メソッドと <code>closeEntry</code> メソッドの呼び出しの間で JAR ファイルに書き込むべきです。 |
2550 | 2550 | </p> |
2749 | 2749 | <Details> |
2750 | 2750 | <![CDATA[ |
2751 | 2751 | <p> |
2752 | このコードは、セキュリティ許可チェックが必要なメソッドを呼び出しています。 | |
2752 | このコードはセキュリティ許可チェックが必要なメソッドを呼び出しています。 | |
2753 | 2753 | このコードにセキュリティ許可が与えられるとしても、セキュリティ許可を持たないコードによって呼び出されるなら doPrivileged ブロックの中で呼び出す必要があります。 |
2754 | 2754 | </p> |
2755 | 2755 | ]]> |
3149 | 3149 | <Details> |
3150 | 3150 | <![CDATA[ |
3151 | 3151 | <p> |
3152 | このコードは、<code>Math.min(0, Math.max(100, value))</code> のような構文を使用して境界値を制限しようとしています。 | |
3152 | このコードは <code>Math.min(0, Math.max(100, value))</code> のような構文を使用して境界値を制限しようとしています。 | |
3153 | 3153 | しかしながら、定数の順序が間違っています。 <code>Math.min(100, Math.max(0, value))</code> とすべきです。 |
3154 | 3154 | 結果としてこのコードは常に同じ結果 (もし値が NaN なら NaN) を作り出します。 |
3155 | 3155 | </p> |
3204 | 3204 | <Details> |
3205 | 3205 | <![CDATA[ |
3206 | 3206 | <p> |
3207 | このコードは、定数でない文字列から SQL の <code>PreparedStatement</code> を作成しています。 | |
3207 | このコードは定数でない文字列から SQL の <code>PreparedStatement</code> を作成しています。 | |
3208 | 3208 | ユーザからのチェックされていない汚染されたデータがこの文字列を作る際に使われるなら、<code>PreparedStatement</code> で予想外で望ましくない何かをするために SQL インジェクションが使われる可能性があります。 |
3209 | 3209 | </p> |
3210 | 3210 | ]]> |
3473 | 3473 | |
3474 | 3474 | <BugPattern type="EQ_OVERRIDING_EQUALS_NOT_SYMMETRIC"> |
3475 | 3475 | <ShortDescription>equals メソッドはスーパークラスの equals メソッドをオーバーライドしているが、対称的ではないかもしれない</ShortDescription> |
3476 | <LongDescription>{1.class} は、{2.class.givenClass} で equals メソッドをオーバーラドしていますが、対称的ではないかもしれません。</LongDescription> | |
3476 | <LongDescription>{1.class} は、{2.class.givenClass} で equals メソッドをオーバーライドしていますが、対称的ではないかもしれません。</LongDescription> | |
3477 | 3477 | <Details> |
3478 | 3478 | <![CDATA[ |
3479 | 3479 | <p> |
3614 | 3614 | <Details> |
3615 | 3615 | <![CDATA[ |
3616 | 3616 | <p> |
3617 | このコードは、<code>compareTo</code> または <code>compare</code> メソッドの戻り値を無効にしています。 | |
3617 | このコードは <code>compareTo</code> または <code>compare</code> メソッドの戻り値を無効にしています。 | |
3618 | 3618 | これは疑わしいかバッドプログラミングプラクティスです。戻り値が Integer.MIN_VALUE なので、戻り値を無効にすることは結果の符号を無効にしません。 |
3619 | 3619 | 結果を無効にするのではなくオペランドの順序を逆にすることによって、同じ意図した結果を得ることができます。 |
3620 | 3620 | </p> |
3819 | 3819 | <Details> |
3820 | 3820 | <![CDATA[ |
3821 | 3821 | <p> |
3822 | このコードは、参照等価性のために == や != を使用して <code>java.lang.String</code> オブジェクトを比較しています。 | |
3822 | このコードは参照等価性のために == や != を使用して <code>java.lang.String</code> オブジェクトを比較しています。 | |
3823 | 3823 | 両方の文字列がソースファイルの定数か、<code>String.intern()</code> を使用して正準化されていないかぎり、同じ文字列は2つの異なる String オブジェクトによって表されるかもしれません。 |
3824 | 3824 | その代わりに <code>equals(Object)</code> メソッドを使用することを検討してください。 |
3825 | 3825 | </p> |
3833 | 3833 | <Details> |
3834 | 3834 | <![CDATA[ |
3835 | 3835 | <p> |
3836 | このコードは、参照等価性のために == や != を使用して <code>java.lang.String</code> パラメータを比較しています。 | |
3836 | このコードは参照等価性のために == や != を使用して <code>java.lang.String</code> パラメータを比較しています。 | |
3837 | 3837 | 文字列定数または正準化された文字列だけをメソッドに渡すことを呼び出し元に要求することは必要以上に脆弱で測定可能な性能の向上をもたらしません。 |
3838 | 3838 | その代わりに <code>equals(Object)</code> メソッドを使用することを検討してください。 |
3839 | 3839 | </p> |
3896 | 3896 | <li>少なくとも1つのロックされたアクセスがクラス自身のメソッドの1つによって実行され、</li> |
3897 | 3897 | <li>読み出しの2倍の重み付けをした書き込みで、非同期フィールドのアクセス (読み出しと書き込み) 数がすべてのアクセスのわずか1/3</li> |
3898 | 3898 | </ul> |
3899 | <p | |
3899 | <p> | |
3900 | 3900 | このバグパターンに合致する典型的なバグは、スレッドセーフを意図したクラスでメソッドを同期化させることを忘れていることです。 |
3901 | 3901 | </p> |
3902 | 3902 | <p> |
3962 | 3962 | <Details> |
3963 | 3963 | <![CDATA[ |
3964 | 3964 | <p> |
3965 | このコードは、オブジェクトの内部表現に外部の可変オブジェクトの参照を格納しています。 | |
3965 | このコードはオブジェクトの内部表現に外部の可変オブジェクトの参照を格納しています。 | |
3966 | 3966 | インスタンスが信頼できないコードによってアクセスされるなら、可変オブジェクトのチェックされていない変更がセキュリティや他の重要なプロパティを危うくするでしょう。 |
3967 | 3967 | 何か違うことをする必要があります。オブジェクトの新しいコピーを返すことは、多くの状況でより良いアプローチです。 |
3968 | 3968 | </p> |
3975 | 3975 | <Details> |
3976 | 3976 | <![CDATA[ |
3977 | 3977 | <p> |
3978 | このコードは、static フィールドに外部の可変オブジェクトを格納しています。 | |
3978 | このコードはstatic フィールドに外部の可変オブジェクトを格納しています。 | |
3979 | 3979 | 可変オブジェクトのチェックされていない変更がセキュリティや他の重要なプロパティを危うくするでしょう。 |
3980 | 3980 | 何か違うことをする必要があります。オブジェクトのコピーを保存することは、多くの状況でより良いアプローチです。 |
3981 | 3981 | </p> |
4016 | 4016 | <Details> |
4017 | 4017 | <![CDATA[ |
4018 | 4018 | <p> |
4019 | このコードは、短絡論理 (&& や ||) ではなく非短絡論理 (& や |) を使用していると思われます。 | |
4019 | このコードは短絡論理 (&& や ||) ではなく非短絡論理 (& や |) を使用していると思われます。 | |
4020 | 4020 | さらに、左辺値によって右辺を評価したくない (例外のスローや演算が高くつく副作用があるため) と思っているのかもしれません。 |
4021 | 4021 | 非短絡論理は、左辺を知ることによって結果を推論できたとしても両側の式が評価されます。 |
4022 | 4022 | これは効率が悪く、右辺の評価でエラーが発生するケースを左辺でガードしているなら、結果としてエラーになる可能性があります。 |
4033 | 4033 | <Details> |
4034 | 4034 | <![CDATA[ |
4035 | 4035 | <p> |
4036 | このコードは、短絡論理 (&& や ||) ではなく非短絡論理 (& や |) を使用していると思われます。 | |
4036 | このコードは短絡論理 (&& や ||) ではなく非短絡論理 (& や |) を使用していると思われます。 | |
4037 | 4037 | 非短絡論理は、左辺を知ることによって結果を推論できたとしても両側の式が評価されます。 |
4038 | 4038 | これは効率が悪く、右辺の評価でエラーが発生するケースを左辺でガードしているなら、結果としてエラーになる可能性があります。 |
4039 | 4039 | </p> |
4082 | 4082 | <![CDATA[ |
4083 | 4083 | <p> |
4084 | 4084 | このメソッドには条件制御フローによってガードされない <code>java.lang.Object.wait()</code> の呼び出しがあります。 |
4085 | このコードは、<code>wait</code> メソッドを呼び出す前に待機するつもりだった条件が既に満たされていないことを確かめるべきです。 | |
4085 | このコードは <code>wait</code> メソッドを呼び出す前に待機するつもりだった条件が既に満たされていないことを確かめるべきです。 | |
4086 | 4086 | どんな前の通知も無視されます。 |
4087 | 4087 | </p> |
4088 | 4088 | ]]> |
4213 | 4213 | <Details> |
4214 | 4214 | <![CDATA[ |
4215 | 4215 | <p> |
4216 | このコードは、正準化した文字列で同期化しています。 | |
4216 | このコードは正準化した文字列で同期化しています。 | |
4217 | 4217 | </p> |
4218 | 4218 | <blockquote><pre> |
4219 | 4219 | private static String LOCK = "LOCK"; |
4264 | 4264 | <Details> |
4265 | 4265 | <![CDATA[ |
4266 | 4266 | <p> |
4267 | このコードは、明らかに共有されていない <code>Integer</code> のようなボクシングされたプリミティブ型で同期化しています。 | |
4267 | このコードは明らかに共有されていない <code>Integer</code> のようなボクシングされたプリミティブ型で同期化しています。 | |
4268 | 4268 | </p> |
4269 | 4269 | <blockquote><pre> |
4270 | 4270 | private static final Integer fileLock = new Integer(1); |
4274 | 4274 | } |
4275 | 4275 | </pre></blockquote> |
4276 | 4276 | <p> |
4277 | このコードは、 fileLock を以下のように宣言するとより良くなります。 | |
4277 | このコードは fileLock を以下のように宣言するとより良くなります。 | |
4278 | 4278 | </p> |
4279 | 4279 | <blockquote><pre> |
4280 | 4280 | private static final Object fileLock = new Object(); |
4293 | 4293 | <Details> |
4294 | 4294 | <![CDATA[ |
4295 | 4295 | <p> |
4296 | このコードは、Integer のようなボクシングされたプリミティブ型の定数で同期化しています。 | |
4296 | このコードはInteger のようなボクシングされたプリミティブ型の定数で同期化しています。 | |
4297 | 4297 | </p> |
4298 | 4298 | <blockquote><pre> |
4299 | 4299 | private static Integer count = 0; |
4472 | 4472 | <![CDATA[ |
4473 | 4473 | <p> |
4474 | 4474 | この final static フィールドは Hashtable を参照しているので、悪意のあるコードや偶然別のパッケージによってアクセスできます。 |
4475 | このコードは、Hashtable のコンテンツを自由に変更できます。 | |
4475 | このコードはHashtable のコンテンツを自由に変更できます。 | |
4476 | 4476 | </p> |
4477 | 4477 | ]]> |
4478 | 4478 | </Details> |
4514 | 4514 | <![CDATA[ |
4515 | 4515 | <p> |
4516 | 4516 | この final static フィールドは配列を参照しているので、悪意のあるコードや偶然別のパッケージによってアクセスできます。 |
4517 | このコードは、配列のコンテンツを自由に変更できます。 | |
4517 | このコードは配列のコンテンツを自由に変更できます。 | |
4518 | 4518 | </p> |
4519 | 4519 | ]]> |
4520 | 4520 | </Details> |
4549 | 4549 | </BugPattern> |
4550 | 4550 | |
4551 | 4551 | <BugPattern type="ME_ENUM_FIELD_SETTER"> |
4552 | <ShortDescription>public 列挙型メソッドが無条件にフィールドを設定するPublic enum method unconditionally sets its field</ShortDescription> | |
4552 | <ShortDescription>public 列挙型メソッドが無条件にフィールドを設定する</ShortDescription> | |
4553 | 4553 | <LongDescription>{1} は無条件にフィールド {2.name} を設定しています。</LongDescription> |
4554 | 4554 | <Details> |
4555 | 4555 | <![CDATA[ |
4627 | 4627 | </BugPattern> |
4628 | 4628 | |
4629 | 4629 | <BugPattern type="NM_METHOD_NAMING_CONVENTION"> |
4630 | <ShortDescription>メソッド名は小文字から始めるべきです</ShortDescription> | |
4630 | <ShortDescription>メソッド名は小文字から始めるべき</ShortDescription> | |
4631 | 4631 | <LongDescription>メソッド名 {1} は、小文字から始まっていません。</LongDescription> |
4632 | 4632 | <Details> |
4633 | 4633 | <![CDATA[ |
4988 | 4988 | </BugPattern> |
4989 | 4989 | |
4990 | 4990 | <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> | |
4993 | 4993 | <Details> |
4994 | 4994 | <![CDATA[ |
4995 | 4995 | <p> |
5001 | 5001 | </BugPattern> |
5002 | 5002 | |
5003 | 5003 | <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> | |
5006 | 5006 | <Details> |
5007 | 5007 | <![CDATA[ |
5008 | 5008 | <p> |
5518 | 5518 | <Details> |
5519 | 5519 | <![CDATA[ |
5520 | 5520 | <p> |
5521 | この条件は常に関係している変数の値が前に絞られたのと同じ結果を作り出します。 | |
5521 | この条件は前に絞られた関係している変数の値と同じ結果を常に作り出します。 | |
5522 | 5522 | おそらく何かほかのことを意味していたのか、あるいは条件を除去できます。 |
5523 | 5523 | </p> |
5524 | 5524 | ]]> |
5531 | 5531 | <Details> |
5532 | 5532 | <![CDATA[ |
5533 | 5533 | <p> |
5534 | この条件は関係している変数の型範囲のために常に同じ結果を作り出します。 | |
5534 | この条件は関係している変数の型範囲のために同じ結果を常に作り出します。 | |
5535 | 5535 | おそらく何かほかのことを意味していたのか、あるいは条件を除去できます。 |
5536 | 5536 | </p> |
5537 | 5537 | ]]> |
5655 | 5655 | <Details> |
5656 | 5656 | <![CDATA[ |
5657 | 5657 | <p> |
5658 | このコードは、メソッドを呼び出して戻り値を無視しています。 | |
5658 | このコードはメソッドを呼び出して戻り値を無視しています。 | |
5659 | 5659 | しかしながら、解析はメソッド (もしあればサブクラスの実装も含む) が戻り値以外の効果をもたらさないことを示しています。 |
5660 | 5660 | この呼び出しは除去できます。 |
5661 | 5661 | </p> |
5680 | 5680 | </BugPattern> |
5681 | 5681 | |
5682 | 5682 | <BugPattern type="RV_RETURN_VALUE_IGNORED_INFERRED"> |
5683 | <ShortDescription>メソッドは戻り値を無視しています、これは間違いではないですか?</ShortDescription> | |
5683 | <ShortDescription>メソッドは戻り値を無視しています。これは間違いではないですか?</ShortDescription> | |
5684 | 5684 | <LongDescription>{2.givenClass} の戻り値を無視しています、これは間違いではないですか? {1}</LongDescription> |
5685 | 5685 | <Details> |
5686 | 5686 | <![CDATA[ |
5687 | 5687 | <p> |
5688 | このコードは、メソッドを呼び出して、戻り値を無視しています。 | |
5688 | このコードはメソッドを呼び出して、戻り値を無視しています。 | |
5689 | 5689 | 戻り値は、メソッドが呼び出される型と同じ型です。そして、我々の解析から戻り値が重要であるかもしれないように見えます (たとえば、<code>String.toLowerCase()</code> の戻り値を無視するような)。 |
5690 | 5690 | </p> |
5691 | 5691 | <p> |
5716 | 5716 | <p> |
5717 | 5717 | プログラマは、<code>trim</code> メソッドが <code>dateString</code> によって参照される String オブジェクトが更新されると思っています。 |
5718 | 5718 | しかし、String オブジェクトは不変で、<code>trim</code> メソッドが新しい String オブジェクトを返すのに無視しています。 |
5719 | このコードは、以下のように修正するべきです。 | |
5719 | このコードは以下のように修正するべきです。 | |
5720 | 5720 | </p> |
5721 | 5721 | <blockquote><pre> |
5722 | 5722 | String dateString = getHeaderField(name); |
5747 | 5747 | <Details> |
5748 | 5748 | <![CDATA[ |
5749 | 5749 | <p> |
5750 | このコードは、compareTo または compare メソッドを呼び出して、戻り値が特定の値(たとえば1または-1) なのか確かめています。 | |
5750 | このコードはcompareTo または compare メソッドを呼び出して、戻り値が特定の値(たとえば1または-1) なのか確かめています。 | |
5751 | 5751 | これらのメソッドを呼び出すときは特定のゼロ以外の値ではなく、結果の符号だけをチェックするべきです。 |
5752 | 5752 | 多数または大部分の compareTo と比較メソッドは-1、0または1を返しますが、いくつかは他の値を返します。 |
5753 | 5753 | </p> |
5761 | 5761 | <Details> |
5762 | 5762 | <![CDATA[ |
5763 | 5763 | <p> |
5764 | このコードは、例外 (またはエラー) オブジェクトを作成していますが、何もしていません。<br> | |
5764 | このコードは例外 (またはエラー) オブジェクトを作成していますが、何もしていません。<br> | |
5765 | 5765 | たとえば以下のようなコードです。 |
5766 | 5766 | </p> |
5767 | 5767 | <blockquote><pre> |
6585 | 6585 | <Details> |
6586 | 6586 | <![CDATA[ |
6587 | 6587 | <p> |
6588 | このコードは、<code>java.util.Random</code> オブジェクトを作成して1つの乱数を生成するために使用して捨てています。 | |
6588 | このコードは <code>java.util.Random</code> オブジェクトを作成して1つの乱数を生成するために使用して捨てています。 | |
6589 | 6589 | これはあまり良くない品質の乱数を作り出し、効率が悪いです。 |
6590 | 6590 | できれば、<code>Random</code> オブジェクトを1つだけ作成して保存されるようにコードを書き直してください。 |
6591 | 6591 | そして、毎回新しい乱数は既存の <code>Random</code> オブジェクトを呼び出して取得することが必要です。 |
6604 | 6604 | <Details> |
6605 | 6605 | <![CDATA[ |
6606 | 6606 | <p> |
6607 | このコードは、符号付き整数の乱数を生成して絶対値を計算しています。 | |
6607 | このコードは符号付き整数の乱数を生成して絶対値を計算しています。 | |
6608 | 6608 | 乱数ジェネレータで返される数が <code>Integer.MIN_VALUE</code> なら結果は同様に負です (<code>Math.abs(Integer.MIN_VALUE) == Integer.MIN_VALUE</code> なので)。 |
6609 | 6609 | (同じ問題は long 値でも同様に起きます)。 |
6610 | 6610 | </p> |
6618 | 6618 | <Details> |
6619 | 6619 | <![CDATA[ |
6620 | 6620 | <p> |
6621 | このコードは、ハッシュコードを生成して絶対値を計算しています。 | |
6621 | このコードはハッシュコードを生成して絶対値を計算しています。 | |
6622 | 6622 | ハッシュコードが <code>Integer.MIN_VALUE</code> なら結果は同様に負です (<code>Math.abs(Integer.MIN_VALUE) == Integer.MIN_VALUE</code> なので)。 |
6623 | 6623 | </p> |
6624 | 6624 | <p> |
6648 | 6648 | <Details> |
6649 | 6649 | <![CDATA[ |
6650 | 6650 | <p> |
6651 | このコードは、ハッシュコードを計算して別の値を法とする剰余を計算しています。 | |
6651 | このコードはハッシュコードを計算して別の値を法とする剰余を計算しています。 | |
6652 | 6652 | ハッシュコードは負になり、剰余演算の結果も負なります。 |
6653 | 6653 | </p> |
6654 | 6654 | <p> |
6667 | 6667 | <Details> |
6668 | 6668 | <![CDATA[ |
6669 | 6669 | <p> |
6670 | このコードは、負でないことが保証されている値と負の定数またはゼロとを比較しています。 | |
6670 | このコードは負でないことが保証されている値と負の定数またはゼロとを比較しています。 | |
6671 | 6671 | </p> |
6672 | 6672 | ]]> |
6673 | 6673 | </Details> |
6692 | 6692 | <Details> |
6693 | 6693 | <![CDATA[ |
6694 | 6694 | <p> |
6695 | このコードは、int 値と int 値として表される値の範囲外の long 定数を比較しています。 | |
6695 | このコードはint 値と int 値として表される値の範囲外の long 定数を比較しています。 | |
6696 | 6696 | この比較は無意味で、おそらく間違っています。 |
6697 | 6697 | </p> |
6698 | 6698 | ]]> |
6819 | 6819 | <Details> |
6820 | 6820 | <![CDATA[ |
6821 | 6821 | <p> |
6822 | このメソッドは、<code>((event.detail & SWT.SELECTED) > 0)</code> のような式を比較しています。 | |
6823 | ビット演算をより大きい演算子で比較することは、予想外の結果 (もちろん、<code>SWT.SELECTED</code> の値による) の原因になる可能性があります。 | |
6824 | <code>SWT.SELECTED</code> が負数であるなら、これはバグの候補です。 | |
6825 | <code>SWT.SELECTED</code> が負ではないとしても、'> 0' の代わりに '!= 0' を使用することは良いプラクティスと思われます。 | |
6826 | </p> | |
6827 | <p> | |
6828 | Boris Bokowski | |
6822 | このメソッドは、<code>((event.detail & SWT.SELECTED) > 0)</code> のような式で比較しています。 | |
6823 | ビット演算をより大きい演算子で比較することは、予想外の結果 (もちろん、SWT.SELECTED の値による) の原因になる可能性があります。 | |
6824 | SWT.SELECTED が負数であるなら、これはバグの候補です。 | |
6825 | SWT.SELECTED が負ではないとしても、'> 0' の代わりに '!= 0' を使用することが良いプラクティスであると思われます。 | |
6829 | 6826 | </p> |
6830 | 6827 | ]]> |
6831 | 6828 | </Details> |
6832 | 6829 | </BugPattern> |
6833 | 6830 | |
6834 | 6831 | <BugPattern type="BIT_SIGNED_CHECK_HIGH_BIT"> |
6835 | <ShortDescription>ビット演算の符号をチェックする</ShortDescription> | |
6836 | <LongDescription>ビット演算の符号をチェックしてください。{1}</LongDescription> | |
6837 | <Details> | |
6838 | <![CDATA[ | |
6839 | <p> | |
6840 | このメソッドは、<code>((event.detail & SWT.SELECTED) > 0)</code> のような式を比較しています。 | |
6841 | ビット演算をより大きい演算子で比較することは、予想外の結果 (もちろん、<code>SWT.SELECTED</code> の値による) の原因になる可能性があります。 | |
6842 | <code>SWT.SELECTED</code> が負数であるなら、これはバグの候補です。 | |
6843 | <code>SWT.SELECTED</code> が負ではないとしても、'> 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 & CONSTANT) > 0)</code> のようなビット演算式で比較しています。 | |
6838 | ビット演算をより大きい演算子で比較することは、予想外の結果の原因になる可能性があります。比較は期待したようになりません。 | |
6839 | '> 0' の代わりに '!= 0' を使用することが良いプラクティスです。 | |
6847 | 6840 | </p> |
6848 | 6841 | ]]> |
6849 | 6842 | </Details> |
6855 | 6848 | <Details> |
6856 | 6849 | <![CDATA[ |
6857 | 6850 | <p> |
6858 | このメソッドは、<i>(e & 0)</i> 形式の式を0と比較しています。それは、常に等価であることを比較します。論理エラーかタイプミスかもしれません。 | |
6851 | このメソッドは、<code>(e & 0)</code> 形式の式を0と比較しています。それは、常に等価であることを比較します。論理エラーかタイプミスかもしれません。 | |
6859 | 6852 | </p> |
6860 | 6853 | ]]> |
6861 | 6854 | </Details> |
6867 | 6860 | <Details> |
6868 | 6861 | <![CDATA[ |
6869 | 6862 | <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 の特定の値のために常に等しくないことを比較します。論理エラーかタイプミスかもしれません。 | |
6872 | 6865 | </p> |
6873 | 6866 | <p> |
6874 | 6867 | 典型的に、このバグは、ビットセットで帰属関係のテストを実行したいコードで発生します。 |
6875 | 6868 | しかし、ビット論理積演算子 ("&") の代わりにビット論理和演算子 ("|") を使用しています。 |
6869 | </p> | |
6870 | <p> | |
6871 | こうしたバグは <code>(e & (A | B)) == C</code> が意図されている間に <code>((e & A) | B) == C</code> のように解析される <code>(e & A | B) == C</code> のような式で現れるかもしれません。 | |
6876 | 6872 | </p> |
6877 | 6873 | ]]> |
6878 | 6874 | </Details> |
7127 | 7123 | <Details> |
7128 | 7124 | <![CDATA[ |
7129 | 7125 | <p> |
7130 | このコードは、String.indexOf() に長さ1の文字列定数を渡しています。String.indexOf() の整数実装を使うほうが効率的です。 | |
7126 | このコードはString.indexOf() に長さ1の文字列定数を渡しています。String.indexOf() の整数実装を使うほうが効率的です。 | |
7131 | 7127 | たとえば、<code>myString.indexOf(".")</code> の代わりに <code>myString.indexOf('.')</code> を呼び出します。 |
7132 | 7128 | </p> |
7133 | 7129 | ]]> |
7140 | 7136 | <Details> |
7141 | 7137 | <![CDATA[ |
7142 | 7138 | <p> |
7143 | このコードは、String.lastIndexOf() に長さ1の文字列定数を渡しています。String.lastIndexOf() の整数実装を使うほうが効率的です。 | |
7139 | このコードはString.lastIndexOf() に長さ1の文字列定数を渡しています。String.lastIndexOf() の整数実装を使うほうが効率的です。 | |
7144 | 7140 | たとえば、<code>myString.lastIndexOf(".")</code> の代わりに <code>myString.lastIndexOf('.')</code> を呼び出します。 |
7145 | 7141 | </p> |
7146 | 7142 | ]]> |
7580 | 7576 | <Details> |
7581 | 7577 | <![CDATA[ |
7582 | 7578 | <p> |
7583 | このコードは、浮動小数点が特別な非数値と等価であるか確かめています (たとえば <code>if (x == Double.NaN)</code>)。 | |
7579 | このコードは浮動小数点が特別な非数値と等価であるか確かめています (たとえば <code>if (x == Double.NaN)</code>)。 | |
7584 | 7580 | しかしながら、<code>NaN</code> の特別な意味のため、値は <code>NaN</code> と等価ではありません。 |
7585 | 7581 | したがって、<code>x == Double.NaN</code> は常に false と評価します。 |
7586 | 7582 | <code>x</code> という値が特別な非数値であるかどうか確かめるためには <code>Double.isNaN(x)</code> を使用します (または <code>x</code> が浮動小数点精度であるなら <code>Float.isNaN(x)</code>)。 |
7773 | 7769 | <Details> |
7774 | 7770 | <![CDATA[ |
7775 | 7771 | <p> |
7776 | このコードは、以下のように整数の乗算を実行してから結果を long に変換しています。 | |
7772 | このコードは以下のように整数の乗算を実行してから結果を long に変換しています。 | |
7777 | 7773 | </p> |
7778 | 7774 | <blockquote><pre> |
7779 | 7775 | long convertDaysToMilliseconds(int days) { return 1000*3600*24*days; } |
7802 | 7798 | <Details> |
7803 | 7799 | <![CDATA[ |
7804 | 7800 | <p> |
7805 | このコードは、32ビット int 値を64ビット long 値に変換して、絶対時間値を必要とするメソッドパラメータに渡しています。 | |
7801 | このコードは32ビット int 値を64ビット long 値に変換して、絶対時間値を必要とするメソッドパラメータに渡しています。 | |
7806 | 7802 | 絶対時間値は、「エポック」(すなわち、1970年1月1日、00:00:00 GMT)としてわかっている標準的な基準時間からのミリ秒数です。<br> |
7807 | 7803 | たとえば、次のメソッド (エポックからの秒を Date へ変換することを意図した) はひどく壊れています。 |
7808 | 7804 | </p> |
7833 | 7829 | <Details> |
7834 | 7830 | <![CDATA[ |
7835 | 7831 | <p> |
7836 | このコードは、整数値を float 精度浮動小数点に変換してから、その結果を <code>Math.round()</code> に渡して引数に最も近い int/long を返します。 | |
7832 | このコードは整数値を float 精度浮動小数点に変換してから、その結果を <code>Math.round()</code> に渡して引数に最も近い int/long を返します。 | |
7837 | 7833 | 整数を float に変換すると小数部がない数値が得られるので、この演算は常にノーオペレーションになります。 |
7838 | 7834 | <code>Math.round()</code>に渡される値を生成した演算が浮動小数点演算を使用して実行することを意図した可能性が高いです。 |
7839 | 7835 | </p> |
7847 | 7843 | <Details> |
7848 | 7844 | <![CDATA[ |
7849 | 7845 | <p> |
7850 | このコードは、整数値 (たとえば、int や long) を倍精度浮動小数点に変換してから、その結果を <code>Math.ceil()</code> に渡しています。 | |
7846 | このコードは整数値 (たとえば、int や long) を倍精度浮動小数点に変換してから、その結果を <code>Math.ceil()</code> に渡しています。 | |
7851 | 7847 | 整数を double に変換すると小数部がない数値が得られるので、この演算は常にノーオペレーションになります。 |
7852 | 7848 | <code>Math.ceil()</code>に渡される値を生成した演算が倍精度浮動小数点演算を使用して実行することを意図した可能性が高いです。 |
7853 | 7849 | </p> |
7861 | 7857 | <Details> |
7862 | 7858 | <![CDATA[ |
7863 | 7859 | <p> |
7864 | このコードは 整数の除算の結果を double または float にキャストしています。 | |
7860 | このコードは整数の除算の結果を double または float にキャストしています。 | |
7865 | 7861 | 整数で除算をすることは、ゼロに最も近い整数値まで結果を切り捨てます。 |
7866 | 7862 | 結果が double にキャストされたという事実は、この精度が維持されるべきだったことを示唆しています。 |
7867 | 7863 | おそらく意味されたことは、除算を実行する前にオペランドの1つまたは両方を double にキャストすることでした。<br> |
7886 | 7882 | <Details> |
7887 | 7883 | <![CDATA[ |
7888 | 7884 | <p> |
7889 | このコードは、HttpSession に非直列化可能オブジェクトを格納していると思われます。 | |
7885 | このコードは HttpSession に非直列化可能オブジェクトを格納していると思われます。 | |
7890 | 7886 | このセッションが不活性化されるか移行したなら、エラーを招きます。 |
7891 | 7887 | </p> |
7892 | 7888 | ]]> |
7899 | 7895 | <Details> |
7900 | 7896 | <![CDATA[ |
7901 | 7897 | <p> |
7902 | このコードは、<code>ObjectOutput.writeObject</code> に非直列化可能オブジェクトを渡していると思われます。 | |
7898 | このコードは <code>ObjectOutput.writeObject</code> に非直列化可能オブジェクトを渡していると思われます。 | |
7903 | 7899 | このオブジェクトが本当に非直列化可能なら、エラーを招きます。 |
7904 | 7900 | </p> |
7905 | 7901 | ]]> |
7912 | 7908 | <Details> |
7913 | 7909 | <![CDATA[ |
7914 | 7910 | <p> |
7915 | この書式文字列は、前の書式指示子の引数が再利用されるようにするために「相対インデックス ("<")」を指定しています。 | |
7911 | この書式文字列は前の書式指示子の引数が再利用されるようにするために「相対インデックス ("<")」を指定しています。 | |
7916 | 7912 | しかしながら、前の引数がありません。 |
7917 | 7913 | たとえば、<code>formatter.format("%<s %s", "a", "b")</code> が実行されると MissingFormatArgumentException をスローします。 |
7918 | 7914 | </p> |
7926 | 7922 | <Details> |
7927 | 7923 | <![CDATA[ |
7928 | 7924 | <p> |
7929 | この書式文字列には改行文字 (\n) が含まれています。 | |
7925 | この書式文字列は改行文字 (\n) が含まれています。 | |
7930 | 7926 | 一般的に書式文字列には %n を使用することがより望ましいです。%n は、プラットホーム特有の行セパレータを作り出します。 |
7931 | 7927 | </p> |
7932 | 7928 | ]]> |
7934 | 7930 | </BugPattern> |
7935 | 7931 | |
7936 | 7932 | <BugPattern type="VA_FORMAT_STRING_BAD_CONVERSION"> |
7937 | <ShortDescription>与えられた引数の型は書式指示子に合致しません</ShortDescription> | |
7933 | <ShortDescription>与えられた引数の型は書式指示子に合致しない</ShortDescription> | |
7938 | 7934 | <LongDescription>引数の型 {3} は、書式指示子 {4} によって扱えません。{1}</LongDescription> |
7939 | 7935 | <Details> |
7940 | 7936 | <![CDATA[ |
7941 | 7937 | <p> |
7942 | 引数の1つは、対応する書式指示子と互換性がありません。その結果、実行されるときに実行時例外を生成します。 | |
7938 | 引数の1つは対応する書式指示子と互換性がありません。その結果、実行されるときに実行時例外を生成します。 | |
7943 | 7939 | たとえば、<code>String.format("%d", "1")</code> は、文字列 "1" が書式指示子 "%d" と互換性がないので例外を生成します。 |
7944 | 7940 | </p> |
7945 | 7941 | ]]> |
8084 | 8080 | <Details> |
8085 | 8081 | <![CDATA[ |
8086 | 8082 | <p> |
8087 | このコードは、Collection を抽象コレクションにキャストしています (たとえば <code>List</code>、<code>Set</code>、<code>Map</code>)。 | |
8083 | このコードはCollection を抽象コレクションにキャストしています (たとえば <code>List</code>、<code>Set</code>、<code>Map</code>)。 | |
8088 | 8084 | オブジェクトがキャストする型であるということが保証されていることを確認してください。 |
8089 | 8085 | 必要とするコレクションの反復処理ができるなら Set または List にキャストする必要はありません。 |
8090 | 8086 | </p> |
8139 | 8135 | <Details> |
8140 | 8136 | <![CDATA[ |
8141 | 8137 | <p> |
8142 | このコードは、以下のように、<code>Object[]</code> より特定の型のコレクションで <code>toArray</code> メソッドを呼び出す結果をキャストしています。 | |
8138 | このコードは以下のように、<code>Object[]</code> より特定の型のコレクションで <code>toArray</code> メソッドを呼び出す結果をキャストしています。 | |
8143 | 8139 | </p> |
8144 | 8140 | <blockquote><pre> |
8145 | 8141 | String[] getAsArray(Collection<String> c) { |
8232 | 8228 | <Details> |
8233 | 8229 | <![CDATA[ |
8234 | 8230 | <p> |
8235 | このコードは、メソッドの戻り値の未確認のキャストを実行しています。 | |
8231 | このコードはメソッドの戻り値の未確認のキャストを実行しています。 | |
8236 | 8232 | コードは、キャストが安全であることが保証されるようにメソッドを呼び出しているかもしれませんが、FindBugs はキャストが安全であることを検証できません。 |
8237 | 8233 | プログラムのロジックがこのキャストが失敗しないことを確実に確認してください。 |
8238 | 8234 | </p> |
8280 | 8276 | <Details> |
8281 | 8277 | <![CDATA[ |
8282 | 8278 | <p> |
8283 | このコードは、正規表現の構文によると無効である正規表現を使用しています。 | |
8279 | このコードは正規表現の構文によると無効である正規表現を使用しています。 | |
8284 | 8280 | この文が実行されるとき PatternSyntaxException をスローします。 |
8285 | 8281 | </p> |
8286 | 8282 | ]]> |
8293 | 8289 | <Details> |
8294 | 8290 | <![CDATA[ |
8295 | 8291 | <p> |
8296 | このコードは、正規表現が必要な場所で、<code>File.separator</code> を使用しています。 | |
8292 | このコードは正規表現が必要な場所で、<code>File.separator</code> を使用しています。 | |
8297 | 8293 | これは <code>File.separator</code> がバックスラッシュである Windows プラットホームでは失敗します。 |
8298 | 8294 | バックスラッシュは正規表現ではエスケープ文字として解釈されます。 |
8299 | 8295 | その他の選択肢としては、<code>File.separator</code> の代わりに <code>File.separatorChar=='\\' ? "\\\\" : File.separator</code> を使用できます。 |
8308 | 8304 | <Details> |
8309 | 8305 | <![CDATA[ |
8310 | 8306 | <p> |
8311 | このコードは、インクリメント演算 (たとえば、<code>i++</code>) を実行してすぐに上書きしています。 | |
8307 | このコードはインクリメント演算 (たとえば、<code>i++</code>) を実行してすぐに上書きしています。 | |
8312 | 8308 | たとえば、<code>i = i++</code> は元の値をインクリメントした値で上書きします。 |
8313 | 8309 | </p> |
8314 | 8310 | ]]> |
8321 | 8317 | <Details> |
8322 | 8318 | <![CDATA[ |
8323 | 8319 | <p> |
8324 | このコードは、符号なしキャストの実行結果を short または byte にキャストしています。結果の上位ビットは捨てられます。 | |
8320 | このコードは符号なしキャストの実行結果を short または byte にキャストしています。結果の上位ビットは捨てられます。 | |
8325 | 8321 | 上位ビットが捨てられるので、符号付きと符号なし右シフト (シフトのサイズによって) との違いがないかもしれません。 |
8326 | 8322 | </p> |
8327 | 8323 | ]]> |
8348 | 8344 | <Details> |
8349 | 8345 | <![CDATA[ |
8350 | 8346 | <p> |
8351 | このコードは、32ビット int の-31から31の範囲を超えた量でシフトを実行しています。 | |
8347 | このコードは32ビット int の-31から31の範囲を超えた量でシフトを実行しています。 | |
8352 | 8348 | これの効果は、どのくらいシフトするのかを決めるために整数値の下位5ビット (32で割った余り) を使用することです (たとえば、40ビットでシフトすることは8ビットでシフトすることと同じで、32ビットでシフトすることは0ビットでシフトすることと同じです)。 |
8353 | 8349 | これはおそらく期待されたことではなく、少なくとも紛らわしいです。 |
8354 | 8350 | </p> |
8362 | 8358 | <Details> |
8363 | 8359 | <![CDATA[ |
8364 | 8360 | <p> |
8365 | このコードは、整数剰余の結果に整数定数を乗算しています。 | |
8361 | このコードは整数剰余の結果に整数定数を乗算しています。 | |
8366 | 8362 | 紛らわしい演算子の優先順位がないことを確実にしてください。 |
8367 | 8363 | たとえば、i % 60 * 1000 は、i % (60 * 1000) ではなく (i % 60) * 1000 となります。 |
8368 | 8364 | </p> |
8376 | 8372 | <Details> |
8377 | 8373 | <![CDATA[ |
8378 | 8374 | <p> |
8379 | このコードは、配列で <code>hashCode</code> メソッドを呼び出しています。 | |
8375 | このコードは配列で <code>hashCode</code> メソッドを呼び出しています。 | |
8380 | 8376 | 配列で <code>hashCode</code> メソッドを呼び出すことは、System.identityHashCode と同じ値を返すので、コンテンツと配列の長さを無視します。 |
8381 | 8377 | 配列 <code>a</code> のコンテンツによるハッシュコードを必要とするなら、<code>java.util.Arrays.hashCode(a)</code> を使用してください。 |
8382 | 8378 | </p> |
8390 | 8386 | <Details> |
8391 | 8387 | <![CDATA[ |
8392 | 8388 | <p> |
8393 | このコードは、配列で <code>toString</code> メソッドを呼び出しています。「[C@16f0472」のようなかなり役に立たない結果を生成します。 | |
8389 | このコードは配列で <code>toString</code> メソッドを呼び出しています。「[C@16f0472」のようなかなり役に立たない結果を生成します。 | |
8394 | 8390 | 配列のコンテンツを与え、読める文字列に変換するために <code>Arrays.toString()</code> を使用することを検討してください。<br> |
8395 | 8391 | 『Programming Puzzlers』の第3章、パズル12を参照してください。 |
8396 | 8392 | </p> |
8404 | 8400 | <Details> |
8405 | 8401 | <![CDATA[ |
8406 | 8402 | <p> |
8407 | このコードは、無名の配列で <code>toString</code> メソッドを呼び出しています。「[C@16f0472」のようなかなり役に立たない結果を生成します。 | |
8403 | このコードは無名の配列で <code>toString</code> メソッドを呼び出しています。「[C@16f0472」のようなかなり役に立たない結果を生成します。 | |
8408 | 8404 | 配列のコンテンツを与え、読める文字列に変換するために <code>Arrays.toString()</code> を使用することを検討してください。<br> |
8409 | 8405 | 『Programming Puzzlers』の第3章、パズル12を参照してください。 |
8410 | 8406 | </p> |
8418 | 8414 | <Details> |
8419 | 8415 | <![CDATA[ |
8420 | 8416 | <p> |
8421 | このコードは、除算か符号付き右シフトを使用して2つの整数の平均を計算して、結果を配列の添字として使用しています。 | |
8417 | このコードは除算か符号付き右シフトを使用して2つの整数の平均を計算して、結果を配列の添字として使用しています。 | |
8422 | 8418 | 平均値が非常に大きいならオーバーフローする可能性があります (結果として負の平均の計算になる)。 |
8423 | 8419 | 結果が負でないことを意図していたなら、その代わりに符号なし右シフトを使用できます。 |
8424 | 8420 | つまり、<code>(low+high)/2</code> ではなく <code>(low+high) >>> 1</code> を使用してください。 |
8438 | 8434 | <Details> |
8439 | 8435 | <![CDATA[ |
8440 | 8436 | <p> |
8441 | このコードは、<code>x % 2 == 1</code> を使用して値が負数なのか確かめていますが、負数 (たとえば、<code>(-5) % 2 == -1</code>) なので機能しません。 | |
8437 | このコードは <code>x % 2 == 1</code> を使用して値が負数なのか確かめていますが、負数 (たとえば、<code>(-5) % 2 == -1</code>) なので機能しません。 | |
8442 | 8438 | 奇数チェックを意図しているなら、<code>x & 1 == 1</code> または <code>x % 2 != 0</code> を使用することを検討してください。 |
8443 | 8439 | </p> |
8444 | 8440 | ]]> |
8451 | 8447 | <Details> |
8452 | 8448 | <![CDATA[ |
8453 | 8449 | <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>)。 | |
8455 | 8451 | </p> |
8456 | 8452 | ]]> |
8457 | 8453 | </Details> |
8463 | 8459 | <Details> |
8464 | 8460 | <![CDATA[ |
8465 | 8461 | <p> |
8466 | このコードは、メソッドに0から11の範囲外の月定数値を渡しています。 | |
8462 | このコードはメソッドに0から11の範囲外の月定数値を渡しています。 | |
8467 | 8463 | </p> |
8468 | 8464 | ]]> |
8469 | 8465 | </Details> |
8475 | 8471 | <Details> |
8476 | 8472 | <![CDATA[ |
8477 | 8473 | <p> |
8478 | このコードは、文字列で <code>substring(0)</code> を呼び出していますが、元の値を返します。 | |
8474 | このコードは文字列で <code>substring(0)</code> を呼び出していますが、元の値を返します。 | |
8479 | 8475 | </p> |
8480 | 8476 | ]]> |
8481 | 8477 | </Details> |
8772 | 8768 | </BugPattern> |
8773 | 8769 | |
8774 | 8770 | <BugPattern type="STCAL_STATIC_SIMPLE_DATE_FORMAT_INSTANCE"> |
8775 | <ShortDescription>static DateFormat</ShortDescription> | |
8771 | <ShortDescription>static DateFormat フィールド</ShortDescription> | |
8776 | 8772 | <LongDescription>{1} は、java.text.DateFormat 型の static フィールドです。それはスレッドセーフではありません。</LongDescription> |
8777 | 8773 | <Details> |
8778 | 8774 | <![CDATA[ |
8941 | 8937 | <Details> |
8942 | 8938 | <![CDATA[ |
8943 | 8939 | <p> |
8944 | このコードは、ファイルを追加モードで開いて、オブジェクト出力ストリームの中で結果をラップしています。 | |
8940 | このコードはファイルを追加モードで開いて、オブジェクト出力ストリームの中で結果をラップしています。 | |
8945 | 8941 | これはファイルに格納された既存のオブジェクト出力ストリームに追加できないでしょう。 |
8946 | 8942 | オブジェクト出力ストリームに追加したいなら、オブジェクト出力ストリームを開いておく必要があります。 |
8947 | 8943 | </p> |
8975 | 8971 | </pre></blockquote> |
8976 | 8972 | <p> |
8977 | 8973 | <code>Label</code> のサブクラスは同じサブクラスで同期化しません。データレースを生じさせます。 |
8978 | 代わりに、このコードは、<code>Label.class</code> で同期化するべきです。 | |
8974 | 代わりに、このコードは <code>Label.class</code> で同期化するべきです。 | |
8979 | 8975 | </p> |
8980 | 8976 | <blockquote><pre> |
8981 | 8977 | 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"> | |
1 | 1 | <modelVersion>4.0.0</modelVersion> |
2 | 2 | <parent> |
3 | 3 | <groupId>org.sonatype.oss</groupId> |
4 | 4 | <artifactId>oss-parent</artifactId> |
5 | 5 | <version>7</version> |
6 | <relativePath></relativePath> | |
6 | <relativePath /> | |
7 | 7 | </parent> |
8 | 8 | |
9 | 9 | <groupId>com.google.code.findbugs</groupId> |
10 | 10 | <artifactId>findbugs</artifactId> |
11 | <version>3.0.1-SNAPSHOT</version> | |
11 | <version>3.1.0-SNAPSHOT</version> | |
12 | 12 | <packaging>jar</packaging> |
13 | 13 | |
14 | 14 | <url>http://findbugs.sourceforge.net/</url> |
59 | 59 | <developer> |
60 | 60 | <id>bp</id> |
61 | 61 | <name>Keith Lea</name> |
62 | <email></email> | |
62 | <email /> | |
63 | 63 | <url>http://keithlea.com/</url> |
64 | 64 | <roles> |
65 | 65 | <role>web cloud</role> |
88 | 88 | </contributor> |
89 | 89 | <contributor> |
90 | 90 | <name>Nay Ayewah</name> |
91 | <email></email> | |
92 | <url></url> | |
93 | <roles> | |
94 | <role></role> | |
91 | <email /> | |
92 | <url /> | |
93 | <roles> | |
94 | <role /> | |
95 | 95 | </roles> |
96 | 96 | <timezone>-5</timezone> |
97 | 97 | </contributor> |
98 | 98 | <contributor> |
99 | 99 | <name>Ben Langmead</name> |
100 | <email></email> | |
101 | <url></url> | |
102 | <roles> | |
103 | <role></role> | |
100 | <email /> | |
101 | <url /> | |
102 | <roles> | |
103 | <role /> | |
104 | 104 | </roles> |
105 | 105 | <timezone>-5</timezone> |
106 | 106 | </contributor> |
107 | 107 | <contributor> |
108 | 108 | <name>Tomas Pollak</name> |
109 | <email></email> | |
110 | <url></url> | |
109 | <email /> | |
110 | <url /> | |
111 | 111 | <roles> |
112 | 112 | <role>Eclipse plugin tests</role> |
113 | 113 | </roles> |
115 | 115 | </contributor> |
116 | 116 | <contributor> |
117 | 117 | <name>Phil Crosby</name> |
118 | <email></email> | |
119 | <url></url> | |
120 | <roles> | |
121 | <role></role> | |
118 | <email /> | |
119 | <url /> | |
120 | <roles> | |
121 | <role /> | |
122 | 122 | </roles> |
123 | 123 | <timezone>-5</timezone> |
124 | 124 | </contributor> |
125 | 125 | <contributor> |
126 | 126 | <name>Peter Friese</name> |
127 | <email></email> | |
128 | <url></url> | |
127 | <email /> | |
128 | <url /> | |
129 | 129 | <roles> |
130 | 130 | <role>Eclipse plugin</role> |
131 | 131 | </roles> |
133 | 133 | </contributor> |
134 | 134 | <contributor> |
135 | 135 | <name>Dave Brosius</name> |
136 | <email></email> | |
137 | <url></url> | |
138 | <roles> | |
139 | <role></role> | |
136 | <email /> | |
137 | <url /> | |
138 | <roles> | |
139 | <role /> | |
140 | 140 | </roles> |
141 | 141 | <timezone>-5</timezone> |
142 | 142 | </contributor> |
143 | 143 | <contributor> |
144 | 144 | <name>Brian Goetz</name> |
145 | <email></email> | |
146 | <url></url> | |
147 | <roles> | |
148 | <role></role> | |
145 | <email /> | |
146 | <url /> | |
147 | <roles> | |
148 | <role /> | |
149 | 149 | </roles> |
150 | 150 | <timezone>-5</timezone> |
151 | 151 | </contributor> |
152 | 152 | <contributor> |
153 | 153 | <name>Rohan Lloyd</name> |
154 | <email></email> | |
155 | <url></url> | |
156 | <roles> | |
157 | <role></role> | |
154 | <email /> | |
155 | <url /> | |
156 | <roles> | |
157 | <role /> | |
158 | 158 | </roles> |
159 | 159 | <timezone>-5</timezone> |
160 | 160 | </contributor> |
161 | 161 | <contributor> |
162 | 162 | <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 /> | |
167 | 167 | </roles> |
168 | 168 | <timezone>+6</timezone> |
169 | 169 | </contributor> |
245 | 245 | </dependency> |
246 | 246 | </dependencies> |
247 | 247 | <build> |
248 | <sourceDirectory>${basedir}/src</sourceDirectory> | |
248 | <sourceDirectory>${basedir}/src/java</sourceDirectory> | |
249 | 249 | <testSourceDirectory>${basedir}/src/junit</testSourceDirectory> |
250 | 250 | <resources> |
251 | 251 | <resource> |
274 | 274 | </includes> |
275 | 275 | </resource> |
276 | 276 | <resource> |
277 | <directory>${basedir}/src/antTask</directory> | |
277 | <directory>${basedir}/src/gui</directory> | |
278 | 278 | <includes> |
279 | 279 | <include>**/*.xsl</include> |
280 | 280 | <include>**/*.properties</include> |
284 | 284 | </includes> |
285 | 285 | </resource> |
286 | 286 | <resource> |
287 | <directory>${basedir}/src/gui</directory> | |
287 | <directory>${basedir}/src/java</directory> | |
288 | 288 | <includes> |
289 | 289 | <include>**/*.xsl</include> |
290 | 290 | <include>**/*.properties</include> |
293 | 293 | <include>**/*.html</include> |
294 | 294 | </includes> |
295 | 295 | </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> | |
306 | 296 | </resources> |
307 | 297 | <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> | |
308 | 316 | <plugin> |
309 | 317 | <groupId>org.apache.maven.plugins</groupId> |
310 | 318 | <artifactId>maven-javadoc-plugin</artifactId> |
311 | 319 | <version>2.9.1</version> |
312 | <configuration> | |
313 | <sourcepath>src/java</sourcepath> | |
314 | </configuration> | |
315 | 320 | </plugin> |
316 | 321 | <plugin> |
317 | 322 | <groupId>org.apache.maven.plugins</groupId> |
328 | 333 | <testExcludes> |
329 | 334 | <exclude>**/architecture/**</exclude> |
330 | 335 | <exclude>**/cloud/**</exclude> |
331 | <!-- --> | |
332 | 336 | <exclude>**/DetectorsTest.java</exclude> |
333 | 337 | </testExcludes> |
334 | 338 | </configuration> |
0 | 0 | #! /bin/sh |
1 | 1 | 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 | |
3 | 3 | mvn clean |
4 | 4 | mvn package |
159 | 159 | getProject().setProperty(errorProperty, "true"); |
160 | 160 | } |
161 | 161 | if ((rc & ExitCodes.ERROR_FLAG) != 0) { |
162 | String message = "At least one error occured!"; | |
162 | String message = "At least one error occurred!"; | |
163 | 163 | if (failIfBugFound) { |
164 | 164 | throw new BuildException(message); |
165 | 165 | } else { |
50 | 50 | * <li>debug (boolean default false) |
51 | 51 | * <li>effort (enum min|default|max)</li> |
52 | 52 | * <li>excludeFilter (filter filename) |
53 | * <li>excludePath (classpath or classpathRef to filters) | |
53 | 54 | * <li>failOnError (boolean - default false) |
54 | 55 | * <li>home (findbugs install dir) |
55 | 56 | * <li>includeFilter (filter filename) |
57 | * <li>includePath (classpath or classpathRef to filters) | |
56 | 58 | * <li>maxRank (maximum rank issue to be reported) |
57 | 59 | * <li>jvm (Set the command used to start the VM) |
58 | 60 | * <li>jvmargs (any additional jvm arguments) |
59 | * <li>omitVisitors (collection - comma seperated) | |
61 | * <li>omitVisitors (collection - comma separated) | |
60 | 62 | * <li>onlyAnalyze (restrict analysis to find bugs to given comma-separated list |
61 | 63 | * of classes and packages - See the textui argument description for details) |
62 | 64 | * <li>output (enum text|xml|xml:withMessages|html - default xml) |
75 | 77 | * "default.xsl") |
76 | 78 | * <li>systemProperty (a system property to set) |
77 | 79 | * <li>timestampNow (boolean - default false) |
78 | * <li>visitors (collection - comma seperated) | |
80 | * <li>visitors (collection - comma separated) | |
79 | 81 | * <li>chooseVisitors (selectively enable/disable visitors) |
80 | 82 | * <li>workHard (boolean default false) |
81 | 83 | * <li>setSetExitCode (boolean default true) |
135 | 137 | |
136 | 138 | private File excludeFile; |
137 | 139 | |
140 | private Path excludePath; | |
141 | ||
138 | 142 | private File includeFile; |
143 | ||
144 | private Path includePath; | |
139 | 145 | |
140 | 146 | private Path auxClasspath; |
141 | 147 | |
531 | 537 | */ |
532 | 538 | public void setSourcePathRef(Reference r) { |
533 | 539 | 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); | |
534 | 596 | } |
535 | 597 | |
536 | 598 | /** |
727 | 789 | addArg("-exclude"); |
728 | 790 | addArg(excludeFile.getPath()); |
729 | 791 | } |
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 | } | |
730 | 799 | if (includeFile != null) { |
731 | 800 | addArg("-include"); |
732 | 801 | 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 | } | |
733 | 809 | } |
734 | 810 | if (visitors != null) { |
735 | 811 | addArg("-visitors"); |
31 | 31 | /** |
32 | 32 | * FindBugsViewerTask.java -- Ant Task to launch the FindBugsFrame |
33 | 33 | * |
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 | |
35 | 35 | * "findbugs-viewer"). Then call this task while passing in parameters to modify |
36 | 36 | * it's behaviour. It supports several options that are the same as the findbugs |
37 | 37 | * task: |
705 | 705 | <p>Changes since version 1.3.5</p> |
706 | 706 | <ul> |
707 | 707 | <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 | |
709 | 709 | specifiers, or mismatched format specifiers and arguments (e.g, |
710 | 710 | passing a String value for a %d format specifier). The logic for |
711 | 711 | doing so is derived from Sun's java.util.Formatter class, and |
1303 | 1303 | extends <code>beta.Foo</code>). This can be exceptionally |
1304 | 1304 | confusing, create lots of situations in which you have to look |
1305 | 1305 | 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 | |
1307 | 1307 | override methods in their superclasses. |
1308 | 1308 | </li> |
1309 | 1309 | <li>NM_SAME_SIMPLE_NAME_AS_INTERFACE: This class/interface |
1312 | 1312 | in a different package (e.g., <code>alpha.Foo</code> extends <code>beta.Foo</code>). |
1313 | 1313 | This can be exceptionally confusing, create lots of situations |
1314 | 1314 | 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 | |
1316 | 1316 | methods that do not override methods in their superclasses. |
1317 | 1317 | </li> |
1318 | 1318 | </ul> |
2129 | 2129 | </li> |
2130 | 2130 | <li>Updated detectors |
2131 | 2131 | <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> | |
2136 | 2136 | <li>QuestionableBooleanAssignment.java: finds more cases of |
2137 | 2137 | <tt>if (b=true)</tt> ilk |
2138 | 2138 | </li> |
2443 | 2443 | <li>New detector to find calls to equals() methods that use |
2444 | 2444 | Object's version. (Dave Brosius)</li> |
2445 | 2445 | <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> | |
2447 | 2447 | <li>New detector to find some cases of infinite recursion |
2448 | 2448 | (Bill Pugh)</li> |
2449 | 2449 | <li>New detector to find dead stores to local variables (David |
2497 | 2497 | <li>Allow Swing GUI to show source code in jar files on |
2498 | 2498 | Windows systems (Dave Brosius) <!-- Bug fixes --> |
2499 | 2499 | </li> |
2500 | <li>Fix the Switch Fall Thru detector (Dave Brosius, David | |
2500 | <li>Fix the Switch Fall Through detector (Dave Brosius, David | |
2501 | 2501 | Hovemeyer, Bill Pugh)</li> |
2502 | 2502 | <li>MacOS GUI fixes (Rohan Lloyd)</li> |
2503 | 2503 | <li>Fix false positive in BOA in case where method is |
20 | 20 | |
21 | 21 | <p>The preferred way to get the FindBugs source code and create the patch is to use Eclipse + Git. |
22 | 22 | 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> | |
24 | 24 | . |
25 | 25 | </p> |
26 | 26 | |
27 | 27 | <h2>Preparing a patch</h2> |
28 | 28 | |
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>, | |
31 | 31 | 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. | |
35 | 34 | </p> |
36 | 35 | |
37 | 36 | <p> Please follow these guidelines when preparing your patch:</p> |
47 | 46 | <li> If you are submitting a new bug detector, please submit a small |
48 | 47 | standalone source file that contains an instance of the |
49 | 48 | 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> | |
51 | 50 | package and named after the bug or feature you are addressing. |
52 | 51 | </ul> |
53 | 52 | |
57 | 56 | <h2>Where to submit a patch</h2> |
58 | 57 | |
59 | 58 | <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>. | |
63 | 61 | |
64 | 62 | @HTML_FOOTER@ |
65 | 63 |
34 | 34 | |
35 | 35 | |
36 | 36 | <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> | |
38 | 38 | for more information about some recent features/changes in FindBugs. |
39 | 39 | </p> |
40 | 40 |
54 | 54 | href="#sponsors">Sponsors</a> | <a href="#support">Support</a> |
55 | 55 | </p> |
56 | 56 | |
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: | |
60 | 60 | <ul> |
61 | 61 | <li> |
62 | 62 | <a |
183 | 183 | for more details.</p> |
184 | 184 | |
185 | 185 | <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> | |
187 | 187 | for more information about some recent features/changes in FindBugs. |
188 | 188 | </p> |
189 | 189 |
1334 | 1334 | <para> |
1335 | 1335 | An optional attribute. It specifies |
1336 | 1336 | 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. | |
1338 | 1338 | If set to "high", only high confidence bugs are reported. |
1339 | 1339 | </para> |
1340 | 1340 | </listitem> |
1473 | 1473 | </varlistentry> |
1474 | 1474 | |
1475 | 1475 | <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 | <findbugs home="${findbugs.home}"> | |
1491 | <excludePath> | |
1492 | <path> | |
1493 | <fileset dir="${findbugs-exclusion-filters.dir}" includes="findbugs-*-exclude-filter.xml" /> | |
1494 | </path> | |
1495 | </excludePath> | |
1496 | </findbugs> | |
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> | |
1476 | 1505 | <term><literal>includeFilter</literal></term> |
1477 | 1506 | <listitem> |
1478 | 1507 | <para> |
1479 | 1508 | Optional attribute. It specifies the filename of a filter specifying |
1480 | 1509 | which bugs are reported. See <xref linkend="filter" />. |
1481 | 1510 | </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 | <findbugs home="${findbugs.home}"> | |
1530 | <includePath> | |
1531 | <path> | |
1532 | <fileset dir="${findbugs-inclusion-filters.dir}" includes="findbugs-*-include-filter.xml" /> | |
1533 | </path> | |
1534 | </includePath> | |
1535 | </findbugs> | |
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> | |
1482 | 1540 | </listitem> |
1483 | 1541 | </varlistentry> |
1484 | 1542 | |
1600 | 1658 | </listitem> |
1601 | 1659 | </varlistentry> |
1602 | 1660 | |
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 | ||
1603 | 1673 | </variablelist> |
1604 | 1674 | |
1605 | 1675 | |
1755 | 1825 | <title>Extending the Eclipse Plugin (since 2.0.0)</title> |
1756 | 1826 | <para> |
1757 | 1827 | 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> | |
1759 | 1829 | for more information). There are two ways to contribute custom plugins to the Eclipse: |
1760 | 1830 | </para> |
1761 | 1831 | <itemizedlist> |
1788 | 1858 | |
1789 | 1859 | <para> |
1790 | 1860 | 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"> | |
1792 | 1862 | findBugsEclipsePlugin/schema/detectorPlugins.exsd</ulink> |
1793 | 1863 | extension point how to update the plugin.xml. Existing &FindBugs; detector plugins can |
1794 | 1864 | be easily "extended" to be full featured &FindBugs; AND Eclipse detector plugins. |
1804 | 1874 | Eclipse plugin. You can do this even for third-party detector packages. |
1805 | 1875 | Another major differentiator is the ability to extend the default FindBugs |
1806 | 1876 | 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> | |
1808 | 1878 | for more information). |
1809 | 1879 | </para> |
1810 | 1880 | </listitem> |
1999 | 2069 | If the <literal>Match</literal> element contains neither a <literal>Class</literal> element, |
2000 | 2070 | nor a <literal>class</literal> / <literal>classregex</literal> attribute, the predicate will apply |
2001 | 2071 | 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. | |
2003 | 2073 | </para> |
2004 | 2074 | </listitem> |
2005 | 2075 | </varlistentry> |
2037 | 2107 | |
2038 | 2108 | <listitem><para>This element specifies a field. The <literal>name</literal> attribute is is used to specify |
2039 | 2109 | 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 | |
2041 | 2111 | of these attributes in order to perform name / signature based matches. The <literal>role</literal> attribute is |
2042 | 2112 | the field role. |
2043 | 2113 | </para></listitem> |
2132 | 2202 | By explicitly matching both classes, you ensure that the IC bug instance will be |
2133 | 2203 | matched regardless of which class involved in the circularity happens to be |
2134 | 2204 | 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 | |
2136 | 2206 | class.) |
2137 | 2207 | </para> |
2138 | 2208 | |
2573 | 2643 | </listitem> |
2574 | 2644 | <listitem> |
2575 | 2645 | <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:"". | |
2577 | 2647 | </para> |
2578 | 2648 | </listitem> |
2579 | 2649 | </varlistentry> |
2740 | 2810 | <para> |
2741 | 2811 | The annotated element could be null under some circumstances. In general, this means |
2742 | 2812 | 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 | |
2744 | 2814 | treat the annotated items as though they had no annotation. |
2745 | 2815 | </para> |
2746 | 2816 | <para> |
3148 | 3218 | <tbody> |
3149 | 3219 | <row><entry>-output <file></entry> <entry>output="<file>"</entry> <entry>save output in the named file (may also be an input file)</entry></row> |
3150 | 3220 | <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> | |
3152 | 3222 | <row><entry>-preciseMatch[:truth]</entry> <entry>preciseMatch="[true|false]"</entry><entry>require bug patterns to match precisely</entry></row> |
3153 | 3223 | <row><entry>-precisePriorityMatch[:truth]</entry> <entry>precisePriorityMatch="[true|false]"</entry><entry>consider two warnings as the same only if priorities match exactly</entry></row> |
3154 | 3224 | <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> |
3324 | 3394 | <row><entry>fixed</entry><entry>Count of warnings removed from a class that remains in the current version</entry></row> |
3325 | 3395 | <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> |
3326 | 3396 | <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> | |
3328 | 3398 | <row><entry>active</entry><entry>Total warnings present in the current version</entry></row> |
3329 | 3399 | </tbody> |
3330 | 3400 | </tgroup> |
3961 | 4031 | <para>Kevin Lubick contributed fixes and tests for multi-quick-fixes and customizable |
3962 | 4032 | annotation colors for Eclipse plugin.</para> |
3963 | 4033 | |
4034 | <para>Boris Bokowski contributed several new bug patterns: BIT_SIGNED_CHECK and BIT_SIGNED_CHECK_HIGH_BIT.</para> | |
4035 | ||
3964 | 4036 | <para>Tagir Valeev contributed several new bug detectors and improved existing ones.</para> |
3965 | 4037 | |
3966 | 4038 | <para>If you have contributed to &FindBugs;, but aren't mentioned above, |
655 | 655 | <varlistentry> |
656 | 656 | <term><command>-userPrefs</command> <replaceable>edu.umd.cs.findbugs.core.prefs</replaceable></term> |
657 | 657 | <listitem> |
658 | <para>ユーザー設定ファイルのパスを設定します。ユーザー設定ファイルの内容で、他のオプションの一部を上書きすることができます。 | |
658 | <para>ユーザー設定ファイルのパスを設定します。ユーザー設定ファイルの内容で、他のオプションの一部を上書きすることができます。 | |
659 | 659 | <literal>userPrefs</literal> を一番目の引数に指定した場合は、後続のオプションの方がユーザー設定ファイルの内容に優先します。 |
660 | 660 | <literal>userPrefs</literal> を最後の引数に指定した場合は、ユーザー設定ファイルの内容の方が前に指定したオプションに優先します。 |
661 | 661 | このオプションを設けた背景・理由は、 Eclipse プロジェクトの FindBugs の設定をコマンドライン実行で再利用するためです。</para> |
1040 | 1040 | <listitem> |
1041 | 1041 | <para> |
1042 | 1042 | 任意指定の属性です。 |
1043 | ユーザー設定ファイルのパスを設定します。ユーザー設定ファイルの内容で、他のオプションの一部を上書きすることができます。 | |
1043 | ユーザー設定ファイルのパスを設定します。ユーザー設定ファイルの内容で、他のオプションの一部を上書きすることができます。 | |
1044 | 1044 | <literal>userPreferencesFile</literal> を一番目の引数に指定した場合は、後続のオプションの方がユーザー設定ファイルの内容に優先します。 |
1045 | 1045 | <literal>userPreferencesFile</literal> を最後の引数に指定した場合は、ユーザー設定ファイルの内容の方が前に指定したオプションに優先します。 |
1046 | 1046 | このオプションを設けた背景・理由は、 Eclipse プロジェクトの FindBugs の設定をコマンドライン実行で再利用するためです。 |
1154 | 1154 | <para> |
1155 | 1155 | Eclipse プラグインでは、 独自の &FindBugs; ディテクタを追加することができます。 |
1156 | 1156 | (詳しく知りたい方は、 |
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 | もご覧ください)。 | |
1159 | 1159 | 独自のプラグインを Eclipse に追加するには以下の2通りの方法があります。 |
1160 | 1160 | </para> |
1161 | 1161 | <itemizedlist> |
1162 | 1162 | <listitem> |
1163 | 1163 | <para> |
1164 | 既存の標準 &FindBugs; ディテクタパッケージは以下で設定できます。 | |
1164 | 既存の標準 &FindBugs; ディテクタパッケージは以下で設定できます。 | |
1165 | 1165 | <menuchoice> |
1166 | 1166 | <guimenu>Window</guimenu> |
1167 | 1167 | <guimenuitem>Preferences</guimenuitem> |
1185 | 1185 | </para> |
1186 | 1186 | |
1187 | 1187 | <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"> | |
1189 | 1189 | findBugsEclipsePlugin/schema/detectorPlugins.exsd</ulink> の documentation で plugin.xml の更新方法を確認してください。 |
1190 | 1190 | 既存の &FindBugs; ディテクタプラグイン を簡単に「拡張」して強力な &FindBugs; Eclipse ディテクタプラグイン にすることができます。 |
1191 | 1191 | 通常必要なのは、 META-INF/MANIFEST.MF および plugin.xml を jar に追加してかつ、 MANIFEST.MF がビルド時に上書きされないようにビルドスクリプトを更新するだけです。 |
1196 | 1196 | 前提条件は現在使用しているディテクタパッケージを Eclipse プラグインに変換しておくことです。 |
1197 | 1197 | これはサードパーティのディテクタパッケージも同様です。 |
1198 | 1198 | もうひとつの主な差別化要因は、 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> | |
1200 | 1200 | をご覧ください)。 |
1201 | 1201 | </para> |
1202 | 1202 | </listitem> |
1367 | 1367 | <varlistentry> |
1368 | 1368 | <term><literal><And></literal></term> |
1369 | 1369 | <listitem><para> |
1370 | この要素は、論理積として <literal>Match</literal> 条項を結合します。 | |
1370 | この要素は、論理積として <literal>Match</literal> 条項を結合します。 | |
1371 | 1371 | すなわち、 <literal>Bug</literal> および <literal>Confidence</literal> 要素を <literal>And</literal> 条項内に指定することで |
1372 | 1372 | 特定の信頼度の特定のバグのみ照合することができます。 |
1373 | 1373 | </para></listitem> |
1807 | 1807 | <para> |
1808 | 1808 | クラスまたはパッケージのすべてのメンバーが指定されたアノテーションクラスのデフォルト値でアノテートされることを指定することができます。 |
1809 | 1809 | この指定は @NonNull 、 @CheckForNull 、または @CheckReturnValueなどに使用する想定です。 |
1810 | 具体的には、 クラスまたはパッケージに @DefaultAnnotation(NonNull.class) を指定した上で、 | |
1810 | 具体的には、 クラスまたはパッケージに @DefaultAnnotation(NonNull.class) を指定した上で、 | |
1811 | 1811 | null を許容したいパラメーター、メソッドまたはフィールドにのみ @Nullable を指定するという使用方法があります。 |
1812 | 1812 | </para> |
1813 | 1813 | </listitem> |
22 | 22 | |
23 | 23 | <p> |
24 | 24 | Please report bugs using the |
25 | <a href="http://sourceforge.net/p/findbugs/_list/tickets?source=navbar">Sourceforge | |
26 | bugs tracker</a>. 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>. Note that you need to be logged in to GitHub to | |
27 | 27 | use the bug tracker. |
28 | 28 | </p> |
29 | 29 | |
30 | 30 | <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 | |
32 | 32 | email to the <a href="http://www.cs.umd.edu/mailman/listinfo/findbugs-discuss" |
33 | 33 | >findbugs-discuss mailing list</a>. You must be subscribed |
34 | 34 | to the list to post a message. |
67 | 67 | </tr> |
68 | 68 | <tr> |
69 | 69 | <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' | |
71 | 71 | </tr> |
72 | 72 | <tr> |
73 | 73 | <td>ba.checkAssertions</td> |
59 | 59 | <li>You can also redirect all update checks to a local server. This allows you to collect information about who is using |
60 | 60 | what versions of FindBugs in your organization, and keep all of that information private. |
61 | 61 | <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 | |
63 | 63 | information to the FindBugs project, you can blacklist that URL in your firewall |
64 | 64 | <ul> |
65 | 65 | <li>You can also block <pre>http://findbugs-cloud.appspot.com</pre>, the host we use for our publicly hosted |
66 | 66 | repository of bug evaluations (e.g., evaluations in open source projects such as the JDK, Eclipse and GlassFish). |
67 | 67 | 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 | |
69 | 69 | remove the WebCloudClient |
70 | 70 | |
71 | 71 | </ul> |
53 | 53 | <p> |
54 | 54 | The following companies, projects and organizations have given us |
55 | 55 | 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 | |
57 | 57 | <a href="mailto:findbugs@cs.umd.edu">findbugs@cs.umd.edu</a> if |
58 | 58 | you'd like to be listed here. |
59 | 59 | </p> |
53 | 53 | saveBugs(UTF8.fileWriter(out), data, p); |
54 | 54 | lastPlaceSaved = out.getAbsolutePath(); |
55 | 55 | } 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"); | |
57 | 57 | } |
58 | 58 | } |
59 | 59 |
44 | 44 | * Our TreeModel. Once upon a time it was a simple model, that queried data, its BugSet, for what to show under each branch |
45 | 45 | * 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. |
46 | 46 | * |
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 | |
48 | 48 | * 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 |
49 | 49 | * |
50 | 50 | * Heres the order things MUST be done when dealing with suppressions, filtering, unsuppressions... unfiltering... all that fun stuff |
353 | 353 | |
354 | 354 | // If this thread is not interrupting a previous thread, set the paths |
355 | 355 | // 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 | |
358 | 358 | |
359 | 359 | // As of now, it should be impossible to interrupt a rebuilding thread, |
360 | 360 | // in another version this may change, so this if statement check is |
753 | 753 | void sendEvent(TreeModelEvent event, TreeModification whatToDo) { |
754 | 754 | Debug.println("Sending An Event!"); |
755 | 755 | if (event == null) { |
756 | throw new IllegalStateException("Dont throw null events."); | |
756 | throw new IllegalStateException("Don't throw null events."); | |
757 | 757 | } |
758 | 758 | resetData(); |
759 | 759 | for (TreeModelListener l : listeners) { |
52 | 52 | * |
53 | 53 | */ |
54 | 54 | /* |
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 | |
56 | 56 | * isn't one, well... there might be, but its all system dependent where it is |
57 | 57 | * and how its stored |
58 | 58 | */ |
66 | 66 | private static final String FRAME_BOUNDS = "Frame Bounds"; |
67 | 67 | private static final String EXTENDED_WINDOW_STATE = "ExtendedWindowState"; |
68 | 68 | |
69 | private static final int MAXNUMRECENTPROJECTS = 5; | |
69 | static final int MAXNUMRECENTPROJECTS = 10; | |
70 | 70 | |
71 | 71 | private static final Sortables[] DEFAULT_COLUMN_HEADERS = new Sortables[] { Sortables.CATEGORY, Sortables.BUGCODE, |
72 | 72 | Sortables.TYPE, Sortables.DIVIDER, Sortables.BUG_RANK, Sortables.FIRST_SEEN, Sortables.DESIGNATION }; |
543 | 543 | if (bugCollection != null) { |
544 | 544 | displayer.clearCache(); |
545 | 545 | 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 | |
547 | 547 | // listener lists. |
548 | 548 | BugTreeModel model = (BugTreeModel) mainFrameTree.getTree().getModel(); |
549 | 549 | model.getOffListenerList(); |
117 | 117 | final File f = saveOpenFileChooser.getSelectedFile(); |
118 | 118 | |
119 | 119 | 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", | |
121 | 121 | "Invalid File", JOptionPane.WARNING_MESSAGE); |
122 | 122 | loading = true; |
123 | 123 | continue; |
632 | 632 | if (!(path.getParentPath() == null)) { |
633 | 633 | // path is null, the |
634 | 634 | // root was selected, |
635 | // dont allow them to | |
635 | // don't allow them to | |
636 | 636 | // filter out the root. |
637 | 637 | branchPopupMenu.show(tree, e.getX(), e.getY()); |
638 | 638 | } |
186 | 186 | |
187 | 187 | wizardComponents[1] = createFilePanel( |
188 | 188 | 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, | |
190 | 190 | "http://findbugs.sourceforge.net/FAQ.html#q4"); |
191 | 191 | |
192 | 192 | wizardComponents[2] = createFilePanel( |
29 | 29 | public class RecentMenu { |
30 | 30 | |
31 | 31 | 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; | |
33 | 33 | |
34 | 34 | public LimitedArrayList() { |
35 | 35 | super(MAX_ENTRIES); |
286 | 286 | public int getColumnIndex(Object columnIdentifier) { |
287 | 287 | |
288 | 288 | 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."); | |
290 | 290 | } |
291 | 291 | |
292 | 292 | for (int x = 0; x < columnList.size(); x++) { |
133 | 133 | (MainFrame.getInstance().getBugTreeModel()).sendEvent(event, whatToDo); |
134 | 134 | } catch (BranchOperationException e) { |
135 | 135 | // 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 | |
137 | 137 | // events. |
138 | 138 | this.active = active; |
139 | 139 | } |
461 | 461 | } |
462 | 462 | |
463 | 463 | /** |
464 | * Get the primary method annotation, which indicates where the bug occurs. | |
464 | * Get the primary field annotation, which indicates where the bug occurs. | |
465 | 465 | */ |
466 | 466 | @CheckForNull |
467 | 467 | public FieldAnnotation getPrimaryField() { |
50 | 50 | * |
51 | 51 | * A bug ranker is comprised of a list of bug patterns, bug kinds and bug |
52 | 52 | * 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 -. | |
54 | 54 | * |
55 | 55 | * For core bug detectors, the bug ranker search order is: |
56 | 56 | * <ul> |
77 | 77 | * name of the BCEL class |
78 | 78 | */ |
79 | 79 | private static void error(String cname) { |
80 | System.err.println("BCEL class compatability error."); | |
80 | System.err.println("BCEL class compatibility error."); | |
81 | 81 | System.err.println("The version of class " + cname + " found was not compatible with\n" |
82 | 82 | + "FindBugs. Please remove any BCEL libraries that may be interfering. This may happen\n" |
83 | 83 | + "if you have an old version of BCEL or a library that includes an old version of BCEL\n" |
43 | 43 | public static final String SUBCLASS_ROLE = "CLASS_SUBCLASS"; |
44 | 44 | |
45 | 45 | public static final String SUPERCLASS_ROLE = "CLASS_SUPERCLASS"; |
46 | ||
47 | public static final String ANONYMOUS_ROLE = "CLASS_ANONYMOUS"; | |
46 | 48 | |
47 | 49 | public static final String RECOMMENDED_SUPERCLASS_ROLE = "CLASS_RECOMMENDED_SUPERCLASS"; |
48 | 50 |
11 | 11 | |
12 | 12 | @Override |
13 | 13 | 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); | |
15 | 15 | } |
16 | 16 | @Override |
17 | 17 | public boolean match(BugInstance bugInstance) { |
2 | 2 | CLASS_REFTYPE =Reference type {0} |
3 | 3 | CLASS_SUBCLASS =has subclass {0} |
4 | 4 | CLASS_SUPERCLASS =superclass is {0} |
5 | CLASS_ANONYMOUS =Anonymous class {0} | |
5 | 6 | CLASS_RECOMMENDED_SUPERCLASS =Perhaps class should be refactored to extend {0} |
6 | 7 | CLASS_IMPLEMENTED_INTERFACE =implements interface {0} |
7 | 8 | CLASS_ANNOTATION =annotated with {0.simpleName} |
276 | 276 | } |
277 | 277 | |
278 | 278 | /** |
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 | |
280 | 280 | * source line matching. |
281 | 281 | */ |
282 | 282 | // private static final int NUM_CONTEXT_OPCODES = 2; |
18 | 18 | |
19 | 19 | package edu.umd.cs.findbugs; |
20 | 20 | |
21 | import java.util.regex.Matcher; | |
22 | import java.util.regex.Pattern; | |
23 | ||
24 | 21 | /** |
25 | 22 | * Support for finding out what version of Java we're running on. |
26 | 23 | */ |
27 | 24 | public class JavaVersion { |
28 | private static final Pattern PATTERN = Pattern.compile("^(\\d+)\\.(\\d+)(\\..*)?$"); | |
29 | 25 | |
30 | 26 | private final int major; |
31 | 27 | |
42 | 38 | try { |
43 | 39 | runtimeVersion = new JavaVersion(SystemProperties.getProperty("java.version")); |
44 | 40 | } 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); | |
48 | 43 | e.printStackTrace(); |
49 | 44 | } |
50 | 45 | } |
62 | 57 | * <code>java.version</code> system property: e.g., "1.4.2_04" |
63 | 58 | */ |
64 | 59 | 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); | |
69 | 63 | 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); | |
74 | 72 | } 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 | } | |
76 | 85 | } |
77 | 86 | } catch (NumberFormatException e) { |
78 | 87 | throw new JavaVersionException("Could not parse Java Version string: " + versionString, e); |
2633 | 2633 | i.setSpecialKind(Item.NON_NEGATIVE); |
2634 | 2634 | } |
2635 | 2635 | 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) { | |
2637 | 2638 | String input = (String) topItem.getConstant(); |
2638 | 2639 | Object result; |
2639 | 2640 | switch(methodName) { |
212 | 212 | classLoader = new URLClassLoader(loaderURLs, parent); |
213 | 213 | } else { |
214 | 214 | 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"); | |
216 | 216 | } |
217 | 217 | Plugin parentPlugin = Plugin.getByPluginId(parentId); |
218 | 218 | if (parentPlugin != null) { |
29 | 29 | |
30 | 30 | import javax.annotation.CheckForNull; |
31 | 31 | |
32 | import org.apache.bcel.Constants; | |
32 | import org.apache.bcel.Const; | |
33 | 33 | import org.apache.bcel.classfile.Attribute; |
34 | 34 | import org.apache.bcel.classfile.ClassFormatException; |
35 | 35 | import org.apache.bcel.classfile.Code; |
36 | 36 | import org.apache.bcel.classfile.ConstantClass; |
37 | 37 | 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; | |
40 | 40 | import org.apache.bcel.classfile.StackMapType; |
41 | 41 | import org.apache.bcel.generic.Type; |
42 | 42 | |
83 | 83 | SAME_FRAME, SAME_LOCALS_1_STACK_ITEM_FRAME, CHOP_FRAME, APPEND_FRAME, FULL_FRAME; |
84 | 84 | |
85 | 85 | 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) { | |
87 | 87 | 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) { | |
90 | 90 | 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) { | |
92 | 92 | 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) { | |
94 | 94 | return CHOP_FRAME; |
95 | } else if (frame_type == Constants.SAME_FRAME_EXTENDED) { | |
95 | } else if (frame_type == Const.SAME_FRAME_EXTENDED) { | |
96 | 96 | 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) { | |
98 | 98 | return APPEND_FRAME; |
99 | } else if (frame_type == Constants.FULL_FRAME) { | |
99 | } else if (frame_type == Const.FULL_FRAME) { | |
100 | 100 | return FULL_FRAME; |
101 | 101 | } else { |
102 | 102 | /* Can't happen */ |
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
108 | static @CheckForNull StackMapTable getStackMapTable(Code code) { | |
108 | static @CheckForNull StackMap getStackMapTable(Code code) { | |
109 | 109 | for(Attribute a : code.getAttributes()) { |
110 | if (a instanceof StackMapTable) { | |
111 | return (StackMapTable) a; | |
110 | if (a instanceof StackMap) { | |
111 | return (StackMap) a; | |
112 | 112 | } |
113 | 113 | } |
114 | 114 | return null; |
142 | 142 | |
143 | 143 | @Override |
144 | 144 | public Field run() { |
145 | Class<StackMapTableEntry> c = StackMapTableEntry.class; | |
145 | Class<StackMapEntry> c = StackMapEntry.class; | |
146 | 146 | Field result; |
147 | 147 | try { |
148 | 148 | result = c.getDeclaredField("frame_type"); |
167 | 167 | frame_type_field = f; |
168 | 168 | } |
169 | 169 | |
170 | static int getFrameType(StackMapTableEntry e) { | |
170 | static int getFrameType(StackMapEntry e) { | |
171 | 171 | if (frame_type_field == null) { |
172 | 172 | return -1; |
173 | 173 | } |
196 | 196 | if (code == null) { |
197 | 197 | return null; |
198 | 198 | } |
199 | StackMapTable stackMapTable = getStackMapTable(code); | |
199 | StackMap stackMapTable = getStackMapTable(code); | |
200 | 200 | if (stackMapTable == null) { |
201 | 201 | return null; |
202 | 202 | } |
212 | 212 | System.out.println(locals); |
213 | 213 | } |
214 | 214 | int pc = 0; |
215 | for(StackMapTableEntry e : stackMapTable.getStackMapTable()) { | |
216 | pc += e.getByteCodeOffsetDelta(); | |
215 | for(StackMapEntry e : stackMapTable.getStackMap()) { | |
216 | pc += e.getByteCodeOffset(); | |
217 | 217 | int rawFrameType = getFrameType(e); |
218 | 218 | StackFrameType stackFrameType = StackFrameType.get(rawFrameType); |
219 | 219 | switch (stackFrameType) { |
226 | 226 | break; |
227 | 227 | case CHOP_FRAME : |
228 | 228 | stack.clear(); |
229 | int n = Constants.CHOP_FRAME_MAX+1-rawFrameType; | |
229 | int n = Const.CHOP_FRAME_MAX+1-rawFrameType; | |
230 | 230 | for(int i = 0; i < n; i++) { |
231 | 231 | Item it = locals.remove(locals.size()-1); |
232 | 232 | if (it == null) { |
276 | 276 | |
277 | 277 | switch (t.getType()) { |
278 | 278 | |
279 | case Constants.ITEM_Double: | |
279 | case Const.ITEM_Double: | |
280 | 280 | return Item.typeOnly("D"); |
281 | case Constants.ITEM_Float: | |
281 | case Const.ITEM_Float: | |
282 | 282 | return Item.typeOnly("F"); |
283 | case Constants.ITEM_Integer: | |
283 | case Const.ITEM_Integer: | |
284 | 284 | return Item.typeOnly("I"); |
285 | case Constants.ITEM_Long: | |
285 | case Const.ITEM_Long: | |
286 | 286 | return Item.typeOnly("J"); |
287 | case Constants.ITEM_Bogus: | |
288 | case Constants.ITEM_NewObject: | |
287 | case Const.ITEM_Bogus: | |
288 | case Const.ITEM_NewObject: | |
289 | 289 | return Item.typeOnly("Ljava/lang/Object;"); |
290 | case Constants.ITEM_Null: | |
290 | case Const.ITEM_Null: | |
291 | 291 | Item it = new Item(); |
292 | 292 | it.setSpecialKind(Item.TYPE_ONLY); |
293 | 293 | return it; |
294 | case Constants.ITEM_InitObject: | |
294 | case Const.ITEM_InitObject: | |
295 | 295 | return Item.typeOnly("Ljava/lang/Object;"); |
296 | case Constants.ITEM_Object: | |
296 | case Const.ITEM_Object: | |
297 | 297 | int index = t.getIndex(); |
298 | 298 | ConstantClass c = (ConstantClass) t.getConstantPool().getConstant(index); |
299 | 299 | String name = c.getBytes(t.getConstantPool()); |
27 | 27 | |
28 | 28 | import edu.umd.cs.findbugs.ba.XClass; |
29 | 29 | import edu.umd.cs.findbugs.ba.XField; |
30 | import edu.umd.cs.findbugs.util.ClassName; | |
31 | 30 | import edu.umd.cs.findbugs.visitclass.DismantleBytecode; |
32 | 31 | |
33 | 32 | public class SwitchHandler { |
45 | 44 | return -1; |
46 | 45 | } |
47 | 46 | int total = 0; |
48 | String enumSignature = ClassName.toSignature(c.getClassDescriptor().getClassName()); | |
49 | 47 | for(XField f : c.getXFields()) { |
50 | if (f.getSignature().equals(enumSignature) | |
51 | && f.isPublic() && f.isFinal()) { | |
48 | if (f.isEnum()) { | |
52 | 49 | total++; |
53 | 50 | } |
54 | 51 | } |
48 | 48 | /** |
49 | 49 | * Minor version number. |
50 | 50 | */ |
51 | public static final int MINOR = 0; | |
51 | public static final int MINOR = 1; | |
52 | 52 | |
53 | 53 | /** |
54 | 54 | * Patch level. |
55 | 55 | */ |
56 | public static final int PATCHLEVEL = 1; | |
56 | public static final int PATCHLEVEL = 0; | |
57 | 57 | |
58 | 58 | /** |
59 | 59 | * Development version or release candidate? |
20 | 20 | |
21 | 21 | import javax.annotation.Nonnull; |
22 | 22 | |
23 | import edu.umd.cs.findbugs.Priorities; | |
24 | ||
25 | 23 | /** |
26 | 24 | * Describes the confidence with which FindBugs reports a bug instance. |
27 | 25 | */ |
28 | 26 | 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 */); | |
31 | 31 | |
32 | 32 | private final int confidenceValue; |
33 | 33 |
6 | 6 | |
7 | 7 | import java.lang.annotation.Retention; |
8 | 8 | import java.lang.annotation.RetentionPolicy; |
9 | ||
10 | import edu.umd.cs.findbugs.BugRanker; | |
11 | 9 | |
12 | 10 | /** |
13 | 11 | * Annotation indicating that a FindBugs warning is desired. |
28 | 26 | public Confidence confidence() default Confidence.LOW; |
29 | 27 | |
30 | 28 | /** 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 | |
32 | 30 | |
33 | 31 | /** Desire at least this many warnings */ |
34 | 32 | public int num() default 1; |
6 | 6 | |
7 | 7 | import java.lang.annotation.Retention; |
8 | 8 | import java.lang.annotation.RetentionPolicy; |
9 | ||
10 | import edu.umd.cs.findbugs.BugRanker; | |
11 | 9 | |
12 | 10 | /** |
13 | 11 | * Annotation indicating that a FindBugs warning is expected. |
28 | 26 | public Confidence confidence() default Confidence.LOW; |
29 | 27 | |
30 | 28 | /** 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 | |
32 | 30 | |
33 | 31 | /** Expect at least this many warnings */ |
34 | 32 | public int num() default 1; |
6 | 6 | |
7 | 7 | import java.lang.annotation.Retention; |
8 | 8 | import java.lang.annotation.RetentionPolicy; |
9 | ||
10 | import edu.umd.cs.findbugs.BugRanker; | |
11 | 9 | |
12 | 10 | /** |
13 | 11 | * Annotation indicating that <em>no</em> FindBugs warning is expected. |
28 | 26 | public Confidence confidence() default Confidence.LOW; |
29 | 27 | |
30 | 28 | /** 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 | |
32 | 30 | |
33 | 31 | /** Tolerate up to this many warnings */ |
34 | 32 | public int num() default 0; |
18 | 18 | |
19 | 19 | package edu.umd.cs.findbugs.annotations; |
20 | 20 | |
21 | import edu.umd.cs.findbugs.Priorities; | |
22 | 21 | |
23 | 22 | /** |
24 | 23 | * @author pugh |
26 | 25 | */ |
27 | 26 | @Deprecated |
28 | 27 | 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 */); | |
31 | 32 | |
32 | 33 | private final int priorityValue; |
33 | 34 |
40 | 40 | return (getAccessFlags() & Constants.ACC_SYNTHETIC) != 0; |
41 | 41 | } |
42 | 42 | |
43 | @Override | |
44 | public boolean isEnum() { | |
45 | return (getAccessFlags() & Constants.ACC_ENUM) != 0; | |
46 | } | |
47 | ||
43 | 48 | /* |
44 | 49 | * (non-Javadoc) |
45 | 50 | * |
49 | 49 | * @see Frame |
50 | 50 | * @see DataflowAnalysis |
51 | 51 | */ |
52 | public abstract class AbstractFrameModelingVisitor<Value, FrameType extends Frame<Value>> implements VisitorSupportsInvokeDynamic { | |
52 | public abstract class AbstractFrameModelingVisitor<Value, FrameType extends Frame<Value>> implements Visitor { | |
53 | 53 | private FrameType frame; |
54 | 54 | |
55 | 55 | private Location location; |
32 | 32 | |
33 | 33 | import javax.annotation.CheckForNull; |
34 | 34 | import javax.annotation.Nonnull; |
35 | ||
36 | import net.jcip.annotations.NotThreadSafe; | |
37 | 35 | |
38 | 36 | import org.apache.bcel.Repository; |
39 | 37 | import org.apache.bcel.classfile.JavaClass; |
69 | 67 | import edu.umd.cs.findbugs.detect.UnreadFieldsData; |
70 | 68 | import edu.umd.cs.findbugs.internalAnnotations.DottedClassName; |
71 | 69 | import edu.umd.cs.findbugs.util.ClassName; |
70 | import net.jcip.annotations.NotThreadSafe; | |
72 | 71 | |
73 | 72 | /** |
74 | 73 | * A context for analysis of a complete project. This serves as the repository |
541 | 540 | } |
542 | 541 | |
543 | 542 | 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); | |
545 | 549 | } |
546 | 550 | |
547 | 551 | /** |
806 | 806 | if (newLine == lineNum || newLine == -1) { |
807 | 807 | continue; |
808 | 808 | } |
809 | ||
809 | 810 | if (prevStartPc >= 0) { |
810 | 811 | int nextPcInFinallyBlock = pcInFinallyBlock.nextSetBit(prevStartPc); |
811 | if (nextPcInFinallyBlock < line.getStartPC()) { | |
812 | if ( prevStartPc < nextPcInFinallyBlock && nextPcInFinallyBlock < line.getStartPC()) { | |
812 | 813 | lineMentionedMultipleTimes.set(lineNum); |
813 | 814 | } |
814 | 815 | } |
816 | ||
815 | 817 | if (line.getStartPC() >= firstHandler) { |
816 | 818 | afterHandler.set(lineNum); |
819 | afterHandler.set(newLine); | |
817 | 820 | } |
818 | ||
819 | 821 | lineNum = newLine; |
820 | prevStartPc = line.getStartPC(); | |
822 | ||
821 | 823 | if (foundOnce.get(lineNum)) { |
822 | 824 | lineMentionedMultipleTimes.set(lineNum); |
823 | 825 | } else { |
824 | 826 | foundOnce.set(lineNum); |
825 | 827 | } |
828 | prevStartPc = line.getStartPC(); | |
826 | 829 | } |
827 | 830 | } |
828 | 831 | lineMentionedMultipleTimes.and(afterHandler); |
189 | 189 | database.addMethodParameterAnnotation("java.util.concurrent.ConcurrentHashMap", "setEntryAt", |
190 | 190 | "([Ljava/util/concurrent/ConcurrentHashMap$HashEntry;ILjava/util/concurrent/ConcurrentHashMap$HashEntry;)V", false, 1, NullnessAnnotation.NULLABLE); |
191 | 191 | 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); | |
193 | 195 | database.addMethodParameterAnnotation("java.util.concurrent.PriorityBlockingQueue", "<init>", |
194 | 196 | "(ILjava/util/Comparator;)V", false, 1, NullnessAnnotation.NULLABLE); |
195 | 197 |
311 | 311 | return Collections.<XMethod> emptySet(); |
312 | 312 | } |
313 | 313 | |
314 | // XXX handle INVOKEDYNAMIC | |
315 | if (opcode == Constants.INVOKEDYNAMIC) { | |
316 | return Collections.<XMethod> emptySet(); | |
317 | } | |
318 | ||
314 | 319 | Type receiverType; |
315 | 320 | boolean receiverTypeIsExact; |
316 | 321 |
47 | 47 | return CHECK_FOR_NULL; |
48 | 48 | } |
49 | 49 | // 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")) { | |
51 | 51 | return NONNULL; |
52 | 52 | } |
53 | 53 | for (NullnessAnnotation v : myValues) { |
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
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. | |
64 | 64 | * If pruning and classifying succeeds, then these momentos can be applied |
65 | 65 | * to actually change the state of the edges. The issue is that the entire |
66 | 66 | * pruning/classifying operation must either fail or succeed as a whole. |
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
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 | |
72 | 72 | * JavaClass is entered into the Repository. |
73 | 73 | * |
74 | 74 | * @return the parsed JavaClass |
51 | 51 | public boolean isVolatile(); |
52 | 52 | |
53 | 53 | /** |
54 | * @return true if this is a enum constant | |
55 | */ | |
56 | public boolean isEnum(); | |
57 | ||
58 | /** | |
54 | 59 | * @return FieldDescriptor referring to this field |
55 | 60 | */ |
56 | 61 | public FieldDescriptor getFieldDescriptor(); |
19 | 19 | package edu.umd.cs.findbugs.ba.bcp; |
20 | 20 | |
21 | 21 | /** |
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 | |
23 | 23 | * ByteCodePattern. BindingSets are immutable; to add a binding, a new cell is |
24 | 24 | * allocated. (Are we CONSING yet?) |
25 | 25 | * |
64 | 64 | * @param bindingSet |
65 | 65 | * previous definitions |
66 | 66 | * @return a MatchResult containing an updated BindingSet if successful, or |
67 | * null if unsucessful | |
67 | * null if unsuccessful | |
68 | 68 | */ |
69 | 69 | protected MatchResult checkConsistent(Variable field, Variable value, BindingSet bindingSet) { |
70 | 70 | // Ensure that the field and value variables are consistent with |
26 | 26 | import javax.annotation.meta.When; |
27 | 27 | |
28 | 28 | import org.apache.bcel.generic.ConstantPoolGen; |
29 | import org.apache.bcel.generic.INVOKEDYNAMIC; | |
29 | 30 | import org.apache.bcel.generic.Instruction; |
30 | 31 | import org.apache.bcel.generic.InvokeInstruction; |
31 | 32 | |
104 | 105 | Location location = i.next(); |
105 | 106 | Instruction ins = location.getHandle().getInstruction(); |
106 | 107 | 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 | } | |
109 | 114 | } |
110 | 115 | |
111 | 116 | if (DEBUG_FIND_EFFECTIVE_RELEVANT_QUALIFIERS) { |
54 | 54 | |
55 | 55 | static final ClassDescriptor intellijNullable = DescriptorFactory.createClassDescriptor("org/jetbrains/annotations/Nullable"); |
56 | 56 | |
57 | static final ClassDescriptor intellijNotNull = DescriptorFactory.createClassDescriptor("org/jetbrains/annotations/NotNull"); | |
58 | ||
57 | 59 | static final ClassDescriptor eclipseNullable = DescriptorFactory.createClassDescriptor("org/eclipse/jdt/annotation/Nullable"); |
58 | 60 | |
59 | 61 | static final ClassDescriptor eclipseNonNull = DescriptorFactory.createClassDescriptor("org/eclipse/jdt/annotation/NonNull"); |
127 | 129 | resolveTypeQualifierNicknames(new AnnotationValue(JSR305NullnessAnnotations.CHECK_FOR_NULL), result, onStack); |
128 | 130 | return; |
129 | 131 | } |
130 | if (annotationClass.equals(eclipseNonNull) || annotationClass.equals(eclipseNonNullByDefault)) { | |
132 | if (annotationClass.equals(eclipseNonNull) || annotationClass.equals(eclipseNonNullByDefault) | |
133 | || annotationClass.equals(intellijNotNull)) { | |
131 | 134 | resolveTypeQualifierNicknames(new AnnotationValue(JSR305NullnessAnnotations.NONNULL), result, onStack); |
132 | 135 | return; |
133 | 136 | } |
68 | 68 | |
69 | 69 | /** |
70 | 70 | * A user-friendly front end for finding null pointer dereferences and redundant |
71 | * null comparisions. | |
71 | * null comparisons. | |
72 | 72 | * |
73 | 73 | * @see IsNullValueAnalysis |
74 | 74 | * @author David Hovemeyer |
4381 | 4381 | javax.xml.soap.SOAPMessage,createAttachmentPart,(Ljavax/activation/DataHandler;)Ljavax/xml/soap/AttachmentPart;,1|true |
4382 | 4382 | javax.xml.soap.SOAPMessage,getProperty,(Ljava/lang/String;)Ljava/lang/Object;,1|true |
4383 | 4383 | javax.xml.soap.SOAPMessage,getSOAPBody,()Ljavax/xml/soap/SOAPBody;,1|true |
4384 | javax.xml.soap.SOAPMessage,getSOAPHeader,()Ljavax/xml/soap/SOAPHeader;,1|true | |
4385 | 4384 | javax.xml.stream.XMLEventFactory,newFactory,()Ljavax/xml/stream/XMLEventFactory;,9|true |
4386 | 4385 | javax.xml.stream.XMLEventFactory,newFactory,(Ljava/lang/String;Ljava/lang/ClassLoader;)Ljavax/xml/stream/XMLEventFactory;,9|true |
4387 | 4386 | javax.xml.stream.XMLEventFactory,newInstance,()Ljavax/xml/stream/XMLEventFactory;,9|true |
210 | 210 | * possiblyLeakedObligation) |
211 | 211 | */) { |
212 | 212 | 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 " | |
214 | 214 | + edge.getSource().getLastInstruction()); |
215 | 215 | } |
216 | 216 | fact.deleteObligation(comparedObligation, edge.getTarget().getLabel()); |
19 | 19 | package edu.umd.cs.findbugs.ba.type; |
20 | 20 | |
21 | 21 | import java.util.Collection; |
22 | ||
23 | import javax.annotation.CheckForNull; | |
22 | 24 | |
23 | 25 | import edu.umd.cs.findbugs.ba.CFG; |
24 | 26 | import edu.umd.cs.findbugs.ba.Dataflow; |
46 | 48 | return getAnalysis().getEdgeExceptionSet(edge); |
47 | 49 | } |
48 | 50 | |
51 | @CheckForNull | |
49 | 52 | public LocationAndFactPair getLocationAndFactForInstruction(int pc) { |
50 | 53 | Collection<Location> locations = getCFG().getLocationsContainingInstructionWithOffset(pc); |
51 | 54 |
168 | 168 | if (p == param) { |
169 | 169 | return getEntryValue(slotOffset); |
170 | 170 | } |
171 | param++; | |
171 | p++; | |
172 | 172 | slotOffset += SignatureParser.getNumSlotsForType(paramSig); |
173 | 173 | } |
174 | 174 |
17 | 17 | */ |
18 | 18 | |
19 | 19 | package edu.umd.cs.findbugs.bcel; |
20 | ||
21 | import javax.annotation.OverridingMethodsMustInvokeSuper; | |
20 | 22 | |
21 | 23 | import org.apache.bcel.classfile.Code; |
22 | 24 | |
64 | 66 | } |
65 | 67 | |
66 | 68 | @Override |
69 | @OverridingMethodsMustInvokeSuper | |
67 | 70 | public boolean beforeOpcode(int seen) { |
68 | 71 | stack.precomputation(this); |
69 | 72 | return !stack.isTop(); |
74 | 77 | * @see #sawOpcode(int) |
75 | 78 | */ |
76 | 79 | @Override |
80 | @OverridingMethodsMustInvokeSuper | |
77 | 81 | public void afterOpcode(int seen) { |
78 | 82 | stack.sawOpcode(this, seen); |
79 | 83 | } |
188 | 188 | return checkFlag(Constants.ACC_PRIVATE); |
189 | 189 | } |
190 | 190 | |
191 | @Override | |
192 | public boolean isEnum() { | |
193 | return checkFlag(Constants.ACC_ENUM); | |
194 | } | |
195 | ||
191 | 196 | /* |
192 | 197 | * (non-Javadoc) |
193 | 198 | * |
24 | 24 | |
25 | 25 | import javax.annotation.CheckForNull; |
26 | 26 | |
27 | import org.apache.bcel.Constants; | |
27 | import org.apache.bcel.Const; | |
28 | 28 | import org.objectweb.asm.Attribute; |
29 | 29 | import org.objectweb.asm.ClassReader; |
30 | 30 | import org.objectweb.asm.ClassVisitor; |
59 | 59 | |
60 | 60 | private static final BitSet RETURN_OPCODE_SET = new BitSet(); |
61 | 61 | 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); | |
68 | 68 | } |
69 | 69 | |
70 | 70 | private final ClassReader classReader; |
206 | 206 | @Override |
207 | 207 | public void visitInsn(int opcode) { |
208 | 208 | switch (opcode) { |
209 | case Constants.MONITORENTER: | |
209 | case Const.MONITORENTER: | |
210 | 210 | mBuilder.setUsesConcurrency(); |
211 | 211 | 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: | |
217 | 217 | if (identityState == IdentityMethodState.LOADED_PARAMETER) { |
218 | 218 | mBuilder.setIsIdentity(); |
219 | 219 | } |
220 | 220 | sawReturn = true; |
221 | 221 | break; |
222 | case Constants.RETURN: | |
222 | case Const.RETURN: | |
223 | 223 | sawReturn = true; |
224 | 224 | break; |
225 | case Constants.ATHROW: | |
225 | case Const.ATHROW: | |
226 | 226 | if (stubState == StubState.INITIALIZE_RUNTIME) { |
227 | 227 | sawStubThrow = true; |
228 | 228 | } else if (justSawInitializationOfUnsupportedOperationException) { |
456 | 456 | mBuilder.setUnsupported(); |
457 | 457 | } |
458 | 458 | if (sawStubThrow) { |
459 | mBuilder.addAccessFlags(Constants.ACC_SYNTHETIC); | |
459 | mBuilder.addAccessFlags(Const.ACC_SYNTHETIC); | |
460 | 460 | mBuilder.setIsStub(); |
461 | 461 | |
462 | 462 | } |
646 | 646 | |
647 | 647 | int size; |
648 | 648 | 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: | |
656 | 656 | size = 5; |
657 | 657 | break; |
658 | case Constants.CONSTANT_Long: | |
659 | case Constants.CONSTANT_Double: | |
658 | case Const.CONSTANT_Long: | |
659 | case Const.CONSTANT_Double: | |
660 | 660 | size = 9; |
661 | 661 | count++; |
662 | 662 | break; |
663 | case Constants.CONSTANT_Utf8: | |
663 | case Const.CONSTANT_Utf8: | |
664 | 664 | size = 3 + classReader.readUnsignedShort(offset + 1); |
665 | 665 | break; |
666 | case Constants.CONSTANT_Class: | |
666 | case Const.CONSTANT_Class: | |
667 | 667 | @SlashedClassName |
668 | 668 | String className = classReader.readUTF8(offset + 1, buf); |
669 | 669 | if (className.indexOf('[') >= 0) { |
674 | 674 | } |
675 | 675 | size = 3; |
676 | 676 | break; |
677 | case Constants.CONSTANT_String: | |
678 | case Constants.CONSTANT_MethodType: | |
677 | case Const.CONSTANT_String: | |
678 | case Const.CONSTANT_MethodType: | |
679 | 679 | size = 3; |
680 | 680 | break; |
681 | case Constants.CONSTANT_MethodHandle: | |
681 | case Const.CONSTANT_MethodHandle: | |
682 | 682 | size = 4; |
683 | 683 | break; |
684 | 684 | default: |
25 | 25 | */ |
26 | 26 | public class FindBugsASM { |
27 | 27 | |
28 | public static final int ASM_VERSION = Opcodes.ASM5; | |
28 | public static final int ASM_VERSION = Opcodes.ASM6; | |
29 | 29 | |
30 | 30 | } |
20 | 20 | |
21 | 21 | import static org.apache.bcel.Constants.*; |
22 | 22 | |
23 | import java.util.ArrayDeque; | |
23 | 24 | import java.util.ArrayList; |
24 | 25 | import java.util.BitSet; |
25 | 26 | import java.util.Collections; |
26 | 27 | import java.util.Comparator; |
28 | import java.util.Deque; | |
27 | 29 | import java.util.HashMap; |
28 | 30 | import java.util.HashSet; |
29 | 31 | import java.util.IdentityHashMap; |
726 | 728 | for (VariableData data : analyzedArguments.values()) { |
727 | 729 | for (LongRangeSet subRange : data.splitSet) { |
728 | 730 | BitSet reachedBlocks = new BitSet(); |
729 | walkCFG(cfg, cfg.getEntry(), subRange, data.edges, reachedBlocks, new HashSet<Long>()); | |
731 | walkCFG(cfg, subRange, data.edges, reachedBlocks); | |
730 | 732 | data.reachableBlocks.or(reachedBlocks); |
731 | 733 | } |
732 | 734 | } |
892 | 894 | return result; |
893 | 895 | } |
894 | 896 | |
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 | } | |
917 | 936 | } |
918 | 937 | } |
919 | 938 | } |
116 | 116 | throw new IOException("File " + file.getAbsolutePath() + " is not a normal file"); |
117 | 117 | } else if (fileName.endsWith(".class")) { |
118 | 118 | return new SingleFileCodeBase(codeBaseLocator, fileName); |
119 | } else if (fileName.endsWith(File.separator + "jrt-fs.jar")) { | |
120 | return new JrtfsCodeBase(codeBaseLocator, fileName); | |
119 | 121 | } else { |
120 | 122 | return ZipCodeBaseFactory.makeZipCodeBase(codeBaseLocator, file); |
121 | 123 | } |
24 | 24 | import java.io.FileNotFoundException; |
25 | 25 | import java.io.IOException; |
26 | 26 | import java.io.InputStream; |
27 | import java.nio.file.Files; | |
28 | import java.nio.file.Path; | |
29 | import java.nio.file.Paths; | |
27 | 30 | import java.util.HashMap; |
28 | 31 | import java.util.HashSet; |
29 | 32 | import java.util.Iterator; |
37 | 40 | import java.util.jar.Manifest; |
38 | 41 | |
39 | 42 | import edu.umd.cs.findbugs.FindBugs; |
43 | import edu.umd.cs.findbugs.JavaVersion; | |
40 | 44 | import edu.umd.cs.findbugs.SystemProperties; |
41 | 45 | import edu.umd.cs.findbugs.classfile.CheckedAnalysisException; |
42 | 46 | import edu.umd.cs.findbugs.classfile.ClassDescriptor; |
272 | 276 | dumpCodeBaseList(classPath.appCodeBaseIterator(), "Application codebases"); |
273 | 277 | dumpCodeBaseList(classPath.auxCodeBaseIterator(), "Auxiliary codebases"); |
274 | 278 | } |
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 | } | |
275 | 285 | } |
276 | 286 | |
277 | 287 | /** |
389 | 399 | } |
390 | 400 | } |
391 | 401 | |
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 | } | |
392 | 408 | return workList; |
409 | } | |
410 | ||
411 | private static boolean isJava9orLater() { | |
412 | JavaVersion javaVersion = JavaVersion.getRuntimeVersion(); | |
413 | return javaVersion.getMajor() >= 9; | |
393 | 414 | } |
394 | 415 | |
395 | 416 | /** |
627 | 648 | } catch (IOException e) { |
628 | 649 | if (item.isAppCodeBase() || item.getHowDiscovered() == ICodeBase.Discovered.SPECIFIED) { |
629 | 650 | 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 | } | |
631 | 656 | } else { |
632 | 657 | errorLogger.logError("Cannot open codebase " + item.getCodeBaseLocator(), e); |
633 | 658 | } |
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 | } |
317 | 317 | if (!option.startsWith("-")) { |
318 | 318 | break; |
319 | 319 | } |
320 | ||
320 | if (dryRun && option.startsWith("@")) { | |
321 | ++arg; | |
322 | continue; | |
323 | } | |
321 | 324 | String optionExtraPart = ""; |
322 | 325 | int colon = option.indexOf(':'); |
323 | 326 | if (colon >= 0) { |
31 | 31 | * |
32 | 32 | * @param keySet |
33 | 33 | * 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 | |
35 | 35 | * lexicographically. The list may be empty if given set was empty |
36 | 36 | */ |
37 | 37 | static public Enumeration<?> sortKeys(Set<String> keySet) { |
197 | 197 | if (props.size() == 0) { |
198 | 198 | return; |
199 | 199 | } |
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 | ||
200 | 213 | for (int i = 0; i < MAX_RECENT_FILES; i++) { |
201 | 214 | String key = "recent" + i; |
202 | 215 | String projectName = (String) props.get(key); |
204 | 217 | recentProjectsList.add(projectName); |
205 | 218 | } |
206 | 219 | } |
220 | ||
207 | 221 | |
208 | 222 | for (Map.Entry<?, ?> e : props.entrySet()) { |
209 | 223 |
20 | 20 | package edu.umd.cs.findbugs.detect; |
21 | 21 | |
22 | 22 | import java.util.regex.Pattern; |
23 | import java.util.regex.PatternSyntaxException; | |
24 | 23 | |
25 | 24 | import edu.umd.cs.findbugs.BugInstance; |
26 | 25 | import edu.umd.cs.findbugs.BugReporter; |
85 | 84 | OpcodeStack.Item it = stack.getStackItem(stackDepth); |
86 | 85 | if (it.getSpecialKind() == OpcodeStack.Item.FILE_SEPARATOR_STRING && (flags & Pattern.LITERAL) == 0) { |
87 | 86 | 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)); | |
89 | 88 | return; |
90 | 89 | } |
91 | 90 | Object value = it.getConstant(); |
95 | 94 | String regex = (String) value; |
96 | 95 | try { |
97 | 96 | Pattern.compile(regex, flags); |
98 | } catch (PatternSyntaxException e) { | |
97 | } catch (IllegalArgumentException e) { | |
99 | 98 | String message = e.getMessage(); |
100 | 99 | int eol = message.indexOf('\n'); |
101 | 100 | if (eol > 0) { |
102 | 101 | message = message.substring(0, eol); |
103 | 102 | } |
104 | 103 | 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); | |
107 | 106 | String options = getOptions(flags); |
108 | 107 | if (options.length() > 0) { |
109 | 108 | bug.addString("Regex flags: " + options).describe(StringAnnotation.STRING_MESSAGE); |
71 | 71 | */ |
72 | 72 | public class BuildObligationPolicyDatabase implements Detector2, NonReportingDetector { |
73 | 73 | |
74 | static class AuxilaryObligationPropertyDatabase extends MethodPropertyDatabase<String> { | |
74 | static class AuxiliaryObligationPropertyDatabase extends MethodPropertyDatabase<String> { | |
75 | 75 | |
76 | 76 | /* |
77 | 77 | * (non-Javadoc) |
142 | 142 | URL u = DetectorFactoryCollection.getCoreResource("obligationPolicy.db"); |
143 | 143 | try { |
144 | 144 | if (u != null) { |
145 | AuxilaryObligationPropertyDatabase db = new AuxilaryObligationPropertyDatabase(); | |
145 | AuxiliaryObligationPropertyDatabase db = new AuxiliaryObligationPropertyDatabase(); | |
146 | 146 | db.read(u.openStream()); |
147 | 147 | for (Map.Entry<MethodDescriptor, String> e : db.entrySet()) { |
148 | 148 | String[] v = e.getValue().split(","); |
30 | 30 | |
31 | 31 | import org.apache.bcel.classfile.Code; |
32 | 32 | import org.apache.bcel.classfile.Method; |
33 | import org.apache.bcel.generic.Type; | |
33 | 34 | |
34 | 35 | import edu.umd.cs.findbugs.BugReporter; |
35 | 36 | import edu.umd.cs.findbugs.NonReportingDetector; |
204 | 205 | |
205 | 206 | private int nArgs; |
206 | 207 | |
207 | private int shift; | |
208 | ||
209 | private boolean[] argEnabled; | |
208 | private int[] argNums; | |
210 | 209 | |
211 | 210 | private List<MethodParameter>[] passedParameters; |
212 | 211 | |
217 | 216 | @SuppressWarnings("unchecked") |
218 | 217 | @Override |
219 | 218 | 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(); | |
222 | 221 | if(argumentTypes.length == 0) { |
223 | 222 | return; |
224 | 223 | } |
224 | int lvNum = obj.isStatic() ? 0 : 1; | |
225 | 225 | nArgs = argumentTypes.length; |
226 | int argCount = lvNum; | |
227 | for(Type type : argumentTypes) { | |
228 | argCount+=type.getSize(); | |
229 | } | |
226 | 230 | for(int i=0; i<nArgs; i++) { |
227 | 231 | 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) { | |
236 | 241 | passedParameters = new List[nArgs]; |
237 | 242 | } |
238 | 243 | super.visitMethod(obj); |
240 | 245 | |
241 | 246 | @Override |
242 | 247 | public boolean shouldVisitCode(Code obj) { |
243 | return argEnabled != null; | |
248 | return argNums != null; | |
244 | 249 | } |
245 | 250 | |
246 | 251 | @Override |
260 | 265 | @Override |
261 | 266 | public void sawOpcode(int seen) { |
262 | 267 | 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 | } | |
267 | 275 | } |
268 | 276 | } |
269 | 277 | switch (seen) { |
275 | 283 | int callArgs = getNumberArguments(md.getSignature()); |
276 | 284 | for (int i = 0; i < callArgs; i++) { |
277 | 285 | 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]]; | |
281 | 289 | if (list == null) { |
282 | passedParameters[param] = list = new ArrayList<>(); | |
290 | passedParameters[argNums[param]] = list = new ArrayList<>(); | |
283 | 291 | } |
284 | 292 | list.add(new MethodParameter(md, i)); |
285 | 293 | } |
46 | 46 | @Override |
47 | 47 | public void visit(JavaClass obj) { |
48 | 48 | |
49 | if (Subtypes2.instanceOf(obj, "java.util.Comparator") && !ClassName.isAnonymous(getClassName()) | |
49 | if (Subtypes2.instanceOf(obj, "java.util.Comparator") && !ClassName.isLocalOrAnonymous(getClassName()) | |
50 | 50 | && !Subtypes2.instanceOf(obj, "java.io.Serializable")) { |
51 | 51 | int priority = NORMAL_PRIORITY; |
52 | 52 | if (obj.isInterface() || obj.isAbstract()) { |
21 | 21 | import edu.umd.cs.findbugs.ba.DataflowAnalysisException; |
22 | 22 | import edu.umd.cs.findbugs.ba.Location; |
23 | 23 | import edu.umd.cs.findbugs.ba.MethodUnprofitableException; |
24 | import edu.umd.cs.findbugs.ba.SignatureParser; | |
24 | 25 | import edu.umd.cs.findbugs.ba.constant.Constant; |
25 | 26 | import edu.umd.cs.findbugs.ba.constant.ConstantDataflow; |
26 | 27 | import edu.umd.cs.findbugs.ba.constant.ConstantFrame; |
94 | 95 | } |
95 | 96 | InvokeInstruction iins = (InvokeInstruction) ins; |
96 | 97 | |
98 | SignatureParser parser = new SignatureParser(iins.getSignature(cpg)); | |
99 | ||
97 | 100 | ConstantFrame frame = constantDataflow.getFactAtLocation(location); |
98 | 101 | if (!frame.isValid()) { |
99 | 102 | // This basic block is probably dead |
103 | 106 | MethodDescriptor md = new MethodDescriptor(iins, cpg); |
104 | 107 | if (allDatabasePasswordMethods.containsKey(md)) { |
105 | 108 | 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); | |
107 | 110 | if (operandValue.isConstantString()) { |
108 | 111 | String password = operandValue.getConstantString(); |
109 | 112 | if (password.length() == 0) { |
133 | 136 | } else if (allFileNameStringMethods.containsKey(md)) { |
134 | 137 | |
135 | 138 | 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); | |
137 | 140 | if (!operandValue.isConstantString()) { |
138 | 141 | continue; |
139 | 142 | } |
21 | 21 | import java.math.BigDecimal; |
22 | 22 | import java.util.Iterator; |
23 | 23 | |
24 | import org.apache.bcel.Const; | |
24 | 25 | import org.apache.bcel.classfile.Attribute; |
25 | 26 | import org.apache.bcel.classfile.Code; |
26 | 27 | import org.apache.bcel.classfile.CodeException; |
201 | 202 | && "setMaximumPoolSize".equals(getNameConstantOperand())) { |
202 | 203 | accumulator.accumulateBug(new BugInstance(DumbMethods.this, |
203 | 204 | "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); | |
205 | 206 | } |
206 | 207 | } |
207 | 208 | } |
383 | 384 | OpcodeStack.Item top = stack.getStackItem(0); |
384 | 385 | if ("Ljava/net/URL;".equals(top.getSignature())) { |
385 | 386 | accumulator.accumulateBug(new BugInstance(DumbMethods.this, "DMI_COLLECTION_OF_URLS", HIGH_PRIORITY) |
386 | .addClassAndMethod(DumbMethods.this), DumbMethods.this); | |
387 | .addClassAndMethod(DumbMethods.this), DumbMethods.this); | |
387 | 388 | } |
388 | 389 | } |
389 | 390 | } |
492 | 493 | if (seen == INVOKEVIRTUAL && "java/util/Random".equals(getClassConstantOperand()) |
493 | 494 | && (freshRandomOnTos || freshRandomOneBelowTos)) { |
494 | 495 | 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); | |
496 | 497 | |
497 | 498 | } |
498 | 499 | freshRandomOneBelowTos = freshRandomOnTos && isRegisterLoad(); |
702 | 703 | } |
703 | 704 | if (primitiveType != null |
704 | 705 | && (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 | |
706 | 707 | && (primitiveType.equals("D") || primitiveType.equals("F")))) { |
707 | 708 | MethodDescriptor shouldCall = new MethodDescriptor(called.getClassDescriptor().getClassName(), "compare", |
708 | 709 | "(" + primitiveType + primitiveType + ")I", true); |
709 | 710 | BugInstance bug = new BugInstance(this, "DM_BOXED_PRIMITIVE_FOR_COMPARE", |
710 | 711 | primitiveType.equals("Z") ? LOW_PRIORITY : primitiveType.equals("B") ? NORMAL_PRIORITY |
711 | 712 | : HIGH_PRIORITY).addClassAndMethod(this).addCalledMethod(this).addMethod(shouldCall) |
712 | .describe(MethodAnnotation.SHOULD_CALL); | |
713 | .describe(MethodAnnotation.SHOULD_CALL); | |
713 | 714 | accumulator.accumulateBug(bug, this); |
714 | 715 | } |
715 | 716 | } |
819 | 820 | && "org/easymock/EasyMock".equals(getClassConstantOperand()) |
820 | 821 | && ("replay".equals(getNameConstantOperand()) || "verify".equals(getNameConstantOperand()) || getNameConstantOperand() |
821 | 822 | .startsWith("reset")) && "([Ljava/lang/Object;)V".equals(getSigConstantOperand()) |
822 | && getPrevOpcode(1) == ANEWARRAY && getPrevOpcode(2) == ICONST_0) { | |
823 | && getPrevOpcode(1) == ANEWARRAY && getPrevOpcode(2) == ICONST_0) { | |
823 | 824 | 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); | |
825 | 826 | } |
826 | 827 | |
827 | 828 | if ((seen == INVOKESTATIC || seen == INVOKEVIRTUAL || seen == INVOKESPECIAL || seen == INVOKEINTERFACE) |
845 | 846 | if (prevOpcode == I2L && seen == INVOKESTATIC && "java/lang/Double".equals(getClassConstantOperand()) |
846 | 847 | && "longBitsToDouble".equals(getNameConstantOperand())) { |
847 | 848 | 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); | |
849 | 850 | } |
850 | 851 | |
851 | 852 | /** |
876 | 877 | int special = item0.getSpecialKind(); |
877 | 878 | if (special == OpcodeStack.Item.RANDOM_INT) { |
878 | 879 | pendingAbsoluteValueBug = new BugInstance(this, "RV_ABSOLUTE_VALUE_OF_RANDOM_INT", HIGH_PRIORITY) |
879 | .addClassAndMethod(this); | |
880 | .addClassAndMethod(this); | |
880 | 881 | pendingAbsoluteValueBugSourceLine = SourceLineAnnotation.fromVisitedInstruction(this); |
881 | 882 | opcodesSincePendingAbsoluteValueBug = 0; |
882 | 883 | } |
883 | 884 | |
884 | 885 | else if (special == OpcodeStack.Item.HASHCODE_INT) { |
885 | 886 | pendingAbsoluteValueBug = new BugInstance(this, "RV_ABSOLUTE_VALUE_OF_HASHCODE", HIGH_PRIORITY) |
886 | .addClassAndMethod(this); | |
887 | .addClassAndMethod(this); | |
887 | 888 | pendingAbsoluteValueBugSourceLine = SourceLineAnnotation.fromVisitedInstruction(this); |
888 | 889 | opcodesSincePendingAbsoluteValueBug = 0; |
889 | 890 | } |
929 | 930 | int v = switchLabels[i]; |
930 | 931 | if (v <= -129 || v >= 128) { |
931 | 932 | 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])); | |
934 | 935 | } |
935 | 936 | |
936 | 937 | } |
1016 | 1017 | } |
1017 | 1018 | |
1018 | 1019 | 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); | |
1020 | 1021 | |
1021 | 1022 | } |
1022 | 1023 | } else if (item0.getSpecialKind() == OpcodeStack.Item.NON_NEGATIVE && constant1 instanceof Number) { |
+1
-1
115 | 115 | Type cType = Type.getType(c.getSignature()); |
116 | 116 | IncompatibleTypes check = IncompatibleTypes.getPriorityForAssumingCompatible(thisType, cType, false); |
117 | 117 | int priority = check.getPriority(); |
118 | if ("java/lang/Object".equals(getSuperclassName()) && ClassName.isAnonymous(getClassName())) { | |
118 | if ("java/lang/Object".equals(getSuperclassName()) && ClassName.isLocalOrAnonymous(getClassName())) { | |
119 | 119 | priority++; |
120 | 120 | } |
121 | 121 | bugAccumulator.accumulateBug(new BugInstance(this, "EQ_CHECK_FOR_OPERAND_NOT_COMPATIBLE_WITH_THIS", priority) |
841 | 841 | * @return true if given method is known to change its object only |
842 | 842 | */ |
843 | 843 | 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")) { | |
845 | 845 | return false; |
846 | 846 | } |
847 | 847 | String className = m.getSlashedClassName(); |
577 | 577 | } |
578 | 578 | boolean result = ifNullTests > 2; |
579 | 579 | |
580 | // System.out.println("Preceeding null tests " + ifNullTests + " " + | |
580 | // System.out.println("Preceding null tests " + ifNullTests + " " + | |
581 | 581 | // ifNonnullTests + " " + result); |
582 | 582 | return result; |
583 | 583 | } catch (CFGBuilderException e) { |
60 | 60 | * resources that aren't closed. |
61 | 61 | * |
62 | 62 | * @author David Hovemeyer |
63 | * @author Agustin Toribio atomo@arrakis.es | |
63 | 64 | */ |
64 | 65 | public final class FindOpenStream extends ResourceTrackingDetector<Stream, StreamResourceTracker> implements StatelessDetector { |
65 | 66 | static final boolean DEBUG = SystemProperties.getBoolean("fos.debug"); |
104 | 105 | streamFactoryCollection.add(new MethodReturnValueStreamFactory("java.lang.Class", "getResourceAsStream", |
105 | 106 | "(Ljava/lang/String;)Ljava/io/InputStream;", "OS_OPEN_STREAM")); |
106 | 107 | |
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 | ||
107 | 134 | // Ignore socket input and output streams |
108 | 135 | streamFactoryCollection.add(new MethodReturnValueStreamFactory("java.net.Socket", "getInputStream", |
109 | 136 | "()Ljava/io/InputStream;")); |
253 | 280 | // class containing one of these words, then we don't run the |
254 | 281 | // detector on the class. |
255 | 282 | private static final String[] PRESCREEN_CLASS_LIST = { "Stream", "Reader", "Writer", "ZipFile", "JarFile", "DriverManager", |
256 | "Connection", "Statement" }; | |
283 | "Connection", "Statement", "Files" }; | |
257 | 284 | |
258 | 285 | /* |
259 | 286 | * (non-Javadoc) |
568 | 568 | if (field != null) { |
569 | 569 | // If the field is final, we'll assume that the String value |
570 | 570 | // is static. |
571 | if (field.isFinal() && field.isFinal()) { | |
571 | if (field.isFinal()) { | |
572 | 572 | pushValue(staticStringTypeInstance); |
573 | 573 | } else { |
574 | 574 | pushValue(type); |
28 | 28 | import edu.umd.cs.findbugs.LocalVariableAnnotation; |
29 | 29 | import edu.umd.cs.findbugs.OpcodeStack; |
30 | 30 | import edu.umd.cs.findbugs.ba.AnalysisContext; |
31 | import edu.umd.cs.findbugs.ba.XField; | |
31 | 32 | import edu.umd.cs.findbugs.bcel.OpcodeStackDetector; |
32 | 33 | |
33 | 34 | public class FindReturnRef extends OpcodeStackDetector { |
105 | 106 | return; |
106 | 107 | } |
107 | 108 | |
108 | if (staticMethod && seen == PUTSTATIC && MutableStaticFields.mutableSignature(getSigConstantOperand())) { | |
109 | if (staticMethod && seen == PUTSTATIC && nonPublicFieldOperand() | |
110 | && MutableStaticFields.mutableSignature(getSigConstantOperand())) { | |
109 | 111 | OpcodeStack.Item top = stack.getStackItem(0); |
110 | 112 | if (isPotentialCapture(top)) { |
111 | 113 | bugAccumulator.accumulateBug( |
116 | 118 | getPC(), getPC() - 1)), this); |
117 | 119 | } |
118 | 120 | } |
119 | if (!staticMethod && seen == PUTFIELD && MutableStaticFields.mutableSignature(getSigConstantOperand())) { | |
121 | if (!staticMethod && seen == PUTFIELD && nonPublicFieldOperand() | |
122 | && MutableStaticFields.mutableSignature(getSigConstantOperand())) { | |
120 | 123 | OpcodeStack.Item top = stack.getStackItem(0); |
121 | 124 | OpcodeStack.Item target = stack.getStackItem(1); |
122 | 125 | if (isPotentialCapture(top) && target.getRegisterNumber() == 0) { |
135 | 138 | return; |
136 | 139 | } |
137 | 140 | |
138 | if (thisOnTOS && seen == GETFIELD && getClassConstantOperand().equals(getClassName()) | |
141 | if (thisOnTOS && seen == GETFIELD && getClassConstantOperand().equals(getClassName()) && nonPublicFieldOperand() | |
139 | 142 | && !AnalysisContext.currentXFactory().isEmptyArrayField(getXFieldOperand())) { |
140 | 143 | fieldOnTOS = true; |
141 | 144 | thisOnTOS = false; |
145 | 148 | fieldIsStatic = false; |
146 | 149 | return; |
147 | 150 | } |
148 | if (seen == GETSTATIC && getClassConstantOperand().equals(getClassName()) | |
151 | if (seen == GETSTATIC && getClassConstantOperand().equals(getClassName()) && nonPublicFieldOperand() | |
149 | 152 | && !AnalysisContext.currentXFactory().isEmptyArrayField(getXFieldOperand())) { |
150 | 153 | fieldOnTOS = true; |
151 | 154 | thisOnTOS = false; |
171 | 174 | thisOnTOS = false; |
172 | 175 | } |
173 | 176 | |
177 | private boolean nonPublicFieldOperand() { | |
178 | XField xField = getXFieldOperand(); | |
179 | return xField == null || !xField.isPublic(); | |
180 | } | |
181 | ||
174 | 182 | private boolean isPotentialCapture(OpcodeStack.Item top) { |
175 | 183 | if (!top.isInitialParameter()) { |
176 | 184 | return false; |
46 | 46 | import edu.umd.cs.findbugs.BugReporter; |
47 | 47 | import edu.umd.cs.findbugs.Detector; |
48 | 48 | import edu.umd.cs.findbugs.SourceLineAnnotation; |
49 | import edu.umd.cs.findbugs.SystemProperties; | |
49 | import edu.umd.cs.findbugs.ba.AnalysisContext; | |
50 | 50 | import edu.umd.cs.findbugs.ba.BasicBlock; |
51 | 51 | import edu.umd.cs.findbugs.ba.CFG; |
52 | 52 | import edu.umd.cs.findbugs.ba.CFGBuilderException; |
54 | 54 | import edu.umd.cs.findbugs.ba.DataflowAnalysisException; |
55 | 55 | import edu.umd.cs.findbugs.ba.EdgeTypes; |
56 | 56 | 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; | |
57 | 60 | import edu.umd.cs.findbugs.ba.constant.Constant; |
58 | 61 | import edu.umd.cs.findbugs.ba.constant.ConstantDataflow; |
59 | 62 | import edu.umd.cs.findbugs.ba.constant.ConstantFrame; |
60 | 63 | import edu.umd.cs.findbugs.ba.type.TopType; |
61 | 64 | import edu.umd.cs.findbugs.ba.type.TypeDataflow; |
62 | 65 | 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; | |
63 | 69 | import edu.umd.cs.findbugs.classfile.CheckedAnalysisException; |
64 | 70 | import edu.umd.cs.findbugs.classfile.Global; |
65 | 71 | import edu.umd.cs.findbugs.classfile.MethodDescriptor; |
188 | 194 | final Map<MethodDescriptor, int[]> executeMethods; |
189 | 195 | final Set<MethodDescriptor> allMethods = new HashSet<>(); |
190 | 196 | |
191 | private final boolean testingEnabled; | |
192 | ||
193 | 197 | public FindSqlInjection(BugReporter bugReporter) { |
194 | 198 | this.bugReporter = bugReporter; |
195 | 199 | this.bugAccumulator = new BugAccumulator(bugReporter); |
196 | testingEnabled = SystemProperties.getBoolean("report_TESTING_pattern_in_standard_detectors"); | |
197 | 200 | Set<MethodParameter> baseExecuteMethods = new HashSet<>(); |
198 | 201 | for(MethodDescriptor executeMethod : EXECUTE_METHODS) { |
199 | 202 | baseExecuteMethods.add(new MethodParameter(executeMethod, 0)); |
464 | 467 | } |
465 | 468 | } |
466 | 469 | |
467 | String description = "TESTING"; | |
470 | String description; | |
468 | 471 | if (isExecute) { |
469 | 472 | description = "SQL_NONCONSTANT_STRING_PASSED_TO_EXECUTE"; |
470 | 473 | } else { |
473 | 476 | |
474 | 477 | BugInstance bug = new BugInstance(this, description, priority); |
475 | 478 | bug.addClassAndMethod(methodGen, javaClass.getSourceFileName()); |
476 | if ("TESTING".equals(description)) { | |
477 | bug.addString("Incomplete report invoking non-constant SQL string"); | |
478 | } | |
479 | 479 | if (sawSeriousTaint) { |
480 | 480 | bug.addString("non-constant SQL string involving HTTP taint"); |
481 | 481 | } |
489 | 489 | |
490 | 490 | private void analyzeMethod(ClassContext classContext, Method method) throws DataflowAnalysisException, CFGBuilderException { |
491 | 491 | JavaClass javaClass = classContext.getJavaClass(); |
492 | ValueNumberDataflow vnd = classContext.getValueNumberDataflow(method); | |
493 | ||
494 | Set<ValueNumber> passthruParams = getPassthruParams(vnd, method, javaClass); | |
495 | ||
492 | 496 | this.method = method; |
493 | 497 | this.classContext = classContext; |
494 | 498 | MethodGen methodGen = classContext.getMethodGen(method); |
528 | 532 | } |
529 | 533 | } |
530 | 534 | 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)) { | |
535 | 540 | // TODO: verify it's the same string represented by |
536 | 541 | // stringAppendState |
537 | 542 | // FIXME: will false positive on const/static strings |
538 | 543 | // returns by methods |
539 | Location prev = getPreviousLocation(cfg, location, true); | |
544 | Location prev = getValueNumberCreationLocation(vnd, vn); | |
540 | 545 | 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); | |
545 | 548 | bugAccumulator.accumulateBug( |
546 | 549 | bug, |
547 | 550 | SourceLineAnnotation.fromVisitedInstruction(classContext, methodGen, |
552 | 555 | bugAccumulator.reportAccumulatedBugs(); |
553 | 556 | } |
554 | 557 | |
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 | ||
555 | 596 | @Override |
556 | 597 | public void report() { |
557 | 598 | } |
50 | 50 | import edu.umd.cs.findbugs.BugReporter; |
51 | 51 | import edu.umd.cs.findbugs.Detector; |
52 | 52 | import edu.umd.cs.findbugs.StringAnnotation; |
53 | import edu.umd.cs.findbugs.ba.AnalysisContext; | |
53 | 54 | import edu.umd.cs.findbugs.ba.BasicBlock; |
54 | 55 | import edu.umd.cs.findbugs.ba.CFG; |
55 | 56 | import edu.umd.cs.findbugs.ba.ClassContext; |
74 | 75 | * @author Tagir Valeev |
75 | 76 | */ |
76 | 77 | public class FindUselessObjects implements Detector { |
78 | private static final int MAX_ITERATIONS = 50; | |
77 | 79 | private final BugReporter reporter; |
78 | 80 | private final NoSideEffectMethodsDatabase noSideEffectMethods; |
79 | 81 | |
470 | 472 | } |
471 | 473 | context.enhanceViaMergeTree(); |
472 | 474 | boolean changed; |
475 | int iteration = 0; | |
473 | 476 | do { |
474 | 477 | 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 | } | |
475 | 484 | for(Iterator<GenLocation> iterator = context.genIterator(); iterator.hasNext() && !context.isEmpty(); ) { |
476 | 485 | GenLocation location = iterator.next(); |
477 | 486 | Instruction inst = location.getHandle().getInstruction(); |
18 | 18 | |
19 | 19 | package edu.umd.cs.findbugs.detect; |
20 | 20 | |
21 | import org.apache.bcel.classfile.Method; | |
21 | import org.apache.bcel.classfile.Code; | |
22 | 22 | |
23 | 23 | import edu.umd.cs.findbugs.BugInstance; |
24 | 24 | 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; | |
27 | 27 | |
28 | 28 | /** |
29 | 29 | * Find comparisons involving values computed with bitwise operations whose |
30 | 30 | * outcomes are fixed at compile time. |
31 | 31 | * |
32 | 32 | * @author Tom Truscott <trt@unx.sas.com> |
33 | * @author Tagir Valeev | |
33 | 34 | */ |
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 { | |
43 | 36 | private final BugReporter bugReporter; |
44 | 37 | |
38 | private int bitop = -1; | |
39 | ||
40 | private boolean equality; | |
41 | ||
42 | private Number arg1, arg2; | |
43 | ||
44 | private Item bitresultItem; | |
45 | ||
45 | 46 | public IncompatMask(BugReporter bugReporter) { |
46 | this.state = 0; | |
47 | 47 | this.bugReporter = bugReporter; |
48 | 48 | } |
49 | 49 | |
50 | static int populationCount(long i) { | |
51 | return Long.bitCount(i); | |
52 | } | |
53 | ||
50 | 54 | @Override |
51 | public void visit(Method obj) { | |
55 | public void visit(Code obj) { | |
56 | arg1 = arg2 = null; | |
52 | 57 | 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; | |
94 | 69 | } |
95 | 70 | |
96 | 71 | @Override |
97 | 72 | public void sawOpcode(int seen) { |
98 | // System.out.println("BIT: " + state + ": " + OPCODE_NAMES[seen]); | |
99 | ||
100 | 73 | 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 | ||
140 | 74 | case IAND: |
141 | 75 | case LAND: |
76 | arg1 = getArg(); | |
142 | 77 | bitop = IAND; |
143 | isLong = seen == LAND; | |
144 | checkState(1); | |
145 | 78 | return; |
146 | 79 | case IOR: |
147 | 80 | case LOR: |
81 | arg1 = getArg(); | |
148 | 82 | bitop = IOR; |
149 | isLong = seen == LOR; | |
150 | checkState(1); | |
151 | return; | |
152 | ||
83 | return; | |
153 | 84 | 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; | |
161 | 103 | case IFLE: |
162 | 104 | case IFLT: |
163 | 105 | case IFGT: |
164 | 106 | 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)); | |
175 | 154 | } |
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; | |
202 | 192 | 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 | } | |
233 | 195 | } |
234 | 196 | |
235 | 197 | static long getFlagBits(boolean isLong, long arg0) { |
244 | 206 | return bits; |
245 | 207 | } |
246 | 208 | } |
247 |
121 | 121 | |
122 | 122 | /** |
123 | 123 | * 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 | |
125 | 125 | * and contains lots of public static String fields which are used as |
126 | 126 | * message constants. Unfortunately these fields cannot be final, so FB |
127 | 127 | * reports tons of warnings for such Eclipse classes. |
377 | 377 | |
378 | 378 | /** |
379 | 379 | * 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 | |
381 | 381 | * and contains lots of public static String fields which are used as |
382 | 382 | * message constants. Unfortunately these fields often has bad names which |
383 | 383 | * does not follow Java code convention, so FB reports tons of warnings for |
57 | 57 | SortedSet<String> redundantInfNames = new TreeSet<String>(); |
58 | 58 | |
59 | 59 | 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); | |
62 | 62 | if (superObj.instanceOf(inf)) { |
63 | 63 | redundantInfNames.add(inf.getClassName()); |
64 | 64 | } |
65 | 65 | |
66 | 66 | String superclassName2 = getSuperclassName(); |
67 | 67 | 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()); | |
69 | 69 | boolean isAnonymousInnerClass = hasAnonymousName && !weird; |
70 | 70 | if (isAnonymousInnerClass) { |
71 | 71 | super.visitJavaClass(obj); |
18 | 18 | |
19 | 19 | package edu.umd.cs.findbugs.detect; |
20 | 20 | |
21 | import java.util.ArrayList; | |
21 | 22 | import java.util.Collection; |
22 | 23 | import java.util.Collections; |
23 | 24 | import java.util.HashMap; |
24 | 25 | import java.util.HashSet; |
25 | 26 | import java.util.Iterator; |
26 | 27 | import java.util.LinkedList; |
28 | import java.util.List; | |
27 | 29 | import java.util.Map; |
28 | 30 | import java.util.Set; |
29 | 31 | import java.util.TreeSet; |
43 | 45 | import org.apache.bcel.generic.Type; |
44 | 46 | |
45 | 47 | import edu.umd.cs.findbugs.BugAccumulator; |
48 | import edu.umd.cs.findbugs.BugAnnotation; | |
46 | 49 | import edu.umd.cs.findbugs.BugInstance; |
47 | 50 | import edu.umd.cs.findbugs.BugReporter; |
51 | import edu.umd.cs.findbugs.ClassAnnotation; | |
48 | 52 | 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; | |
49 | 56 | import edu.umd.cs.findbugs.OpcodeStack; |
57 | import edu.umd.cs.findbugs.OpcodeStack.Item; | |
50 | 58 | import edu.umd.cs.findbugs.Priorities; |
51 | 59 | import edu.umd.cs.findbugs.ProgramPoint; |
52 | 60 | import edu.umd.cs.findbugs.SourceLineAnnotation; |
55 | 63 | import edu.umd.cs.findbugs.ba.XClass; |
56 | 64 | import edu.umd.cs.findbugs.ba.XFactory; |
57 | 65 | import edu.umd.cs.findbugs.ba.XField; |
66 | import edu.umd.cs.findbugs.ba.XMethod; | |
58 | 67 | import edu.umd.cs.findbugs.ba.ch.Subtypes2; |
59 | 68 | import edu.umd.cs.findbugs.ba.generic.GenericObjectType; |
60 | 69 | import edu.umd.cs.findbugs.ba.generic.GenericUtilities; |
102 | 111 | private final BugAccumulator bugAccumulator; |
103 | 112 | |
104 | 113 | boolean publicOrProtectedConstructor; |
114 | ||
115 | private final Map<String, List<BugAnnotation>> anonymousClassAnnotation = new HashMap<>(); | |
105 | 116 | |
106 | 117 | /** |
107 | 118 | * @deprecated Use {@link edu.umd.cs.findbugs.detect.UnreadFieldsData#getReadFields()} instead |
567 | 578 | bugAccumulator.accumulateBug(new BugInstance(this, "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD", priority) |
568 | 579 | .addClassAndMethod(this).addField(f), this); |
569 | 580 | |
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); | |
570 | 607 | } |
571 | 608 | } |
572 | 609 | |
743 | 780 | boolean isConstructor = "<init>".equals(getMethodName()) || "<clinit>".equals(getMethodName()); |
744 | 781 | if (getMethod().isStatic() == f.isStatic() |
745 | 782 | && (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())) { | |
748 | 785 | |
749 | 786 | if (isConstructor) { |
750 | 787 | data.writtenInConstructorFields.add(f); |
1134 | 1171 | priority = NORMAL_PRIORITY; |
1135 | 1172 | } |
1136 | 1173 | |
1137 | String bug = "SIC_INNER_SHOULD_BE_STATIC"; | |
1174 | BugInstance bugInstance; | |
1138 | 1175 | 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 | } | |
1140 | 1184 | } 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); | |
1142 | 1188 | } |
1143 | 1189 | |
1144 | bugReporter.reportBug(new BugInstance(this, bug, priority).addClass(className)); | |
1190 | bugReporter.reportBug(bugInstance); | |
1145 | 1191 | |
1146 | 1192 | } |
1147 | 1193 | } |
31 | 31 | import edu.umd.cs.findbugs.BytecodeScanningDetector; |
32 | 32 | import edu.umd.cs.findbugs.MethodAnnotation; |
33 | 33 | import edu.umd.cs.findbugs.StatelessDetector; |
34 | import edu.umd.cs.findbugs.ba.CFGBuilderException; | |
34 | 35 | import edu.umd.cs.findbugs.ba.ClassContext; |
36 | import edu.umd.cs.findbugs.ba.DataflowAnalysisException; | |
35 | 37 | import edu.umd.cs.findbugs.ba.XClass; |
38 | import edu.umd.cs.findbugs.ba.type.TypeDataflow.LocationAndFactPair; | |
36 | 39 | import edu.umd.cs.findbugs.classfile.CheckedAnalysisException; |
37 | 40 | import edu.umd.cs.findbugs.classfile.ClassDescriptor; |
38 | 41 | import edu.umd.cs.findbugs.classfile.FieldDescriptor; |
165 | 168 | private static boolean implementsMap(ClassDescriptor d) { |
166 | 169 | while (d != null) { |
167 | 170 | 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 | } | |
168 | 175 | // True if variable is itself declared as a Map |
169 | 176 | if ("java.util.Map".equals(d.getDottedClassName())) { |
170 | 177 | return true; |
225 | 232 | "keySet".equals(getNameConstantOperand()) && "()Ljava/util/Set;".equals(getSigConstantOperand()) |
226 | 233 | // Following check solves sourceforge bug 1830576 |
227 | 234 | && 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 | } | |
228 | 245 | mapVariable = loadedVariable; |
229 | 246 | removedFromStack(true); |
230 | 247 | keySetRegister = IN_STACK; |
47 | 47 | |
48 | 48 | if (name == null) { |
49 | 49 | 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"); | |
51 | 51 | } |
52 | 52 | else { |
53 | 53 | name = "~.*"; // any name |
33 | 33 | * String and null) |
34 | 34 | * |
35 | 35 | * 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 | |
37 | 37 | * matched against whole value (ie Matcher.match(), not Matcher.find()) |
38 | 38 | * |
39 | 39 | * If matchSpec is a non-null String with any other initial charcter, exact |
70 | 70 | if (type.endsWith("[]")) { |
71 | 71 | return "[" + typeToSignature(type.substring(0, type.length() - 2)); |
72 | 72 | } else { |
73 | return scalarTypeToSiganture(type); | |
73 | return scalarTypeToSignature(type); | |
74 | 74 | } |
75 | 75 | } |
76 | 76 | |
77 | private static String scalarTypeToSiganture(String type) { | |
77 | private static String scalarTypeToSignature(String type) { | |
78 | 78 | if ("boolean".equals(type)) { |
79 | 79 | return "Z"; |
80 | 80 | } else if ("byte".equals(type)) { |
46 | 46 | menu.viewbugs_item=Fehler ansehen |
47 | 47 | |
48 | 48 | menu.filterwarnings_menu=Filterwarnungen |
49 | menu.exppriority_item=Experimental Priorität | |
49 | menu.exppriority_item=Experimentelle Priorität | |
50 | 50 | menu.lowpriority_item=&Niedrige Priorität |
51 | 51 | menu.mediumpriority_item=&Mittlere Priorität |
52 | 52 | menu.highpriority_item=&Hohe Priorität |
76 | 76 | |
77 | 77 | dlg.cloud.add_review=Klicken um Review zu erstellen... |
78 | 78 | 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... | |
80 | 80 | |
81 | 81 | dlg.byclass_tab=Nach Klasse |
82 | 82 | dlg.bypackage_tab=Nach Paket |
152 | 152 | menu.sortConfiguration=Konfiguration sortieren... |
153 | 153 | menu.gotoLine=Gehe zu Zeile... |
154 | 154 | menu.changeDesignation=Bewertung ändern |
155 | menu.filterBugsLikeThis=ähnliche Fehler filtern | |
155 | menu.filterBugsLikeThis=Ähnliche Fehler filtern | |
156 | 156 | menu.filterTheseBugs=Diese Fehler filtern |
157 | 157 | menu.mergeAnalysis=Analyse zusammenführen |
158 | 158 | menu.suppress=Fehler unterdrücken |
166 | 166 | menu.normaleffort_item=Normal |
167 | 167 | menu.maxeffort_item=Maximal |
168 | 168 | menu.rerunAnalysis=Analyse wiederholen |
169 | dlg.new_item=Neues Project | |
169 | dlg.new_item=Neues Projekt | |
170 | 170 | dlg.reconfig=Rekonfigurieren |
171 | 171 | dlg.rerunAnalysis=Analyse wiederholen |
172 | 172 | msg.addRemoveFiles=Dateien hinzufügen/entfernen |
173 | 173 | msg.nosource_txt=Quelltext nicht verfügbar |
174 | 174 | msg.loading_bugs_over_network_txt=Fehler laden (Netzwerk)... |
175 | 175 | 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? | |
177 | 177 | msg.confirm_save_txt=Wollen Sie speichern? |
178 | 178 | 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? | |
180 | 180 | dlg.annotation_change_ttl=Anmerkung ändern |
181 | 181 | dlg.yes_btn=Ja |
182 | 182 | dlg.no_btn=Nein |
194 | 194 | dlg.analysis_exists_lbl=Diese Analyse existiert schon.\nÜberschreiben? |
195 | 195 | dlg.file_does_not_exist_lbl=Diese Datei existiert nicht |
196 | 196 | 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! | |
198 | 198 | summary.lines=Zeilen |
199 | 199 | summary.line=Zeile |
200 | 200 | statusbar.bugs_hidden=Fehler ausgeblendet |
201 | 201 | 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 | |
204 | 204 | progress.scanning_archives=Lese Archive... |
205 | 205 | progress.analyzing_classes=Analysiere Klassen... |
206 | 206 | progress.finishing_analysis=Analyse beendet... |
246 | 246 | tooltip.longer_description=Längere Beschreibung für das Fehler-Muster |
247 | 247 | tooltip.reorder_message=Ziehen, um den Verzeichnisbaum neu zu ordnen |
248 | 248 | menu.recent_projects_menu=Letzte Projekte |
249 | menu.about_fb=Über Findbugs... | |
249 | menu.about_fb=Über FindBugs... | |
250 | 250 | menu.go_to_line=Gehe zu Zeile... |
251 | 251 | menu.change_designation=Fehler-Bewertung ändern |
252 | 252 | menu.filter_these_bugs=Fehler filtern |
277 | 277 | dlg.error_ttl=Datei nicht gefunden |
278 | 278 | dlg.project_settings_changed_lbl=Projekt-Einstellungen geändert. Neue Analyse durchführen? |
279 | 279 | 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: | |
283 | 283 | dlg.finish_btn=Übernehmen |
284 | 284 | dlg.warning_ttl=Warnung! |
285 | 285 | 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. | |
289 | 289 | menu.designation=Bewertung⏎ |
193 | 193 | dlg.warning_ttl=Warning! |
194 | 194 | dlg.analyze_btn=Analyze |
195 | 195 | 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) | |
197 | 197 | dlg.source_dirs_lbl=Source directories (optional; used when browsing found bugs) |
198 | 198 | dlg.invalid_txt= can't be found. OK to continue? |
199 | 199 | dlg.error_ttl=Can't locate file |
29 | 29 | * Denotes a class name or package name where the . character is used to |
30 | 30 | * separate package/class name components. |
31 | 31 | * |
32 | * e.g. {@code java.util.Collection}, {@code foo.Bar$Baz} | |
33 | * | |
32 | 34 | * @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 | |
33 | 37 | */ |
34 | 38 | @Documented |
35 | 39 | @SlashedClassName(when = When.NEVER) |
29 | 29 | import javax.annotation.meta.When; |
30 | 30 | |
31 | 31 | /** |
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 | |
33 | 33 | * separate package/class name components. |
34 | 34 | * |
35 | * e.g. {@code java/util/Collection}, {@code foo/Bar$Baz} | |
36 | * | |
35 | 37 | * @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 | |
36 | 40 | */ |
37 | 41 | @Documented |
38 | 42 | @TypeQualifier(applicableTo = CharSequence.class) |
54 | 54 | } |
55 | 55 | |
56 | 56 | // 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. | |
58 | 58 | // Unicode escapes are not implemented (but could be implemented in the |
59 | 59 | // fillLineBuf() method). |
60 | 60 |
56 | 56 | |
57 | 57 | /** |
58 | 58 | * 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 | |
60 | 60 | * constraints automatically enable the source (earlier) detector if the |
61 | 61 | * target (later) detector is enabled. |
62 | 62 | * |
40 | 40 | |
41 | 41 | /** |
42 | 42 | * 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 | |
44 | 44 | * constraints automatically enable the source (earlier) detector if the |
45 | 45 | * target (later) detector is enabled. |
46 | 46 | */ |
50 | 50 | |
51 | 51 | /** |
52 | 52 | * 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 | |
54 | 54 | * detector). Such constraints automatically enable the source (earlier) |
55 | 55 | * detector if the target (later) detector is enabled. |
56 | 56 | * |
185 | 185 | } |
186 | 186 | |
187 | 187 | /** |
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. | |
190 | 191 | * |
191 | 192 | * @param className |
192 | 193 | * 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) { | |
196 | 197 | int i = className.lastIndexOf('$'); |
197 | 198 | if (i >= 0 && i + 1 < className.length()) { |
198 | 199 | 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; | |
199 | 222 | } |
200 | 223 | return false; |
201 | 224 | } |
221 | 221 | if (retvel == JFileChooser.APPROVE_OPTION) { |
222 | 222 | File file = fc.getSelectedFile(); |
223 | 223 | try { |
224 | writer.println("File choosen:"); | |
224 | writer.println("File chosen:"); | |
225 | 225 | writer.println("File path: " + file.getAbsolutePath()); |
226 | 226 | writer.println("File canonical path: " + file.getCanonicalPath()); |
227 | 227 |
709 | 709 | int s = ((ConstantString) constantRefOperand).getStringIndex(); |
710 | 710 | |
711 | 711 | 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()); | |
712 | 718 | } else if (constantRefOperand instanceof ConstantCP) { |
713 | 719 | ConstantCP cp = (ConstantCP) constantRefOperand; |
714 | 720 | ConstantClass clazz = (ConstantClass) getConstantPool().getConstant(cp.getClassIndex()); |
720 | 726 | nameConstantOperand = getStringFromIndex(sig.getNameIndex()); |
721 | 727 | sigConstantOperand = getStringFromIndex(sig.getSignatureIndex()); |
722 | 728 | 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 | ||
731 | 729 | } |
732 | 730 | break; |
733 | 731 | case M_R: |
28 | 28 | import org.apache.bcel.classfile.AnnotationEntry; |
29 | 29 | import org.apache.bcel.classfile.Annotations; |
30 | 30 | import org.apache.bcel.classfile.Attribute; |
31 | import org.apache.bcel.classfile.BootstrapMethods; | |
31 | 32 | import org.apache.bcel.classfile.Code; |
32 | 33 | import org.apache.bcel.classfile.CodeException; |
33 | 34 | import org.apache.bcel.classfile.Constant; |
34 | 35 | import org.apache.bcel.classfile.ConstantCP; |
35 | 36 | import org.apache.bcel.classfile.ConstantClass; |
36 | 37 | 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; | |
37 | 41 | import org.apache.bcel.classfile.ConstantMethodref; |
38 | 42 | import org.apache.bcel.classfile.ConstantNameAndType; |
39 | 43 | import org.apache.bcel.classfile.ConstantPool; |
48 | 52 | import org.apache.bcel.classfile.LocalVariable; |
49 | 53 | import org.apache.bcel.classfile.LocalVariableTable; |
50 | 54 | import org.apache.bcel.classfile.Method; |
55 | import org.apache.bcel.classfile.MethodParameters; | |
56 | import org.apache.bcel.classfile.ParameterAnnotationEntry; | |
51 | 57 | import org.apache.bcel.classfile.ParameterAnnotations; |
58 | import org.apache.bcel.classfile.StackMap; | |
59 | import org.apache.bcel.classfile.StackMapEntry; | |
52 | 60 | import org.apache.bcel.classfile.StackMapTable; |
53 | 61 | import org.apache.bcel.classfile.StackMapTableEntry; |
54 | 62 | |
820 | 828 | public void visitParameterAnnotation(ParameterAnnotations arg0) { |
821 | 829 | } |
822 | 830 | |
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 | ||
823 | 850 | /* |
824 | 851 | * (non-Javadoc) |
825 | 852 | * |
828 | 855 | * classfile.StackMapTable) |
829 | 856 | */ |
830 | 857 | @Override |
831 | public void visitStackMapTable(StackMapTable arg0) { | |
858 | public void visitStackMap(StackMap arg0) { | |
832 | 859 | // TODO Auto-generated method stub |
833 | 860 | |
834 | 861 | } |
841 | 868 | * bcel.classfile.StackMapTableEntry) |
842 | 869 | */ |
843 | 870 | @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) { | |
845 | 908 | // TODO Auto-generated method stub |
846 | 909 | |
847 | 910 | } |
403 | 403 | } |
404 | 404 | |
405 | 405 | /** |
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 | |
407 | 407 | * successive versions in the history. |
408 | 408 | * |
409 | 409 | * @param activePrevious |
146 | 146 | addOption("-prefix", "class name prefix", |
147 | 147 | "comma separated list of class name prefixes that should be analyzed (e.g., edu.umd.cs.)"); |
148 | 148 | 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.)"); | |
150 | 150 | addOption("-excludePattern", "class name pattern(s)", |
151 | 151 | "comma separated list of regular expressions; all classes matching them are excluded"); |
152 | 152 | |
255 | 255 | |
256 | 256 | int analysisCount = 1; |
257 | 257 | |
258 | int auxilaryCount = 1; | |
259 | ||
260 | String getNextAuxilaryFileOutput() { | |
258 | int auxiliaryCount = 1; | |
259 | ||
260 | String getNextAuxiliaryFileOutput() { | |
261 | 261 | String result; |
262 | if (auxilaryCount == 1) { | |
263 | result = "auxilary.jar"; | |
262 | if (auxiliaryCount == 1) { | |
263 | result = "auxiliary.jar"; | |
264 | 264 | } else { |
265 | result = "auxilary" + (auxilaryCount) + ".jar"; | |
266 | } | |
267 | auxilaryCount++; | |
265 | result = "auxiliary" + (auxiliaryCount) + ".jar"; | |
266 | } | |
267 | auxiliaryCount++; | |
268 | 268 | System.out.println("Starting " + result); |
269 | 269 | return result; |
270 | 270 | } |
301 | 301 | doit.execute(); |
302 | 302 | } |
303 | 303 | |
304 | int auxilaryClassCount = 0; | |
305 | ||
306 | ZipOutputStream auxilaryOut; | |
304 | int auxiliaryClassCount = 0; | |
305 | ||
306 | ZipOutputStream auxiliaryOut; | |
307 | 307 | |
308 | 308 | final byte buffer[] = new byte[8192]; |
309 | 309 | |
456 | 456 | } |
457 | 457 | |
458 | 458 | if (numFilesToAnalyze < copied.size() || numFilesToAnalyze > commandLine.maxClasses) { |
459 | auxilaryOut = createZipFile(getNextAuxilaryFileOutput()); | |
459 | auxiliaryOut = createZipFile(getNextAuxiliaryFileOutput()); | |
460 | 460 | } |
461 | 461 | |
462 | 462 | int count = Integer.MAX_VALUE; |
515 | 515 | } |
516 | 516 | |
517 | 517 | boolean writeToAnalyzeOut = false; |
518 | boolean writeToAuxilaryOut = false; | |
518 | boolean writeToAuxiliaryOut = false; | |
519 | 519 | if (commandLine.prefix.matches(dottedName)) { |
520 | 520 | writeToAnalyzeOut = true; |
521 | 521 | if (numFilesToAnalyze > commandLine.maxClasses) { |
522 | writeToAuxilaryOut = true; | |
522 | writeToAuxiliaryOut = true; | |
523 | 523 | } |
524 | 524 | } else { |
525 | writeToAuxilaryOut = auxilaryOut != null; | |
525 | writeToAuxiliaryOut = auxiliaryOut != null; | |
526 | 526 | } |
527 | 527 | ZipOutputStream out = null; |
528 | 528 | if (writeToAnalyzeOut) { |
530 | 530 | out.putNextEntry(newZipEntry(ze)); |
531 | 531 | } |
532 | 532 | |
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(); | |
538 | 538 | } |
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); | |
543 | 543 | } |
544 | 544 | |
545 | 545 | }); |
566 | 566 | return; |
567 | 567 | } |
568 | 568 | |
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); | |
577 | 577 | } |
578 | 578 | |
579 | 579 | }); |
580 | 580 | } |
581 | 581 | |
582 | if (auxilaryOut != null) { | |
583 | auxilaryOut.close(); | |
582 | if (auxiliaryOut != null) { | |
583 | auxiliaryOut.close(); | |
584 | 584 | } |
585 | 585 | for (ZipOutputStream out : analysisOutputFiles.values()) { |
586 | 586 | out.close(); |
614 | 614 | } |
615 | 615 | |
616 | 616 | 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 { | |
618 | 618 | InputStream zipIn = zipInputFile.getInputStream(ze); |
619 | 619 | |
620 | 620 | while (true) { |
625 | 625 | if (writeToAnalyzeOut) { |
626 | 626 | analyzeOut1.write(buffer, 0, bytesRead); |
627 | 627 | } |
628 | if (writeToAuxilaryOut) { | |
629 | auxilaryOut1.write(buffer, 0, bytesRead); | |
628 | if (writeToAuxiliaryOut) { | |
629 | auxiliaryOut1.write(buffer, 0, bytesRead); | |
630 | 630 | } |
631 | 631 | } |
632 | 632 | if (writeToAnalyzeOut) { |
633 | 633 | analyzeOut1.closeEntry(); |
634 | 634 | } |
635 | if (writeToAuxilaryOut) { | |
636 | auxilaryOut1.closeEntry(); | |
635 | if (writeToAuxiliaryOut) { | |
636 | auxiliaryOut1.closeEntry(); | |
637 | 637 | } |
638 | 638 | zipIn.close(); |
639 | 639 | } |
640 | 640 | |
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()); | |
644 | 644 | } |
645 | 645 | |
646 | 646 | boolean processZipEntries(File f, ZipElementHandler handler) { |
90 | 90 | addOption("-projectName", "name", "set name for project"); |
91 | 91 | addOption("-timestamp", "when", "set timestamp for (last) revision"); |
92 | 92 | 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"); | |
94 | 94 | addOption("-source", "directory", "Add this directory to the source search path"); |
95 | 95 | addSwitch("-purgeStats", "purge/delete information about sizes of analyzed class files"); |
96 | 96 | addSwitch("-uploadDesignations", "upload all designations to cloud"); |
92 | 92 | UpdateCommandLine() { |
93 | 93 | addSwitch("-overrideRevisionNames", "override revision names for each version with names computed filenames"); |
94 | 94 | 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"); | |
96 | 96 | addSwitch("-noResurrections", |
97 | 97 | "if an issue had been detected in two versions but not in an intermediate version, record as two separate issues"); |
98 | 98 | 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 | } |
1646 | 1646 | <ClassStats class="edu.umd.cs.findbugs.detect.BuildNonNullAnnotationDatabase" sourceFile="BuildNonNullAnnotationDatabase.java" interface="false" size="71" bugs="0"/> |
1647 | 1647 | <ClassStats class="edu.umd.cs.findbugs.detect.BuildNonnullReturnDatabase" sourceFile="BuildNonnullReturnDatabase.java" interface="false" size="58" bugs="0"/> |
1648 | 1648 | <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"/> | |
1650 | 1650 | <ClassStats class="edu.umd.cs.findbugs.detect.BuildUnconditionalParamDerefDatabase" sourceFile="BuildUnconditionalParamDerefDatabase.java" interface="false" size="113" bugs="0"/> |
1651 | 1651 | <ClassStats class="edu.umd.cs.findbugs.detect.CallToUnconditionalThrower" sourceFile="CallToUnconditionalThrower.java" interface="false" size="75" bugs="0"/> |
1652 | 1652 | <ClassStats class="edu.umd.cs.findbugs.detect.CallToUnsupportedMethod" sourceFile="CallToUnsupportedMethod.java" interface="false" size="72" bugs="0"/> |