All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.checkerframework.framework.type.HashcodeAtmVisitor Maven / Gradle / Ivy

Go to download

The Checker Framework enhances Java's type system to make it more powerful and useful. This lets software developers detect and prevent errors in their Java programs. The Checker Framework includes compiler plug-ins ("checkers") that find bugs or verify their absence. It also permits you to write your own compiler plug-ins.

The newest version!
package org.checkerframework.framework.type;

import org.checkerframework.framework.type.visitor.SimpleAnnotatedTypeScanner;

import java.util.Objects;

/**
 * Computes the hashcode of an AnnotatedTypeMirror using the underlying type and primary annotations
 * and the hash code of component types of AnnotatedTypeMirror.
 *
 * 

This class should be synchronized with EqualityAtmComparer. * * @see org.checkerframework.framework.type.EqualityAtmComparer for more details. *

This is used by AnnotatedTypeMirror.hashcode. */ public class HashcodeAtmVisitor extends SimpleAnnotatedTypeScanner { /** Creates a {@link HashcodeAtmVisitor}. */ public HashcodeAtmVisitor() { super(Integer::sum, 0); } /** * Generates hashcode for type using the underlying type and the primary annotation. This method * does not descend into component types (this occurs in the scan method) * * @param type the type */ @Override protected Integer defaultAction(AnnotatedTypeMirror type, Void v) { // To differentiate between partially initialized type's (which may have null components) // and fully initialized types, null values are allowed if (type == null) { return 0; } return Objects.hash(type.getUnderlyingTypeHashCode(), type.getAnnotations().toString()); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy