Cloverage causing ‘Method code too large!’ error on a defprotocol - clojure

The defprotocol does have a large set of methods, 26.
I don’t need the defprotocol instrumented anyway so I’m trying to get the --exclude-call argument to work, but all my attempts have failed, I keep getting the ‘Method code too large!’ error for the defprotocol.
I've tried...
lein cloverage --exclude-call ‘mynamespace.main/my-protocol’
lein cloverage --exclude-call ‘clojure.core/defprotocol’
and other variants of the above.
Any ideas?
Ref:
https://github.com/cloverage/cloverage

Related

Build failing with ClassCastException

Hoping someone else has encountered this problem. We have a build running a pretty simple transform with a few left joins one after the other, that is failing with the following exception:
: java.lang.ClassCastException: class org.apache.spark.sql.catalyst.plans.logical.Project cannot be cast to class org.apache.spark.sql.catalyst.plans.logical.Join (org.apache.spark.sql.catalyst.plans.logical.Project and org.apache.spark.sql.catalyst.plans.logical.Join are in unnamed module of loader 'app')
I've been searching around everywhere for some explanation of this, but have turned up empty. It seems like from the exception that there's some cast going on from a project to a join? (related to the logical plan?)
Happy to post the redacted code for the transform if that's helpful
Tried to run a build and it ended up failing with an ClassCastException, and the error message makes it difficult to understand what's actually going wrong.

Clojure yagni "could not find any references" to a proxy Callable instance

I'm trying to use https://github.com/venantius/yagni
When I run it, I get the following error:
=================== WARNING: Parents ======================
== Could not find any references to the following ==
===========================================================
my-proj.my-ns/my-proj.my-ns.proxy$java.lang.Object$Callable$7da976d4
From what I found online, nothing can explain the meaning of this error
Update
Thanks for the comments asking me to give more context.
I was able to understand that the error is coming from a macro I'm using.
In my code, I'm using the time! macro, from the metrics lib.
As you can see herethis macro is using proxy
But this is not my code, is there a way to tell yagni not to look at it? (I guess not since it is a macro and compiled before yagni reads it)

Setting QT_DEBUG_PLUGINS fails

I have read this blogpost http://www.ics.com/blog/qt-tips-and-tricks-part-1 and tried to enable plugin debugging as described.
I've put this line in my main.cpp:
qputenv(QT_DEBUG_PLUGINS, 1);
But if I try to compile I'm getting this error:
.../src/main.cpp:14: error: 'QT_DEBUG_PLUGINS' was not declared in this scope
qputenv(QT_DEBUG_PLUGINS, -1);
What is the problem here and how do I have to do it right?
qputenv("QT_DEBUG_PLUGINS", QByteArray("1"));
But I don't get any additional output.
I'm using Qt5.5.1 with QtCreator 3.6 under KUbuntu 15.10.
You're supposed to set env variable from outside your program, not from inside! It's very likely the plugin loading you're interested into already happened by the time you reach that line. Try putting it before creating a Q*Application object.
– peppe
That's it. It was definitely set before plugin loading, but it seems to be important to set it before creating Q*Application as you wrote. Thank you.
– avb

Any way to block out new code for legacy versions of CF

I have written a library I include for some security patches. In that library there are a number of CF8 and up function,attributes,etc.
I really really dont want to cut the functionality down bc adobe couldnt get it together and get this basic functionality into CF7 so Im looking to write separate lines into each function. The issue is when CF is initially reading the code it bugs out if it finds something it doesnt recognize, whether or not it is going to be called.
For example in cfdirectory CF7 doesnt support the 'type' attribute. I have a find directory function that fails in CF7 when the 'type' attribute is present and taking it out increases the search time by 10x.
<cftry>
<cfdirectory action="list" directory="#arguments.start#" name="LOCAL.dirquery" type="dir" /><!---//GET QUERY OF DIRECTORIES IN START DIRECTORY--->
<cfcatch>
<cfsetting requesttimeout="600">
<cfdirectory action="list" directory="#arguments.start#" name="LOCAL.dirquery" /><!---//GET QUERY OF DIRECTORIES IN START DIRECTORY--->
</cfcatch>
This code does not work, neither does a conditional block. Im guessing the reader cannot parse thsi into whatever language and so is failing.
The code is probably failing at compile time, not at run time (need to see the error you are receiving to know for sure). If it's a compiler error, you'll need to have break out your CF7 functions in separate components from your CF8+ functions. Then check the CF version at run time to determine which component/function to call.
Here's some pseudo code you can use in application startup to load the correct version functions into memory. That way you have a consistent interface for calling the functions anywhere in your code.
Pseudo Code:
onApplicationStart(){
if (server.coldfusion.productversion == 7){
application.cffunctions = CF7FunctionsComponent;
} else {
application.cffunctions = CF8FunctionsComponent;
}
}
Everywhere else, you call the same function regardless of CF version currently running:
application.cffunctions.doSomething();

Play : Invalid method Code length

I have added one condition on my HTML page that is
#{if userObject == null}
Text
#{/if}
The code is working fine on the dev mode and getting this error in PROD mode.
SEVERE: Cannot start in PROD mode with errors
java.lang.ClassFormatError: Invalid method Code length 65561 in class file Template_M1175588447$_run_closure1_closure2
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at play.templates.GroovyTemplate$TClassLoader.defineTemplate(GroovyTemplate.java:77)
at play.templates.GroovyTemplate.compile(GroovyTemplate.java:133)
at play.templates.TemplateLoader.scan(TemplateLoader.java:184)
at play.templates.TemplateLoader.scan(TemplateLoader.java:194)
at play.templates.TemplateLoader.scan(TemplateLoader.java:194)
at play.templates.TemplateLoader.getAllTemplate(TemplateLoader.java:164)
at play.Play.preCompile(Play.java:501)
at play.Play.init(Play.java:273)
at play.server.Server.main(Server.java:131)
Is there any way out on this
I believe your issue is not related to the code you added, but to having a template "too big" that goes over the allowed lines size (in Java) for a method.
Probably you are xtending big templates or your page is really long.
As said on the official Java documentation, that means the jvm tries to read a class file that is malformed. Thus, try to delete all class files, tmp folder and recompile.