FAQ

[scala-language] Scala reflection spamming to System.out at runtime (2.10.0 release)

Aleksey Nikiforov
Jan 22, 2013 at 4:40 pm
Getting spammed by these messages in System.out:

...
[] ?_$3 setInst org.mypackage.MyClass
[] ?_$3 setInst org.mypackage.MyClass
[] ?_$3 setInst org.mypackage.MyClass
[] ?_$3 setInst org.mypackage.MyClass
...

Stack trace from System.out reveals:

...
at scala.Console$.println(Console.scala:240)
at scala.Predef$.println(Predef.scala:287)
at scala.reflect.runtime.JavaUniverse.log(JavaUniverse.scala:20)
at scala.reflect.internal.Types$class.solveOne$1(Types.scala:6377)
at scala.reflect.internal.Types$$anonfun$solve$1.apply(Types.scala:6384)
at scala.reflect.internal.Types$$anonfun$solve$1.apply(Types.scala:6384)
at
scala.reflect.internal.util.Collections$class.foreach3(Collections.scala:160)
at scala.reflect.internal.SymbolTable.foreach3(SymbolTable.scala:12)
at scala.reflect.internal.Types$class.solve(Types.scala:6384)
at scala.reflect.internal.SymbolTable.solve(SymbolTable.scala:12)
at
scala.reflect.internal.Types$ExistentialType.withTypeVars(Types.scala:2805)
at scala.reflect.internal.Types$class.thirdTry$1(Types.scala:6030)
at scala.reflect.internal.Types$class.secondTry$1(Types.scala:5989)
at scala.reflect.internal.Types$class.firstTry$1(Types.scala:5965)
at scala.reflect.internal.Types$class.isSubType2(Types.scala:6108)
at scala.reflect.internal.Types$class.isSubType(Types.scala:5717)
at
scala.reflect.runtime.JavaUniverse.scala$reflect$runtime$SynchronizedTypes$$super$isSubType(JavaUniverse.scala:12)
at
scala.reflect.runtime.SynchronizedTypes$class.isSubType(SynchronizedTypes.scala:60)
at scala.reflect.runtime.JavaUniverse.isSubType(JavaUniverse.scala:12)
at scala.reflect.internal.Types$Type.$less$colon$less(Types.scala:837)
at scala.reflect.internal.Types$Type.$less$colon$less(Types.scala:328)
...

Looks like the following line was left uncommented:

scala.reflect.internal.Types$class.solveOne$1(Types.scala:6377):
log(s"$tvar setInst $newInst")

Should this be filed as a tickets? Was not sure, just leaving it here.
reply

Search Discussions

5 responses

  • Eugene Burmako at Jan 22, 2013 at 4:45 pm
    Sorry I've overlooked this one. It's fixed in 2.10.1.

    On 22 Jan 2013, at 17:40, Aleksey Nikiforov wrote:

    Getting spammed by these messages in System.out:

    ...
    [] ?_$3 setInst org.mypackage.MyClass
    [] ?_$3 setInst org.mypackage.MyClass
    [] ?_$3 setInst org.mypackage.MyClass
    [] ?_$3 setInst org.mypackage.MyClass
    ...

    Stack trace from System.out reveals:

    ...
    at scala.Console$.println(Console.scala:240)
    at scala.Predef$.println(Predef.scala:287)
    at scala.reflect.runtime.JavaUniverse.log(JavaUniverse.scala:20)
    at scala.reflect.internal.Types$class.solveOne$1(Types.scala:6377)
    at scala.reflect.internal.Types$$anonfun$solve$1.apply(Types.scala:6384)
    at scala.reflect.internal.Types$$anonfun$solve$1.apply(Types.scala:6384)
    at
    scala.reflect.internal.util.Collections$class.foreach3(Collections.scala:160)
    at scala.reflect.internal.SymbolTable.foreach3(SymbolTable.scala:12)
    at scala.reflect.internal.Types$class.solve(Types.scala:6384)
    at scala.reflect.internal.SymbolTable.solve(SymbolTable.scala:12)
    at
    scala.reflect.internal.Types$ExistentialType.withTypeVars(Types.scala:2805)
    at scala.reflect.internal.Types$class.thirdTry$1(Types.scala:6030)
    at scala.reflect.internal.Types$class.secondTry$1(Types.scala:5989)
    at scala.reflect.internal.Types$class.firstTry$1(Types.scala:5965)
    at scala.reflect.internal.Types$class.isSubType2(Types.scala:6108)
    at scala.reflect.internal.Types$class.isSubType(Types.scala:5717)
    at
    scala.reflect.runtime.JavaUniverse.scala$reflect$runtime$SynchronizedTypes$$super$isSubType(JavaUniverse.scala:12)
    at
    scala.reflect.runtime.SynchronizedTypes$class.isSubType(SynchronizedTypes.scala:60)
    at scala.reflect.runtime.JavaUniverse.isSubType(JavaUniverse.scala:12)
    at scala.reflect.internal.Types$Type.$less$colon$less(Types.scala:837)
    at scala.reflect.internal.Types$Type.$less$colon$less(Types.scala:328)
    ...

    Looks like the following line was left uncommented:

    scala.reflect.internal.Types$class.solveOne$1(Types.scala:6377):
    log(s"$tvar setInst $newInst")

    Should this be filed as a tickets? Was not sure, just leaving it here.
  • Alexandre Curreli at Mar 20, 2013 at 1:47 pm
    Hello,

    So I just downloaded scala-library 2.10.1 and checked the source file.

    The log(s"$tvar setInst $newInst") is still there so the library is still
    spamming in 2.10.1.
    On Tuesday, January 22, 2013 4:45:57 PM UTC, Eugene Burmako wrote:

    Sorry I've overlooked this one. It's fixed in 2.10.1.

    On 22 Jan 2013, at 17:40, Aleksey Nikiforov wrote:

    Getting spammed by these messages in System.out:

    ...
    [] ?_$3 setInst org.mypackage.MyClass
    [] ?_$3 setInst org.mypackage.MyClass
    [] ?_$3 setInst org.mypackage.MyClass
    [] ?_$3 setInst org.mypackage.MyClass
    ...

    Stack trace from System.out reveals:

    ...
    at scala.Console$.println(Console.scala:240)
    at scala.Predef$.println(Predef.scala:287)
    at scala.reflect.runtime.JavaUniverse.log(JavaUniverse.scala:20)
    at scala.reflect.internal.Types$class.solveOne$1(Types.scala:6377)
    at
    scala.reflect.internal.Types$$anonfun$solve$1.apply(Types.scala:6384)
    at
    scala.reflect.internal.Types$$anonfun$solve$1.apply(Types.scala:6384)
    at
    scala.reflect.internal.util.Collections$class.foreach3(Collections.scala:160)
    at scala.reflect.internal.SymbolTable.foreach3(SymbolTable.scala:12)
    at scala.reflect.internal.Types$class.solve(Types.scala:6384)
    at scala.reflect.internal.SymbolTable.solve(SymbolTable.scala:12)
    at
    scala.reflect.internal.Types$ExistentialType.withTypeVars(Types.scala:2805)
    at scala.reflect.internal.Types$class.thirdTry$1(Types.scala:6030)
    at scala.reflect.internal.Types$class.secondTry$1(Types.scala:5989)
    at scala.reflect.internal.Types$class.firstTry$1(Types.scala:5965)
    at scala.reflect.internal.Types$class.isSubType2(Types.scala:6108)
    at scala.reflect.internal.Types$class.isSubType(Types.scala:5717)
    at
    scala.reflect.runtime.JavaUniverse.scala$reflect$runtime$SynchronizedTypes$$super$isSubType(JavaUniverse.scala:12)
    at
    scala.reflect.runtime.SynchronizedTypes$class.isSubType(SynchronizedTypes.scala:60)
    at scala.reflect.runtime.JavaUniverse.isSubType(JavaUniverse.scala:12)
    at scala.reflect.internal.Types$Type.$less$colon$less(Types.scala:837)
    at scala.reflect.internal.Types$Type.$less$colon$less(Types.scala:328)
    ...

    Looks like the following line was left uncommented:

    scala.reflect.internal.Types$class.solveOne$1(Types.scala:6377):
    log(s"$tvar setInst $newInst")

    Should this be filed as a tickets? Was not sure, just leaving it here.
    --
    You received this message because you are subscribed to the Google Groups "scala-language" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to scala-language+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Eugene Burmako at Mar 20, 2013 at 1:51 pm
    Yeah unfortunately the PR that fixed this issue along with other didn't
    make it into 2.10.1 :(


    On 20 March 2013 14:47, Alexandre Curreli
    wrote:
    Hello,

    So I just downloaded scala-library 2.10.1 and checked the source file.

    The log(s"$tvar setInst $newInst") is still there so the library is still
    spamming in 2.10.1.
    On Tuesday, January 22, 2013 4:45:57 PM UTC, Eugene Burmako wrote:

    Sorry I've overlooked this one. It's fixed in 2.10.1.

    On 22 Jan 2013, at 17:40, Aleksey Nikiforov wrote:

    Getting spammed by these messages in System.out:

    ...
    [] ?_$3 setInst org.mypackage.MyClass
    [] ?_$3 setInst org.mypackage.MyClass
    [] ?_$3 setInst org.mypackage.MyClass
    [] ?_$3 setInst org.mypackage.MyClass
    ...

    Stack trace from System.out reveals:

    ...
    at scala.Console$.println(**Console.scala:240)
    at scala.Predef$.println(Predef.**scala:287)
    at scala.reflect.runtime.**JavaUniverse.log(JavaUniverse.**scala:20)
    at scala.reflect.internal.Types$**class.solveOne$1(Types.scala:**
    6377)
    at scala.reflect.internal.Types$$**anonfun$solve$1.apply(Types.**
    scala:6384)
    at scala.reflect.internal.Types$$**anonfun$solve$1.apply(Types.**
    scala:6384)
    at scala.reflect.internal.util.**Collections$class.foreach3(**
    Collections.scala:160)
    at scala.reflect.internal.**SymbolTable.foreach3(**
    SymbolTable.scala:12)
    at scala.reflect.internal.Types$**class.solve(Types.scala:6384)
    at scala.reflect.internal.**SymbolTable.solve(SymbolTable.**scala:12)
    at scala.reflect.internal.Types$**ExistentialType.withTypeVars(**
    Types.scala:2805)
    at scala.reflect.internal.Types$**class.thirdTry$1(Types.scala:**
    6030)
    at scala.reflect.internal.Types$**class.secondTry$1(Types.scala:**
    5989)
    at scala.reflect.internal.Types$**class.firstTry$1(Types.scala:**
    5965)
    at scala.reflect.internal.Types$**class.isSubType2(Types.scala:**
    6108)
    at scala.reflect.internal.Types$**class.isSubType(Types.scala:**5717)
    at scala.reflect.runtime.**JavaUniverse.scala$reflect$**
    runtime$SynchronizedTypes$$**super$isSubType(JavaUniverse.**scala:12)
    at scala.reflect.runtime.**SynchronizedTypes$class.**
    isSubType(SynchronizedTypes.**scala:60)
    at scala.reflect.runtime.**JavaUniverse.isSubType(**
    JavaUniverse.scala:12)
    at scala.reflect.internal.Types$**Type.$less$colon$less(Types.**
    scala:837)
    at scala.reflect.internal.Types$**Type.$less$colon$less(Types.**
    scala:328)
    ...

    Looks like the following line was left uncommented:

    scala.reflect.internal.Types$**class.solveOne$1(Types.scala:**6377):
    log(s"$tvar setInst $newInst")

    Should this be filed as a tickets? Was not sure, just leaving it here.

    --
    You received this message because you are subscribed to the Google Groups
    "scala-language" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to scala-language+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

    --
    You received this message because you are subscribed to the Google Groups "scala-language" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to scala-language+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Alexandre Curreli at Mar 20, 2013 at 1:53 pm
    Is there a way we can easily disable those logs?
    On Wednesday, March 20, 2013 1:50:57 PM UTC, Eugene Burmako wrote:

    Yeah unfortunately the PR that fixed this issue along with other didn't
    make it into 2.10.1 :(


    On 20 March 2013 14:47, Alexandre Curreli <alexandr...@livestream.com<javascript:>
    wrote:
    Hello,

    So I just downloaded scala-library 2.10.1 and checked the source file.

    The log(s"$tvar setInst $newInst") is still there so the library is still
    spamming in 2.10.1.
    On Tuesday, January 22, 2013 4:45:57 PM UTC, Eugene Burmako wrote:

    Sorry I've overlooked this one. It's fixed in 2.10.1.

    On 22 Jan 2013, at 17:40, Aleksey Nikiforov wrote:

    Getting spammed by these messages in System.out:

    ...
    [] ?_$3 setInst org.mypackage.MyClass
    [] ?_$3 setInst org.mypackage.MyClass
    [] ?_$3 setInst org.mypackage.MyClass
    [] ?_$3 setInst org.mypackage.MyClass
    ...

    Stack trace from System.out reveals:

    ...
    at scala.Console$.println(**Console.scala:240)
    at scala.Predef$.println(Predef.**scala:287)
    at scala.reflect.runtime.**JavaUniverse.log(JavaUniverse.**scala:20)
    at scala.reflect.internal.Types$**class.solveOne$1(Types.scala:**
    6377)
    at scala.reflect.internal.Types$$**anonfun$solve$1.apply(Types.**
    scala:6384)
    at scala.reflect.internal.Types$$**anonfun$solve$1.apply(Types.**
    scala:6384)
    at scala.reflect.internal.util.**Collections$class.foreach3(**
    Collections.scala:160)
    at scala.reflect.internal.**SymbolTable.foreach3(**
    SymbolTable.scala:12)
    at scala.reflect.internal.Types$**class.solve(Types.scala:6384)
    at scala.reflect.internal.**SymbolTable.solve(SymbolTable.**
    scala:12)
    at scala.reflect.internal.Types$**ExistentialType.withTypeVars(**
    Types.scala:2805)
    at scala.reflect.internal.Types$**class.thirdTry$1(Types.scala:**
    6030)
    at scala.reflect.internal.Types$**class.secondTry$1(Types.scala:**
    5989)
    at scala.reflect.internal.Types$**class.firstTry$1(Types.scala:**
    5965)
    at scala.reflect.internal.Types$**class.isSubType2(Types.scala:**
    6108)
    at scala.reflect.internal.Types$**class.isSubType(Types.scala:**
    5717)
    at scala.reflect.runtime.**JavaUniverse.scala$reflect$**
    runtime$SynchronizedTypes$$**super$isSubType(JavaUniverse.**scala:12)
    at scala.reflect.runtime.**SynchronizedTypes$class.**
    isSubType(SynchronizedTypes.**scala:60)
    at scala.reflect.runtime.**JavaUniverse.isSubType(**
    JavaUniverse.scala:12)
    at scala.reflect.internal.Types$**Type.$less$colon$less(Types.**
    scala:837)
    at scala.reflect.internal.Types$**Type.$less$colon$less(Types.**
    scala:328)
    ...

    Looks like the following line was left uncommented:

    scala.reflect.internal.Types$**class.solveOne$1(Types.scala:**6377):
    log(s"$tvar setInst $newInst")

    Should this be filed as a tickets? Was not sure, just leaving it here.

    --
    You received this message because you are subscribed to the Google Groups
    "scala-language" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to scala-languag...@googlegroups.com <javascript:>.
    For more options, visit https://groups.google.com/groups/opt_out.

    --
    You received this message because you are subscribed to the Google Groups "scala-language" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to scala-language+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Eugene Burmako at Mar 20, 2013 at 3:32 pm
    Here's the offending method:

    def log(msg: => AnyRef): Unit = println(" [] "+msg)

    https://github.com/scalamacros/kepler/blob/bbd69f5dd1d5b7eb6a90aa7d59df9c491d112d4d/src/reflect/scala/reflect/runtime/JavaUniverse.scala#L20

    I don't think you can do anything with the logic there short of silencing
    the entire stdout or attaching a filter to stdout and weeding out
    everything, which starts from " [] " (with an obvious risk to lose messages
    that don't come from reflection).

    Another workaround which comes to my mind is that you could probably
    subclass scala.reflect.runtime.JavaUniverse, override log and then
    instantiate and use the subclass just as you used
    scala.reflect.runtime.universe. This would work in isolation, but will
    break when you'll try to integrate with other reflection-based code though.

    Good news is that finally I've submitted a fix to this problem:
    https://github.com/scala/scala/pull/2283.



    On 20 March 2013 14:53, Alexandre Curreli
    wrote:
    Is there a way we can easily disable those logs?
    On Wednesday, March 20, 2013 1:50:57 PM UTC, Eugene Burmako wrote:

    Yeah unfortunately the PR that fixed this issue along with other didn't
    make it into 2.10.1 :(

    On 20 March 2013 14:47, Alexandre Curreli wrote:

    Hello,

    So I just downloaded scala-library 2.10.1 and checked the source file.

    The log(s"$tvar setInst $newInst") is still there so the library is
    still spamming in 2.10.1.
    On Tuesday, January 22, 2013 4:45:57 PM UTC, Eugene Burmako wrote:

    Sorry I've overlooked this one. It's fixed in 2.10.1.

    On 22 Jan 2013, at 17:40, Aleksey Nikiforov wrote:

    Getting spammed by these messages in System.out:

    ...
    [] ?_$3 setInst org.mypackage.MyClass
    [] ?_$3 setInst org.mypackage.MyClass
    [] ?_$3 setInst org.mypackage.MyClass
    [] ?_$3 setInst org.mypackage.MyClass
    ...

    Stack trace from System.out reveals:

    ...
    at scala.Console$.println(**Console**.scala:240)
    at scala.Predef$.println(Predef.**s**cala:287)
    at scala.reflect.runtime.**JavaUniv**erse.log(JavaUniverse.**scala:
    **20)
    at scala.reflect.internal.Types$**c**lass.solveOne$1(Types.scala:**
    63**77)
    at scala.reflect.internal.Types$$****anonfun$solve$1.apply(Types.**
    sc**ala:6384)
    at scala.reflect.internal.Types$$****anonfun$solve$1.apply(Types.**
    sc**ala:6384)
    at scala.reflect.internal.util.**Co**llections$class.foreach3(**
    Colle**ctions.scala:160)
    at scala.reflect.internal.**SymbolT**able.foreach3(**SymbolTable.**
    scala:12)
    at scala.reflect.internal.Types$**c**lass.solve(Types.scala:6384)
    at scala.reflect.internal.**SymbolT**able.solve(SymbolTable.**
    scala:**12)
    at scala.reflect.internal.Types$**E**xistentialType.withTypeVars(**
    Ty**pes.scala:2805)
    at scala.reflect.internal.Types$**c**lass.thirdTry$1(Types.scala:**
    60**30)
    at scala.reflect.internal.Types$**c**lass.secondTry$1(Types.scala:*
    *5**989)
    at scala.reflect.internal.Types$**c**lass.firstTry$1(Types.scala:**
    59**65)
    at scala.reflect.internal.Types$**c**lass.isSubType2(Types.scala:**
    61**08)
    at scala.reflect.internal.Types$**c**lass.isSubType(Types.scala:**
    571**7)
    at scala.reflect.runtime.**JavaUniv**erse.scala$reflect$**runtime$*
    *SynchronizedTypes$$**super$**isSubType(JavaUniverse.**scala:**12)
    at scala.reflect.runtime.**Synchron**izedTypes$class.**isSubType(**
    SynchronizedTypes.**scala:60)
    at scala.reflect.runtime.**JavaUniv**erse.isSubType(**JavaUniverse.
    **scala:12)
    at scala.reflect.internal.Types$**T**ype.$less$colon$less(Types.**
    sca**la:837)
    at scala.reflect.internal.Types$**T**ype.$less$colon$less(Types.**
    sca**la:328)
    ...

    Looks like the following line was left uncommented:

    scala.reflect.internal.Types$**c**lass.solveOne$1(Types.scala:**63**
    77):
    log(s"$tvar setInst $newInst")

    Should this be filed as a tickets? Was not sure, just leaving it here.

    --
    You received this message because you are subscribed to the Google
    Groups "scala-language" group.
    To unsubscribe from this group and stop receiving emails from it, send
    an email to scala-languag...@**googlegroups.com.
    For more options, visit https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
    .

    --
    You received this message because you are subscribed to the Google Groups
    "scala-language" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to scala-language+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

    --
    You received this message because you are subscribed to the Google Groups "scala-language" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to scala-language+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post