Method for checking null pointer in source code and computer system

A computer system and source code technology, applied in the field of null pointer detection, can solve the problems of not being able to scan, too much preparation time, and not being able to scan source code, etc., to achieve the effects of avoiding instability, accurate search, and simple application

Inactive Publication Date: 2012-07-04
ALIBABA GRP HLDG LTD
View PDF2 Cites 1 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

) The null pointer of the parameter is not checked, therefore, the null pointer problem in many cases cannot be scanned
[0020] In addition, due to the instability of the program, the code parsing process is complicated and error-prone, etc., it often leads to the null pointer problem that cannot be scanned
[0021] 2. The scanning tool is relatively large and the scanning speed is slow
[0024] Existing findbugs often require the code to be compiled before scanning, because it mainly scans bytecodes and cannot scan source codes, so it needs to be compiled, and compiling is cumbersome and requires a lot of preparation time, which is contrary to the spirit of program development
[0025] 4. The existing algorithms used for null pointer scanning tools are relatively backward. It constructs a large number of complex regular expression lists, and recursively calls regular expressions, which consumes a lot of CPU and other resources.

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Method for checking null pointer in source code and computer system
  • Method for checking null pointer in source code and computer system
  • Method for checking null pointer in source code and computer system

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0074] The following will clearly and completely describe the technical solutions in the embodiments of the application with reference to the drawings in the embodiments of the application. Apparently, the described embodiments are only some of the embodiments of the application, not all of them. Based on the embodiments in this application, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of this application.

[0075] In order to illustrate this application more clearly, some existing concepts are briefly introduced below.

[0076] A variable is a quantity that can change at any time during the running of the program. Variables are temporary storage places for data in a program. In short, variables are simple tools for keeping track of almost any type of information.

[0077] Global variables, which are visible throughout the program.

[0078] Local variables, they are variables defined inside ...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

The invention discloses a method for checking a null pointer in a source code, comprising: a computer system construction referencable variable type dictionary, a computer system receiving an instruction for scanning the null pointer, formatting the source code to be checked; scanning the global code zone of the source code to be checked and obtaining an uninitialized global variable list corresponding to the variable statement type in the dictionary; scanning the method zone of the source code to be checked and obtaining the uninitialized local variable list corresponding to the variable statement type in the dictionary; acquiring uninitialized global variable list in method based on the uninitialized global variable list; scanning the method zone of the source code to be checked, searching the called variable name, if the called variable name is in the uninitialized local variable list or uninitialized global variable list in method, the found called variable name is the null pointerin the source code. The invention also discloses a computer system.

Description

technical field [0001] The present application relates to the technical field of null pointer detection, in particular to a method and computer system for checking null pointers in source codes. Background technique [0002] In a computer program, a pointer with an indeterminate value will randomly generate a value, a pointer that does not know where to point, or a pointer that points to a pointer that is out of range is very dangerous, because this uncertainty can paralyze the program, so it is necessary to Define a null pointer to accommodate these uncertainties. This null pointer is also commonly referred to as a null pointer. [0003] The following takes the JAVA language as an example to provide a simple example of a null pointer: [0004] / / Source code of Hello.java [0005] import com.xx.Bye; [0006] public class Hello{ [0007] private Integer num1; / / Declare an integer pointer num1 [0008] private bye bye; [0009] public int getNum(){ [0010] return nu...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
Patent Type & Authority Patents(China)
IPC IPC(8): G06F11/36
Inventor 何崚
Owner ALIBABA GRP HLDG LTD
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products