On Sun, Apr 7, 2019 at 1:24 PM Matthias Bläsing <mblaes...@doppel-helix.eu> wrote:
> Hi Jan, > > Am Sonntag, den 07.04.2019, 11:30 +0200 schrieb Jan Lahoda: > > I'd like to release the standalone Java Hints tool ("jackpot") based on > > Apache NetBeans 11.0. > > could you please give a sample how to use it. I now managed to build it > after some fiddeling, but I don't see how to use it. > As the simplest way, imagine a file: "<somedir>src/test/Test.java with content: --- package test; public class Test { public void test(boolean b) { int i = 0; if (b) System.err.println("was true"); assert (i = 1) == 1; } } --- One can get the list of all known hints using: --- jackpot --list --- Then it is possible to run some hint: --- $ jackpot --hint "Confusing indentation" <somedir>/src <somedir>/src/test/Test.java:9: warning: [Confusing_indentation] Confusing indentation assert (i = 1) == 1; ^ --- Or: --- $ jackpot --hint "Assert with side effects" <somedir>/src <somedir>/src/test/Test.java:9: warning: [Assert_with_side_effects] Assert condition produces side effects assert (i = 1) == 1; ^ --- When one has the hint configuration file, like the one under the main repo, in nbbuild/misc/hint-settings.xml, then this can be used: --- $ ./jackpot --config-file <path-to-netbeans-checkout>/nbbuild/misc/hints-settings.xml <somedir>/src <somedir>/src/test/Test.java:9: warning: [Confusing_indentation] Confusing indentation assert (i = 1) == 1; ^ <somedir>/src/test/Test.java:9: warning: [Assert_with_side_effects] Assert condition produces side effects assert (i = 1) == 1; ^ <somedir>/src/test/Test.java:9: warning: [Nested_assignment] Nested assignment 'i = 1' assert (i = 1) == 1; ^ --- With "--apply" the tool will apply the primary fix for each warning produced, and will write the changes directly into the sources. With "--out" it will apply the primary fix, but will not write the changes into the sources, but will rather produce a patch. > Randomly playing, I notices, that there is something fishy. According > to the CLI output, this should show me a GUI: > > ./jackpot --show-gui --config-file test.config > Hmm, the gui is disabled, that was only showing allowing to configure which hints should be enabled in configuration file (and not really needed that much, since NetBeans itself can be used to configure the settings, which was not the case when this option was introduced.) But I forgot to remove the command line option. Sorry for that. Jan > > but is silently fails. > > Running with debug I get: > > matthias@athena:~/tmp/x/x/jackpot$ ./jackpot --debug --show-gui > --config-file test.config > Apr. 07, 2019 1:19:29 NACHM. org.openide.util.lookup.MetaInfServicesLookup > search > INFORMATION: null > java.lang.ClassNotFoundException: > org.netbeans.modules.web.common.remote.RemoteURLMapper > at > java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583) > at > java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) > at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) > at java.base/java.lang.Class.forName0(Native Method) > at java.base/java.lang.Class.forName(Class.java:398) > at > org.openide.util.lookup.MetaInfServicesLookup.search(MetaInfServicesLookup.java:306) > at > org.openide.util.lookup.MetaInfServicesLookup.beforeLookup(MetaInfServicesLookup.java:131) > at > org.openide.util.lookup.MetaInfServicesLookup.beforeLookupResult(MetaInfServicesLookup.java:110) > at > org.openide.util.lookup.AbstractLookup.lookup(AbstractLookup.java:458) > at > org.openide.util.lookup.ProxyLookup$R.initResults(ProxyLookup.java:365) > at > org.openide.util.lookup.ProxyLookup$R.addLookupListener(ProxyLookup.java:464) > at org.openide.filesystems.URLMapper.reset(URLMapper.java:92) > at org.openide.filesystems.URLMapper.<clinit>(URLMapper.java:82) > at > org.netbeans.modules.jackpot30.cmdline.lib.Utils.createDefaultBootClassPath(Utils.java:122) > at > org.netbeans.modules.jackpot30.cmdline.Main$RootConfiguration.<init>(Main.java:866) > at > org.netbeans.modules.jackpot30.cmdline.Main.compile(Main.java:189) > at org.netbeans.modules.jackpot30.cmdline.Main.main(Main.java:121) > > matthias@athena:~/tmp/x/x/jackpot$ > > > The JDK looks reasonably sane: > > matthias@athena:~/tmp/x/x/jackpot$ java -version > openjdk version "11.0.1" 2018-10-16 > OpenJDK Runtime Environment (build 11.0.1+13-Ubuntu-3ubuntu3.18.10.1) > OpenJDK 64-Bit Server VM (build 11.0.1+13-Ubuntu-3ubuntu3.18.10.1, mixed > mode, sharing) > matthias@athena:~/tmp/x/x/jackpot$ > > > Greetings > > Matthias > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@netbeans.incubator.apache.org > For additional commands, e-mail: dev-h...@netbeans.incubator.apache.org > > For further information about the NetBeans mailing lists, visit: > https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists > > > >