how to avoid warnings in ProGuard GUI - automation

While trying to use ProGuard (5.3.2) to obfuscate a Automation framework getting lot of warnings i've resolved most of the warnings by adding respective library's but could not able to resolve below warnings. i have tried by adding com.hibernate-core jar but still getting same.
Warning: com.test.utils.DBOperations: can't find referenced method 'org.hibernate.Session openSession()' in library class org.hibernate.SessionFactory
Warning: com.test.utils.DBOperations: can't find referenced method 'void close()' in library class org.hibernate.Session
I have tried searching for a solution but the answer would always be for an android application.

I have find there is an option that I can select inside the Proguard GUI. Please check the picture:
This method is good for obfuscation the class name or method name inside the .jar file.
If you want to ignore the warning when creating from android studio or eclipse... just put some "-dontwarn" or "-ignorewarning" command inside the proguard-rule.pro file.

Related

Coroutines working but IntelliJ shows errors

I am working on a project using kotlinjs for nodejs and I start to learn coroutines and integrate them into my code to say goodbye to the callback hell.
I managed to get coroutines working, my code can be compiled and executed, everything seems fine.
...except: The IDE still shows me errors. It seems to be confused by the additional libraries I added in order to get coroutines running.
I am currently fiddling around with the library dependencies, sometimes some errors go away, but then some code gets red which was okay before...
This is what I see:
Case 1:
Cannot access class 'kotlinx.coroutines.experimental.CoroutineContext'. Check your module classpath for missing or conflicting dependencies
Case 2:
Unresolved reference: JsModule
Modifier 'external' is not applicable to 'class'
You see, launch is recognized when I add the stdlib, but then the IDE complains with the other two errors.
Again, please note: In both cases, actual compilation is successful!
I am using IntelliJ 2018.1 with Kotlin Plugin 1.2.41.
Thanks to Alexander Chernikov at youtrack.jetbrains I could resolve my problem.
I cite his explanation:
The issue is that JavaScript libraries should be marked with special attribute to be recognized.
When they are imported from pom.xml or build.gradle, this mark is set, so the feature works.
In your project they are not marked.
At the moment, to correct the libs manually, please open .idea/libraries/org_jetbrains_kotlin_kotlin_stdlib_js_1_2_41.xml and .idea/libraries/org_jetbrains_kotlinx_kotlinx_coroutines_core_js_0_22_5.xml.
In both files find type="repository" and replace it with type="kotlin.js".
Make sure IDEA sees the change. (You can exit IDEA, make the change and restart.)
Then you can keep only these two libs in dependencies. The editor should work.
Here is the issue link:
https://youtrack.jetbrains.com/issue/KT-24575
There I have also attached a sample project with the problem.

Cannot find sun.tools.java.* while compiling openjdk-7

I am trying to compile openjdk-7 source code on Ubuntu 14.04:
export LANG=C ALT_BOOTDIR=/usr
make all
I saw some errors like:
symbol: class ClassNotFound
location: class CompoundType
../../../../src/share/classes/sun/rmi/rmic/iiop/CompoundType.java:1299: error: cannot find symbol
These missing classes are all in the package named sun.tools.java. I suspect these are some nonstandard libs required by the jdk build process. However I cannot find relevant information in online build tutorials. So what are these missing classes and how I can fix them?
Thanks.
Some applications need the tools.jar from the JDK which has these packages. This is often used for runtime compilation of generated code. Add this to the class path from your JDK.
Note: these are not package you would normally pass via RMI however. I would have a look at the classes to see why it would need to do this.

Why am I getting System.MissingMethodException when calling a custom library?

I have a library project called MyLib, in which I have a namespace called Extensions, in which there is a module called Extension1, which has a method called ext1Method1 of type string -> string.
In the solution for the library project, there is an executable console project called Test. Within Test I can call MyLib.Extensions.Extension1.ext1Method1 str and it works fine.
I have created a completely separate solution called NewSol1 and included a reference to MyLib.dll in NewSol1. In NewSol1 there is a line
printfn "%s" (MyLib.Extensions.Extension1.ext1Method1 "Hello, World")
The solution NewSol1 builds without any error. But when I run the executable I get the following error:
System.MissingMethodException was unhandled
Message: An unhandled exception of type 'System.MissingMethodException' occurred in NewSol1.exe
Additional information: Method not found: 'Microsoft.FSharp.Collections.FSharpList`1<System.String> MyLib.Extensions.Extension1.ext1Method1(System.String)'.
Thanks in advance for your help.
I'm posting a succinct answer here even though the link provided by ildjarn answers the question: to fix the problem, ensure that the Nuget packages in the two solutions are the same.
In my case, the library used a slightly older version of FSharp.Core. Since I had the freedom to recompile the library against any version of FSharp.Core, I chose to update all the Nuget packages in both the library and the consumer. I did this by right-clicking the library solution, choosing Manage Nuget Packages for Solution... and making sure all of the packages were up-to-date.

OSGI cannot link to native method via JNI at runtime

I am trying to use a method from a DLL in a OSGI-bundle. The DLL gets loaded correctly in OSGI, but I still get an java unsatisfied link error, the native method is not found!
When deployed standalone in Java only (no OSGI), the DLL gets loaded and run perfectly.
Here's what I did:
I generated a JNI bridge to my C++ compiled DLL through SWIG.
I specified the package name when calling swig.
I declared the dll inclusion in my Maven pom.xml xml element, which generates a correct Manifest file.
Loading of the DLL libraries is done without any errors / warnings
What truly puzzles me is that the symbols in the dll seem to not be found:
java.lang.UnsatisfiedLinkError: com.bmw.corona.components.sample.impl.generated.AdasDeconstructorJNI.swig_module_init()V
The problem is when coupling it with OSGI, I'm guessing somewhere in OSGI's ClassLoader.
The method in the dll seems to have a the correct signature :
_Java_com_bmw_corona_components_sample_impl_generated_AdasDeconstructorJNI_swig_1module_1init#8
with the following prototype in the generated SWIG file:
SWIGEXPORT void JNICALL Java_AdasDeconstructorJNI_swig_1module_1init(JNIEnv *jenv, jclass jcls)
I was triple-sure to check that the Manifest includes the Bundle Native instruction.
What am I doing wrong?
You may want to consult this wiki article: http://wiki.osgi.org/wiki/Dependencies_In_Native_Code
It is hard to tell from your description, but it sound like you have 2 native libs. One with the JNI entry points and the other with the real native function. The above wiki article discusses the dependencies from the JNI native lib to other native libs.
The problem was twofold. First, the methods weren't found do to Visual Studio 2010's method name mangling. I added a linker directive :
#pragma comment(linker, "/EXPORT:__Java_com_bmw_corona_components_sample_impl_AdasDeconstructorJNI_swig_module_init=_Java_com_bmw_corona_components_sample_impl_AdasDeconstructorJNI_swig_1module_1init#8")
It does take a bit of time for all the bundles (more than 100) to get up and running, and I do get a java.lang.NullPointerException: null the first couple of seconds after launch. Afterwards, everything seems to be working fine. And the nullPointerException is gone..

VB.Net project shows errors on clean in VS2010

my issue is very similar to:
http://www.dotnetmonster.com/Uwe/Forum.aspx/dotnet-vb/54944/VB-Net-project-throwing-errors-when-executing-Clean-Solution
Typical errors: Unable to load referenced library X
Type IWshRuntimeLibrary.WshShell is not defined.
Interface System.IDisposable is not implemented by this class.
Namespace of type specified in the Imports Z does not contain any public members or cannot be found. Make sure the imported element name does not use any aliases.
This must have to do with a VB.net project configuration. Currently there is a setting "Treat all warnings as errors". I would like to keep that setting, but also resolve these annoying "errors".
I've experienced a similar problem and fixed it by running the following command in the VS command line tool
devenv /resetskippkgs
I'ev had problems executing Clean's via MSBuild in VS2008 when projects were registered for COM interop.
The problem is that the "Clean" target auto-generated for a solution cleans projects in the same order in which they were built.
This causes problems for projects registered for COM when MSBuild attempts to load and then unregister the assembly from COM during a "Clean".The issue occurs if the assembly has a dependency on another project because the dependency will be deleted first and therefore loading the assembly will fail and MSBuild will be unable to unregister it.
A workaround is to change the solution .cache file (which contains the targets auto-generated by MSBuild during "Build") and reverse the order of the "Clean" target. I hacked-together a quick-fix custom build task to do this as a post-build step.
No idea if this was fixed in VS2010 or indeed if this matches your problem since you don't give many specifics in your question ;)