-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Javaparser #183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Javaparser #183
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you didn't pick up scala/scala@17a1abb.
It would be really helpful to record the SHA of scala/scala from which you ported this, so that in the future merging is possible. It would also be great to discuss if this is a straight port, if if you had to make any interesting changes to fit into dotc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ported from scala/scala@9753f23, which was before scala/scala@17a1abb.
I have updated the first commit message with the SHA and some discussion of the changes from scalac. Only very minor changes were needed.
for t1751 and t294 types in tree are correct(and thus were correctly tranformed). |
7866919
to
8e28653
Compare
I tried cherry-picking 1b79def from #184, but it did not fix t1751 and t294. I investigated the behaviour of elimrepeated in the debugger. It appears that it does actually eliminate repeated parameters correctly, even though they are inside an annotation tree. However, after the method type with eliminated parameters has been created, it gets thrown out by a call to cur.current in Denotations.scala. Could this be an issue with the lifetime of the transformed method info? I think I will need help in person to debug this. |
Ported from scalac 2.11.x branch SHA 9753f23f9362b25a9f481b11dd8d51187187882a This is mostly a direct port, with few significant dotty-specific changes needed. The two more significant changes are: In dotty, the first constructor of a class is pulled out separately from the other stats in the Template. The keyword detection code (buildKeywordArray) was moved into Tokens so that it can more cleanly be shared by the Scala and Java scanners.
A Java constructor needs to see the import of the companion object of the class. It is not necessary to move to an outer context because a Java constructor does not have an implementation. scalac also does it this way: see Namers.Namer.createNamer.isConstrParam.
The dummy constructor is needed so that the real constructors see the import of the companion object. The constructor has a parameter of type Unit so that no Java code can call it.
transformSym explicitly checks that a field is JavaDefined and does not create a symbol for it. Creation of a setter body looks for the symbol and fails because it does not find it. We do not need setter bodies for Java fields because we are not generating bytecode for them.
I have rebased to dotty master and fixed most of the resulting issues. I have fixed the problem with Java constructors not seeing the import of the companion object. The two elimrepeated tests are still failing. Newly failing is t1782. It contains a NamedArg in an annotation declaration. FirstTransform does not transform it because it is in an annotation, then fails an assertion because the NamedArg still exists. |
Backport "Undo patch of double-block apply" to 3.3 LTS
Fix val parameter override problem v0.2.1 -- fix potential IDB API issue dep: update a whole bunch of things (scala#71) This pr updates the following: - various dependencies to the latest - adds in dependabot - updates java and checkout actions - updates ammonite scripts and uses new ammonite in CI - updates mill to the latest 0.10.5 - bumps scalajs to 1.x - corrects repo location in pomSettings Merge pull request scala#4238 from armanbilge/issue/4229 Build docs on 2.13 Merge pull request scala#350 from typelevel/update/sbt-typelevel-0.4.13 Update sbt-typelevel to 0.4.13 Merge pull request scala#187 from typelevel/update/sbt-typelevel-0.4.13 Update sbt-typelevel to 0.4.13 Merge pull request scala#318 from scala-steward/update/sbt-typelevel-0.4.3 Update sbt-typelevel, sbt-typelevel-site to 0.4.3 fix http4s output encoding to UTF-8 (scala#900) support scala 3.0.0 Migrate to sbt slash syntax Merge pull request scala#2951 from pchlupacek/patch-1 Update adopters.md Adapt to new restrictions in fewerBraces wip: cleanups Reduce program size in one of the tests to decrease the chance of stack overflow. v4.6.0 Update scalafmt-core to 3.4.0 Remove import suggestions from assertions Clarify the unit of proc().call() 'timeout' parameter (scala#107) Pull request: com-lihaoyi/os-lib#107 Setting version to 2.4.1-SNAPSHOT Update auxlib, javalib, junit-plugin, ... to 0.4.3 Update serialization base64 for new lazy vals Merge pull request scala#616 from SethTisue/enable-scala-3-publishing Disable ExpectationsSpecs message tests Fix test for change in union type inference empty Merge pull request scala#380 from scala-steward/update/sbt-typelevel-0.4.3 Update sbt-typelevel to 0.4.3 Update scalafmt-core to 3.7.12 (scala#163) Co-authored-by: typelevel-steward[bot] <106827141+typelevel-steward[bot]@users.noreply.github.com> test: use the same line numbers in the location spec regardless of the scala compiler version Disable buggy test See scala#16390 New reference compiler is Scala 2.13.12 deps: update a bunch of things (scala#395) * deps: update a bunch of things This updates the following: - make sure Mill is on the latest 0.10.5 - drops support for scalajs 0.x - bumps to the latest scala patch versions - bumps to the latest scalaJS and scala native - bumps to 0.8.0 of utest - adds in dependabot - adds in cross testing jdk for 8 and 17 - bumps version of checkout and java actions * refactor: restructure build to actually build * fix: make mima happy by updating Merge pull request scala#264 from scala-steward/update/test-interface-0.4.7 Update test-interface to 0.4.7 Merge pull request scala#183 from scala-steward/update/auxlib-0.4.3 Update auxlib, javalib, nativelib, nscplugin, ... to 0.4.3 Revert "Fix tests to work with changes after scala#15569" This reverts commit 912b4f887912792202aa76e93fd19e63bd62f3bc.
Java parser for dotty.
As we discussed, three tests are still failing:
Requires import of companion object before first constructor.
Tree transformer does not transform repeated method arguments within an annotation instantiation.
Review by @odersky @DarkDimius