Skip to content
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

GTD is not working if referenced library is updated without file name change #1577

Closed
jdneo opened this issue Oct 21, 2020 · 3 comments · Fixed by #1578
Closed

GTD is not working if referenced library is updated without file name change #1577

jdneo opened this issue Oct 21, 2020 · 3 comments · Fixed by #1578
Assignees
Labels

Comments

@jdneo
Copy link
Contributor

jdneo commented Oct 21, 2020

Step to reproduce

  1. Generate a invisible project with a .jar file in lib/ folder
  2. Add a new class in the .jar file and generate a new jar
  3. replace the .jar file in the lib/ folder
  4. the GTD is not working for the newly added class

// Original issue: microsoft/vscode-java-dependency#287

@rgrunber
Copy link
Contributor

I'll have a look.

@rgrunber
Copy link
Contributor

rgrunber commented Oct 22, 2020

I'm able to reproduce the problem, and while this change does improve the situation, I think there are still some other issues at play that make the change inconsistent.

I have the following file structure in a workspace:
lib/mylib.jar (this is the old jar)
simple/src/App.java
mylib.jar.old
mylib.jar.new

(the mylib.jar.{old,new} are so that I can easily swap the contents within lib)

Whether I change the contents from a terminal, or through the UI, the change is detected but GTD does not work immediately in some cases. I usually end up having to reload the file or make some edits. I've tried this on both Theia and VSCode and it seems to be the same behaviour.

Are you able to reproduce this at all ?

@jdneo
Copy link
Contributor Author

jdneo commented Oct 23, 2020

Yes I can reproduce this with a certain probability.

I also have some new findings.

Finding

Instead of adding

javaProject.getProject().refreshLocal(IResource.DEPTH_ZERO, monitor);

, change it to

javaProject.getJavaModel().refreshExternalArchives(new IJavaElement[]{javaProject}, monitor);

can solve the problem. At least I tried several times locally, the problem is not reproduced anymore. The difference between these two invocations is, the latter one will emit one more BufferChangedEvent for the jar file, and the first one does not have this event emitted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants