Skip to content

Commit

Permalink
Prevent compilation of native methods (fixed compile flag not being p…
Browse files Browse the repository at this point in the history
…assed)
  • Loading branch information
stanhebben committed Aug 16, 2024
1 parent 57bcce5 commit e933c7c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public String getMapping(JavaClass definition) {

@Override
public JavaCompilingMethod asCompilingMethod(JavaClass compiled, String signature) {
return new JavaCompilingMethod(compiled, this, signature);
return new JavaCompilingMethod(compiled, this, signature, compile);
}

public boolean isAbstract() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ public JavaCompilingMethod(JavaClass class_, JavaNativeMethod compiled, String s
this.compile = true;
}

public JavaCompilingMethod(JavaClass class_, JavaNativeMethod compiled, String signature, boolean compile) {
this.class_ = class_;
this.compiled = compiled;
this.signature = signature;
this.compile = compile;
}

public JavaCompilingMethod(JavaClass class_, String signature) {
this.class_ = class_;
this.compiled = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,23 +131,23 @@ public class JavaPrepareDefinitionVisitor implements DefinitionVisitor<JavaClass
{
JavaClass string = new JavaClass("java.lang", "String", JavaClass.Kind.CLASS);
JavaNativeClass cls = new JavaNativeClass(string);
//cls.addMethod("contains", JavaSpecialMethod.CONTAINS_AS_INDEXOF);
cls.addMethod("contains", JavaSpecialMethod.CONTAINS_AS_INDEXOF);
cls.addInstanceMethod("compareToIgnoreCase","compareToIgnoreCase", "(Ljava/lang/String;)I");
cls.addInstanceMethod("equalsIgnoreCase","equalsIgnoreCase", "(Ljava/lang/String;)Z");

//cls.addInstanceMethod("indexOf", "indexOf", "(I)I");
//cls.addInstanceMethod("indexOfFrom","indexOf", "(II)I");
//cls.addInstanceMethod("lastIndexOf", "lastIndexOf", "(I)I");
//cls.addInstanceMethod("lastIndexOfFrom", "lastIndexOf", "(II)I");
cls.addInstanceMethod("indexOf", "indexOf", "(I)I");
cls.addInstanceMethod("indexOfFrom","indexOf", "(II)I");
cls.addInstanceMethod("lastIndexOf", "lastIndexOf", "(I)I");
cls.addInstanceMethod("lastIndexOfFrom", "lastIndexOf", "(II)I");
cls.addInstanceMethod("indexOfString", "indexOf", "(Ljava/lang/String;)I");
cls.addInstanceMethod("indexOfStringFrom", "indexOf", "(Ljava/lang/String;I)I");
cls.addInstanceMethod("lastIndexOfString", "lastIndexOf", "(Ljava/lang/String;)I");
cls.addInstanceMethod("lastIndexOfStringFrom", "lastIndexOf", "(Ljava/lang/String;I)I");

cls.addInstanceMethod("replace", "replace", "(CC)Ljava/lang/String;");
//cls.addInstanceMethod("trim", "trim", "()Ljava/lang/String;");
//cls.addInstanceMethod("startsWith", "startsWith", "(Ljava/lang/String;)Z");
//cls.addInstanceMethod("endsWith", "endsWith", "(Ljava/lang/String;)Z");
cls.addInstanceMethod("trim", "trim", "()Ljava/lang/String;");
cls.addInstanceMethod("startsWith", "startsWith", "(Ljava/lang/String;)Z");
cls.addInstanceMethod("endsWith", "endsWith", "(Ljava/lang/String;)Z");
cls.addMethod("fromAsciiBytes", JavaSpecialMethod.BYTES_ASCII_TO_STRING);
cls.addMethod("fromUTF8Bytes", JavaSpecialMethod.BYTES_UTF8_TO_STRING);
cls.addMethod("toAsciiBytes", JavaSpecialMethod.STRING_TO_ASCII);
Expand Down

0 comments on commit e933c7c

Please sign in to comment.