Skip to content

A method is not a member of a class even though it is (and can be seen using javap) #13957

@matviichukv

Description

@matviichukv

Compiler version

3.1.0

Minimized code

import org.graalvm.graphio._
@main def foo(): Unit = GraphOutput.newBuilder(null).attr("a", "b")

Output

[error] 3 |@main def foo(): Unit = GraphOutput.newBuilder(null).attr("a", "b")
[error]   |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error]   |value attr is not a member of org.graalvm.graphio.GraphOutput#Builder[G, N, ?1.CAP] - did you mean org.graalvm.graphio.GraphOutput#Builder[G, N, ?1.CAP].wait?
[error]   |
[error]   |where:    ?1 is an unknown value of type scala.runtime.TypeBox[Nothing, Object]
[error]   |          G  is a type variable with constraint <: Object
[error]   |          N  is a type variable with constraint <: Object

Expectation

It should compile without any errors.

I've made a small repo to easily reproduce this error: https://github.com/matviichukv/scalac_bug . Main.scala fails with this error, while Main.java compiles just fine. Same happens with .embedded method, but all others are fine. attr method is not shown for completion in sbt shell. Invoking it using the java.reflect things calls the method just fine.

Here's the output of javap on the GraphOutput.java from graalvm@21.2.0

Compiled from "GraphOutput.java"
public final class org.graalvm.graphio.GraphOutput$Builder<G, N, M> {
  static final boolean $assertionsDisabled;
  org.graalvm.graphio.GraphOutput$Builder(org.graalvm.graphio.GraphStructure<G, N, ?, ?>);
  public org.graalvm.graphio.GraphOutput$Builder<G, N, M> protocolVersion(int, int);
  public org.graalvm.graphio.GraphOutput$Builder<G, N, M> embedded(boolean);
  public org.graalvm.graphio.GraphOutput$Builder<G, N, M> types(org.graalvm.graphio.GraphTypes);
  public org.graalvm.graphio.GraphOutput$Builder<G, N, M> blocks(org.graalvm.graphio.GraphBlocks<G, ?, N>);
  public <E, P> org.graalvm.graphio.GraphOutput$Builder<G, N, E> elements(org.graalvm.graphio.GraphElements<E, ?, ?, P>);
  public <E, P> org.graalvm.graphio.GraphOutput$Builder<G, N, E> elementsAndLocations(org.graalvm.graphio.GraphElements<E, ?, ?, P>, org.graalvm.graphio.GraphLocations<E, P, ?>);
  public org.graalvm.graphio.GraphOutput$Builder<G, N, M> attr(java.lang.String, java.lang.Object);
  public org.graalvm.graphio.GraphOutput<G, M> build(java.nio.channels.WritableByteChannel) throws java.io.IOException;
  public org.graalvm.graphio.GraphOutput<G, M> build(org.graalvm.graphio.GraphOutput<?, ?>);
  static {};
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions