| Chunk |
|---|
| Conflicting content |
|---|
@SupportedAnnotationTypes({"io.realm.annotations.RealmClass", "io.realm.annotations.Ignore"})
@SupportedSourceVersion(javax.lang.model.SourceVersion.RELEASE_6)
public class RealmProcessor extends AbstractProcessor {
<<<<<<< HEAD
private static Set |
| Solution content |
|---|
@SupportedAnnotationTypes({"io.realm.annotations.RealmClass", "io.realm.annotations.Ignore"})
@SupportedSourceVersion(javax.lang.model.SourceVersion.RELEASE_6)
public class RealmProcessor extends AbstractProcessor {
Set |
| File |
|---|
| RealmProcessor.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Attribute |
| Method invocation |
| Chunk |
|---|
| Conflicting content |
|---|
}
/**
*/
public static Realm create(File writableFolder, String filename) {
String absolutePath = new File(writableFolder, filename).getAbsolutePath();
<<<<<<< HEAD
return createAndValidate(absolutePath, true);
}
private static Realm createAndValidate(String absolutePath, boolean validateSchema) {
Map |
| Solution content |
|---|
* Realm static constructor
* @param context an Android context
* @param key a 32-byte encryption key
* @return an instance of the Realm class
*/
public static Realm getInstance(Context context, byte[] key) {
return Realm.getInstance(context, DEFAULT_REALM_NAME, key);
}
/**
* Realm static constructor
* @param context an Android context
* @param fileName the name of the file to save the Realm to
* @param key a 32-byte encryption key
* @return an instance of the Realm class
*/
public static Realm getInstance(Context context, String fileName, byte[] key) {
return Realm.create(context.getFilesDir(), fileName, key);
}
/**
* Realm static constructor
* @param writableFolder absolute path to a writable directory
* @param key a 32-byte encryption key
* @return an instance of the Realm class
*/
public static Realm getInstance(File writableFolder, byte[] key) {
return Realm.create(writableFolder, DEFAULT_REALM_NAME, key);
}
/**
* @param writableFolder absolute path to a writable directory
* @param filename the name of the file to save the Realm to
* @param key a 32-byte encryption key
* @return an instance of the Realm class
*/
public static Realm create(File writableFolder, String filename, byte[] key) {
String absolutePath = new File(writableFolder, filename).getAbsolutePath();
return createAndValidate(absolutePath, key, true);
}
private static Realm createAndValidate(String absolutePath, byte[] key, boolean validateSchema) {
ThreadRealm threadRealm = realms.get(absolutePath);
boolean needsValidation = (threadRealm == null);
if (threadRealm == null) {
threadRealm = new ThreadRealm(absolutePath, key);
}
SoftReference |
| File |
|---|
| Realm.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Comment |
| If statement |
| Method declaration |
| Method invocation |
| Method signature |
| Return statement |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
throw new RealmException("An exception was thrown in the getProxyClasses method in the ValidationList class");
}
<<<<<<< HEAD
long version = realm.getVersion();
try {
realm.beginTransaction();
if (version == UNVERSIONED) {
realm.setVersion(0);
}
for (String className : proxyClasses) {
String modelClassName = Iterables.getLast(Splitter.on(".").split(className));
String generatedClassName = "io.realm." + modelClassName + "RealmProxy";
Class> generatedClass;
try {
generatedClass = Class.forName(generatedClassName);
} catch (ClassNotFoundException e) {
throw new RealmException("Could not find the generated " + generatedClassName + " class");
}
// if not versioned, create table
if (version == UNVERSIONED) {
Method initTableMethod;
try {
initTableMethod = generatedClass.getMethod("initTable", new Class[]{ImplicitTransaction.class});
} catch (NoSuchMethodException e) {
throw new RealmException("Could not find the initTable method in the generated " + generatedClassName + " class");
}
try {
initTableMethod.invoke(null, realm.transaction);
} catch (IllegalAccessException e) {
throw new RealmException("Could not execute the initTable method in the " + generatedClassName + " class");
} catch (InvocationTargetException e) {
throw new RealmException("An exception was thrown in the initTable method in the " + generatedClassName + " class");
}
}
// validate created table
Method validateMethod;
try {
validateMethod = generatedClass.getMethod("validateTable", new Class[]{ImplicitTransaction.class});
} catch (NoSuchMethodException e) {
throw new RealmException("Could not find the validateTable method in the generated " + generatedClassName + " class");
}
try {
validateMethod.invoke(null, realm.transaction);
} catch (IllegalAccessException e) {
throw new RealmException("Could not execute the validateTable method in the " + generatedClassName + " class");
} catch (InvocationTargetException e) {
throw new RealmMigrationNeededException(e.getMessage());
}
// Populate the columnIndices table
Method fieldNamesMethod;
try {
fieldNamesMethod = generatedClass.getMethod("getFieldNames");
} catch (NoSuchMethodException e) {
throw new RealmException("Could not find the getFieldNames method in the generated " + generatedClassName + " class");
}
List |
| Solution content |
|---|
}
for (String className : proxyClasses) {
String modelClassName = Iterables.getLast(Splitter.on(".").split(className));
String generatedClassName = "io.realm." + modelClassName + "RealmProxy";
Class> generatedClass;
try {
generatedClass = Class.forName(generatedClassName);
} catch (ClassNotFoundException e) {
throw new RealmException("Could not find the generated " + generatedClassName + " class");
}
// if not versioned, create table
if (version == UNVERSIONED) {
Method initTableMethod;
try {
initTableMethod = generatedClass.getMethod("initTable", new Class[]{ImplicitTransaction.class});
} catch (NoSuchMethodException e) {
throw new RealmException("Could not find the initTable method in the generated " + generatedClassName + " class");
}
try {
initTableMethod.invoke(null, realm.transaction);
} catch (IllegalAccessException e) {
throw new RealmException("Could not execute the initTable method in the " + generatedClassName + " class");
} catch (InvocationTargetException e) {
throw new RealmException("An exception was thrown in the initTable method in the " + generatedClassName + " class");
}
}
// validate created table
Method validateMethod;
try {
validateMethod = generatedClass.getMethod("validateTable", new Class[]{ImplicitTransaction.class});
} catch (NoSuchMethodException e) {
throw new RealmException("Could not find the validateTable method in the generated " + generatedClassName + " class");
}
try {
validateMethod.invoke(null, realm.transaction);
} catch (IllegalAccessException e) {
throw new RealmException("Could not execute the validateTable method in the " + generatedClassName + " class");
} catch (InvocationTargetException e) {
throw new RealmMigrationNeededException(e.getMessage());
}
// Populate the columnIndices table
Method fieldNamesMethod;
try {
fieldNamesMethod = generatedClass.getMethod("getFieldNames");
} catch (NoSuchMethodException e) {
throw new RealmException("Could not find the getFieldNames method in the generated " + generatedClassName + " class");
}
List |
| File |
|---|
| Realm.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Attribute |
| Class signature |
| Comment |
| Method invocation |
| Method signature |
| Try statement |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
// This class stores soft-references to realm objects per thread per realm file
private static class ThreadRealm extends ThreadLocal |
| Solution content |
|---|
@Override
protected SoftReference |
| File |
|---|
| Realm.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Method invocation |
| Method signature |
| Return statement |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
getTable(classSpec).clear();
}
<<<<<<< HEAD
private long getVersion() {
if (!transaction.hasTable("metadata")) {
return UNVERSIONED;
}
Table metadataTable = transaction.getTable("metadata");
return metadataTable.getLong(0, 0);
}
private void setVersion(long version) {
Table metadataTable = transaction.getTable("metadata");
if (metadataTable.getColumnCount() == 0) {
metadataTable.addColumn(ColumnType.INTEGER, "version");
metadataTable.addEmptyRow();
}
metadataTable.setLong(0, 0, version);
}
static public void migrateRealmAtPath(String realmPath, RealmMigration migration) {
Realm realm = Realm.createAndValidate(realmPath, false);
realm.beginTransaction();
realm.setVersion(migration.execute(realm, realm.getVersion()));
realm.commitTransaction();
// Update the cache
Map |
| Solution content |
|---|
getTable(classSpec).clear();
}
private long getVersion() {
if (!transaction.hasTable("metadata")) {
return UNVERSIONED;
}
Table metadataTable = transaction.getTable("metadata");
return metadataTable.getLong(0, 0);
}
private void setVersion(long version) {
Table metadataTable = transaction.getTable("metadata");
if (metadataTable.getColumnCount() == 0) {
metadataTable.addColumn(ColumnType.INTEGER, "version");
metadataTable.addEmptyRow();
}
metadataTable.setLong(0, 0, version);
}
static public void migrateRealmAtPath(String realmPath, RealmMigration migration) {
migrateRealmAtPath(realmPath, null, migration);
}
static public void migrateRealmAtPath(String realmPath, byte [] key, RealmMigration migration) {
Realm realm = Realm.createAndValidate(realmPath, key, false);
realm.beginTransaction();
realm.setVersion(migration.execute(realm, realm.getVersion()));
realm.commitTransaction();
}
/** |
| File |
|---|
| Realm.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Attribute |
| Comment |
| Method declaration |
| Method invocation |
| Method signature |
| Variable |