Eastwood linter not disabling deprecation warnings - clojure

Using Eastwood, I'm trying to disable deprecation warnings, for a specific package, when linting a given Clojure namespace. In this case, eastwood is failing when making a Google API call which is deprecated.
As per the documentation, I tried to disable the linter for that package.
λ cat src/main/resources/third-party-libs.clj
(disable-warning
{:linter :deprecations
:symbol-matches #{"^#'com\.google\.api\.core\.*'"}})
But no dice. How can I turn off deprecation for specific classes or packages?
my/namespace.clj:13:5: deprecations: Static method 'public static void com.google.api.core.ApiFutures.addCallback(com.google.api.core.ApiFuture,com.google.api.core.ApiFutureCallback)' is deprecated.
EDIT
A) I'm able to load src/main/resources/my-eastwood-config.clj. But com.google.api.core.ApiFutures.* still isn't ignored.
(disable-warning
{:linter :deprecations
:symbol-matches #{#"com\.google\.api\.core\.ApiFutures.*"}})
B) Either of these formats gives me the error below.
i)
(disable-warning
{:linter :deprecations
:symbol-matches #{"^#'com\.google\.api\.core\..*'"}})
(disable-warning
{:linter :deprecations
:symbol-matches #{"^#'com\\.google\\.api\\.core\\..*'"}})
ii)
CompilerException java.lang.RuntimeException: Unsupported escape character: \., compiling:(null:4:31)
clojure.lang.Compiler.load (Compiler.java:7521)
clojure.lang.Compiler.load (Compiler.java:7461)
clojure.core/load-reader (core.clj:4053)
clojure.core/load-reader (core.clj:4048)
eastwood.util/init-warning-enable-config/fn--40733 (util.clj:916)
eastwood.util/init-warning-enable-config (util.clj:914)
eastwood.util/init-warning-enable-config (util.clj:907)
eastwood.lint/last-options-map-adjustments (lint.clj:467)
eastwood.lint/last-options-map-adjustments (lint.clj:456)
eastwood.lint/eastwood (lint.clj:511)
eastwood.lint/eastwood (lint.clj:501)
eastwood.lint/eastwood (lint.clj:502)
eastwood.lint/eastwood (lint.clj:501)
eastwood.lint/eastwood-from-cmdline (lint.clj:529)
eastwood.lint/eastwood-from-cmdline (lint.clj:528)
clojure.lang.Var.invoke (Var.java:381)
eastwood.versioncheck/run-eastwood (versioncheck.clj:15)
eastwood.versioncheck/run-eastwood (versioncheck.clj:9)
user/eval39298 (form-init6182731209880131993.clj:1)
user/eval39298 (form-init6182731209880131993.clj:1)
clojure.lang.Compiler.eval (Compiler.java:7062)
clojure.lang.Compiler.eval (Compiler.java:7052)
clojure.lang.Compiler.load (Compiler.java:7514)
clojure.lang.Compiler.loadFile (Compiler.java:7452)
clojure.main/load-script (main.clj:278)
clojure.main/init-opt (main.clj:280)
clojure.main/init-opt (main.clj:280)
clojure.main/initialize (main.clj:311)
clojure.main/null-opt (main.clj:345)
clojure.main/null-opt (main.clj:342)
clojure.main/main (main.clj:424)
clojure.main/main (main.clj:387)
clojure.lang.Var.applyTo (Var.java:702)
clojure.main.main (main.java:37)

Eastwood is not picking up your config file. You can debug this with:
lein eastwood '{:debug [:config]}'
== Eastwood 0.3.7 Clojure 1.10.1 JVM 1.8.0_242 ==
Loading config file: jar:file:$HOME/.m2/repository/jonase/eastwood/0.3.7/eastwood-0.3.7.jar!/eastwood/config/clojure.clj
Loading config file: jar:file:$HOME/.m2/repository/jonase/eastwood/0.3.7/eastwood-0.3.7.jar!/eastwood/config/clojure-contrib.clj
Loading config file: jar:file:$HOME/.m2/repository/jonase/eastwood/0.3.7/eastwood-0.3.7.jar!/eastwood/config/third-party-libs.clj
...
The reason, why a similar named file is not picked up:
You can specify the key :builtin-config-files in the options map to
override the built-in config files read. It defaults to ["clojure.clj"
"clojure-contrib.clj" "third-party-libs.clj"]. All such file names are
only looked for in Eastwood's built-in config files.
Similarly you can specify :config-files in the options map to give
additional files to read. These are file names that can be anywhere in
your file system, specified as strings, or if Eastwood is invoked from
the REPL, anything that can be passed to clojure.java.io/reader.
Source: https://github.com/jonase/eastwood#eastwood-config-files
Not very specific, but that would imply they are looked up as resources
under /eastwood/config/....
If you would put a file under that same location with the same name you may
or may not win against the default configs (e.g. one wins). So the way out is to
specify the config just yourself. E.g.
lein eastwood '{:config-files ["eastwood-config.clj"] :debug [:config]}'
== Eastwood 0.3.7 Clojure 1.10.1 JVM 1.8.0_242 ==
Loading config file: jar://...
...
Loading config file: eastwood-config.clj
...
Also watch out with your regexp. I think you want: "^#'com\.google\.api\.core\..*'" (note the additional . before the *); otherwise the \. repeats.

Related

Weka 3.8.6 error cannot load applications

Environment variable 'JAVA_OPTS' does not exist!
Environment variable 'CLASSPATH' does not exist!
WARNING: A terminally deprecated method in java.lang.System has been called
WARNING: System::setSecurityManager has been called by weka.gui.GUIChooserApp (file:/C:/Program%20Files/Weka-3-8-6/weka.jar)
WARNING: Please consider reporting this to the maintainers of weka.gui.GUIChooserApp
WARNING: System::setSecurityManager will be removed in a future release
ar Situation Can Help Me :<
THANKS A LOT
i am getting error using weka version 3.8.6
when i try to use explorer. app loads very slow, almost unresponsive, i
t also almost gives no error, when i try to use console version it just shows warning messages
ANYONE Having Similar Situation Can Help Me :<
THANKS A LOT
You might want to try a different version of Java rather than the one that Weka comes with, to rule out that this is the culprit:
From adoptium.net download a ZIP file (not MSI!) of Java 11 and unzip it somewhere, e.g., on your Desktop (by using the ZIP file you don't have to be admin to make use of it).
Determine the absolute path to the executable java.exe that you just extracted, e.g.:
C:\Users\MyUser\Desktop\jdk-11.0.18+10\bin\java.exe
Determine the absolute path the weka.jar of your Weka installation, e.g.:
C:\Program Files\Weka-3-8-6\weka.jar
Open a Windows command-prompt.
Run the following command to start up Weka, using the paths that you just determined (use double quotes around the paths to account for potential spaces in the paths):
"JAVAEXE_PATH" -jar "WEKAJAR_PATH"
Which translates to this using the above mentioned paths:
"C:\Users\MyUser\Desktop\jdk-11.0.18+10\bin\java.exe" -jar "C:\Program Files\Weka-3-8-6\weka.jar"
If it is no longer slow, then the Zulu Java that comes with Weka is likely to be the culprit.
If not, you will have to check whether other programs, like an anti-virus, might cause the slowdown.
i think i found something :v
> java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module #32464a14
java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)
java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
weka.core.WekaPackageClassLoaderManager.injectClasses(WekaPackageClassLoaderManager.java:792)
weka.core.WekaPackageClassLoaderManager.injectAllClassesInFromStream(WekaPackageClassLoaderManager.java:690)
weka.core.WekaPackageClassLoaderManager.injectMTJCoreClasses(WekaPackageClassLoaderManager.java:118)
weka.core.WekaPackageManager.<clinit>(WekaPackageManager.java:255)
weka.core.ResourceUtils.readProperties(ResourceUtils.java:241)
weka.core.ResourceUtils.readProperties(ResourceUtils.java:184)
weka.core.Utils.readProperties(Utils.java:183)
weka.core.logging.Logger.<clinit>(Logger.java:50)
weka.gui.GUIChooserApp.main(GUIChooserApp.java:1660)
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.base/java.lang.reflect.Method.invoke(Method.java:568)
weka.gui.SplashWindow.invokeMain(SplashWindow.java:306)
weka.gui.GUIChooser.main(GUIChooser.java:92)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)
at java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
at weka.core.WekaPackageClassLoaderManager.injectClasses(WekaPackageClassLoaderManager.java:792)
at weka.core.WekaPackageClassLoaderManager.injectAllClassesInFromStream(WekaPackageClassLoaderManager.java:690)
at weka.core.WekaPackageClassLoaderManager.injectMTJCoreClasses(WekaPackageClassLoaderManager.java:118)
at weka.core.WekaPackageManager.<clinit>(WekaPackageManager.java:255)
at weka.core.ResourceUtils.readProperties(ResourceUtils.java:241)
at weka.core.ResourceUtils.readProperties(ResourceUtils.java:184)
at weka.core.Utils.readProperties(Utils.java:183)
at weka.core.logging.Logger.<clinit>(Logger.java:50)
at weka.gui.GUIChooserApp.main(GUIChooserApp.java:1660)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at weka.gui.SplashWindow.invokeMain(SplashWindow.java:306)
at weka.gui.GUIChooser.main(GUIChooser.java:92)
WARNING: A terminally deprecated method in java.lang.System has been called
WARNING: System::setSecurityManager has been called by weka.gui.GUIChooserApp (file:/C:/Users/Kenzn2/Downloads/Compressed/stable-3-8/weka/weka.jar)
WARNING: Please consider reporting this to the maintainers of weka.gui.GUIChooserApp
WARNING: System::setSecurityManager will be removed in a future release
enter image description here

Getting error while building project "com.bea.util.jam.internal.javadoc.JavadocClassloadingException:"

I am getting error while trying to build a java project in TeamCity. The same project builds and excecutes well on my local. I recently pushed changes to this project on GitLab. This is my first time working with GitLab and TeamCity together. Other projects have no issues during build. I am unable to understand what is causing this error:
[15:58:54][Step 1/1] compile.earCommons (4s)
[15:58:54][compile.earCommons] echo
[15:58:54][compile.earCommons] echo
[15:58:54][compile.earCommons] wlcompile (4s)
[15:58:59][wlcompile]
com.bea.util.jam.internal.javadoc.JavadocClassloadingException: An error
has occurred while invoking javadoc to inspect your source
files. This may be due to the fact that $JAVA_HOME/lib/tools.jar does
not seem to be in your system classloader. One common case in which
this happens is when using the 'ant' tool, which uses a special
context classloader to load classes from tools.jar.
This situation elicits what is believed to a javadoc bug in the initial
release of JDK 1.6. Javadoc attempts to use its own context classloader
tools.jar but ignores one that may have already been set, which leads
to some classes being loaded into two different classloaders. The
telltale sign of this problem is a javadoc error message saying that
'languageVersion() must return LanguageVersion - you might see this
message in your process' output.
This will hopefully be fixed in a later release of JDK 1.6; if a new
version of 1.6 has become available, you might be able to solve this
by simply upgrading to the latest JDK.
Alternatively, you can work around it by simply including
$JAVA_HOME/lib/tools.jar in the java -classpath
parameter. If you are running ant, you will need to modify the standard
ant script to include tools.jar in the -classpath.
[15:58:59][Step 1/1] Process exited with code 1
[15:58:59][Step 1/1] Ant output
[15:59:10][Step 1/1] Process exited with code 1 (Step: Ant)
[15:58:59][Step 1/1] Step Ant failed
****Update****
Build Step: Ant
Step 1:
Runner type: Ant (Runner for Ant build.xml files)
Execute: If all previous steps finished successfully
build.xml file: \ant\build.xml
Working directory: same as checkout directory
Targets: none specified
Ant home path: C:\apache-ant-1.7.0
Additional Ant command line parameters: -lib c:\WebLogic\12.1.2\wlserver\server\lib\javaee.jar;c:\WebLogic\12.1.2\wlserver\server\lib\weblogic.jar;c:\WebLogic\12.1.2\wlserver\server\lib\webservices.jar
JDK home path: c:\Program Files\Java\jdk1.7.0_80
JVM command line parameters: not specified
Reduce test failure feedback time: OFF
Java code coverage: disabled
Docker Settings
Docker Image: unset
I'll appreciate any help in this regard.
I found there was character encoding issue with one of the files that prevented compiler from loading the java classes. Once that was fixed, the build worked fine.

cljs/core.cljs [line 988, col 14] No reader function for tag Inf

I'm trying to launch the latest stable [org.clojure/clojurescript "1.9.946"], using boot-cljs and getting this error: cljs/core.cljs [line 988, col 14] No reader function for tag Inf.
I've learned that 1.9.946 introduced new ##Inf syntax: https://cljs.github.io/api/syntax/Inf. but not sure why I'm getting this error. I've also tried to do this: [adzerk/boot-cljs "2.1.4" :exclusions [org.clojure/clojurescript]] but it changed nothing.
Edit: just tried to build cljs version from repo and hooked up npm deps with lein-npm, server rendering of react worked as expected. May be something to do with boot-cljs deps or some other my components.
Support for ##Inf was added in tools.reader 1.1.0, which ClojureScript 1.9.946 depends upon.
If you see this error, it is because you have tools.reader 1.0.6 or earlier on your classpath.
Note that, while ClojureScript 1.9.946 specifies [org.clojure/tools.reader "1.1.0"] as a dependency, explicitly specifying an older version in your project configuration would cause the issue.
Also note that this is independent of the Clojure version being used. If desired, you can run the ClojureScript 1.9.946 compiler using Clojure 1.8.0 and successfully compile ClojureScript code that makes use of ##Inf; Clojure 1.9.0 is not required.

Clojure: how to explicitly choose JVM in the environment with Leiningen/Lighttable

In my Windows 7 (64 bits) environment, I have quite a few JVM available:
C:\Program Files (x86)\Java\j2re1.4.2_12\bin\client\jvm.dll
C:\Program Files (x86)\Java\jre6\bin\client\jvm.dll
D:\programs\Java\jdk1.7.0_45\jre\bin\server\jvm.dll
D:\programs\Java\jre7\bin\server\jvm.dll
Currently, with Lighttable/Leiningen (I don't know which makes the choice, and how), it uses
C:\Program Files (x86)\Java\j2re1.4.2_12\bin\client\jvm.dll
But I really would like to try
D:\programs\Java\jdk1.7.0_45\jre\bin\server\jvm.dll
It's even more puzzling that when I type
java -version
I got the following:
D:\yushen>java -version
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
It seems that's what I want to have inside Lighttable/Leinengen.
Could you show me how to make the explicit choice/configuration?
I tried Google, but couldn't find some leads.
Thanks a lot!
I found a Leiningen profile in
$HOME/.lein/profiles.clj
For me on Windows, $HOME was D:\Users\carl . More generally, it's the directory Windows will (usually) dump you in if you start the shell using CMD .
This contained:
{:user
{
:java-cmd "F:\\JDK8\\bin\\java.exe"
:plugins [
]
}
}
...which I was able to change to good effect.
Put the JDK's bin directory in your path first. It's the surest way.
More detail. Windows, you can use the where command to see what version of an executable. It's either where java or where java.exe You can also look at your path from the command prompt by typing path. If you're launching something from the command line, and it's not undertaking strange measures to find the JVM, it should come up with the first one in your path, which should agree with the results of running the where command.
If the where command is coming up with something you don't expect, either add the right directory to your path before the entry that's coming up or rearrange your path so it's coming up first.
To test this in leiningen, start a repl, and evaluate this.
(println (System/getProperty "java.version"))
e.g.
Yoyo-2:Desktop bill$ lein repl
(System/getPnREPL server started on port 61475 on host 127.0.0.1 - nrepl://127.0.0.1:61475
REPL-y 0.3.5, nREPL 0.2.6
Clojure 1.6.0
Java HotSpot(TM) 64-Bit Server VM 1.8.0_20-b26
Docs: (doc function-name-here)
(find-doc "part-of-name-here")
Source: (source function-name-here)
Javadoc: (javadoc java-object-or-class-here)
Exit: Control+D or (exit) or (quit)
Results: Stored in vars *1, *2, *3, an exception in *e
ruser=> (System/getProperty "java.version")
"1.8.0_20"
In my experience, Leiningen has always used the version of java it finds in the path. No experience with light table though.
For Leiningen, you can edit lein.bat to point exactly to your desired Java SDK version. I don't know if the same could apply to LightTable.
Or you can set a global JAVA_HOME. That is really Googleable (or DuckDuckGo-able).
Finally, I found this link: http://leiningen-win-installer.djpowell.net/
After running the installer, it has the function to re-configure leiningen, using it, I was able to configure my old leiningen to use my desired JDK: D:\programs\Java\jdk1.7.0_45\bin\java.exe, then the JVM instance in leiningen/lighttable is the desired one now.
The moral of the story: leiningen needs to be reconfigured with newly installed JDK with the configuration functionality of leiningen-win-installer.
It might be possible to configure leiningen manually, but I hadn't found a way to do yet.
I tried to manually configure through my project.clj with java-command option, it didn't work.

pomegranate could not be found on class path

I am trying to do a tutorial about Castra and Hoplon and am trying to follow the basic steps to set it up. The project uses https://github.com/tailrecursion/boot to bootstrap itself, and I can't get it to work at all. I cloned the repo and built it (boot, that is), and get the following error when I try to use it to do anything (start the tutorial or do the hello world app thingy from boots github readme):
java.io.FileNotFoundException: Could not locate cemerick/pomegranate__init.class
or cemerick/pomegranate.clj on classpath:
at clojure.lang.RT.load (RT.java:443)
clojure.lang.RT.load (RT.java:411)
clojure.core$load$fn__5018.invoke (core.clj:5530)
clojure.core$load.doInvoke (core.clj:5529)
clojure.lang.RestFn.invoke (RestFn.java:408)
.......
I am very new to clojure in general but after googling around I don't know what to do. It seems kind of ironic also as the whole point of Pomegranate is to put things on your class path and the error is that it isn't on class path.
Inside the build.boot file check if your line 3 is:
#tailrecursion.boot.core/version "2.3.1"
And if you have boot.task 2.1.2 in your deps
[tailrecursion/boot.task "2.1.2"]
HTH