Skip to content
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
1b2483b
migrated AnalysisParams on record
rishikraj990 Dec 29, 2025
9c7e5d3
migrated CollectLikeMethodRecord on record
rishikraj990 Dec 29, 2025
ed33a43
migrated MethodAnnotationsRecord on record
rishikraj990 Dec 29, 2025
75a2d78
migrated FieldRef on record
rishikraj990 Dec 29, 2025
c43b083
migrated MethodClassAndName on record
rishikraj990 Dec 29, 2025
76cf410
remove unsed import
rishikraj990 Dec 29, 2025
9ebfd92
migrated CollectRecordAndInnerMethod on record
rishikraj990 Dec 29, 2025
506e4c4
migrated FieldInitEntities on record
rishikraj990 Dec 29, 2025
a14c9ce
migrated CfgParams from AutoValue to direct
rishikraj990 Dec 29, 2025
9de1799
removed auto-value dependencies
rishikraj990 Dec 29, 2025
32806d6
replace java doc
rishikraj990 Dec 29, 2025
5dd8b69
remove autovalue dependencies for model gen module
rishikraj990 Dec 29, 2025
f7fd4bd
java doc correction
rishikraj990 Dec 29, 2025
21d6359
correcting
rishikraj990 Dec 29, 2025
3000a24
Merge branch 'master' into autoValue2Records
rishikraj990 Jan 2, 2026
f8671ff
Updating the java doc
rishikraj990 Jan 3, 2026
fa305c1
remove autoValue from build gradle
rishikraj990 Jan 3, 2026
91f0cdc
Merge branch 'master' into autoValue2Records
rishikraj990 Jan 10, 2026
b449530
applied spotlessApply
rishikraj990 Jan 10, 2026
d85b929
resolved nullable warning
rishikraj990 Jan 10, 2026
06ccd25
restore autovalue for benchmark
msridhar Jan 10, 2026
c2e6bda
updated java doc by moving details to record rather than in method
rishikraj990 Jan 11, 2026
c67a209
Refactor ContractsTests to use Java text blocks (#1435)
cobayo Jan 11, 2026
158fbd2
Update Error Prone and errorprone-plugin versions (#1434)
msridhar Jan 12, 2026
daec884
convert docs
msridhar Jan 13, 2026
99049cb
Merge branch 'master' into autoValue2Records
msridhar Jan 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@ subprojects { project ->
"-parameters",
]
options.errorprone {
// disable warnings in generated code; AutoValue code fails UnnecessaryParentheses check
disableWarningsInGeneratedCode = true

// https://github.com/uber/NullAway/issues/1398
check("MisformattedTestData", CheckSeverity.OFF)
Expand Down
3 changes: 0 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ check-framework = "3.53.0"
support = "27.1.1"
wala = "1.6.12"
commons-cli = "1.4"
auto-value = "1.11.1"
auto-service = "1.1.1"
google-java-format = "1.30.0"
android-gradle-plugin = "8.13.0"
Expand Down Expand Up @@ -59,8 +58,6 @@ android-gradle-plugin = { module = "com.android.tools.build:gradle", version.ref
gradle-maven-publish-plugin = { module = "com.vanniktech:gradle-maven-publish-plugin", version.ref = "gradle-maven-publish-plugin" }

# --- APT (Annotation Processing) ---
auto-value = { module = "com.google.auto.value:auto-value", version.ref = "auto-value" }
auto-value-annotations = { module = "com.google.auto.value:auto-value-annotations", version.ref = "auto-value" }
auto-service = { module = "com.google.auto.service:auto-service", version.ref = "auto-service" }
auto-service-annotations = { module = "com.google.auto.service:auto-service-annotations", version.ref = "auto-service" }
jakarta-inject = { module = "jakarta.inject:jakarta.inject-api", version.ref = "jakarta-inject" }
Expand Down
3 changes: 0 additions & 3 deletions library-model/library-model-generator/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,5 @@ plugins {
dependencies {
implementation libs.guava

compileOnly libs.auto.value.annotations
annotationProcessor libs.auto.value

testImplementation libs.junit4
}
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@
package com.uber.nullaway.libmodel;

import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;

/** A record describing the annotations associated with a java method and its arguments. */
@AutoValue
public abstract class MethodAnnotationsRecord {
public record MethodAnnotationsRecord(
ImmutableSet<String> methodAnnotations,
ImmutableSet<Integer> typeParamNullableUpperbounds,
ImmutableMap<Integer, ImmutableSet<String>> argumentAnnotations) {

public static MethodAnnotationsRecord create(
ImmutableSet<String> methodAnnotations,
ImmutableSet<Integer> typeParamNullableUpperbounds,
ImmutableMap<Integer, ImmutableSet<String>> argumentAnnotations) {
return new AutoValue_MethodAnnotationsRecord(
return new MethodAnnotationsRecord(
methodAnnotations, typeParamNullableUpperbounds, argumentAnnotations);
}

abstract ImmutableSet<String> methodAnnotations();

abstract ImmutableSet<Integer> typeParamNullableUpperbounds();

abstract ImmutableMap<Integer, ImmutableSet<String>> argumentAnnotations();
}
2 changes: 0 additions & 2 deletions nullaway/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ configurations {

dependencies {
compileOnly project(":annotations")
compileOnly libs.auto.value.annotations
annotationProcessor libs.auto.value
compileOnly libs.auto.service.annotations
annotationProcessor libs.auto.service
// Using api following the guidance at https://jspecify.dev/docs/using#gradle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

package com.uber.nullaway;

import com.google.auto.value.AutoValue;
import com.google.common.base.Joiner;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableSet;
Expand Down Expand Up @@ -613,11 +612,10 @@ public boolean warnOnGenericInferenceFailure() {
return warnOnInferenceFailure;
}

@AutoValue
abstract static class MethodClassAndName {
record MethodClassAndName(String enclosingClass, String methodName) {

static MethodClassAndName create(String enclosingClass, String methodName) {
return new AutoValue_ErrorProneCLIFlagsConfig_MethodClassAndName(enclosingClass, methodName);
return new MethodClassAndName(enclosingClass, methodName);
}

static MethodClassAndName fromClassDotMethod(String classDotMethod) {
Expand All @@ -626,9 +624,5 @@ static MethodClassAndName fromClassDotMethod(String classDotMethod) {
String className = classDotMethod.substring(0, lastDot);
return MethodClassAndName.create(className, methodName);
}

abstract String enclosingClass();

abstract String methodName();
}
}
10 changes: 2 additions & 8 deletions nullaway/src/main/java/com/uber/nullaway/LibraryModels.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

package com.uber.nullaway;

import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
Expand Down Expand Up @@ -325,15 +324,10 @@ public String toString() {
}

/** Representation of a field as a qualified class name + a field name */
@AutoValue
abstract class FieldRef {

public abstract String getEnclosingClassName();

public abstract String getFieldName();
record FieldRef(String enclosingClassName, String fieldName) {

public static FieldRef fieldRef(String enclosingClass, String fieldName) {
return new AutoValue_LibraryModels_FieldRef(enclosingClass, fieldName);
return new FieldRef(enclosingClass, fieldName);
}
}
}
90 changes: 43 additions & 47 deletions nullaway/src/main/java/com/uber/nullaway/NullAway.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import static java.lang.annotation.ElementType.TYPE_USE;

import com.google.auto.service.AutoService;
import com.google.auto.value.AutoValue;
import com.google.common.base.Verify;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMultimap;
Expand Down Expand Up @@ -2782,9 +2781,49 @@ public void setComputedNullness(ExpressionTree e, Nullness nullness) {
computedNullnessMap.put(e, nullness);
}

@AutoValue
abstract static class FieldInitEntities {
/**
* Aggregates all entities involved in field initialization for a class.
*
* <p>This record captures information needed to reason about initialization of {@code @NonNull}
* fields, including initializer blocks, constructors, and initializer methods, both
* instance-level and static.
*
* <p>The data is extracted from a class symbol and used during NullAway analysis to verify that
* all required fields are properly initialized.
*/
record FieldInitEntities(
Symbol.ClassSymbol classSymbol,
ImmutableSet<Symbol> nonnullInstanceFields,
ImmutableSet<Symbol> nonnullStaticFields,
ImmutableList<BlockTree> instanceInitializerBlocks,
ImmutableList<BlockTree> staticInitializerBlocks,
ImmutableSet<MethodTree> constructors,
ImmutableSet<MethodTree> instanceInitializerMethods,
ImmutableSet<MethodTree> staticInitializerMethods) {

/**
* Creates an immutable {@link FieldInitEntities} instance from mutable inputs.
*
* @param classSymbol symbol for class.
* @param nonnullInstanceFields <code>@NonNull</code> instance fields that are not directly
* initialized at declaration.
* @param nonnullStaticFields <code>@NonNull</code> static fields that are not directly
* initialized at declaration.
* @param instanceInitializerBlocks the list of instance initializer blocks (e.g. blocks of the
* form `class X { { //Code } } ), in the order in which they appear in the class.
* @param staticInitializerBlocks the list of static initializer blocks (e.g. blocks of the form
* `class X { static { //Code } } ), in the order in which they appear in the class.
* @param constructors constructors in the class.
* @param instanceInitializerMethods the list of non-static (instance) initializer methods. This
* includes methods annotated @Initializer, as well as those specified by
* -XepOpt:NullAway:KnownInitializers or annotated with annotations passed to
* -XepOpt:NullAway:CustomInitializerAnnotations.
* @param staticInitializerMethods the list of static initializer methods. This includes static
* methods annotated @Initializer, as well as those specified by
* -XepOpt:NullAway:KnownInitializers or annotated with annotations passed to
* -XepOpt:NullAway:CustomInitializerAnnotations.
* @return an immutable {@link FieldInitEntities} instance
*/
static FieldInitEntities create(
Symbol.ClassSymbol classSymbol,
Set<Symbol> nonnullInstanceFields,
Expand All @@ -2794,7 +2833,7 @@ static FieldInitEntities create(
Set<MethodTree> constructors,
Set<MethodTree> instanceInitializerMethods,
Set<MethodTree> staticInitializerMethods) {
return new AutoValue_NullAway_FieldInitEntities(
return new FieldInitEntities(
classSymbol,
ImmutableSet.copyOf(nonnullInstanceFields),
ImmutableSet.copyOf(nonnullStaticFields),
Expand All @@ -2804,48 +2843,5 @@ static FieldInitEntities create(
ImmutableSet.copyOf(instanceInitializerMethods),
ImmutableSet.copyOf(staticInitializerMethods));
}

/** Returns symbol for class. */
abstract Symbol.ClassSymbol classSymbol();

/**
* Returns <code>@NonNull</code> instance fields that are not directly initialized at
* declaration.
*/
abstract ImmutableSet<Symbol> nonnullInstanceFields();

/**
* Returns <code>@NonNull</code> static fields that are not directly initialized at declaration.
*/
abstract ImmutableSet<Symbol> nonnullStaticFields();

/**
* Returns the list of instance initializer blocks (e.g. blocks of the form `class X { { //Code
* } } ), in the order in which they appear in the class.
*/
abstract ImmutableList<BlockTree> instanceInitializerBlocks();

/**
* Returns the list of static initializer blocks (e.g. blocks of the form `class X { static {
* //Code } } ), in the order in which they appear in the class.
*/
abstract ImmutableList<BlockTree> staticInitializerBlocks();

/** Returns constructors in the class. */
abstract ImmutableSet<MethodTree> constructors();

/**
* Returns the list of non-static (instance) initializer methods. This includes methods
* annotated @Initializer, as well as those specified by -XepOpt:NullAway:KnownInitializers or
* annotated with annotations passed to -XepOpt:NullAway:CustomInitializerAnnotations.
*/
abstract ImmutableSet<MethodTree> instanceInitializerMethods();

/**
* Returns the list of static initializer methods. This includes static methods
* annotated @Initializer, as well as those specified by -XepOpt:NullAway:KnownInitializers or
* annotated with annotations passed to -XepOpt:NullAway:CustomInitializerAnnotations.
*/
abstract ImmutableSet<MethodTree> staticInitializerMethods();
}
}
Loading