Skip to content

Conversation

@valerauko
Copy link

@valerauko valerauko commented Jul 23, 2020

Fixes #2695

Tests are passing.

@glts
Copy link
Collaborator

glts commented Jul 23, 2020

No, I don’t see how this is different from #2306. I just tried it and it breaks in the same way.

The last time this was attempted – and released – it caused a lot of damage (sorry). The next attempt needs to have more extensive testing. See #2328 and the mentioned issues there.

@valerauko
Copy link
Author

It's not different. I thought it was unintentionally removed at some point. I expected there to be tests for any known regressions like that...

If you have a repro I could add to the lein test suite please advise. Currently I can only repro by running lein eastwood.

Workaround to resolve reflection warning while avoiding #2328
form can be a single symbol and can't filter that...
@valerauko
Copy link
Author

I added a hacky fix using metadata to tag the form in question. Stuff without the magical meta tag won't have metadata printed (this is current behavior). I added a test case for this as well.

The last test failure seems to be a maven connection refused error... I can't rerun the tests on Circle to check if time resolves it

@glts
Copy link
Collaborator

glts commented Jul 24, 2020

I don’t remember what the problem was, aren’t all projects with plugins affected? Anyway, I cannot look into this further.

@frenchy64
Copy link
Contributor

frenchy64 commented Dec 17, 2020

Perhaps we can always use *print-meta* true to generate forms, but first prepare the form by removing all non-:tag metadata (and coerce all tags to symbols or strings) via a postwalk. That might help avoid the problem of generating unreadable forms.

@frenchy64
Copy link
Contributor

After some investigation, my idea isn't going to work because you can't remove metadata from vars and other such objects with mutable metadata.

I'll experiment with hybrid of these approaches (use a flag like in this PR to signal a very strict use of print-meta).

(binding [*print-dup* *eval-print-dup*
;; only to resolve reflection warning in run-form (run.clj)
*print-meta* (and (seq? form)
(first (filter #(:lein-with-meta (meta %)) form)))]
Copy link
Contributor

@frenchy64 frenchy64 Dec 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is going to have the desired effect because most calls to shell-command wrap their arguments with extra forms. For example, see impl of eval-in-project and leiningen.trampoline's use of shell-command.

EDIT: Ah, now I understand that you've probably considered this case, that's why the filter is there right?

Copy link
Contributor

@frenchy64 frenchy64 Dec 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have the feeling this approach is still too dangerous because there might be var literals in a project's :global-vars or :injections, and they contain unreadable Namespace objects in their metadata (assuming my understanding is correct that most calls to shell-command will come via eval-in-project).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reflector/invokeStaticMethod reflection warning

3 participants