Skip to content

Roaster backend drops or corrupts type-use annotations on field and return types #433

Closed

Description

@igel-devin-ai

Found while tightening the conformance asserts in #430 (#420).

The Roaster backend loses type-use annotations in three positions:

Position Input Generated
Field type @Nullable String String (annotation dropped)
Method return type @Nullable String String (annotation dropped)
Return type with an annotated generic argument List<@Nullable String> void

Cause (Roaster 2.31.1.Final):

  • FieldImpl.setType → TypeImpl.fromString copies only FieldDeclaration.getType(). JDT parses the leading annotation into the declaration's modifiers, so it's lost.
  • MethodImpl.setReturnType → getReturnType2() has the same problem.
  • Types.splitGenerics strips all whitespace, so @Nullable String becomes @NullableString and the return type can't be parsed.

RoasterMapper itself renders the annotation correctly. Method/constructor parameters and generic arguments in fields/parameters are preserved.

Impact today: ordinary builder output isn't affected, because builder fields wrap the type in TrackedValue<…> and setter parameters keep the annotation (verified with jspecify @Nullable). Any generator emitting an annotated field type or return type directly is affected.

Related original implementations: type-use support in #111, Roaster migration in #139.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions