How to not obfuscate class names but get the right simplename anyway? - obfuscation

I have over 20 Fragments which extends from MyFragment e.g.:
LoginFragment extends MyFragment
UploadFragment extends MyFragment
CameraFragment extends MyFragment
etc..
and MyFragment in turn extends from Fragment . So in my Android app, and whenever I inflate one of them, I call in my abstrac t class a showFragment(MyFragment f) where I fire the Adjust event,
AdjustEvent event = new AdjustEvent(EVENT_LOAD_FRAGMENT);
// Add callback parameters to this parameter.
event.addCallbackParameter("LoadFragment",
f.getClass().getSimpleName());
Adjust.trackEvent(event);
so that I can measure what fragment is how often used as kay value pair. So far so good, and during debug phase it works nice.
As you can imagine now, the getClass().getSimpleName() is being obfuscated in the produtction environment. I do not want to touch all the 20 Fragments and would be totally fine if the classes get obfuscated. But I still would like to get the class' valid getSimpleName() String..
How can I get a classes valid getSimpleName() after it was obfuscated?

I used
-keepnames class * extends com.you.package.name.MyFragment
unpacked the aar and classes.jar, and checked the build forlder for seeds.txt and mapping.txt to see the obfuscation

add below to your proguard configuration file.
-keep,allowobfuscation class * extends com.you.package.name.MyFragment

Related

'MyMethod' in 'Dao_Impl' clashes with 'MyMethod + extends' in 'Dao'; both methods have same erasure, yet neither overrides the other

I wasnt getting any errors before. But today, i entered my project to edit and saw these errors.
First one is on this line;
public final class NoteDao_Impl implements NoteDao {
// The error code is : Class 'NoteDao_Impl' must either be declared abstract or implement abstract method 'getAllNotes(Continuation<? super List<? extends Notes>>)' in 'NoteDao'
I can fix it with Alt + Enter and then clicking 'implement methods' but just in case i want to write it.
The second one and third one is on these lines;
#Override
// Error : Method does not override method from its superclass
public Object getAllNotes(final Continuation<? super List<Notes>> continuation) {
// Error : 'getAllNotes(Continuation<? super List<Notes>>)' in 'com.ahmetkaan.kediy.data.NoteDao_Impl' clashes with 'getAllNotes(Continuation<? super List<? extends Notes>>)' in 'com.ahmetkaan.kediy.data.NoteDao'; both methods have same erasure, yet neither overrides the other
The NoteDao;
package com.ahmetkaan.kediy.data
import androidx.room.*
#Dao
interface NoteDao {
#Query("SELECT * FROM notes ORDER BY id DESC")
suspend fun getAllNotes() : List<Notes>
#Query("SELECT * FROM notes WHERE id =:id")
suspend fun getSpecificNote(id:Int) : Notes
#Query("SELECT * FROM notes WHERE category = :id")
suspend fun getCategoryNote(id:Int) : Notes
#Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun insertNotes(note:Notes)
#Delete
suspend fun deleteNote(note:Notes)
#Query("DELETE FROM notes WHERE id =:id")
suspend fun deleteSpecificNote(id:Int)
#Update
suspend fun updateNote(note:Notes)
}
The problem appears when i set getAllNotes() method as "getAllNotes() : List " So i guess thats why. But i dont understand why i get this error now. I do some research and i encounter some solutions like;
public class a<T extends Comparable> implements A<T>
but probably i cant make it compatible with my project :,) Thanks in advance.
I met the same problem. I try this link to fix the problem.
You can try changing List<Notes> to Array<Notes>.
Hope it will help.
Also, if this error causes your app to crash at runtime, and you don't want to change the List to Array, maybe there is another approach. If you are using manual migration of the room database, try to change it to auto migration(Doc). Although there still has this error in the build package, it won't affect your app performance. Your app can run without crashing.

solr: read stopword.txt in Custom Handler

I want to read stopword.txt in my custom handler. How to do that ? I know that this is used in Filtering and can be done from there. But I need to read that list in my Custom UpdateRequestProcessorFactory. Also can I read any other custom file created by me.
I was aware that limitation. I overlooked that you are using about update processor.
I looked into the code, here is an existing code you can use as example. SolrCoreAware is the interface you are after.
public class StatelessScriptUpdateProcessorFactory extends UpdateRequestProcessorFactory implements SolrCoreAware
#Override
public void inform(SolrCore core) {
resourceLoader = core.getResourceLoader();
}
Classes that implement org.apache.lucene.analysis.util.ResourceLoaderAware can read files under conf directory. However what it your use case anyway?
looks like xy problem

setValue:forUndefinedKey: issue that makes no sense UIActivityIndicatorView

In ViewController.m I am allocating a class like so:
myClass = [[MyClass alloc]init];
but when I set a breakpoint in that class it's throwing an exception before it even hits ViewDidLoad of:
[<MyClass 0x1a4a60> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key activityIndicator.'
But the thing is the class doesn't use an interface file and there is not a single UIActivityIndicatorView in the entire project. Can some please help, I have spent hours trying to address this and it makes no sense to me.

ATK4 jobeet project

I found your doc about jobeet project.
I'm testing (last 4.1b1 version) it step by step, but in day 3 I've error, I think:
model Category it'd be
class Model_Category extends Model_Table {
public $entity_code='category';
public $table_alias='c';
//...........
model Job it'd be
class Model_Job extends Model_Table {
public $entity_code='job';
public $table_alias='j';
//.......
Right?
And now, from here I've error after call generate.html
PathFinder_Exception
Unable to include Model\.php
Additional information:
type: php
attempted_locations: Array ( [0] => D:/xampp/htdocs/atk4jobeet/lib/Model\.php [1] => D:\xampp\htdocs\atk4jobeet\atk4/lib/Model\.php [2] => D:/xampp/htdocs/atk4jobeet/atk4-addons/mvc/Model\.php [3] => D:/xampp/htdocs/atk4jobeet/atk4-addons/misc/lib/Model\.php )
Is it problem in class page_generate extends Page_SchemaGenerator?
It waiting for GET[model] param, but day3 write:
If you are willing for Agile Toolkit to generate SQL CREATE code for you, you can set up a page for that. Code generator exists as a class, but you need to enable it in order to use it. Add file page/generate.php with the following content:
class page_generate extends Page_SchemaGenerator {}
Next navigate to http://localhost/jobeet/generate.html in your browser, pick Category model and click Generate button. The schema code will be shown on the right. You can also click "Generate" checkbox and "create" statement will be evaluated by sql automatically. Once you create 'Category' proceed to create 'Job'.
Where problem is?
Yes, actually i have done changes for the generator while writing jobeet doc. In your case you can add ?model=Job to the URL. Otherwise you can use git version.
BTW - there is a branch for day3 in the jobeet repository:
https://github.com/romaninsh/jobeet/tree/day3

Can mockito or easymock replace rmock

I'm sitting with a legacy project, and we're starting to replace some old legacycode. As Rmock don't have support for junit4, we would like to replace it. One thing i was wondering is - how could i replace the dynamictestsuite feature of rmock. This is a good feature where you create a dynamic testsuite for each run, and can do stuff like.
#Override
protected void setupSuite() {
forEach(is.clazz.assignableTo(TestCase.class).and(is.not(is.clazz.name(is.endingWith("oldTest")))).perform(addAllToSuite);
}
that would get all testclasses not ending with oldTest and create a dynamictestsuite. And so on, you get the point.
ClasspathSuite can define a suite by searching for JUnit test classes in the class path, with a filter on the test class names to include or exclude.
import org.junit.extensions.cpsuite.ClasspathSuite.*;
import org.junit.runner.RunWith;
#RunWith(ClasspathSuite.class)
#ClassnameFilters({"!.*oldTest"})
public class MySuite {}

Resources