Skip to content

Commit

Permalink
Fixed byte array interpreter
Browse files Browse the repository at this point in the history
  • Loading branch information
ashitikov committed Feb 7, 2016
1 parent e1e3bba commit 412b52f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ allprojects {
apply plugin: 'java'

group = 'ru.objective.jni'
version = '1.0-SNAPSHOT'
version = '1.2-SNAPSHOT'
sourceCompatibility = 7

repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ protected String getHeaderDeclarationField(String name, Field field, boolean set

String returnType = Utility.signatureToString(field.getSignature());

returnType = PrimitiveTypeConverter.convertToOBJCType(Utils.getBasicType(returnType));
returnType = Utils.getBasicType(returnType);

if (!Utils.isPrimitive(field.getType())) {
JavaClass typeJavaClass = OJNIClassLoader.getInstance().loadClass(field.getType().toString());
Expand All @@ -93,6 +93,8 @@ protected String getHeaderDeclarationField(String name, Field field, boolean set

if (Utils.isArrayType(field.getType()))
returnType = getStringArrayType(returnType, (ArrayType)field.getType());
else
returnType = PrimitiveTypeConverter.convertToOBJCType(returnType);

String declSign = (field.isStatic() ? "+" : "-")+" ";

Expand Down Expand Up @@ -136,7 +138,7 @@ protected String getHeaderDeclarationMethod(MethodExportInfo info, Method method

methodReturnType = Utility.methodSignatureReturnType(method.getSignature()).toString();

methodReturnType = PrimitiveTypeConverter.convertToOBJCType(Utils.getBasicType(methodReturnType));
methodReturnType = Utils.getBasicType(methodReturnType);

if (!Utils.isPrimitive(method.getReturnType())) {
JavaClass typeJavaClass = OJNIClassLoader.getInstance().loadClass(method.getReturnType().toString());
Expand All @@ -149,6 +151,8 @@ protected String getHeaderDeclarationMethod(MethodExportInfo info, Method method

if (Utils.isArrayType(method.getReturnType()))
methodReturnType = getStringArrayType(methodReturnType, (ArrayType)method.getReturnType());
else
methodReturnType = PrimitiveTypeConverter.convertToOBJCType(methodReturnType);
}
stringBuilder.append((method.isStatic() ? "+" : "-")+" " + "("+PrimitiveTypeConverter.convertToOBJCType(methodReturnType)+")");

Expand Down Expand Up @@ -190,8 +194,6 @@ protected String getHeaderDeclarationMethod(MethodExportInfo info, Method method
+ Utils.getShortClassName(type);/*+ StringUtils.capitalize(utils.getShortClassName(type));*/
}

type = PrimitiveTypeConverter.convertToOBJCType(type);

if (!Utils.isPrimitive(javaType)) {
JavaClass argTypeJavaClass = OJNIClassLoader.getInstance().loadClass(javaType.toString());

Expand All @@ -211,6 +213,8 @@ protected String getHeaderDeclarationMethod(MethodExportInfo info, Method method
overloadedParameter += "Array";
}
type = getStringArrayType(type, (ArrayType) javaType);
} else {
type = PrimitiveTypeConverter.convertToOBJCType(type);
}

stringBuilder.append(nameParameter + overloadedParameter + ":(" + type + ")" + variable_name + " ");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,7 @@ private String getFieldImplementation(Field field, String declaration, boolean s
if (Utils.isArrayType(returnType)) {
ArrayType arrayType = (ArrayType)returnType;
int dimensions = arrayType.getDimensions();
String typeString = PrimitiveTypeConverter.convertToOBJCType(
arrayType.getBasicType().toString());
String typeString = arrayType.getBasicType().toString();
String capitalizedType = StringUtils.capitalize(typeString);

// fix Boolean = Bool conflicts
Expand Down Expand Up @@ -406,8 +405,7 @@ public String generateArgumentString(Method method) {
if (Utils.isArrayType(type)) {
ArrayType arrayType = (ArrayType)type;
int dimensions = arrayType.getDimensions();
String typeString = PrimitiveTypeConverter.convertToOBJCType(
arrayType.getBasicType().toString());
String typeString = arrayType.getBasicType().toString();
String capitalizedType = StringUtils.capitalize(typeString);

// fix Boolean = Bool conflicts
Expand Down Expand Up @@ -459,8 +457,7 @@ public String generateReturnObject(Type returnType) {
if (Utils.isArrayType(returnType)) {
ArrayType arrReturnType = (ArrayType) returnType;
int dimensions = arrReturnType.getDimensions();
String capitalizedType = StringUtils.capitalize(PrimitiveTypeConverter.convertToOBJCType(
arrReturnType.getBasicType().toString()));
String capitalizedType = StringUtils.capitalize(arrReturnType.getBasicType().toString());

// fix Boolean = Bool conflicts
if (capitalizedType.equals("Bool"))
Expand Down

0 comments on commit 412b52f

Please sign in to comment.