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

Error compiling with JDK11 when a case class does not have its companion object #222

Open
julianmendez opened this issue Jan 21, 2020 · 0 comments

Comments

@julianmendez
Copy link

problem

If a case class does not have a companion object, the following error message appears:

 error: illegal combination of modifiers: abstract and static
[ERROR]   static public abstract  R apply ()  ;
[ERROR]                             ^

In JDK 8 using abstract and static is considered a warning. In JDK 11 this is an error.

expectation

A case class can be used without needing a companion object.

reproduction

To reproduce this issue, it is enough to create a file containing:

case class MyCaseClass() {}

However, the following does not have any problems:

case class MyCaseClass() {}

object MyCaseClass {}

In the generated Java code, one can see the difference. In the first case we see:

public  class MyCaseClass implements scala.Product, java.io.Serializable {
  static public abstract  R apply ()  ;
  static public  java.lang.String toString ()  { throw new RuntimeException(); }
  public   MyCaseClass ()  { throw new RuntimeException(); }
}

In the second case we see:

public  class MyCaseClass implements scala.Product, java.io.Serializable {
  public   MyCaseClass ()  { throw new RuntimeException(); }
}

configuration

This was compiled with:

  • genjavadoc 0.15
  • org.scala-tools.maven-scala-plugin 2.15.2
  • net.alchim31.maven.scala-maven-plugin 4.3.0
  • org.apache.maven.plugins.maven-javadoc-plugin 3.1.1
  • org.apache.maven.plugins.maven-compiler-plugin 3.8.1
  • Apache Maven 3.6.0
  • Java 11.0.5
  • Scala 2.13.1

related issues

These issues could be related:
#181
#154

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

No branches or pull requests

1 participant