Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation failure in checker-framework code since update to 3.43.0 #6664

Closed
pSub opened this issue Jun 9, 2024 · 5 comments · Fixed by #6692
Closed

Compilation failure in checker-framework code since update to 3.43.0 #6664

pSub opened this issue Jun 9, 2024 · 5 comments · Fixed by #6692
Assignees
Labels

Comments

@pSub
Copy link
Contributor

pSub commented Jun 9, 2024

While trying to update from 3.42.0 to 3.43 my build breaks with a strage compilation error "in" the checker-framework code (link to Github Action build).

[ERROR] error: Error in AnnotatedTypeMirror.fromExpression(RegexAnnotatedTypeFactory, either.map(Arrays::asList)): Enclosing type not found: type: Object supertype: Either<A extends Object, B extends Object>

I cloudn't really figure out where the method fromExpression in the class AnnotatedTypeMirror is. However, at lease the class AnnotatedTypeMirror is from the source of the checkerframework.

I can try to create a minimal example that reproduces that error, if needed.

@mernst
Copy link
Member

mernst commented Jun 10, 2024

Thanks for getting in touch, and I'm sorry you are having trouble.

First, could you please try 3.44.0? We fixed quite a number of obscure crashes, and it is possible that 3.44.0 does not crash for you.

If 3.44.0 still crashes for you, then we would appreciate a minimal example that crashes, so that we can fix it.

@pSub
Copy link
Contributor Author

pSub commented Jun 10, 2024

The error occurs with 3.44.0 as well, but the message is less specific:

error: Enclosing type not found: type: Object supertype: Either<A extends Object, B extends Object>

I will try to create a minimal example.

@pSub
Copy link
Contributor Author

pSub commented Jun 11, 2024

I think I have a small example that reproduces the error (Java Code and Repository). I am using derive4j in this example and I am not sure whether this is a problem with the interaction between derive4j and checker-framework. Currently, I am unsure how to reproduce the error without derive4j.

@agentgt
Copy link

agentgt commented Jun 11, 2024

FWIW I'm having similar errors across my projects as the one

I think I saw a different error in another project that I will add later.

It seems the culprit is the new type argument inference and I cannot figure out a way to suppress so we are stuck on 3.42.0.

@smillst
Copy link
Member

smillst commented Jun 20, 2024

I think I have a small example that reproduces the error (Java Code and Repository). I am using derive4j in this example and I am not sure whether this is a problem with the interaction between derive4j and checker-framework. Currently, I am unsure how to reproduce the error without derive4j.

Thanks! I've reduced this test case further:

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Collector;
import java.util.stream.Collectors;

public abstract class Issue6664<A, B> {

  public static <A, B> Collector<Issue6664<A, B>, ?, Issue6664<A, List<B>>> breakIt() {
    return Collectors.reducing(Eithers.right(new ArrayList<>()),
        either -> either.map(Arrays::asList), (either, eithers) -> either);
  }
  
  public <C> Issue6664<A, C> map(Function<B, C> function) {
    throw new RuntimeException();
  }

  public static final class Eithers {
    public static <A, B> Issue6664<A, B> left(A left) {throw new RuntimeException();}
    public static <A, B> Issue6664<A, B> right(B right) {throw new RuntimeException(); }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants