-
Notifications
You must be signed in to change notification settings - Fork 7
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
Preserve annotations #72
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.
As we discussed in our meeting this morning, this PR needs to be modified. I think we should adopt the following strategy for annotations:
- as input, we should take a jar file containing annotation definitions that Specimin should preserve. We should test this using the CF's
checker-qual.jar
file (that is, the jar file that we expect users will put on their classpath so that they can preserve annotations in the bytecode) - for any annotation that we encounter, we should preserve it if and only if it is either 1) solvable with the input source files/classpath, or 2) solvable using the jar file(s) provided in the previous step
We should also consider the case of Lombok and other tools that generate new code based on annotations, which makes this much trickier. We probably want to delombok code before passing it to Specimin in the general case. I don't think this PR needs to solve the Lombok problem, but I wanted to bring it up now @LoiNguyenCS since eventually we probably will encounter code that uses Lombok.
src/test/resources/PreserveAnnotations/expected/com/example/Simple.java
Outdated
Show resolved
Hide resolved
Professor, I have updated the codes. In this current version of Specimin, the jar files used by annotations will be included in the final output. Please take a look. |
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.
@LoiNguyenCS I made a number of changes to try to simplify this PR. I think it is ready to merge, but you should re-review it before we do (this can wait until you are back from your vacation).
"removeunsolvedannotations", | ||
new String[] {"com/example/Simple.java"}, | ||
new String[] {"com.example.Simple#baz()"}, | ||
new String[] {"src/test/resources/removeunsolvedannotations/input/checker-qual-3.42.0.jar"}); |
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.
We should only need one copy of this jar file in the repo (if we need it at all - we could ask Gradle to fetch it for us from Maven, instead). Each test should not require its own copy.
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.
This file should not be copied into the output.
typecheck_test_outputs.sh
Outdated
@@ -14,7 +14,7 @@ for testcase in * ; do | |||
cd "${testcase}/expected/" || exit 1 | |||
# javac relies on word splitting | |||
# shellcheck disable=SC2046 | |||
javac -proc:only -nowarn $(find . -name "*.java") \ | |||
javac -proc:only -nowarn -classpath *.jar $(find . -name "*.java") \ |
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.
If there is only one copy of checker-qual.jar
, then this doesn't need a *
LGTM. |
This PR is falling right now because javac requires the class files of annotations in order for the input program to compile successfully.