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

Scalasig and bytecode differences in 2.12.8 when compiling final objects #467

Open
wiwa opened this issue Jul 30, 2019 · 0 comments
Open
Labels

Comments

@wiwa
Copy link
Contributor

wiwa commented Jul 30, 2019

A.scala:

final object A
   name: "A"
   source: "A.scala"
   symbols {
     tag: MODULEsym
     id: <empty>.#A.
-    flags: FINAL | MODULE
+    flags: MODULE
     info {
       tag: TYPEREFtpe
       pre {
         tag: THIStpe
         sym: <empty>.#
@@ -15,11 +15,11 @@
     }
   }
   symbols {
     tag: CLASSsym
     id: <empty>.#A.#
-    flags: FINAL | MODULE
+    flags: MODULE
     info {
       tag: CLASSINFOtpe
       sym: <empty>.#A.#
       parents {
         tag: TYPEREFtpe

Bytecode differences will happen when this final object is in another object, regardless of the outer object's finality. There may be other cases too...

X.scala:

object X {
  final object A
}

Y.scala:

class Y {
  def foo = X.A
}
diff --git a/Y.class.asm b/Y.class.asm
index 87af470..7210c82 100644
--- a/Y.class.asm
+++ b/Y.class.asm
@@ -2,8 +2,8 @@
 // access flags 0x21
 public class Y {
 
-  // access flags 0x19
-  public final static INNERCLASS X$A$ X A$
+  // access flags 0x9
+  public static INNERCLASS X$A$ X A$
 
   // access flags 0x1
   public <init>()V
@wiwa wiwa added the Scalasig label Jul 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

1 participant