diff --git a/src/de/dhbwstuttgart/bytecode/BytecodeGen.java b/src/de/dhbwstuttgart/bytecode/BytecodeGen.java index 8ec49b8b..57aeecc3 100644 --- a/src/de/dhbwstuttgart/bytecode/BytecodeGen.java +++ b/src/de/dhbwstuttgart/bytecode/BytecodeGen.java @@ -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(); diff --git a/test/bytecode/ATest.java b/test/bytecode/ATest.java index 9865825e..14dbacbf 100644 --- a/test/bytecode/ATest.java +++ b/test/bytecode/ATest.java @@ -2,7 +2,7 @@ package bytecode; public class ATest extends JavaTXCompilerTest { public ATest() { - fileName = "A"; + fileName = "Example"; } } diff --git a/test/bytecode/Example.jav b/test/bytecode/Example.jav index 451803ea..8fc7a0a7 100644 --- a/test/bytecode/Example.jav +++ b/test/bytecode/Example.jav @@ -1,7 +1,7 @@ public class Example { - public m() { - String x = "X"; + public m(Integer x) { +// String x = "X"; return x; } } \ No newline at end of file diff --git a/test/bytecode/For.jav b/test/bytecode/For.jav new file mode 100644 index 00000000..c93b34c4 --- /dev/null +++ b/test/bytecode/For.jav @@ -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; +// } + } +} \ No newline at end of file diff --git a/test/bytecode/ForTest.java b/test/bytecode/ForTest.java new file mode 100644 index 00000000..7df68665 --- /dev/null +++ b/test/bytecode/ForTest.java @@ -0,0 +1,9 @@ +package bytecode; + +public class ForTest extends JavaTXCompilerTest { + + public ForTest() { + this.fileName = "For"; + } + +} diff --git a/test/bytecode/LamAssign.jav b/test/bytecode/LamAssign.jav index e522bd3b..7fd5bc64 100644 --- a/test/bytecode/LamAssign.jav +++ b/test/bytecode/LamAssign.jav @@ -1,3 +1,4 @@ + class LamAssign { m () {