2
0

Ignore annotations in STG, fix

This commit is contained in:
Daniel Holle 2024-03-13 11:29:17 +01:00
parent 83ae05ea4a
commit 2cb84f9e2b
3 changed files with 17 additions and 0 deletions
resources/bytecode/javFiles
src
main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator
test/java

@ -0,0 +1,8 @@
class Base {
public void foo() {}
}
public class Annotation extends Base {
@Override
public void foo() {}
}

@ -294,6 +294,8 @@ public class SyntaxTreeGenerator {
member = (MemberdeclContext) classBody;
Integer membermodifiers = 0;
for (ModifierContext mod : member.modifier()) {
if (mod.classOrInterfaceModifier() != null && mod.classOrInterfaceModifier().annotation() != null)
continue; // TODO don't eat annotations
membermodifiers += allmodifiers.get(mod.getText());
}
switch (member.memberDeclaration()) {

@ -874,6 +874,13 @@ public class TestComplete {
var instance = clazz.getDeclaredConstructor().newInstance();
}
@Test
public void testAnnotation() throws Exception {
var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Annotation.jav");
var clazz = classFiles.get("Annotation");
var instance = clazz.getDeclaredConstructor().newInstance();
}
@Test
public void testBug122() throws Exception {
var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Bug122.jav");