Skip to content

Instantly share code, notes, and snippets.

View abeln's full-sized avatar

Abel Nieto abeln

View GitHub Profile
@abeln
abeln / gist:e7db55878014f27c90d1dfd2f5dc984e
Last active February 5, 2019 23:08
Java imports in Scala community build (+ dotty)
import java.io.File 282
import java.util.concurrent.TimeUnit 153
import java.io._ 115
import java.nio.ByteBuffer 96
import java.util.UUID 93
import java.io.InputStream 93
import java.util 92
import java.net.URI 85
import java.util.Date 85
import java.net.URL 76
@abeln
abeln / gist:028cfa66c11df2a9d8fce954737980bc
Created January 8, 2019 17:03
Unpickling logic in Dotty
ClassFileLoader (SymbolLoader)
|
v
ClassFileParser
|
v
run()
|
v
parseClass()
@abeln
abeln / scala-explicit-nulls.md
Last active December 18, 2020 13:57
Scala with Explicit Nulls
@abeln
abeln / null-eq
Last active January 21, 2019 21:18
Equality comparisons involving null in Dotty community build
/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/bin/java "-javaagent:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=49686:/Applications/IntelliJ IDEA.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/ext/jaccess.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/ext/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/ext/sunec.jar:/Libr
@abeln
abeln / gist:3b709744ccfe13a0065d4f36db35b927
Created March 21, 2019 21:24
Occurences of JavaNull in findMember by type
➜ dotty git:(explicit-null-bootstrap) ✗ sort kk2 | uniq -c | sort -r
136 >>> dotty.tools.dotc.reporting.diagnostic.ErrorMessageID | JavaNull
87 >>> java.nio.file.Path | JavaNull
80 >>> String | JavaNull
51 >>> Object | JavaNull
39 >>> org.jline.reader.LineReaderBuilder | JavaNull
32 >>> ProfilingAsyncHelper.this.ThreadProfileData | JavaNull
21 >>> scala.tools.asm.MethodVisitor | JavaNull
15 >>> scala.tools.asm.Type | JavaNull
14 >>> xsbti.api.Structure | JavaNull
@abeln
abeln / gist:36a245f67a519b7318f749811d84e475
Created March 21, 2019 21:27
Methods refined via checker framework annotations (on return type only)
```scala
>>> valueOf with type (x$0: Double): String
>>> valueOf with type (x$0: Float): String
>>> valueOf with type (x$0: Long): String
>>> valueOf with type (x$0: Int): String
>>> valueOf with type (x$0: Char): String
>>> valueOf with type (x$0: Boolean): String
>>> valueOf with type (x$0: Array[Char], x$1: Int, x$2: Int): String
>>> valueOf with type (x$0: Array[Char]): String
>>> valueOf with type (x$0: Any): String
@abeln
abeln / gist:d0d2979efbf469501923c7d73341e145
Last active March 28, 2019 15:27
Per-file change stats of the migration
```
370 ++++++++++----------- .../tools/backend/jvm/DottyBackendInterface.scala
208 ++++++------ compiler/src/dotty/tools/dotc/core/Types.scala
148 ++++----- .../dotty/tools/backend/jvm/BCodeSkelBuilder.scala
138 ++++---- compiler/src/dotty/tools/dotc/core/Scopes.scala
86 +++-- compiler/src/dotty/tools/dotc/sbt/ExtractAPI.scala
71 ++-- .../src/dotty/tools/dotc/util/WeakHashSet.scala
68 ++-- .../src/dotty/tools/backend/jvm/GenBCode.scala
66 ++-- compiler/src/dotty/tools/dotc/core/Contexts.scala
63 ++-- .../src/dotty/tools/dotc/core/SymDenotations.scala
@abeln
abeln / gist:3cdde264692b2ee69ba29da8ee2133bd
Created March 21, 2019 21:33
Usages of flow inference
>>> tpe = BCodeBodyBuilder.this.int.Symbol(hostClass)
>>> tpe = BCodeBodyBuilder.this.int.Symbol(hostClass0)
>>> tpe = BCodeBodyBuilder.this.int.Tree(nonNullSide)
>>> tpe = Nullable[tools.asm.Label](finCleanup)
>>> tpe = Nullable[tools.asm.Label](finCleanup)
>>> tpe = Nullable[tools.asm.Label](finCleanup)
>>> tpe = Nullable[tools.asm.Label](lbl)
>>> tpe = Nullable[tools.asm.tree.AbstractInsnNode](i0)
>>> tpe = Nullable[BCodeSyncAndTry.this.bTypes.ClassBType](excType)
>>> tpe = BCodeSyncAndTry.this.int.Symbol(tmp)
@abeln
abeln / gist:47f9ec548b78f41591636d7e45e5e2ee
Last active April 1, 2019 20:51
Delta for dotty with explicit nulls (LOC modified, per file, decreasing)
296 +- compiler/src/dotty/tools/dotc/core/Types.scala
268 - compiler/src/dotty/tools/dotc/core/JavaNull.scala
207 - compiler/src/dotty/tools/dotc/core/FlowFacts.scala
190 +- .../src/dotty/tools/dotc/core/Definitions.scala
137 +- compiler/src/dotty/tools/dotc/typer/Typer.scala
50 +- compiler/src/dotty/tools/dotc/typer/Namer.scala
47 +- .../dotc/parsing/xml/SymbolicXMLBuilder.scala
45 +- .../dotty/tools/dotc/transform/patmat/Space.scala
42 +- .../src/dotty/tools/dotc/typer/Implicits.scala
41 +- .../src/dotty/tools/dotc/typer/Applications.scala