mirror of
https://github.com/github/codeql.git
synced 2025-12-18 01:33:15 +01:00
Merge remote-tracking branch 'upstream/main' into main
This commit is contained in:
@@ -38,15 +38,15 @@ so it is annotated with <code>@Override</code>.</p>
|
||||
</li>
|
||||
<li>
|
||||
Help - Eclipse Platform:
|
||||
<a href="http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Freference%2Fpreferences%2Fjava%2Fcompiler%2Fref-preferences-errors-warnings.htm">Java Compiler Errors/Warnings Preferences</a>.
|
||||
<a href="https://help.eclipse.org/2020-12/advanced/content.jsp?topic=/org.eclipse.jdt.doc.user/reference/preferences/java/compiler/ref-preferences-errors-warnings.htm">Java Compiler Errors/Warnings Preferences</a>.
|
||||
</li>
|
||||
<li>
|
||||
Java Platform, Standard Edition 6, API Specification:
|
||||
<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Override.html">Annotation Type Override</a>.
|
||||
Java API Specification:
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Override.html">Annotation Type Override</a>.
|
||||
</li>
|
||||
<li>
|
||||
The Java Tutorials:
|
||||
<a href="http://docs.oracle.com/javase/tutorial/java/annotations/predefined.html">Predefined Annotation Types</a>.
|
||||
<a href="https://docs.oracle.com/javase/tutorial/java/annotations/predefined.html">Predefined Annotation Types</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -26,8 +26,8 @@ value cannot be changed subsequently, which can help to avoid defects and increa
|
||||
|
||||
<li>
|
||||
Java Language Specification:
|
||||
<a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-4.html#jls-4.12.4">4.12.4 final Variables</a>,
|
||||
<a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.3.1.2">8.3.1.2 final Fields</a>.
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-4.html#jls-4.12.4">4.12.4 final Variables</a>,
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-8.html#jls-8.3.1.2">8.3.1.2 final Fields</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ there is a good reason to increase its visibility.
|
||||
</li>
|
||||
<li>
|
||||
The Java Tutorials:
|
||||
<a href="http://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html">Controlling Access to Members of a Class</a>.
|
||||
<a href="https://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html">Controlling Access to Members of a Class</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -31,15 +31,15 @@ call to the deprecated method.
|
||||
|
||||
<li>
|
||||
Help - Eclipse Platform:
|
||||
<a href="http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Freference%2Fpreferences%2Fjava%2Fcompiler%2Fref-preferences-errors-warnings.htm">Java Compiler Errors/Warnings Preferences</a>.
|
||||
<a href="https://help.eclipse.org/2020-12/advanced/content.jsp?topic=/org.eclipse.jdt.doc.user/reference/preferences/java/compiler/ref-preferences-errors-warnings.htm">Java Compiler Errors/Warnings Preferences</a>.
|
||||
</li>
|
||||
<li>
|
||||
Java Platform, Standard Edition 6, API Specification:
|
||||
<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Deprecated.html">Annotation Type Deprecated</a>.
|
||||
Java API Specification:
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Deprecated.html">Annotation Type Deprecated</a>.
|
||||
</li>
|
||||
<li>
|
||||
Java SE Documentation:
|
||||
<a href="http://docs.oracle.com/javase/6/docs/technotes/guides/javadoc/deprecation/deprecation.html">How and When To Deprecate APIs</a>.
|
||||
<a href="https://docs.oracle.com/javase/8/docs/technotes/guides/javadoc/deprecation/deprecation.html">How and When To Deprecate APIs</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ tag.</p>
|
||||
|
||||
<li>
|
||||
Java SE Documentation:
|
||||
<a href="http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html#throwstag">How to Write Doc Comments for the Javadoc Tool</a>,
|
||||
<a href="https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html#throwstag">How to Write Doc Comments for the Javadoc Tool</a>,
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -51,12 +51,12 @@ its parameter, return value, and thrown exception.</p>
|
||||
</li>
|
||||
<li>
|
||||
Help - Eclipse Platform:
|
||||
<a href="http://help.eclipse.org/indigo/topic/org.eclipse.jdt.doc.user/reference/preferences/java/compiler/ref-preferences-javadoc.htm">Java Compiler Javadoc Preferences</a>.
|
||||
<a href="https://help.eclipse.org/2020-12/advanced/content.jsp?topic=/org.eclipse.jdt.doc.user/reference/preferences/java/compiler/ref-preferences-javadoc.htm">Java Compiler Javadoc Preferences</a>.
|
||||
</li>
|
||||
<li>
|
||||
Java SE Documentation:
|
||||
<a href="http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html">How to Write Doc Comments for the Javadoc Tool</a>,
|
||||
<a href="http://www.oracle.com/technetwork/java/javase/documentation/index-142372.html">Requirements for Writing Java API Specifications</a>.
|
||||
<a href="https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html">How to Write Doc Comments for the Javadoc Tool</a>,
|
||||
<a href="https://www.oracle.com/java/technologies/javase/api-specifications.html">Requirements for Writing Java API Specifications</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -33,12 +33,12 @@ parameter.</p>
|
||||
</li>
|
||||
<li>
|
||||
Help - Eclipse Platform:
|
||||
<a href="http://help.eclipse.org/indigo/topic/org.eclipse.jdt.doc.user/reference/preferences/java/compiler/ref-preferences-javadoc.htm">Java Compiler Javadoc Preferences</a>.
|
||||
<a href="https://help.eclipse.org/2020-12/advanced/content.jsp?topic=/org.eclipse.jdt.doc.user/reference/preferences/java/compiler/ref-preferences-javadoc.htm">Java Compiler Javadoc Preferences</a>.
|
||||
</li>
|
||||
<li>
|
||||
Java SE Documentation:
|
||||
<a href="http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html">How to Write Doc Comments for the Javadoc Tool</a>,
|
||||
<a href="http://www.oracle.com/technetwork/java/javase/documentation/index-142372.html">Requirements for Writing Java API Specifications</a>.
|
||||
<a href="https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html">How to Write Doc Comments for the Javadoc Tool</a>,
|
||||
<a href="https://www.oracle.com/java/technologies/javase/api-specifications.html">Requirements for Writing Java API Specifications</a>.
|
||||
</li>
|
||||
|
||||
</references>
|
||||
|
||||
@@ -33,12 +33,12 @@ return value.</p>
|
||||
</li>
|
||||
<li>
|
||||
Help - Eclipse Platform:
|
||||
<a href="http://help.eclipse.org/indigo/topic/org.eclipse.jdt.doc.user/reference/preferences/java/compiler/ref-preferences-javadoc.htm">Java Compiler Javadoc Preferences</a>.
|
||||
<a href="https://help.eclipse.org/2020-12/advanced/content.jsp?topic=/org.eclipse.jdt.doc.user/reference/preferences/java/compiler/ref-preferences-javadoc.htm">Java Compiler Javadoc Preferences</a>.
|
||||
</li>
|
||||
<li>
|
||||
Java SE Documentation:
|
||||
<a href="http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html">How to Write Doc Comments for the Javadoc Tool</a>,
|
||||
<a href="http://www.oracle.com/technetwork/java/javase/documentation/index-142372.html">Requirements for Writing Java API Specifications</a>.
|
||||
<a href="https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html">How to Write Doc Comments for the Javadoc Tool</a>,
|
||||
<a href="https://www.oracle.com/java/technologies/javase/api-specifications.html">Requirements for Writing Java API Specifications</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -36,12 +36,12 @@ thrown exception.</p>
|
||||
</li>
|
||||
<li>
|
||||
Help - Eclipse Platform:
|
||||
<a href="http://help.eclipse.org/indigo/topic/org.eclipse.jdt.doc.user/reference/preferences/java/compiler/ref-preferences-javadoc.htm">Java Compiler Javadoc Preferences</a>.
|
||||
<a href="https://help.eclipse.org/2020-12/advanced/content.jsp?topic=/org.eclipse.jdt.doc.user/reference/preferences/java/compiler/ref-preferences-javadoc.htm">Java Compiler Javadoc Preferences</a>.
|
||||
</li>
|
||||
<li>
|
||||
Java SE Documentation:
|
||||
<a href="http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html">How to Write Doc Comments for the Javadoc Tool</a>,
|
||||
<a href="http://www.oracle.com/technetwork/java/javase/documentation/index-142372.html">Requirements for Writing Java API Specifications</a>.
|
||||
<a href="https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html">How to Write Doc Comments for the Javadoc Tool</a>,
|
||||
<a href="https://www.oracle.com/java/technologies/javase/api-specifications.html">Requirements for Writing Java API Specifications</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -41,12 +41,12 @@ its author, and version.</p>
|
||||
</li>
|
||||
<li>
|
||||
Help - Eclipse Platform:
|
||||
<a href="http://help.eclipse.org/indigo/topic/org.eclipse.jdt.doc.user/reference/preferences/java/compiler/ref-preferences-javadoc.htm">Java Compiler Javadoc Preferences</a>.
|
||||
<a href="https://help.eclipse.org/2020-12/advanced/content.jsp?topic=/org.eclipse.jdt.doc.user/reference/preferences/java/compiler/ref-preferences-javadoc.htm">Java Compiler Javadoc Preferences</a>.
|
||||
</li>
|
||||
<li>
|
||||
Java SE Documentation:
|
||||
<a href="http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html">How to Write Doc Comments for the Javadoc Tool</a>,
|
||||
<a href="http://www.oracle.com/technetwork/java/javase/documentation/index-142372.html">Requirements for Writing Java API Specifications</a>.
|
||||
<a href="https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html">How to Write Doc Comments for the Javadoc Tool</a>,
|
||||
<a href="https://www.oracle.com/java/technologies/javase/api-specifications.html">Requirements for Writing Java API Specifications</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -29,12 +29,12 @@ the documentation more difficult to read.
|
||||
|
||||
<li>
|
||||
Help - Eclipse Platform:
|
||||
<a href="http://help.eclipse.org/indigo/topic/org.eclipse.jdt.doc.user/reference/preferences/java/compiler/ref-preferences-javadoc.htm">Java Compiler Javadoc Preferences</a>.
|
||||
<a href="https://help.eclipse.org/2020-12/advanced/content.jsp?topic=/org.eclipse.jdt.doc.user/reference/preferences/java/compiler/ref-preferences-javadoc.htm">Java Compiler Javadoc Preferences</a>.
|
||||
</li>
|
||||
<li>
|
||||
Java SE Documentation:
|
||||
<a href="http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html#@param">How to Write Doc Comments for the Javadoc Tool</a>,
|
||||
<a href="http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#param">The Java API Documentation Generator</a>
|
||||
<a href="https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html#@param">How to Write Doc Comments for the Javadoc Tool</a>,
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/specs/doc-comment-spec.html#param">Documentation Comment Specification for the Standard Doclet</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -58,9 +58,9 @@ of type <code>Galaxy</code>.</p>
|
||||
Addison-Wesley, 2008.
|
||||
</li>
|
||||
<li>
|
||||
Java Platform, Standard Edition 6, API Specification:
|
||||
<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Cloneable.html">Interface Cloneable</a>,
|
||||
<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html#clone%28%29">Object.clone</a>.
|
||||
Java API Specification:
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Cloneable.html">Interface Cloneable</a>,
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#clone()">Object.clone</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ called by users of an API.
|
||||
</li>
|
||||
<li>
|
||||
Java Language Specification:
|
||||
<a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-12.html#jls-12.6">12.6. Finalization of Class Instances</a>.
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-12.html#jls-12.6">12.6. Finalization of Class Instances</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -28,11 +28,11 @@ separate words within the field name. For example, <code>MIN_WIDTH</code>.
|
||||
</li>
|
||||
<li>
|
||||
Java Language Specification:
|
||||
<a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-6.html#jls-6.1">6.1. Declarations</a>.
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-6.html#jls-6.1">6.1. Declarations</a>.
|
||||
</li>
|
||||
<li>
|
||||
Java SE Documentation:
|
||||
<a href="http://www.oracle.com/technetwork/java/javase/documentation/codeconventions-135099.html#367">9 - Naming Conventions</a>.
|
||||
<a href="https://www.oracle.com/java/technologies/javase/codeconventions-namingconventions.html">9 - Naming Conventions</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -28,11 +28,11 @@ the method name. For example, <code>getBackground</code>.
|
||||
</li>
|
||||
<li>
|
||||
Java Language Specification:
|
||||
<a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-6.html#jls-6.1">6.1. Declarations</a>.
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-6.html#jls-6.1">6.1. Declarations</a>.
|
||||
</li>
|
||||
<li>
|
||||
Java SE Documentation:
|
||||
<a href="http://www.oracle.com/technetwork/java/javase/documentation/codeconventions-135099.html#367">9 - Naming Conventions</a>.
|
||||
<a href="https://www.oracle.com/java/technologies/javase/codeconventions-namingconventions.html">9 - Naming Conventions</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -27,11 +27,11 @@ Use lowercase letters throughout a package name. For example, <code>com.sun.eng<
|
||||
</li>
|
||||
<li>
|
||||
Java Language Specification:
|
||||
<a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-6.html#jls-6.1">6.1. Declarations</a>.
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-6.html#jls-6.1">6.1. Declarations</a>.
|
||||
</li>
|
||||
<li>
|
||||
Java SE Documentation:
|
||||
<a href="http://www.oracle.com/technetwork/java/javase/documentation/codeconventions-135099.html#367">9 - Naming Conventions</a>.
|
||||
<a href="https://www.oracle.com/java/technologies/javase/codeconventions-namingconventions.html">9 - Naming Conventions</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -28,11 +28,11 @@ the class name. For example, <code>HotelBooking</code>.
|
||||
</li>
|
||||
<li>
|
||||
Java Language Specification:
|
||||
<a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-6.html#jls-6.1">6.1. Declarations</a>.
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-6.html#jls-6.1">6.1. Declarations</a>.
|
||||
</li>
|
||||
<li>
|
||||
Java SE Documentation:
|
||||
<a href="http://www.oracle.com/technetwork/java/javase/documentation/codeconventions-135099.html#367">9 - Naming Conventions</a>.
|
||||
<a href="https://www.oracle.com/java/technologies/javase/codeconventions-namingconventions.html">9 - Naming Conventions</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -29,11 +29,11 @@ the variable name. For example, <code>numberOfGuests</code>.
|
||||
</li>
|
||||
<li>
|
||||
Java Language Specification:
|
||||
<a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-6.html#jls-6.1">6.1. Declarations</a>.
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-6.html#jls-6.1">6.1. Declarations</a>.
|
||||
</li>
|
||||
<li>
|
||||
Java SE Documentation:
|
||||
<a href="http://www.oracle.com/technetwork/java/javase/documentation/codeconventions-135099.html#367">9 - Naming Conventions</a>.
|
||||
<a href="https://www.oracle.com/java/technologies/javase/codeconventions-namingconventions.html">9 - Naming Conventions</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ has made. However, if the user does not choose 1, 2, or 3, execution falls throu
|
||||
|
||||
<li>
|
||||
Java SE Documentation:
|
||||
<a href="http://www.oracle.com/technetwork/java/javase/documentation/codeconventions-142311.html#468">7.8 switch Statements</a>.
|
||||
<a href="https://www.oracle.com/java/technologies/javase/codeconventions-statements.html#468">7.8 switch Statements</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
<li>
|
||||
Java SE Documentation:
|
||||
<a href="http://www.oracle.com/technetwork/java/javase/documentation/codeconventions-142311.html#431">7.1 Simple Statements</a>.
|
||||
<a href="https://www.oracle.com/java/technologies/javase/codeconventions-statements.html#431">7.1 Simple Statements</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ test score. However, if the score is less than 60, execution falls through silen
|
||||
|
||||
<li>
|
||||
Java SE Documentation:
|
||||
<a href="http://www.oracle.com/technetwork/java/javase/documentation/codeconventions-142311.html#449">7.4 if, if-else, if else-if else Statements</a>.
|
||||
<a href="https://www.oracle.com/java/technologies/javase/codeconventions-statements.html#449">7.4 if, if-else, if else-if else Statements</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,6 @@
|
||||
<qhelp>
|
||||
|
||||
|
||||
<include src="Generics_Common.qhelp" />
|
||||
<include src="Generics_Common.inc.qhelp" />
|
||||
|
||||
</qhelp>
|
||||
|
||||
@@ -4,6 +4,6 @@
|
||||
<qhelp>
|
||||
|
||||
|
||||
<include src="Generics_Common.qhelp" />
|
||||
<include src="Generics_Common.inc.qhelp" />
|
||||
|
||||
</qhelp>
|
||||
|
||||
@@ -4,6 +4,6 @@
|
||||
<qhelp>
|
||||
|
||||
|
||||
<include src="Generics_Common.qhelp" />
|
||||
<include src="Generics_Common.inc.qhelp" />
|
||||
|
||||
</qhelp>
|
||||
|
||||
@@ -43,12 +43,12 @@ more error prone because the compiler is less able to perform type checks.</p>
|
||||
</li>
|
||||
<li>
|
||||
Help - Eclipse Platform:
|
||||
<a href="http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Freference%2Fpreferences%2Fjava%2Fcompiler%2Fref-preferences-errors-warnings.htm">Java Compiler Errors/Warnings Preferences</a>.
|
||||
<a href="https://help.eclipse.org/2020-12/advanced/content.jsp?topic=/org.eclipse.jdt.doc.user/reference/preferences/java/compiler/ref-preferences-errors-warnings.htm">Java Compiler Errors/Warnings Preferences</a>.
|
||||
</li>
|
||||
<li>
|
||||
The Java Tutorials:
|
||||
<a href="http://docs.oracle.com/javase/tutorial/java/generics/">Generics</a>,
|
||||
<a href="http://docs.oracle.com/javase/tutorial/extra/generics/convert.html">Converting Legacy Code to Use Generics</a>.
|
||||
<a href="https://docs.oracle.com/javase/tutorial/java/generics/">Generics</a>,
|
||||
<a href="https://docs.oracle.com/javase/tutorial/extra/generics/convert.html">Converting Legacy Code to Use Generics</a>.
|
||||
</li>
|
||||
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
"-//Semmle//qhelp//EN"
|
||||
"qhelp.dtd">
|
||||
<qhelp>
|
||||
<include src="UnusedMavenDependency.qhelp" />
|
||||
<include src="UnusedMavenDependency.inc.qhelp" />
|
||||
</qhelp>
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
"-//Semmle//qhelp//EN"
|
||||
"qhelp.dtd">
|
||||
<qhelp>
|
||||
<include src="UnusedMavenDependency.qhelp" />
|
||||
<include src="UnusedMavenDependency.inc.qhelp" />
|
||||
</qhelp>
|
||||
|
||||
@@ -27,8 +27,8 @@ Oracle JDK Documentation:
|
||||
<li>
|
||||
OpenJDK Documentation:
|
||||
<a href="https://wiki.openjdk.java.net/display/JDK8/Java+Dependency+Analysis+Tool">Java Dependency Analysis Tool</a>,
|
||||
<a href="http://openjdk.java.net/jeps/260">JEP 260: Encapsulate Most Internal APIs</a>,
|
||||
<a href="http://openjdk.java.net/jeps/261">JEP 261: Module System</a>.
|
||||
<a href="https://openjdk.java.net/jeps/260">JEP 260: Encapsulate Most Internal APIs</a>,
|
||||
<a href="https://openjdk.java.net/jeps/261">JEP 261: Module System</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
/**
|
||||
* Provides a QL encoding of the list of unsupported JDK-internal APIs at:
|
||||
*
|
||||
* http://hg.openjdk.java.net/jdk9/jdk9/langtools/file/6ba2130e87bd/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/resources/jdk8_internals.txt
|
||||
* https://hg.openjdk.java.net/jdk9/jdk9/langtools/file/6ba2130e87bd/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/resources/jdk8_internals.txt
|
||||
*/
|
||||
predicate jdkInternalApi(string p) {
|
||||
p = "apple.applescript" or
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
/**
|
||||
* Provides a QL encoding of the suggested replacements for unsupported JDK-internal APIs listed at:
|
||||
*
|
||||
* http://hg.openjdk.java.net/jdk9/jdk9/langtools/file/6ba2130e87bd/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/resources/jdkinternals.properties
|
||||
* https://hg.openjdk.java.net/jdk9/jdk9/langtools/file/6ba2130e87bd/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/resources/jdkinternals.properties
|
||||
*/
|
||||
predicate jdkInternalReplacement(string old, string new) {
|
||||
exists(string r, int eqIdx | jdkInternalReplacement(r) and eqIdx = r.indexOf("=") |
|
||||
@@ -33,10 +33,10 @@ private predicate jdkInternalReplacement(string r) {
|
||||
r = "sun.awt.CausedFocusEvent=Use java.awt.event.FocusEvent::getCause @since 9" or
|
||||
r = "sun.font.FontUtilities=See java.awt.Font.textRequiresLayout @since 9" or
|
||||
r = "sun.reflect.Reflection=Use java.lang.StackWalker @since 9" or
|
||||
r = "sun.reflect.ReflectionFactory=See http://openjdk.java.net/jeps/260" or
|
||||
r = "sun.misc.Unsafe=See http://openjdk.java.net/jeps/260" or
|
||||
r = "sun.misc.Signal=See http://openjdk.java.net/jeps/260" or
|
||||
r = "sun.misc.SignalHandler=See http://openjdk.java.net/jeps/260" or
|
||||
r = "sun.reflect.ReflectionFactory=See https://openjdk.java.net/jeps/260" or
|
||||
r = "sun.misc.Unsafe=See https://openjdk.java.net/jeps/260" or
|
||||
r = "sun.misc.Signal=See https://openjdk.java.net/jeps/260" or
|
||||
r = "sun.misc.SignalHandler=See https://openjdk.java.net/jeps/260" or
|
||||
r = "sun.security.action=Use java.security.PrivilegedAction @since 1.1" or
|
||||
r = "sun.security.krb5=Use com.sun.security.jgss" or
|
||||
r =
|
||||
@@ -58,6 +58,6 @@ private predicate jdkInternalReplacement(string r) {
|
||||
r =
|
||||
"sun.misc.Cleaner=Use java.lang.ref.PhantomReference @since 1.2 or java.lang.ref.Cleaner @since 9" or
|
||||
r = "sun.misc.Service=Use java.util.ServiceLoader @since 1.6" or
|
||||
r = "sun.misc=Removed. See http://openjdk.java.net/jeps/260" or
|
||||
r = "sun.reflect=Removed. See http://openjdk.java.net/jeps/260"
|
||||
r = "sun.misc=Removed. See https://openjdk.java.net/jeps/260" or
|
||||
r = "sun.reflect=Removed. See https://openjdk.java.net/jeps/260"
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<p>
|
||||
Classes that are never used at runtime are redundant and should be removed.
|
||||
</p>
|
||||
<include src="DeadCodeSummary.qhelp"/>
|
||||
<include src="DeadCodeSummary.inc.qhelp"/>
|
||||
<p>
|
||||
Classes are considered dead if at runtime:
|
||||
</p>
|
||||
@@ -26,7 +26,7 @@ fields, methods and nested classes - it is never instantiated, has no public con
|
||||
instance methods. If a class is considered to be a namespace class, then it is live if at least one
|
||||
of the static members of that class is live - including static nested classes.
|
||||
</p>
|
||||
<include src="DeadCodeDetails.qhelp"/>
|
||||
<include src="DeadCodeDetails.inc.qhelp"/>
|
||||
</overview>
|
||||
<recommendation>
|
||||
<p>
|
||||
@@ -48,7 +48,7 @@ if there are some live nested classes within the dead class, the class can be re
|
||||
converting all live nested classes to static members, and removing all instance methods and fields,
|
||||
and all dead static members (see Example 2).
|
||||
</p>
|
||||
<include src="DeadCodeExtraEntryPoints.qhelp"/>
|
||||
<include src="DeadCodeExtraEntryPoints.inc.qhelp"/>
|
||||
</recommendation>
|
||||
<section title="Example 1">
|
||||
<p>
|
||||
@@ -95,5 +95,5 @@ Taking the second approach, this is the final result.
|
||||
</p>
|
||||
<sample src="NamespaceClass2.java" />
|
||||
</section>
|
||||
<include src="DeadCodeReferences.qhelp" />
|
||||
<include src="DeadCodeReferences.inc.qhelp" />
|
||||
</qhelp>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<p>
|
||||
Enum constants that are never used at runtime are redundant and should be removed.
|
||||
</p>
|
||||
<include src="DeadCodeSummary.qhelp"/>
|
||||
<include src="DeadCodeSummary.inc.qhelp"/>
|
||||
<p>
|
||||
An enum constant is considered dead if at runtime it is never used, or only used in comparisons. Any
|
||||
enum constant which is not dead is considered to be "live".
|
||||
@@ -17,7 +17,7 @@ An enum constant that is only used in a comparison is considered dead because th
|
||||
always produce the same result. This is because no variable holds the value of the enum constant,
|
||||
so the comparison of any variable against the constant will always return the same result.
|
||||
</p>
|
||||
<include src="DeadCodeDetails.qhelp"/>
|
||||
<include src="DeadCodeDetails.inc.qhelp"/>
|
||||
</overview>
|
||||
<recommendation>
|
||||
<p>
|
||||
@@ -32,7 +32,7 @@ After confirming that the enum constant is not required, remove the enum constan
|
||||
need to remove any references to this enum constant, which may, in turn, require removing other dead
|
||||
code.
|
||||
</p>
|
||||
<include src="DeadCodeExtraEntryPoints.qhelp"/>
|
||||
<include src="DeadCodeExtraEntryPoints.inc.qhelp"/>
|
||||
</recommendation>
|
||||
<example>
|
||||
<p>
|
||||
@@ -51,5 +51,5 @@ stored or returned anywhere in the program. Therefore, <code>ERROR</code> is dea
|
||||
along with the comparison check, and the <code>exit(1);</code>.
|
||||
</p>
|
||||
</example>
|
||||
<include src="DeadCodeReferences.qhelp" />
|
||||
<include src="DeadCodeReferences.inc.qhelp" />
|
||||
</qhelp>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<p>
|
||||
Fields that are never read at runtime are unnecessary and should be removed.
|
||||
</p>
|
||||
<include src="DeadCodeSummary.qhelp"/>
|
||||
<include src="DeadCodeSummary.inc.qhelp"/>
|
||||
<p>
|
||||
Fields are considered dead if at runtime they are never read directly or indirectly, for example
|
||||
through a framework or a use of reflection. Any field which is not dead is considered to be "live".
|
||||
@@ -15,7 +15,7 @@ through a framework or a use of reflection. Any field which is not dead is consi
|
||||
<p>
|
||||
Fields are considered to be dead if they are only written to, and never read.
|
||||
</p>
|
||||
<include src="DeadCodeDetails.qhelp"/>
|
||||
<include src="DeadCodeDetails.inc.qhelp"/>
|
||||
</overview>
|
||||
<recommendation>
|
||||
<p>
|
||||
@@ -30,7 +30,7 @@ After confirming that the field is not required, remove the field. You will also
|
||||
references to this field, which may, in turn, require removing other unused classes, methods
|
||||
and fields.
|
||||
</p>
|
||||
<include src="DeadCodeExtraEntryPoints.qhelp"/>
|
||||
<include src="DeadCodeExtraEntryPoints.inc.qhelp"/>
|
||||
</recommendation>
|
||||
<section title="Example 1">
|
||||
<p>
|
||||
@@ -64,5 +64,5 @@ the contents of the object in an XML file, or to construct an instance of the ob
|
||||
file. The field is therefore considered to be read at runtime, which makes the field live.
|
||||
</p>
|
||||
</section>
|
||||
<include src="DeadCodeReferences.qhelp" />
|
||||
<include src="DeadCodeReferences.inc.qhelp" />
|
||||
</qhelp>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<p>
|
||||
Methods that are never called at runtime are redundant and should be removed.
|
||||
</p>
|
||||
<include src="DeadCodeSummary.qhelp"/>
|
||||
<include src="DeadCodeSummary.inc.qhelp"/>
|
||||
<p>
|
||||
Methods are considered dead if at runtime they are never called, either directly, by a method call,
|
||||
or indirectly, through a framework or use of reflection. Any method which is not dead is considered
|
||||
@@ -18,7 +18,7 @@ The results can include methods, constructors and initializers. Initializers com
|
||||
instance initializers and static initializers. For each class there will be at most one dead
|
||||
initializer of each type, representing all the initialization of that type in the class.
|
||||
</p>
|
||||
<include src="DeadCodeDetails.qhelp"/>
|
||||
<include src="DeadCodeDetails.inc.qhelp"/>
|
||||
</overview>
|
||||
<recommendation>
|
||||
<p>
|
||||
@@ -47,7 +47,7 @@ and initializers on instance fields are dead. In addition, the lack of instance
|
||||
implies that the class is never constructed, which means that all instance methods and fields are
|
||||
also dead and can be removed. These methods and fields will also be reported separately.
|
||||
</p>
|
||||
<include src="DeadCodeExtraEntryPoints.qhelp"/>
|
||||
<include src="DeadCodeExtraEntryPoints.inc.qhelp"/>
|
||||
</recommendation>
|
||||
<section title="Example 1">
|
||||
<p>
|
||||
@@ -77,5 +77,5 @@ framework when running the tests. <code>testCustomer</code> and <code>setUp</cod
|
||||
considered to be "live".
|
||||
</p>
|
||||
</section>
|
||||
<include src="DeadCodeReferences.qhelp" />
|
||||
<include src="DeadCodeReferences.inc.qhelp" />
|
||||
</qhelp>
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
"qhelp.dtd">
|
||||
<qhelp>
|
||||
<overview>
|
||||
<include src="DeadCodeSummary.qhelp"/>
|
||||
<include src="DeadCodeDetails.qhelp"/>
|
||||
<include src="DeadCodeSummary.inc.qhelp"/>
|
||||
<include src="DeadCodeDetails.inc.qhelp"/>
|
||||
</overview>
|
||||
<recommendation>
|
||||
<p>
|
||||
@@ -13,5 +13,5 @@ can see which classes, methods and fields contribute to this metric using the ru
|
||||
analysis.
|
||||
</p>
|
||||
</recommendation>
|
||||
<include src="DeadCodeReferences.qhelp" />
|
||||
<include src="DeadCodeReferences.inc.qhelp" />
|
||||
</qhelp>
|
||||
|
||||
@@ -35,5 +35,5 @@ parameter <code>name</code> is not used within the body of the method. The param
|
||||
as useless, and can be removed from the program.
|
||||
</p>
|
||||
</example>
|
||||
<include src="DeadCodeReferences.qhelp" />
|
||||
<include src="DeadCodeReferences.inc.qhelp" />
|
||||
</qhelp>
|
||||
|
||||
@@ -21,13 +21,7 @@ class InstanceFieldWrite extends FieldWrite {
|
||||
not getEnclosingCallable().isStatic() and
|
||||
// Must be declared in this type or a supertype.
|
||||
getEnclosingCallable().getDeclaringType().inherits(getField()) and
|
||||
(
|
||||
// There must either be no qualifier - implied "this"
|
||||
not exists(getQualifier()) or
|
||||
// Or the qualifier implies we are accessing this or the super type
|
||||
getQualifier() instanceof ThisAccess or
|
||||
getQualifier() instanceof SuperAccess
|
||||
)
|
||||
isOwnFieldAccess()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ explicit wiring.</p>
|
||||
|
||||
<li>
|
||||
Spring Framework Reference Documentation 3.0:
|
||||
<a href="http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/beans.html#beans-autowired-exceptions">3.4.5.1 Limitations and disadvantages of autowiring</a>.
|
||||
<a href="https://docs.spring.io/spring-framework/docs/3.0.x/spring-framework-reference/html/beans.html#beans-autowired-exceptions">3.4.5.1 Limitations and disadvantages of autowiring</a>.
|
||||
</li>
|
||||
<li>
|
||||
ONJava:
|
||||
|
||||
@@ -32,7 +32,7 @@ whose <code>constructor-arg</code> elements use type matching.</p>
|
||||
|
||||
<li>
|
||||
Spring Framework Reference Documentation 3.0:
|
||||
<a href="http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/beans.html#beans-constructor-injection">3.4.1.1 Constructor-based dependency injection</a>.
|
||||
<a href="https://docs.spring.io/spring-framework/docs/3.0.x/spring-framework-reference/html/beans.html#beans-constructor-injection">3.4.1.1 Constructor-based dependency injection</a>.
|
||||
</li>
|
||||
<li>
|
||||
ONJava:
|
||||
|
||||
@@ -47,7 +47,7 @@ the bean configuration is followed by the class definition.</p>
|
||||
|
||||
<li>
|
||||
Martin Fowler:
|
||||
<a href="http://martinfowler.com/articles/injection.html">Inversion of Control Containers and the Dependency Injection pattern</a>.
|
||||
<a href="https://martinfowler.com/articles/injection.html">Inversion of Control Containers and the Dependency Injection pattern</a>.
|
||||
</li>
|
||||
<li>
|
||||
ONJava:
|
||||
@@ -55,12 +55,12 @@ ONJava:
|
||||
</li>
|
||||
<li>
|
||||
Spring Framework Reference Documentation 3.0:
|
||||
<a href="http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/beans.html#beans-constructor-injection">3.4.1.1 Constructor-based dependency injection</a>,
|
||||
<a href="http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/beans.html#beans-setter-injection">3.4.1.2 Setter-based dependency injection</a>.
|
||||
<a href="https://docs.spring.io/spring-framework/docs/3.0.x/spring-framework-reference/html/beans.html#beans-constructor-injection">3.4.1.1 Constructor-based dependency injection</a>,
|
||||
<a href="https://docs.spring.io/spring-framework/docs/3.0.x/spring-framework-reference/html/beans.html#beans-setter-injection">3.4.1.2 Setter-based dependency injection</a>.
|
||||
</li>
|
||||
<li>
|
||||
SpringSource:
|
||||
<a href="http://blog.springsource.org/2007/07/11/setter-injection-versus-constructor-injection-and-the-use-of-required/">Setter injection versus constructor injection and the use of @Required</a>.
|
||||
<a href="https://spring.io/blog/2007/07/11/setter-injection-versus-constructor-injection-and-the-use-of-required/">Setter injection versus constructor injection and the use of @Required</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ an explanatory comment for the body instead.
|
||||
|
||||
<li>
|
||||
Help - Eclipse Platform:
|
||||
<a href="http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Freference%2Fpreferences%2Fjava%2Fcompiler%2Fref-preferences-errors-warnings.htm">Java Compiler Errors/Warnings Preferences</a>.
|
||||
<a href="https://help.eclipse.org/2020-12/advanced/content.jsp?topic=/org.eclipse.jdt.doc.user/reference/preferences/java/compiler/ref-preferences-errors-warnings.htm">Java Compiler Errors/Warnings Preferences</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ constraint, the variable should be renamed.</p>
|
||||
|
||||
<li>
|
||||
Java Language Specification:
|
||||
<a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.9">8.9 Enums</a>.
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-8.html#jls-8.9">8.9 Enum Types</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -35,16 +35,16 @@ extended or implemented by the class.
|
||||
|
||||
|
||||
<li>
|
||||
The Java Language Specification:
|
||||
<a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-9.html#jls-9.6">Annotation Types</a>.
|
||||
Java Language Specification:
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-9.html#jls-9.6">Annotation Types</a>.
|
||||
</li>
|
||||
<li>
|
||||
The Java Tutorials:
|
||||
<a href="http://docs.oracle.com/javase/tutorial/java/annotations/index.html">Annotations</a>.
|
||||
<a href="https://docs.oracle.com/javase/tutorial/java/annotations/index.html">Annotations</a>.
|
||||
</li>
|
||||
<li>
|
||||
Help - Eclipse Platform:
|
||||
<a href="http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Freference%2Fpreferences%2Fjava%2Fcompiler%2Fref-preferences-errors-warnings.htm">Java Compiler Errors/Warnings Preferences</a>.
|
||||
<a href="https://help.eclipse.org/2020-12/advanced/content.jsp?topic=/org.eclipse.jdt.doc.user/reference/preferences/java/compiler/ref-preferences-errors-warnings.htm">Java Compiler Errors/Warnings Preferences</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"qhelp.dtd">
|
||||
<qhelp>
|
||||
|
||||
<include src="IterableOverview.qhelp" />
|
||||
<include src="IterableOverview.inc.qhelp" />
|
||||
|
||||
<recommendation>
|
||||
<p>
|
||||
@@ -53,14 +53,14 @@ refactoring above, but nevertheless an improvement over the original.
|
||||
<references>
|
||||
|
||||
<li>
|
||||
The Java Language Specification:
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se8/html/jls-14.html#jls-14.14.2">The enhanced for statement</a>.
|
||||
Java Language Specification:
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-14.14.2">The enhanced for statement</a>.
|
||||
</li>
|
||||
<li>
|
||||
The Java API Specification:
|
||||
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Iterable.html">Interface Iterable<T></a>,
|
||||
<a href="https://docs.oracle.com/javase/8/docs/api/java/util/Iterator.html">Interface Iterator<T></a>,
|
||||
<a href="https://docs.oracle.com/javase/8/docs/api/java/nio/file/DirectoryStream.html">Interface DirectoryStream<T></a>.
|
||||
Java API Specification:
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Iterable.html">Interface Iterable<T></a>,
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Iterator.html">Interface Iterator<T></a>,
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/DirectoryStream.html">Interface DirectoryStream<T></a>.
|
||||
</li>
|
||||
|
||||
</references>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
import java
|
||||
|
||||
predicate complicatedBranch(Stmt branch) {
|
||||
exists(ConditionalExpr ce | ce.getParent*() = branch) or
|
||||
any(ConditionalExpr ce).getParent*() = branch or
|
||||
count(MethodAccess a | a.getParent*() = branch) > 1
|
||||
}
|
||||
|
||||
|
||||
@@ -52,11 +52,11 @@ example, <code>PhotoResizerWidget.width</code> would be better named
|
||||
|
||||
<li>
|
||||
Help - Eclipse Platform:
|
||||
<a href="http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Freference%2Fpreferences%2Fjava%2Fcompiler%2Fref-preferences-errors-warnings.htm">Java Compiler Errors/Warnings Preferences</a>.
|
||||
<a href="https://help.eclipse.org/2020-12/advanced/content.jsp?topic=/org.eclipse.jdt.doc.user/reference/preferences/java/compiler/ref-preferences-errors-warnings.htm">Java Compiler Errors/Warnings Preferences</a>.
|
||||
</li>
|
||||
<li>
|
||||
Java Language Specification:
|
||||
<a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.4.8.1">8.4.8.1 Overriding (by Instance Methods)</a>.
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-8.html#jls-8.4.8.1">8.4.8.1 Overriding (by Instance Methods)</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -35,12 +35,12 @@ subclasses. Therefore, it is clearer to replace <code>? extends String
|
||||
|
||||
<li>
|
||||
Help - Eclipse Platform:
|
||||
<a href="http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Freference%2Fpreferences%2Fjava%2Fcompiler%2Fref-preferences-errors-warnings.htm">Java Compiler Errors/Warnings Preferences</a>.
|
||||
<a href="https://help.eclipse.org/2020-12/advanced/content.jsp?topic=/org.eclipse.jdt.doc.user/reference/preferences/java/compiler/ref-preferences-errors-warnings.htm">Java Compiler Errors/Warnings Preferences</a>.
|
||||
</li>
|
||||
<li>
|
||||
Java Language Specification:
|
||||
<a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-4.html#jls-4.5.1">4.5.1 Type Arguments and Wildcards</a>,
|
||||
<a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.1.1.2">8.1.1.2 final Classes</a>.
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-4.html#jls-4.5.1">4.5.1 Type Arguments of Parameterized Types </a>,
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-8.html#jls-8.1.1.2">8.1.1.2 final Classes</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -36,11 +36,11 @@ interface. The type variable therefore shadows <code>Map.Entry</code>.</p>
|
||||
|
||||
<li>
|
||||
Help - Eclipse Platform:
|
||||
<a href="http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Freference%2Fpreferences%2Fjava%2Fcompiler%2Fref-preferences-errors-warnings.htm">Java Compiler Errors/Warnings Preferences</a>.
|
||||
<a href="https://help.eclipse.org/2020-12/advanced/content.jsp?topic=/org.eclipse.jdt.doc.user/reference/preferences/java/compiler/ref-preferences-errors-warnings.htm">Java Compiler Errors/Warnings Preferences</a>.
|
||||
</li>
|
||||
<li>
|
||||
Java Language Specification:
|
||||
<a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-6.html#jls-6.4">6.4 Shadowing and Obscuring</a>.
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-6.html#jls-6.4">6.4 Shadowing and Obscuring</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -33,8 +33,8 @@ returned by <code>new</code> can never be null, so this check is superfluous.
|
||||
|
||||
<li>
|
||||
Java Language Specification:
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se8/html/jls-12.html#jls-12.5">Creation of New Class Instances</a>,
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se8/html/jls-14.html#jls-14.20.1">Execution of try-catch</a>.
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-12.html#jls-12.5">Creation of New Class Instances</a>,
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-14.20.1">Execution of try-catch</a>.
|
||||
</li>
|
||||
|
||||
</references>
|
||||
|
||||
@@ -36,7 +36,7 @@ predicate usefulUpcast(CastExpr e) {
|
||||
)
|
||||
or
|
||||
// Upcasts that are performed on an operand of a ternary expression.
|
||||
exists(ConditionalExpr ce | e = ce.getTrueExpr() or e = ce.getFalseExpr())
|
||||
e = any(ConditionalExpr ce).getABranchExpr()
|
||||
or
|
||||
// Upcasts to raw types.
|
||||
e.getType() instanceof RawType
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"qhelp.dtd">
|
||||
<qhelp>
|
||||
|
||||
<include src="IterableOverview.qhelp" />
|
||||
<include src="IterableOverview.inc.qhelp" />
|
||||
|
||||
<recommendation>
|
||||
<p>
|
||||
@@ -45,14 +45,14 @@ beginning.
|
||||
<references>
|
||||
|
||||
<li>
|
||||
The Java Language Specification:
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se8/html/jls-14.html#jls-14.14.2">The enhanced for statement</a>.
|
||||
Java Language Specification:
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-14.14.2">The enhanced for statement</a>.
|
||||
</li>
|
||||
<li>
|
||||
The Java API Specification:
|
||||
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Iterable.html">Interface Iterable<T></a>,
|
||||
<a href="https://docs.oracle.com/javase/8/docs/api/java/util/Iterator.html">Interface Iterator<T></a>,
|
||||
<a href="https://docs.oracle.com/javase/8/docs/api/java/nio/file/DirectoryStream.html">Interface DirectoryStream<T></a>.
|
||||
Java API Specification:
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Iterable.html">Interface Iterable<T></a>,
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Iterator.html">Interface Iterator<T></a>,
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/DirectoryStream.html">Interface DirectoryStream<T></a>.
|
||||
</li>
|
||||
|
||||
</references>
|
||||
|
||||
@@ -36,14 +36,14 @@ The example shows how using the two solutions described above means that <code>p
|
||||
|
||||
|
||||
<li>
|
||||
Java API Documentation:
|
||||
<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Math.html#abs%28int%29">Math.abs(int)</a>,
|
||||
<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Math.html#abs%28long%29">Math.abs(long)</a>,
|
||||
<a href="http://docs.oracle.com/javase/6/docs/api/java/util/Random.html">Random</a>.
|
||||
Java API Specification:
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Math.html#abs(int)">Math.abs(int)</a>,
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Math.html#abs(long)">Math.abs(long)</a>,
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Random.html">Random</a>.
|
||||
</li>
|
||||
<li>
|
||||
Java Language Specification, 3rd ed:
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se6/html/typesValues.html#4.2.1">4.2.1 Integral Types and Values</a>.
|
||||
Java Language Specification:
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-4.html#jls-4.2.1">4.2.1 Integral Types and Values</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -11,15 +11,15 @@
|
||||
*/
|
||||
|
||||
import java
|
||||
import semmle.code.java.security.Random
|
||||
|
||||
from MethodAccess ma, Method abs, Method nextIntOrLong, MethodAccess nma
|
||||
from MethodAccess ma, Method abs, Method nextIntOrLong, RandomDataSource nma
|
||||
where
|
||||
ma.getMethod() = abs and
|
||||
abs.hasName("abs") and
|
||||
abs.getDeclaringType().hasQualifiedName("java.lang", "Math") and
|
||||
ma.getAnArgument() = nma and
|
||||
nma.getMethod() = nextIntOrLong and
|
||||
(nextIntOrLong.hasName("nextInt") or nextIntOrLong.hasName("nextLong")) and
|
||||
nextIntOrLong.getDeclaringType().hasQualifiedName("java.util", "Random") and
|
||||
nextIntOrLong.hasNoParameters()
|
||||
nextIntOrLong.hasName(["nextInt", "nextLong"]) and
|
||||
not nma.resultMayBeBounded()
|
||||
select ma, "Incorrect computation of abs of signed integral random value."
|
||||
|
||||
@@ -36,8 +36,8 @@ Consider using <code>x % 2 != 0</code> to check for odd and <code>x % 2 == 0</co
|
||||
J. Bloch and N. Gafter, <em>Java Puzzlers: Traps, Pitfalls, and Corner Cases</em>, Puzzle 1. Addison-Wesley, 2005.
|
||||
</li>
|
||||
<li>
|
||||
The Java Language Specification:
|
||||
<a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.17.3">Remainder Operator %</a>.
|
||||
Java Language Specification:
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-15.html#jls-15.17.3">Remainder Operator %</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -40,8 +40,8 @@ This avoids potentially unexpected results caused by binary numeric promotion.
|
||||
J. Bloch and N. Gafter, <em>Java Puzzlers: Traps, Pitfalls, and Corner Cases</em>, Puzzle 8. Addison-Wesley, 2005.
|
||||
</li>
|
||||
<li>
|
||||
The Java Language Specification:
|
||||
<a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.25">Conditional Operator ?</a>.
|
||||
Java Language Specification:
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-15.html#jls-15.25">Conditional Operator ? :</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -16,10 +16,7 @@ class CharType extends PrimitiveType {
|
||||
CharType() { this.hasName("char") }
|
||||
}
|
||||
|
||||
private Type getABranchType(ConditionalExpr ce) {
|
||||
result = ce.getTrueExpr().getType() or
|
||||
result = ce.getFalseExpr().getType()
|
||||
}
|
||||
private Type getABranchType(ConditionalExpr ce) { result = ce.getABranchExpr().getType() }
|
||||
|
||||
from ConditionalExpr ce
|
||||
where
|
||||
|
||||
@@ -53,8 +53,8 @@ an integer. The correct check is <code>x % 2 == 0</code>.
|
||||
|
||||
|
||||
<li>
|
||||
The Java Language Specification:
|
||||
<a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.17.1">Multiplication operator *</a>, <a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.17.3">Remainder operator %</a>, <a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.22.1">Bitwise AND operator &</a>, <a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.23">Conditional-and operator &&</a> and <a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.24">Conditional-or operator ||</a>.
|
||||
Java Language Specification:
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-15.html#jls-15.17.1">Multiplication Operator *</a>, <a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-15.html#jls-15.17.3">Remainder Operator %</a>, <a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-15.html#jls-15.22.1">Integer Bitwise Operators &, ^, and |</a>, <a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-15.html#jls-15.23">Conditional-And Operator &&</a> and <a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-15.html#jls-15.24">Conditional-Or Operator ||</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -39,12 +39,12 @@ the left-hand side of the assignment: <code>short</code>, possibly leading to in
|
||||
J. Bloch and N. Gafter, <em>Java Puzzlers: Traps, Pitfalls, and Corner Cases</em>, Puzzle 9. Addison-Wesley, 2005.
|
||||
</li>
|
||||
<li>
|
||||
The Java Language Specification:
|
||||
<a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.26.2">Compound Assignment Operators</a>,
|
||||
<a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-5.html#jls-5.1.3">Narrowing Primitive Conversion</a>.
|
||||
Java Language Specification:
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-15.html#jls-15.26.2">Compound Assignment Operators</a>,
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-5.html#jls-5.1.3">Narrowing Primitive Conversion</a>.
|
||||
</li>
|
||||
<li>The CERT Oracle Secure Coding Standard for Java:
|
||||
<a href="https://www.securecoding.cert.org/confluence/display/java/NUM00-J.+Detect+or+prevent+integer+overflow">NUM00-J. Detect or prevent integer overflow</a>.</li>
|
||||
<li>SEI CERT Oracle Coding Standard for Java:
|
||||
<a href="https://wiki.sei.cmu.edu/confluence/display/java/NUM00-J.+Detect+or+prevent+integer+overflow">NUM00-J. Detect or prevent integer overflow</a>.</li>
|
||||
|
||||
|
||||
</references>
|
||||
|
||||
@@ -40,11 +40,11 @@ one of the operands to type <code>long</code>.
|
||||
J. Bloch and N. Gafter, <em>Java Puzzlers: Traps, Pitfalls, and Corner Cases</em>, Puzzle 3. Addison-Wesley, 2005.
|
||||
</li>
|
||||
<li>
|
||||
The Java Language Specification:
|
||||
<a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.17.1">Multiplication Operator</a>.
|
||||
Java Language Specification:
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-15.html#jls-15.17.1">Multiplication Operator</a>.
|
||||
</li>
|
||||
<li>The CERT Oracle Secure Coding Standard for Java:
|
||||
<a href="https://www.securecoding.cert.org/confluence/display/java/NUM00-J.+Detect+or+prevent+integer+overflow">NUM00-J. Detect or prevent integer overflow</a>.</li>
|
||||
<li>SEI CERT Oracle Coding Standard for Java:
|
||||
<a href="https://wiki.sei.cmu.edu/confluence/display/java/NUM00-J.+Detect+or+prevent+integer+overflow">NUM00-J. Detect or prevent integer overflow</a>.</li>
|
||||
|
||||
|
||||
</references>
|
||||
|
||||
@@ -39,8 +39,8 @@ be cast to <code>long</code> before the shift is applied. Then the left-shift of
|
||||
|
||||
|
||||
<li>
|
||||
The Java Language Specification:
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.19">Shift Operators</a>.
|
||||
Java Language Specification:
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-15.html#jls-15.19">Shift Operators</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ Instead, the expression should be <code>t % (60 * 1000)</code>.
|
||||
J. Bloch and N. Gafter, <em>Java Puzzlers: Traps, Pitfalls, and Corner Cases</em>, Puzzle 35. Addison-Wesley, 2005.
|
||||
</li>
|
||||
<li>
|
||||
The Java Tutorials: <a href="http://docs.oracle.com/javase/tutorial/java/nutsandbolts/operators.html">Operators</a>.
|
||||
The Java Tutorials: <a href="https://docs.oracle.com/javase/tutorial/java/nutsandbolts/operators.html">Operators</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -36,8 +36,8 @@ octal literal. This can lead to two problems:</p>
|
||||
J. Bloch and N. Gafter, <em>Java Puzzlers: Traps, Pitfalls, and Corner Cases</em>, Puzzle 59. Addison-Wesley, 2005.
|
||||
</li>
|
||||
<li>
|
||||
The Java Language Specification:
|
||||
<a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-3.html#jls-3.10.1">Integer Literals</a>.
|
||||
Java Language Specification:
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-3.html#jls-3.10.1">Integer Literals</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ every time a new pseudo-random number is required (for example, <code>new Random
|
||||
</p>
|
||||
|
||||
<p>
|
||||
According to the Java API specification:</p>
|
||||
According to the Java API Specification:</p>
|
||||
|
||||
<blockquote>
|
||||
<p>If two instances of <code>Random</code> are created with the same seed, and the same sequence of method calls is made for each, they will generate and return
|
||||
@@ -48,8 +48,8 @@ the numbers are based on only one <code>Random</code> object.</p>
|
||||
|
||||
|
||||
<li>
|
||||
Java API Documentation:
|
||||
<a href="http://docs.oracle.com/javase/6/docs/api/java/util/Random.html">Random</a>.
|
||||
Java API Specification:
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Random.html">Random</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -12,10 +12,8 @@
|
||||
*/
|
||||
|
||||
import java
|
||||
import semmle.code.java.security.Random
|
||||
|
||||
from MethodAccess ma, Method random
|
||||
where
|
||||
random.getDeclaringType().hasQualifiedName("java.util", "Random") and
|
||||
ma.getMethod() = random and
|
||||
ma.getQualifier() instanceof ClassInstanceExpr
|
||||
from RandomDataSource ma
|
||||
where ma.getQualifier() instanceof ClassInstanceExpr
|
||||
select ma, "Random object created and used only once."
|
||||
|
||||
@@ -12,7 +12,7 @@ the contract for <code>Cloneable</code>.
|
||||
</p>
|
||||
|
||||
</overview>
|
||||
<include src="MissingCloneDetails.qhelp" />
|
||||
<include src="MissingCloneDetails.inc.qhelp" />
|
||||
|
||||
<recommendation>
|
||||
<p>
|
||||
@@ -42,7 +42,7 @@ because <code>super.clone</code> is implemented correctly in its superclass <cod
|
||||
J. Bloch, <em>Effective Java (second edition)</em>, Item 11. Addison-Wesley, 2008.
|
||||
</li>
|
||||
<li>
|
||||
Java 6 API Specification: <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html#clone%28%29">Object.clone()</a>.
|
||||
Java API Specification: <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#clone()">Object.clone()</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<qhelp>
|
||||
<overview>
|
||||
<p>
|
||||
The Java API documentation states that, for an object <code>x</code>, the general intent of the <code>clone</code> method is for it to
|
||||
The Java API Specification states that, for an object <code>x</code>, the general intent of the <code>clone</code> method is for it to
|
||||
satisfy the following three properties:
|
||||
</p>
|
||||
<ul>
|
||||
@@ -12,7 +12,7 @@ that does not have a <code>clone</code> method indicates that the class is break
|
||||
</p>
|
||||
|
||||
</overview>
|
||||
<include src="MissingCloneDetails.qhelp" />
|
||||
<include src="MissingCloneDetails.inc.qhelp" />
|
||||
|
||||
<recommendation>
|
||||
<p>
|
||||
@@ -53,7 +53,7 @@ operations on the <code>rs1clone</code> stack do not affect the <code>rs1</code>
|
||||
J. Bloch, <em>Effective Java (second edition)</em>, Item 11. Addison-Wesley, 2008.
|
||||
</li>
|
||||
<li>
|
||||
Java 6 API Specification: <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html#clone%28%29">Object.clone()</a>.
|
||||
Java API Specification: <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#clone()">Object.clone()</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -33,8 +33,8 @@ The condition should be changed as follows to correctly guard the array access.
|
||||
<references>
|
||||
|
||||
<li>
|
||||
The Java API Specification:
|
||||
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/ArrayIndexOutOfBoundsException.html">ArrayIndexOutOfBoundsException</a>.
|
||||
Java API Specification:
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/ArrayIndexOutOfBoundsException.html">ArrayIndexOutOfBoundsException</a>.
|
||||
</li>
|
||||
|
||||
</references>
|
||||
|
||||
@@ -50,8 +50,8 @@ returns <code>true</code> because you can compare <code>Short(1)</code> and <cod
|
||||
|
||||
|
||||
<li>
|
||||
Java API Documentation:
|
||||
<a href="http://docs.oracle.com/javase/6/docs/api/java/util/Collection.html#contains%28java.lang.Object%29">Collection.contains</a>.
|
||||
Java API Specification:
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Collection.html#contains(java.lang.Object)">Collection.contains</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -46,9 +46,9 @@ body to ensure that <code>seen</code> is correctly maintained.
|
||||
|
||||
|
||||
<li>
|
||||
Java API Documentation:
|
||||
<a href="http://docs.oracle.com/javase/8/docs/api/java/util/Collection.html">Collection</a>,
|
||||
<a href="http://docs.oracle.com/javase/8/docs/api/java/util/Map.html">Map</a>.
|
||||
Java API Specification:
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Collection.html">Collection</a>,
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Map.html">Map</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -52,8 +52,8 @@ item to remove.
|
||||
|
||||
|
||||
<li>
|
||||
Java API Documentation:
|
||||
<a href="http://docs.oracle.com/javase/6/docs/api/java/util/Collection.html#remove%28java.lang.Object%29">Collection.remove</a>.
|
||||
Java API Specification:
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Collection.html#remove(java.lang.Object)">Collection.remove</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -43,9 +43,9 @@ to see whether the node has already been considered.
|
||||
|
||||
|
||||
<li>
|
||||
Java API Documentation:
|
||||
<a href="http://docs.oracle.com/javase/8/docs/api/java/util/Collection.html">Collection</a>,
|
||||
<a href="http://docs.oracle.com/javase/8/docs/api/java/util/Map.html">Map</a>.
|
||||
Java API Specification:
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Collection.html">Collection</a>,
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Map.html">Map</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -37,8 +37,8 @@ even though the 31st bit of <code>x</code> is, in fact, set.
|
||||
|
||||
|
||||
<li>
|
||||
The Java Language Specification:
|
||||
<a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.22.1">Integer Bitwise Operators &, ^, and |</a>.
|
||||
Java Language Specification:
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-15.html#jls-15.22.1">Integer Bitwise Operators &, ^, and |</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -45,11 +45,11 @@ includes the missing qualifier <code>o</code> in the comparison of <code>id</cod
|
||||
|
||||
<li>
|
||||
Help - Eclipse Platform:
|
||||
<a href="http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Freference%2Fpreferences%2Fjava%2Fcompiler%2Fref-preferences-errors-warnings.htm">Java Compiler Errors/Warnings Preferences</a>.
|
||||
<a href="https://help.eclipse.org/2020-12/advanced/content.jsp?topic=/org.eclipse.jdt.doc.user/reference/preferences/java/compiler/ref-preferences-errors-warnings.htm">Java Compiler Errors/Warnings Preferences</a>.
|
||||
</li>
|
||||
<li>
|
||||
Java Language Specification:
|
||||
<a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.21.1">15.21.1. Numerical Equality Operators</a>.
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-15.html#jls-15.21.1">15.21.1. Numerical Equality Operators</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -35,10 +35,10 @@ to <code>Super</code>.</p>
|
||||
|
||||
|
||||
<li>J. Bloch, <em>Effective Java (second edition)</em>, Item 12. Addison-Wesley, 2008.</li>
|
||||
<li>The Java Language Specification:
|
||||
<a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.4.8.1">Overriding (by Instance Methods)</a>,
|
||||
<a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.4.9">Overloading</a>.</li>
|
||||
<li>The Java Tutorials: <a href="http://docs.oracle.com/javase/tutorial/java/IandI/override.html">Overriding and Hiding Methods</a>.</li>
|
||||
<li>Java Language Specification:
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-8.html#jls-8.4.8.1">Overriding (by Instance Methods)</a>,
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-8.html#jls-8.4.9">Overloading</a>.</li>
|
||||
<li>The Java Tutorials: <a href="https://docs.oracle.com/javase/tutorial/java/IandI/override.html">Overriding and Hiding Methods</a>.</li>
|
||||
|
||||
|
||||
</references>
|
||||
|
||||
@@ -29,10 +29,10 @@ so that <code>r.equals(s)</code> returns <code>true</code>.</p>
|
||||
|
||||
|
||||
<li>J. Bloch, <em>Effective Java (second edition)</em>, Item 8. Addison-Wesley, 2008.</li>
|
||||
<li>The Java Language Specification:
|
||||
<a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.4.8.1">Overriding (by Instance Methods)</a>,
|
||||
<a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.4.9">Overloading</a>.</li>
|
||||
<li>The Java Tutorials: <a href="http://docs.oracle.com/javase/tutorial/java/IandI/override.html">Overriding and Hiding Methods</a>.</li>
|
||||
<li>Java Language Specification:
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-8.html#jls-8.4.8.1">Overriding (by Instance Methods)</a>,
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-8.html#jls-8.4.9">Overloading</a>.</li>
|
||||
<li>The Java Tutorials: <a href="https://docs.oracle.com/javase/tutorial/java/IandI/override.html">Overriding and Hiding Methods</a>.</li>
|
||||
|
||||
|
||||
<!-- A related issue is examined by the query <a href="MissingInstanceOfInEquals.html">Equals Method Does Not Inspect Argument Type</a>. -->
|
||||
|
||||
@@ -41,8 +41,8 @@ not rectangles. (Note that, in practice, the example should also include an impl
|
||||
|
||||
|
||||
<li>
|
||||
Java API Documentation:
|
||||
<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html#equals(java.lang.Object)">Object.equals()</a>.
|
||||
Java API Specification:
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#equals(java.lang.Object)">Object.equals()</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -41,12 +41,13 @@ Because this compares the length and contents of the arrays, <code>Arrays.equals
|
||||
|
||||
</example>
|
||||
<references>
|
||||
<li>Java API Documentation:
|
||||
<a href="http://docs.oracle.com/javase/6/docs/api/java/util/Arrays.html#equals%28java.lang.Object[],%20java.lang.Object[]%29">Arrays.equals</a>,
|
||||
<a href="http://docs.oracle.com/javase/6/docs/api/java/util/Arrays.html#deepEquals%28java.lang.Object[],%20java.lang.Object[]%29">Arrays.deepEquals</a>,
|
||||
<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html#equals%28java.lang.Object%29">Object.equals</a>,
|
||||
<a href="http://docs.oracle.com/javase/6/docs/api/java/util/Arrays.html#hashCode%28java.lang.Object[]%29">Arrays.hashCode</a>,
|
||||
<a href="http://docs.oracle.com/javase/6/docs/api/java/util/Arrays.html#deepHashCode%28java.lang.Object[]%29">Arrays.deepHashCode</a>,
|
||||
<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html#hashCode%28%29">Object.hashCode</a>.</li>
|
||||
<li>Java API Specification:
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Arrays.html#equals(java.lang.Object[],java.lang.Object[])">Arrays.equals</a>,
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Arrays.html#deepEquals(java.lang.Object[],java.lang.Object[])">Arrays.deepEquals</a>,
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Objects.html#deepEquals(java.lang.Object,java.lang.Object)">Objects.deepEquals</a>,
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#equals(java.lang.Object)">Object.equals</a>,
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Arrays.html#hashCode(java.lang.Object[])">Arrays.hashCode</a>,
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Arrays.html#deepHashCode(java.lang.Object[])">Arrays.deepHashCode</a>,
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#hashCode()">Object.hashCode</a>.</li>
|
||||
</references>
|
||||
</qhelp>
|
||||
|
||||
@@ -64,16 +64,16 @@ using <code>getClass</code> rather than <code>instanceof</code>.
|
||||
J. Bloch, <em>Effective Java (second edition)</em>, Items 8 and 16. Addison-Wesley, 2008.
|
||||
</li>
|
||||
<li>
|
||||
Java API Documentation:
|
||||
<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html#equals(java.lang.Object)">Object.equals()</a>.
|
||||
Java API Specification:
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#equals(java.lang.Object)">Object.equals()</a>.
|
||||
</li>
|
||||
<li>
|
||||
The Java Language Specification:
|
||||
<a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.20.2">Type Comparison Operator instanceof</a>.
|
||||
Java Language Specification:
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-15.html#jls-15.20.2">Type Comparison Operator instanceof</a>.
|
||||
</li>
|
||||
<li>
|
||||
Artima Developer:
|
||||
<a href="http://www.artima.com/lejava/articles/equality.html">How to Write an Equality Method in Java</a>.
|
||||
<a href="https://www.artima.com/lejava/articles/equality.html">How to Write an Equality Method in Java</a>.
|
||||
</li>
|
||||
<li>JavaSolutions, April 2002:
|
||||
<a href="http://www.angelikalanger.com/Articles/JavaSolutions/SecretsOfEquals/Equals.html">Secrets of equals()</a>.
|
||||
|
||||
@@ -43,12 +43,12 @@ in the <code>equals</code> method. Therefore, the contract of the <code>hashCode
|
||||
J. Bloch, <em>Effective Java (second edition)</em>, Item 9. Addison-Wesley, 2008.
|
||||
</li>
|
||||
<li>
|
||||
Java API Documentation:
|
||||
<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html#equals%28java.lang.Object%29">Object.equals</a>,
|
||||
<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html#hashCode%28%29">Object.hashCode</a>.
|
||||
Java API Specification:
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#equals(java.lang.Object)">Object.equals</a>,
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#hashCode()">Object.hashCode</a>.
|
||||
</li>
|
||||
<li>
|
||||
IBM developerWorks: <a href="http://www.ibm.com/developerworks/java/library/j-jtp05273/index.html">Java theory and practice: Hashing it out</a>.
|
||||
IBM developerWorks: <a href="https://www.ibm.com/developerworks/java/library/j-jtp05273/index.html">Java theory and practice: Hashing it out</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -30,8 +30,8 @@ mistake, instead of a specific element. Therefore, "Value not found" is returned
|
||||
|
||||
|
||||
<li>
|
||||
Java API Documentation:
|
||||
<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html#equals(java.lang.Object)">Object.equals()</a>.
|
||||
Java API Specification:
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#equals(java.lang.Object)">Object.equals()</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -42,10 +42,9 @@ If you require a natural ordering that is inconsistent with <code>equals</code>,
|
||||
J. Bloch, <em>Effective Java (second edition)</em>, Item 12. Addison-Wesley, 2008.
|
||||
</li>
|
||||
<li>
|
||||
Java API Documentation:
|
||||
<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Comparable.html#compareTo%28T%29">Comparable.compareTo</a>,
|
||||
<a href="http://java.sun.com/javase/6/docs/api/java/lang/Comparable.html">Comparable</a>,
|
||||
<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html#equals%28java.lang.Object%29">Object.equals</a>.
|
||||
Java API Specification:
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Comparable.html#compareTo(T)">Comparable.compareTo</a>,
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#equals(java.lang.Object)">Object.equals</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -39,16 +39,16 @@ retrieving objects of such a class in a hashing data structure.
|
||||
J. Bloch, <em>Effective Java (second edition)</em>, Item 9. Addison-Wesley, 2008.
|
||||
</li>
|
||||
<li>
|
||||
Java API Documentation:
|
||||
<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html#equals%28java.lang.Object%29">Object.equals</a>,
|
||||
<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html#hashCode%28%29">Object.hashCode</a>.
|
||||
Java API Specification:
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#equals(java.lang.Object)">Object.equals</a>,
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#hashCode()">Object.hashCode</a>.
|
||||
</li>
|
||||
<li>
|
||||
IBM developerWorks: <a href="http://www.ibm.com/developerworks/java/library/j-jtp05273/index.html">Java theory and practice: Hashing it out</a>.
|
||||
IBM developerWorks: <a href="https://www.ibm.com/developerworks/java/library/j-jtp05273/index.html">Java theory and practice: Hashing it out</a>.
|
||||
</li>
|
||||
<li>
|
||||
Help - Eclipse Platform:
|
||||
<a href="http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Freference%2Fpreferences%2Fjava%2Fcompiler%2Fref-preferences-errors-warnings.htm">Java Compiler Errors/Warnings Preferences</a>.
|
||||
<a href="https://help.eclipse.org/2020-12/advanced/content.jsp?topic=/org.eclipse.jdt.doc.user/reference/preferences/java/compiler/ref-preferences-errors-warnings.htm">Java Compiler Errors/Warnings Preferences</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -46,12 +46,12 @@ instances of a class and its subclasses, even when no additional state is added
|
||||
J. Bloch, <em>Effective Java (second edition)</em>, Item 8. Addison-Wesley, 2008.
|
||||
</li>
|
||||
<li>
|
||||
Java API Documentation:
|
||||
<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html#equals(java.lang.Object)">Object.equals()</a>.
|
||||
Java API Specification:
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#equals(java.lang.Object)">Object.equals()</a>.
|
||||
</li>
|
||||
<li>
|
||||
The Java Language Specification:
|
||||
<a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.20.2">Type Comparison Operator instanceof</a>.
|
||||
Java Language Specification:
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-15.html#jls-15.20.2">Type Comparison Operator instanceof</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -34,12 +34,12 @@ condition, possibly splitting the condition into several separate tests.</p>
|
||||
|
||||
<li>
|
||||
Help - Eclipse Platform:
|
||||
<a href="http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Freference%2Fpreferences%2Fjava%2Fcompiler%2Fref-preferences-errors-warnings.htm">Java Compiler Errors/Warnings Preferences</a>.
|
||||
<a href="https://help.eclipse.org/2020-12/advanced/content.jsp?topic=/org.eclipse.jdt.doc.user/reference/preferences/java/compiler/ref-preferences-errors-warnings.htm">Java Compiler Errors/Warnings Preferences</a>.
|
||||
</li>
|
||||
<li>
|
||||
Java Language Specification:
|
||||
<a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.21">15.21 Equality Operators</a>,
|
||||
<a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.26">15.26 Assignment Operators</a>.
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-15.html#jls-15.21">15.21 Equality Operators</a>,
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-15.html#jls-15.26">15.26 Assignment Operators</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@ import semmle.code.java.Statement
|
||||
/** An expression that is used as a condition. */
|
||||
class BooleanExpr extends Expr {
|
||||
BooleanExpr() {
|
||||
exists(ConditionalStmt s | s.getCondition() = this) or
|
||||
exists(ConditionalExpr s | s.getCondition() = this)
|
||||
this = any(ConditionalStmt s).getCondition() or
|
||||
this = any(ConditionalExpr s).getCondition()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ J. Bloch, <em>Effective Java (second edition)</em>, Item 48. Addison-Wesley, 200
|
||||
</li>
|
||||
<li>
|
||||
Numerical Computation Guide:
|
||||
(<a href="http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html">What Every Computer Scientist Should Know About Floating-Point Arithmetic</a>).
|
||||
<a href="https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html">What Every Computer Scientist Should Know About Floating-Point Arithmetic</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@ equality.
|
||||
|
||||
|
||||
<li>
|
||||
Java API Documentation:
|
||||
<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html#equals%28java.lang.Object%29">Object.equals()</a>.
|
||||
Java API Specification:
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#equals(java.lang.Object)">Object.equals()</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -35,9 +35,9 @@ returns <code>true</code> because the objects contain equal values.</p>
|
||||
J. Bloch and N. Gafter, <em>Java Puzzlers: Traps, Pitfalls, and Corner Cases</em>, Puzzle 32. Addison-Wesley, 2005.
|
||||
</li>
|
||||
<li>
|
||||
Java API Documentation:
|
||||
<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html#equals%28java.lang.Object%29">Object.equals()</a>,
|
||||
<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Integer.html#equals%28java.lang.Object%29">Integer.equals()</a>.
|
||||
Java API Specification:
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#equals(java.lang.Object)">Object.equals()</a>,
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Integer.html#equals(java.lang.Object)">Integer.equals()</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -42,15 +42,15 @@ the <code>equals</code> method. This version will reliably detect whenever
|
||||
</example>
|
||||
<references>
|
||||
<li>
|
||||
Java API Documentation:
|
||||
<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html#equals%28java.lang.Object%29">String.equals()</a>,
|
||||
<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html#intern%28%29">String.intern()</a>.
|
||||
Java API Specification:
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#equals(java.lang.Object)">String.equals()</a>,
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#intern()">String.intern()</a>.
|
||||
</li>
|
||||
<li>
|
||||
The Java Language Specification:
|
||||
<a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.21.3">15.21.3</a>,
|
||||
<a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-3.html#jls-3.10.5">3.10.5</a>,
|
||||
<a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.28">15.28</a>.
|
||||
Java Language Specification:
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-15.html#jls-15.21.3">15.21.3 Reference Equality Operators == and !=</a>,
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-3.html#jls-3.10.5">3.10.5 String Literals </a>,
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-15.html#jls-15.28">15.28 Constant Expressions</a>.
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ the condition should be removed to make this clear.
|
||||
|
||||
<li>
|
||||
Java Language Specification:
|
||||
<a href="http://docs.oracle.com/javase/specs/jls/se8/html/jls-14.html#jls-14.9">The if Statement</a>.
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-14.9">The if Statement</a>.
|
||||
</li>
|
||||
|
||||
</references>
|
||||
|
||||
@@ -25,7 +25,7 @@ by <code>Double.isNaN(x)</code>, which accurately identifies whether <code>x</co
|
||||
|
||||
<li>
|
||||
Java Language Specification:
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se8/html/jls-15.html#jls-15.21.1">Numerical Equality Operators == and !=</a>.
|
||||
<a href="https://docs.oracle.com/javase/specs/jls/se11/html/jls-15.html#jls-15.21.1">Numerical Equality Operators == and !=</a>.
|
||||
</li>
|
||||
|
||||
</references>
|
||||
|
||||
@@ -50,12 +50,12 @@ message has been sent. This means that the thread can respond immediately instea
|
||||
|
||||
|
||||
<li>J. Bloch, <em>Effective Java (second edition)</em>, Item 72. Addison-Wesley, 2008.</li>
|
||||
<li>Java API Documentation:
|
||||
<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html#wait%28%29">Object.wait()</a>,
|
||||
<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html#notifyAll%28%29">Object.notifyAll()</a>,
|
||||
<a href="http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/package-summary.html#package_description">java.util.concurrent</a>.</li>
|
||||
<li>The Java Tutorials: <a href="http://docs.oracle.com/javase/tutorial/essential/concurrency/guardmeth.html">Guarded Blocks</a>,
|
||||
<a href="http://docs.oracle.com/javase/tutorial/essential/concurrency/highlevel.html">High Level Concurrency Objects</a>.</li>
|
||||
<li>Java API Specification:
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#wait()">Object.wait()</a>,
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#notifyAll()">Object.notifyAll()</a>,
|
||||
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/concurrent/package-summary.html">java.util.concurrent</a>.</li>
|
||||
<li>The Java Tutorials: <a href="https://docs.oracle.com/javase/tutorial/essential/concurrency/guardmeth.html">Guarded Blocks</a>,
|
||||
<a href="https://docs.oracle.com/javase/tutorial/essential/concurrency/highlevel.html">High Level Concurrency Objects</a>.</li>
|
||||
|
||||
|
||||
</references>
|
||||
|
||||
@@ -18,7 +18,7 @@ typing "wait" instead of "await".
|
||||
<references>
|
||||
|
||||
|
||||
<li>Java API Documentation: <a href="http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/locks/Condition.html">java.util.concurrent.Condition</a>.</li>
|
||||
<li>Java API Specification: <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/concurrent/locks/Condition.html">java.util.concurrent.Condition</a>.</li>
|
||||
|
||||
|
||||
</references>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user