Comments (11)
Thanks for reporting. Could you check your theory, and debug which field is causing trouble here?
de.greenrobot.dao.DaoConfig.reflectProperties(DaoConfig.java:98)
Property property = (Property) field.get(null);
from greendao.
The field is $jacocoData. I quickly googled for it and found the following code http://www.eclemma.org/jacoco/trunk/coverage/org.jacoco.core/org.jacoco.core.internal.instr/InstrSupport.java.html
where the comment says "Name of the field that stores coverage information of a class"
from greendao.
Hmm, strange behavior. Wonder how to deal with that... Maybe just catch the exception, do a warn logging, and continue?
from greendao.
Yes, I also think this should just be ignored
from greendao.
Ok, in the meanwhile I changed the method to work correctly with emma. Would be nice, if you could include the fix in greenDAO code :-)
private static Property[] reflectProperties(Class<? extends AbstractDao<?, ?>> daoClass)
throws ClassNotFoundException, IllegalArgumentException, IllegalAccessException {
Class<?> propertiesClass = Class.forName(daoClass.getName() + "$Properties");
Field[] fields = propertiesClass.getDeclaredFields();
Map<Integer, Property> propertyMap = new HashMap<Integer, Property>();
for (Field field : fields) {
Property property = null;
try
{
property = (Property) field.get(null);
if(propertyMap.containsKey(property.ordinal))
{
throw new DaoException("Duplicate property ordinals");
}
propertyMap.put(property.ordinal, property);
}
catch(IllegalAccessException e)
{
// just ignore this, it could be instrumented code and contain additional properties
// System.out.println(field.getName());
}
}
Property[] properties = new Property[1];
properties = propertyMap.values().toArray(properties);
return properties;
}
from greendao.
We just found a problem with this fix. Due to usage of the hashmap the order of the properties are not kept correctly, if you use more than about 20 columns in a table the order changes and therefore the queries are no longer correct. Using a LinkedHashMap fixes this problem, since it always maintains the order in which the properties have been inserted
from greendao.
The order of properties is given by the field ordinal. I am not sure if your code would take care of that. Let me give it a shot, I'll push a suggestion soon. Hope you can check it later.
from greendao.
Please check 5b3260f if that fixes these issues.
from greendao.
Hmm, no the problem is still existing. I think the problem is not the static modifier but the private modifier. If I change the if statement to
if ((field.getModifiers() & Modifier.STATIC) != 0 && (field.getModifiers() & Modifier.PRIVATE) == 0)
it works.
from greendao.
Thanks for the feedback. With a375028 it checks for static and public modifiers now. I assume this will fix the issue and close it. If there's another problem, let me know.
from greendao.
Ok, it works now. Thanks for fixing!
from greendao.
Related Issues (20)
- 一对多的关系表映射问题 HOT 3
- disk image is malformed (Sqlite code 11 SQLITE_CORRUPT) HOT 1
- How to do data filling, such as populating data from a database in assets into an app HOT 1
- Read this first! Check out our new database
- kotlin version problem HOT 1
- Can I use greenDao in multiple libraries? ------ Look forward to your reply HOT 1
- 什么时候支持协程 HOT 1
- Will a new version be released in the future when a bug occurs in the project? HOT 1
- DaoGenerator.getConfiguration Exception HOT 2
- Lambda 表达式报错 HOT 2
- The project encountered errors after updating Gradle Version 7.6.1 to Gradle Version 8.0+ HOT 40
- when use ’group by‘ ,the result is not expected HOT 1
- Unable to load class 'org.greenrobot.greendao.codemodifier.FormattingOptions'.
- DaoMaster class error HOT 1
- error: cannot find symbol db.execSQL("CREATE TABLE " + constraint + "\ symbol: method makeConcatWithConstants(Lookup,String,MethodType,String) location: interface StringConcatFactory HOT 1
- ... not supported with the configuration cache HOT 1
- net.zetetic:android-database-sqlcipher:3+ update 4+ DaoException HOT 2
- @ToMany Can't the associated field be a string type? HOT 1
- Cannot use @TaskAction annotation on method HOT 1
- Android SDK 35 - Error getEncryptedWritableDb(dbPassword)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from greendao.