Skip to content

Commit

Permalink
Treat default value getters as accessible.
Browse files Browse the repository at this point in the history
They are called from other compilation units and their names can change
when a new overload is added to a method with default values.

Fixes lightbend-labs#136.
  • Loading branch information
szeiger committed Nov 23, 2016
1 parent 4f62c2e commit 02e9598
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ class MemberInfo(val owner: ClassInfo, val bytecodeName: String, override val fl
decodedName.substring(0, i+1).endsWith("$extension")
}

def isAccessible: Boolean = isPublic && !isSynthetic && (!hasSyntheticName || isExtensionMethod)
def isDefaultGetter: Boolean = decodedName.contains("$default$")

def isAccessible: Boolean = isPublic && !isSynthetic && (!hasSyntheticName || isExtensionMethod || isDefaultGetter)

def nonAccessible: Boolean = !isAccessible

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
synthetic method copy$default$2()java.lang.String in class A has a different result type in new version, where it is Int rather than java.lang.String
synthetic method copy$default$1()Int in class A has a different result type in new version, where it is Boolean rather than Int
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
final class A {
def copy(x: Int = 0, y: String = "") = ()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
final class A {
def copy(x: Int, y: String) = ()
def copy(z: Boolean = true, x: Int = 0, y: String = "") = ()
}

0 comments on commit 02e9598

Please sign in to comment.