typetools / typetools/checker-framework

documentaton enhancement for stubs and generics

Open
#4,587 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.1k
Forks
440
Avg merge
1d 12h
Merged PRs (30d)
134

Description

this is a question but I feel like the documentation could be improved

  @SuppressWarnings("unchecked")
  Map<String, @Nullable Object> getContext( Map<String, String> context ) {
    var map = new HashMap<String, @Nullable Object>();
    map.putAll( context );
    map.putAll( mapper.convertValue( cliConfiguration, Map.class ) );
    map.put( "configDir", configDir.getParent() );
    return Collections.unmodifiableMap( map );
  }

  ProcessedFileConfiguration from( RawFileConfiguration config ) {
    var context = this.getContext( config.getContext() );
    var bldr = ImmutableProcessedFileConfiguration.builder();
    bldr.overwrite( config.getOverwrite() );
    bldr.context( context );

    config.getSource().ifPresent( src -> {
      bldr.source( Path.of( this.processTemplate( src, context ) ) );
    } );
    return bldr.build();
  }

is giving the errors

/home/xeno/IdeaProjects/brix/config-loader/spi/src/main/java/com/xenoterracide/brix/configloader/spi/ConfigValueProcessor.java:61: error: [assignment.type.incompatible] incompatible types in assignment.
    var context = this.getContext( config.getContext() );
                                 ^
  found   : @Initialized @NonNull Map<@Initialized @NonNull String, @Initialized @Nullable Object>
  required: @UnknownInitialization @Nullable Map<@Initialized @NonNull String, @Initialized @NonNull Object>
/home/xeno/IdeaProjects/brix/config-loader/spi/src/main/java/com/xenoterracide/brix/configloader/spi/ConfigValueProcessor.java:74: error: [assignment.type.incompatible] incompatible types in assignment.
    var map = new HashMap<String, @Nullable Object>();
              ^
  found   : @Initialized @NonNull HashMap<@Initialized @NonNull String, @Initialized @Nullable Object>
  required: @UnknownInitialization @Nullable HashMap<@Initialized @NonNull String, @Initialized @NonNull Object>
/home/xeno/IdeaProjects/brix/config-loader/spi/src/main/java/com/xenoterracide/brix/configloader/spi/ConfigValueProcessor.java:77: error: [argument.type.incompatible] incompatible argument for parameter value of put.
    map.put( "configDir", configDir.getParent() );
                                             ^
  found   : @Initialized @Nullable Path
  required: @Initialized @NonNull Object
3 errors

I've referred to https://github.com/typetools/checker-framework/issues/4070#issuecomment-751540533 but still haven't had any luck with this. I had compilation working with PolyNull but

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the question and its referenced Checker Framework issue 4070, then inspect ConfigValueProcessor.java at the reported lines. Determine which guidance about stubs, generics, and nullness annotations is missing or misleading. Done means a clearly scoped documentation improvement addresses the reported errors and explains the relevant constraints.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.