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

transient var in trait compiles but does not generate #10147

Closed
scabug opened this issue Jan 13, 2017 · 3 comments
Closed

transient var in trait compiles but does not generate #10147

scabug opened this issue Jan 13, 2017 · 3 comments

Comments

@scabug
Copy link

scabug commented Jan 13, 2017

Adding @transient to the start of line on code highlighted here results in a .class that generates the following output from javap:

BTopping-MPro:akka-http btopping$ javap akka-http-core/target/scala-2.11/classes/akka/http/scaladsl/model/HttpMethods$.class
Compiled from "HttpMethod.scala"
public final class akka.http.scaladsl.model.HttpMethods$ implements akka.http.impl.util.ObjectRegistry<java.lang.String, akka.http.scaladsl.model.HttpMethod> {
  public static final akka.http.scaladsl.model.HttpMethods$ MODULE$;
  public static {};
  *public scala.collection.immutable.Map akka$http$impl$util$ObjectRegistry$$_registry();*
  public void akka$http$impl$util$ObjectRegistry$$_registry_$eq(scala.collection.immutable.Map);
  public final java.lang.Object register(java.lang.Object, java.lang.Object);
  public scala.Option getForKey(java.lang.Object);
  public scala.Option<akka.http.scaladsl.model.HttpMethod> getForKeyCaseInsensitive(java.lang.String, scala.Predef$$less$colon$less<java.lang.String, java.lang.String>);
  public akka.http.scaladsl.model.HttpMethod CONNECT();
  public akka.http.scaladsl.model.HttpMethod DELETE();
  public akka.http.scaladsl.model.HttpMethod GET();
  public akka.http.scaladsl.model.HttpMethod HEAD();
  public akka.http.scaladsl.model.HttpMethod OPTIONS();
  public akka.http.scaladsl.model.HttpMethod PATCH();
  public akka.http.scaladsl.model.HttpMethod POST();
  public akka.http.scaladsl.model.HttpMethod PUT();
  public akka.http.scaladsl.model.HttpMethod TRACE();
}

The line in bold should have the transient modifier.

Please let me know if there's anything I can provide!

@scabug
Copy link
Author

scabug commented Jan 13, 2017

Imported From: https://issues.scala-lang.org/browse/SI-10147?orig=1
Reporter: Brian Topping (briantopping)
Affected Versions: 2.11.8

@scabug
Copy link
Author

scabug commented Jan 13, 2017

@adriaanm said:
This is not a bug. The transient field is there, but you need to use javap -p to see it:

trait ObjectRegistry { @transient private[this] var _registry = "hi!" } 
class OR extends ObjectRegistry
$  javap -p OR
public class OR implements ObjectRegistry {
  private transient java.lang.String ObjectRegistry$$_registry;
  public java.lang.String ObjectRegistry$$_registry();
  public void ObjectRegistry$$_registry_$eq(java.lang.String);
  public OR();
}

@scabug scabug closed this as completed Jan 13, 2017
@scabug
Copy link
Author

scabug commented Jan 13, 2017

Brian Topping (briantopping) said:
Indeed, thanks!

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