Unable to use scala's repl :javap to look at trait companion object -


I am using: scal repl in javap was trying to see commands and properties, but i Do not know how to find out what I do with the command line here.

  $ cat> Foo.scala & lt; & Lt; EOF attribute Foo {def foo: string def echo = println (foo)} EOF $ scalac Foo.scala $ javap Foo.class "Foo.scala" Public intangible class Foo $ class {Zero Echo (Foo) compiled from public static; Public fixed zero $ init $ (Foo); } $ Javap Foo \ $ class.class "Foo.scala" public intangible class Foo $ class {compiled from public static zero echo (Foo); Public fixed zero $ init $ (Foo); }  

I try the same in copy and get the following (since foo will be compiled using bar, hence repl raises on it)

  Scala> Feature bar {| Def Bar: string | Def echo = println (bar) | } Defined attribute bar Scale & gt; : Javap Bar "& lt; Console"; Compiled public interface bar {public essence java.lang.String bar (); Public essence zero zero (); } Scala & gt; : Javap Bar $ class failed: Class bytes could not be found for 'bar $ square'.  

The Scale version of the replica

  $ scala -version scala code runner version 2.10.2 - Copyright 2002-2013, LAMP / EPFL  < / Pre> 

Running on a Mac

EDIT: Just downloaded 2.11 scale and ran again there. It seems that: Jwap is capable of receiving the class, but it operates: Instead of Jawap-V: Jawap Javap -p makes this output like 2.10

module you are not asking about partner , But about the properties implementation class.

Not finding a class byte was a bug in 2.10, fixed in 2.11.

If you have a companion object, the encoded name, such as bar $ .

  Scala> : Pa // Enter the Paste Mode (to eliminate the ctrl-D) attribute bar {def bar: int} Object bar {def apply} = New bar {def bar = 8}} // Exit Paste Mode Get out, interpret now. Defined attribute bar defined object bar scale & gt; : Javap -prv Bar $ binary file bar is $ $ $ line3 $ $ $ $ iw $ $ iw $ bar $ size 701 bytes MD5 checksum a46d3c3cb62cb5ed3521a697023e82dd " public class $ line3. $ $ $ $ $ $ $ $ $ $ Iw $ Bar $ [snip]  

For your insula class example, I think you are asking for:

  Scala> : Javap-public x.Foo $ class "x.scala" compiled from public intangible class x.Foo $ class {public static void echo (x.Foo); public static zero $ init $ (x.Foo);}  

Note:

  Scala>: Javap -help Usage: javap [opts] [path or category or -] - Help print this help message - Do not dismiss RPL names - Show input body delayed applications - -Soon or class # Meth-wordbo / -ve stack size, number of locals, method arg-private / - P. Private classes and member-package packages- Private classes and members -Safe protected sections and members-public public classes and member-line and local variables Table-D Dismissed D -S Internal Type Signature -Synix System - System Information of Problems Fixed Last Constants  

and

  val DefaultOptions = List (" 

The help menu can say more about using the word bar instead of the word; There may be an upcoming - dome which shows different uses.

I was going to joke about this using the Reflection API - : javap TermName ("Bar"). - But maybe this is not a joke.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -