Skip to content

[jackpot] hint reload on save + run action registration + small cleanup - #3171

Merged
matthiasblaesing merged 5 commits into
apache:masterfrom
mbien:hint_reload
Oct 21, 2021
Merged

matthiasblaesing merged 5 commits into
apache:masterfrom
mbien:hint_reload

Conversation

@mbien

@mbien mbien commented Sep 16, 2021 •

Copy link
Copy Markdown
Member

NetBeans has some very well hidden features :) for example, I didn't know that you can run hint files - if you can find the aciton.

This PR

  • registers run file action on the hint file right click menu
  • reloads the inspection automatically when a hint file is saved (main reason why i started this effort)
  • hintfile editor shows now only errors as errors, rest is mapped to warning (if its enabled)
  • java 8 language level updates to the two packages I looked at (separate commits), e.g diamonds, lambdas try-with resource etc
    • contains trivial improvements, e.g refactoring to Deque interface, descending iterator instead of reversing collections etc
    • refactored while testing jackpot rules of course :)

feedback needed for UpdateGlobalHintsOnSaveTask (92712389824797). This task has to run after the file is saved but the OnSaveTask happens before IO - the current impl is not very clean.

@mbien mbien changed the title Jackpot hint reload on save + run action registration + small cleanup [jackpot] hint reload on save + run action registration + small cleanup Sep 19, 2021
@mbien
mbien marked this pull request as ready for review September 28, 2021 11:42
@matthiasblaesing

Copy link
Copy Markdown
Contributor

I left two inline comments, but how can this be tested? I build this PR branch and opened the java.hints.declarative module and opened one of the unittest `.hint' files and got:

java.lang.NullPointerException
	at org.netbeans.modules.java.hints.declarative.idebinding.HintsTask.computeErrors(HintsTask.java:102)
	at org.netbeans.modules.java.hints.declarative.idebinding.HintsTask.run(HintsTask.java:84)
	at org.netbeans.modules.parsing.impl.TaskProcessor.callParserResultTask(TaskProcessor.java:561)
[catch] at org.netbeans.modules.parsing.impl.TaskProcessor$RequestPerformer.run(TaskProcessor.java:786)
	at org.openide.util.lookup.Lookups.executeWith(Lookups.java:279)
	at org.netbeans.modules.parsing.impl.TaskProcessor$RequestPerformer.execute(TaskProcessor.java:702)
	at org.netbeans.modules.parsing.impl.TaskProcessor$CompilationJob.run(TaskProcessor.java:663)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
	at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
	at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)

@mbien

mbien commented Oct 2, 2021 •

Copy link
Copy Markdown
Member Author

I left two inline comments, but how can this be tested? I build this PR branch and opened the java.hints.declarative module and opened one of the unittest `.hint' files and got:
...

i have some hint files here: https://github.com/mbien/jackpot-inspections
README has a guide how to use hints.

I haven't encountered the NPE before. I take a look. On first glance it looks like my changes should not be the cause of it. All you did was to open a hint file?

edit: what i get though is lots of IllegalStateExceptions from the lexer when editing larger hint files. But this seems to be only from the hint editor and has no effect of the code inspection itself.

@mbien

mbien commented Oct 2, 2021

Copy link
Copy Markdown
Member Author

sorry had to force push because i rebased yesterday since the master was green for a short time. Only change is in UpdateGlobalHintsOnSaveTask.java

@matthiasblaesing matthiasblaesing left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks sane to me. @jlahoda could you please also have a look at this?

@neilcsmith-net neilcsmith-net added this to the 12.6 milestone Oct 13, 2021
@mbien

mbien commented Oct 20, 2021

Copy link
Copy Markdown
Member Author

@matthiasblaesing @jlahoda any chance to get this integrated? This is likely low risk since the feature is fairly niche while making reloading hint files significantly less painful.

@jlahoda jlahoda left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me.

@matthiasblaesing

Copy link
Copy Markdown
Contributor

Unittests are finally green. Lets get this in.

@matthiasblaesing
matthiasblaesing merged commit 534408e into apache:master Oct 21, 2021
@mbien

mbien commented Oct 21, 2021

Copy link
Copy Markdown
Member Author

@jlahoda @matthiasblaesing thanks!

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 this pull request may close these issues.

4 participants