This repository has been archived by the owner on Feb 20, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Current implementation uses reflectivelyWithoutGetter to try accessing primary constructor params by name, and is allowed to fail silently. This ends up generating empty objects for Java classes like java.lang.Byte. - This does not attempt reflection unless we have a known param. - When the list of fields are non-empty, but the pickler generates zero fields, it will raise exception to fail the macro.
- Loading branch information
Showing
2 changed files
with
32 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package scala.pickling.javafieldfail | ||
|
||
import scala.pickling._ | ||
import NegativeCompilation._ | ||
import org.scalatest.FunSuite | ||
|
||
class JavaFieldFailTest extends FunSuite { | ||
test("main") { | ||
expectError("Cannot generate") { | ||
"""import _root_.scala.pickling._ | ||
|import _root_.scala.pickling.Defaults._ | ||
|import _root_.scala.pickling.json._ | ||
|import _root_.scala.pickling.static._ | ||
| | ||
|val x: java.lang.Byte = 10.toByte | ||
| | ||
|val p = x.pickle""".stripMargin | ||
} | ||
} | ||
} |