Skip to content

NPE crash on auto-annotator v1.3.6 in the presence of Lombok generated constructor #185

Open
@lazaroclapp

Description

I am getting an auto-annotator error due to Lombok.

In code like:

  @AllArgsConstructor
  @EqualsAndHashCode
  public static class Foo {

    private final String a;
    private final String b;
    private final String c;

    public Foo(String a, String b) {
      this.a = a;
      this.b = b;
      this.c = null;
    }

    public Foo(String c) {
      this.a = null;
      this.b = null;
      this.c = c;
    }
  }

I get the following NPE crash:

Exception in thread "main" java.lang.NullPointerException
        at edu.ucr.cs.riple.core.cache.downstream.DownstreamImpactEvaluator.lambda$collectGraphResults$1(DownstreamImpactEvaluator.java:97)
        at java.base/java.lang.Iterable.forEach(Iterable.java:75)
        at edu.ucr.cs.riple.core.cache.downstream.DownstreamImpactEvaluator.lambda$collectGraphResults$2(DownstreamImpactEvaluator.java:88)
        at edu.ucr.cs.riple.injector.location.OnMethod.ifMethod(OnMethod.java:96)
        at edu.ucr.cs.riple.core.metadata.index.Fix.ifOnMethod(Fix.java:99)
        at edu.ucr.cs.riple.core.cache.downstream.DownstreamImpactEvaluator.lambda$collectGraphResults$3(DownstreamImpactEvaluator.java:70)
        at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)
        at com.google.common.collect.CollectSpliterators$FlatMapSpliterator.lambda$forEachRemaining$1(CollectSpliterators.java:377)
        at java.base/java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1693)
        at com.google.common.collect.CollectSpliterators$FlatMapSpliterator.forEachRemaining(CollectSpliterators.java:373)
        at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:658)
        at edu.ucr.cs.riple.core.cache.downstream.DownstreamImpactEvaluator.collectGraphResults(DownstreamImpactEvaluator.java:68)
        at edu.ucr.cs.riple.core.evaluators.AbstractEvaluator.evaluate(AbstractEvaluator.java:96)
        at edu.ucr.cs.riple.core.cache.downstream.DownstreamImpactCacheImpl.analyzeDownstreamDependencies(DownstreamImpactCacheImpl.java:114)
        at edu.ucr.cs.riple.core.Annotator.annotate(Annotator.java:134)
        at edu.ucr.cs.riple.core.Annotator.start(Annotator.java:84)
        at edu.ucr.cs.riple.core.Main.main(Main.java:46)

Which some debugging prints trace to the three argument constructor automatically injected by the lombok @AllArgsConstructor annotation (i.e. Foo(String, String, String) which isn't present in the source code, but which lombok generates). I thought we had handling in place for methods being missing from the source?

Metadata

Labels

bugSomething isn't workinglow priorityLow priority task

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions