Kleine Änderung

This commit is contained in:
Fayez Abu Alia 2018-02-21 11:44:03 +01:00
parent 6cf98f200b
commit 7c2f7c54dd
5 changed files with 25 additions and 4 deletions

View File

@ -435,11 +435,10 @@ public class BytecodeGenMethod implements StatementVisitor{
@Override @Override
public void visit(Literal literal) { public void visit(Literal literal) {
System.out.println(resultSet.resolveType(literal.getType()).resolvedType.acceptTV(new TypeToDescriptor()));
Object value = literal.value; Object value = literal.value;
switch (resultSet.resolveType(literal.getType()).resolvedType.acceptTV(new TypeToDescriptor())) { switch (resultSet.resolveType(literal.getType()).resolvedType.acceptTV(new TypeToDescriptor())) {
case "java/lang/String": case "java/lang/String":
mv.visitLdcInsn((String) value); mv.visitLdcInsn(value);
break; break;
case "java/lang/Boolean": case "java/lang/Boolean":
visitBooleanLiteral((Boolean) value); visitBooleanLiteral((Boolean) value);

View File

@ -132,6 +132,7 @@ public class Signature {
break; break;
case "TPH": case "TPH":
RefTypeOrTPHOrWildcardOrGeneric r = resultSet.resolveType(t).resolvedType; RefTypeOrTPHOrWildcardOrGeneric r = resultSet.resolveType(t).resolvedType;
if(!r.acceptTV(new TypeToSignature()).substring(0, 4).equals("TPH "))
sv.visitInterface().visitClassType(r.acceptTV(new TypeToSignature())); sv.visitInterface().visitClassType(r.acceptTV(new TypeToSignature()));
// sv.visitClassType(r.acceptTV(new TypeToSignature())); // sv.visitClassType(r.acceptTV(new TypeToSignature()));
System.out.println(r.getClass()+" Signature TPH: "+r.acceptTV(new TypeToSignature())); System.out.println(r.getClass()+" Signature TPH: "+r.acceptTV(new TypeToSignature()));

View File

@ -10,7 +10,7 @@ import java.lang.Character;
class AssignToLit { class AssignToLit {
void m(){ void m(){
String s = "String"; String s = "Test";
Boolean b = false; Boolean b = false;
Byte byte1 = 5; Byte byte1 = 5;
Byte byte2 = 55; Byte byte2 = 55;

14
test/bytecode/Methods.jav Normal file
View File

@ -0,0 +1,14 @@
import java.lang.Integer;
class Methods {
m(a,b){
var c=a+b;
return c;
}
method2(x){
Integer i = this.m(x,2);
return i;
}
}

View File

@ -0,0 +1,7 @@
package bytecode;
public class MethodsTest extends JavaTXCompilerTest {
public MethodsTest() {
this.fileName = "Methods";
}
}