This commit is contained in:
Fayez Abu Alia 2018-01-31 16:16:05 +01:00
parent 1888eb6d46
commit b32e437a05
6 changed files with 28 additions and 5 deletions

View File

@ -155,7 +155,7 @@ public class BytecodeGen implements ASTVisitor {
String methDesc = null;
// Method getModifiers() ?
int acc = isInterface?Opcodes.ACC_ABSTRACT:0;
int acc = isInterface?Opcodes.ACC_ABSTRACT:method.modifier;
boolean hasGenInParameterList = genericsAndBounds.containsKey(resultSet.resolveType(method.getReturnType()).resolvedType.acceptTV(new TypeToDescriptor()));
if(!hasGenInParameterList) {
@ -183,7 +183,7 @@ public class BytecodeGen implements ASTVisitor {
System.out.println(sig);
NormalMethod meth = new NormalMethod(method,genericsAndBounds,genericsAndBoundsMethod,hasGen);
methDesc = meth.accept(new DescriptorToString(resultSet));
MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC+acc, method.getName(), methDesc, sig, null);
MethodVisitor mv = cw.visitMethod(acc, method.getName(), methDesc, sig, null);
mv.visitCode();

View File

@ -2,7 +2,7 @@ package bytecode;
public class ATest extends JavaTXCompilerTest {
public ATest() {
fileName = "A";
fileName = "Example";
}
}

View File

@ -1,7 +1,7 @@
public class Example {
public m() {
String x = "X";
public m(Integer x) {
// String x = "X";
return x;
}
}

13
test/bytecode/For.jav Normal file
View File

@ -0,0 +1,13 @@
class For{
m(Integer x){
Boolean b = true;
while(x<2){
x = x +1;
b = false;
}
return x;
// for(int i = 0;i<10;i++) {
// x = x + 5;
// }
}
}

View File

@ -0,0 +1,9 @@
package bytecode;
public class ForTest extends JavaTXCompilerTest {
public ForTest() {
this.fileName = "For";
}
}

View File

@ -1,3 +1,4 @@
class LamAssign {
m () {