GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • CodeQL documentation
  • CodeQL overview
  • Writing CodeQL queries
  • CodeQL language guides
  • QL language reference
  • CodeQL standard-libraries
  • CodeQL query help
  • CodeQL repository
  • QL publications
  • CodeQL query help for C and C++
  • CodeQL query help for C#
  • CodeQL query help for GitHub Actions
  • CodeQL query help for Go
  • CodeQL query help for Java and Kotlin

This view

  • Original page
  • New address

GeezerVison is showing codeql.github.com — Typo in toString — CodeQL query help documentation

Typo in toString¶

ID: java/tostring-typo
Kind: problem
Security severity: 
Severity: warning
Precision: medium
Tags:
   - quality
   - reliability
   - correctness
   - readability
Query suites:
   - java-security-and-quality.qls

Click to see the query in the CodeQL repository

A method named tostring may be a typographical error. toString (different capitalization) may have been intended instead.

Recommendation¶

Ensure that any such method is intended to have this name. Even if it is, it may be better to rename it to avoid confusion with the inherited method Object.toString.

Example¶

The following example shows a method named tostring. It may be better to rename it.

public class Customer
{
	private String title;
	private String forename;
	private String surname;

	// ...

	public String tostring() {  // The method is named 'tostring'.
		return title + " " + forename + " " + surname;
	}
}

References¶

  • Java API Specification: Object.toString.

  • © GitHub, Inc.
  • Terms
  • Privacy
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.